@use('App\Services\Date')

@lang('reports::reports.Trial Balance')

{{ $data['companyName'] }}

@lang('reports::reports.as_of') {{$data['dates']['to']}}

@if (request('exclude_net') == 0) @endif @php $debit_openning_balance =0; $credit_openning_balance =0; $debit_closing_balance =0; $credit_closing_balance =0; @endphp @foreach($data['categorizedAccounts'] as $categoryName => $accounts) @if($accounts['total_for_display']) @foreach($accounts as $account) @if(isset($account['total_for_display']) && isset($account['id'])) {{-- --}} @if($account['default_type'] == 'debit') @php if(isset($account['opening']['total_balance'])) { if($account['opening']['total_balance']>0) { $debit_openning_balance +=abs(@$account['opening']['total_balance']) ?? 0; } else{ $credit_openning_balance +=abs(@$account['opening']['total_balance']) ?? 0; } } @endphp @else @php if(isset($account['opening']['total_balance'])) { if($account['opening']['total_balance']>0) { $credit_openning_balance +=abs(@$account['opening']['total_balance']) ?? 0; }else{ $debit_openning_balance +=abs(@$account['opening']['total_balance']) ?? 0; } } @endphp @endif @if($account['default_type'] == 'debit') {{-- start for debit + period debit - credit start (0) + period credit --}} {{-- if the balance is negative add it in credit if it positive add it in debit --}} @php if(isset($account['opening']['total_balance'])) { $period = ($account['opening']['total_balance'] + $account['period']['debit']) - (0 + $account['period']['credit']); }else{ $period =0; } if($period > 0) { $debit_closing_balance += abs($period); }else{ $credit_closing_balance += abs($period); } @endphp @else @php if(isset($account['opening']['total_balance'])) { $period = ($account['opening']['total_balance'] + $account['period']['credit']) - (0 + $account['period']['debit']); } else{ $period =0; } if($period >0) { $credit_closing_balance += abs($period); }else{ $debit_closing_balance += abs($period); } @endphp {{-- --}} @endif {{-- --}} @if (request('exclude_net') == 0) @endif @isset($account['childs']) @foreach($account['childs'] as $childAccount) @if($childAccount['total_for_display']) @if($account['default_type'] == 'debit') @isset($childAccount['opening']['debit']) @php if(isset($childAccount['opening']) && $childAccount['opening']['total_balance'] >0) { $debit_openning_balance +=abs(@$childAccount['opening']['total_balance']) ?? 0; }else{ $credit_openning_balance +=abs(@$childAccount['opening']['total_balance']) ?? 0; } @endphp @endisset @else @php if(isset($childAccount['opening']) && $childAccount['opening']['total_balance'] >0) { $credit_openning_balance +=abs(@$childAccount['opening']['total_balance']) ?? 0; }else{ $debit_openning_balance +=abs(@$childAccount['opening']['total_balance']) ?? 0; } @endphp @endif {{-- --}} @if($account['default_type'] == 'debit') {{-- start for debit + period debit - credit start (0) + period credit --}} {{-- if the balance is negative add it in credit if it positive add it in debit --}} @php if(isset($childAccount['opening']['total_balance'])) { $period = ($childAccount['opening']['total_balance'] + $childAccount['period']['debit']) - (0 + $childAccount['period']['credit']); }else{ $period =0; } if($period >0) { $debit_closing_balance += abs($period); }else{ $credit_closing_balance += abs($period); } @endphp @else @php if(isset($childAccount['opening']['total_balance'])) { $period = ($childAccount['opening']['total_balance'] + $childAccount['period']['credit']) - (0 + $childAccount['period']['debit']); }else{ $period =0; } if($period >0) { $credit_closing_balance += abs($period); }else{ $debit_closing_balance += abs($period); } @endphp {{-- --}} @endif @if (request('exclude_net') == 0) @endif @endif @endforeach @endisset @endif @endforeach @endif @endforeach @if (request('exclude_net') == 0) @endif
@lang('reports::reports.account') @lang('reports::reports.trial_balance.opening_balance') @lang('reports::reports.trial_balance.period_transactions') @lang('reports::reports.trial_balance.closing_balance')
@lang('reports::reports.debit') @lang('reports::reports.credit') @lang('reports::reports.debit') @lang('reports::reports.credit') @lang('reports::reports.debit') @lang('reports::reports.credit')@lang('reports::reports.total closing balance')
{{$categoryName}}
{{ $account['code'] . ' - ' . $account['name'] }} @if(isset($account['opening']['debit'])) {{number_format($account['opening']['debit'],2)}} @else 0.00 @endif @isset($account['opening']['debit']) @if($account['opening']['total_balance'] > 0) {{ number_format(abs($account['opening']['total_balance']),2)}} @else {{ number_format(0,2)}} @endif @endisset @isset($account['opening']['credit']) @if($account['opening']['total_balance'] > 0) {{ number_format(0,2)}} @else {{ number_format(abs($account['opening']['total_balance']),2)}}@endif @endisset@isset($account['opening']['debit']) @if($account['opening']['total_balance'] >= 0) {{ number_format(0,2)}} @else{{ number_format(abs($account['opening']['total_balance']) ,2)}} @endif @endisset @isset($account['opening']['credit']) @if($account['opening']['total_balance'] > 0) {{ number_format(abs($account['opening']['total_balance'] ) ,2)}} @else {{ number_format(0,2)}} @endif @endisset@isset($account['period']['debit']) {{ number_format($account['period']['debit'],2)}} @endisset @isset($account['period']['credit']) {{ number_format($account['period']['credit'],2)}} @endisset@isset($account['opening']['debit']) @if($period > 0) {{ number_format(abs($period),2)}} @else {{ number_format(0,2)}} @endif @endisset @isset($account['opening']['credit']) @if($period < 0) {{ number_format(abs($period),2)}} @else {{ number_format(0,2)}} @endif @endisset@isset($account['opening']['debit']) @if($period < 0) {{ number_format(abs($period),2)}} @else {{ number_format(0,2)}} @endif @endisset @isset($account['opening']['credit']) @if($period > 0) {{ number_format(abs($period),2)}} @else {{ number_format(0,2)}} @endif @endisset@isset($childAccount['closing']['debit']) {{ number_format($childAccount['closing']['debit'],2)}} @endisset @isset($childAccount['closing']['credit']) {{ number_format($childAccount['closing']['credit'],2)}} @endisset@isset($account['closing']['debit']) {{ number_format($account['closing']['debit'],2)}} @endisset @isset($account['closing']['credit']) {{ number_format($account['closing']['credit'],2)}} @endisset @isset($account['closing']['total_balance']) @if($account['closing']['total_balance'] >= 0) {{ number_format($account['closing']['total_balance'],2)}} @else {{ "(" . number_format(abs($account['closing']['total_balance']),2) . ")"}} @endif @endisset
{{ $childAccount['code'] . ' - ' . $childAccount['name'] }} @isset($childAccount['opening']['debit']) @if($childAccount['opening']['total_balance'] > 0) {{ number_format(abs($childAccount['opening']['total_balance']),2)}} @else {{ number_format(0,2)}} @endif @endisset @isset($childAccount['opening']['credit']) @if($childAccount['opening']['total_balance'] > 0) {{ number_format(0,2)}} @else {{ number_format(abs($childAccount['opening']['total_balance']),2)}}@endif @endisset@isset($childAccount['opening']['debit']) @if($childAccount['opening']['total_balance'] > 0) {{ number_format(0,2)}} @else{{ number_format(abs($childAccount['opening']['total_balance']),2)}} @endif @endisset @isset($childAccount['opening']['credit']) @if($childAccount['opening']['total_balance'] > 0) {{ number_format(abs($childAccount['opening']['total_balance']),2)}} @else {{ number_format(0,2)}} @endif @endisset@isset($childAccount['period']['debit']) {{ number_format($childAccount['period']['debit'],2)}} @endisset @isset($childAccount['period']['credit']) {{ number_format($childAccount['period']['credit'],2)}} @endisset@isset($childAccount['closing']['debit']) {{ number_format($childAccount['closing']['debit'],2)}} @endisset @isset($childAccount['closing']['credit']) {{ number_format($childAccount['closing']['credit'],2)}} @endisset@isset($childAccount['opening']['debit']) @if($period > 0) {{ number_format(abs($period),2)}} @else {{ number_format(0,2)}} @endif @endisset @isset($childAccount['opening']['credit']) @if($period < 0) {{ number_format(abs($period),2)}} @else {{ number_format(0,2)}} @endif @endisset@isset($childAccount['opening']['debit']) @if($period < 0) {{ number_format(abs($period),2)}} @else{{ number_format(0,2)}} @endif @endisset @isset($childAccount['opening']['credit']) @if($period > 0) {{ number_format(abs($period),2)}} @else {{ number_format(0,2)}} @endif @endisset@isset($childAccount['closing']['debit']) {{ number_format($childAccount['closing']['debit'],2)}} @endisset @isset($childAccount['closing']['credit']) {{ number_format($childAccount['closing']['credit'],2)}} @endisset @isset($childAccount['closing']['total_balance']) @if($childAccount['closing']['total_balance'] >= 0) {{ number_format($childAccount['closing']['total_balance'],2)}} @else {{ "(" . number_format(abs($childAccount['closing']['total_balance']),2) . ")"}} @endif @endisset
@lang('reports::reports.trial_balance.total') {{number_format($debit_openning_balance,2)}} {{number_format($credit_openning_balance,2)}} {{number_format($data['total']['period']['debit'],2)}} {{number_format($data['total']['period']['credit'],2)}} {{number_format($debit_closing_balance,2)}} {{number_format($credit_closing_balance,2)}}---
@lang('reports::reports.accrual_basis') {{ Date::format(now(), 'datetime') }}