@php $from_date = (request()->from_date)?? $active_year->from; @endphp
@php $to_date = (request()->to_date)?? $active_year->to; @endphp

@php $selected_level = (request()->has('level'))? request()->level : 5; @endphp

@php $available_accounts_options = $accounts_list->where('level', $selected_level)->all(); @endphp

@php $is_debit = request('is_debit')?? true; @endphp
@php $is_credit = request('is_credit')?? true; @endphp
@php $is_zero = request('is_zero')?? true; @endphp
@php $with_initial_balance = request('with_initial_balance')?? true; @endphp

@lang('accounting/reports/accounts/total-account-balance.total_balances_accounts')

@lang('accounting/reports/accounts/total-account-balance.download_pdf') @php $query = (count(request()->all()) > 0)? '?' . explode('?', request()->fullUrl())[1] : "" @endphp @lang('accounting/reports/accounts/total-account-balance.export_excel')
@php $table_options = [ 'lang' => ['noAvailableData' => __('noAvailableData.no_balances_yet')], ]; @endphp @if (request()->from_date || request()->to_date)
@if (request()->from_date)

@lang('accounting/reports/accounts/trial-balance.from_date') {{ request()->from_date }}

@endif @if (request()->to_date)

@lang('accounting/reports/accounts/trial-balance.to_date') {{ request()->to_date }}

@endif
@endif @php $debit_column_total = 0; $credit_column_total = 0; $balance_column_total = 0; $initial_balance_column_total = 0; @endphp @foreach ($accounts as $parent_id => $accounts_arr) @php $parent = (count($accounts_arr) > 0)? $accounts_arr[0]['parent'] : null; @endphp @php $debit_sum = $credit_sum = $parent_balance = $initial_balance_sum = 0; @endphp @foreach ($accounts_arr as $account) @php $balance = $account['balance'] + $account['initial_balance']; @endphp @php $parent_balance += $balance; if ($account['balance'] > 0) { $debit_sum += abs($account['balance']); } else { $credit_sum += abs($account['balance']); } $initial_balance_sum += $account['initial_balance']; @endphp @endforeach @if ($parent) @php $debit_column_total += $debit_sum; $credit_column_total += $credit_sum; $balance_column_total += $parent_balance; $initial_balance_column_total += $initial_balance_sum; @endphp @endif @endforeach
@lang('accounting/reports/accounts/total-account-balance.balance') @lang('accounting/reports/accounts/total-account-balance.debit') @lang('accounting/reports/accounts/total-account-balance.credit') @lang('accounting/reports/accounts/total-account-balance.initial_balance') @lang('accounting/reports/accounts/total-account-balance.account_name')
{{ dn($balance) }} {{ dn($account['balance'] > 0 ? $account['balance'] : '0') }} {{ dn($account['balance'] < 0 ? abs($account['balance']) : '0') }} {{ dn($account['initial_balance']) }} {{ $account['name'] }}
{{ dn($balance_column_total) }} {{ dn($debit_column_total) }} {{ dn($credit_column_total) }} {{ dn($initial_balance_column_total) }}
@push('script') @endpush