@php $total_debet = 0; $total_credit = 0; $total_ending_balance = 0; $submain_debet = 0; $submain_credit = 0; $submain_total_ending_balance = 0; $total_all_beg_balance = 0; $total_all_end_balance = 0; @endphp @foreach($main_trial_balances as $main => $sub_trial_balance) @php $sub_total_debet = 0; $sub_total_credit = 0; $sub_total_ending_balance = 0; $total_coa_beg_balance = 0; $total_coa_end_balance = 0; @endphp @foreach ($sub_trial_balance as $trial_balance) @php $total_debet += $trial_balance['debet'] ?? 0; $total_credit += $trial_balance['credit'] ?? 0; if ($trial_balance->coa_type == 1) { $ending_balance = ($trial_balance['debet'] - $trial_balance['credit'] ); } else { $ending_balance = ($trial_balance['credit'] - $trial_balance['debet'] ); } $total_ending_balance += $ending_balance; $sub_total_debet += $trial_balance['debet']; $sub_total_credit += $trial_balance['credit']; $sub_total_ending_balance += $ending_balance; $total_beg_balance = 0; $total_end_balance = 0; @endphp @foreach($submain_trial_balances as $main => $sub_submain_trial_balance) @if(isset($sub_submain_trial_balance[$trial_balance['account_no']])) @foreach ($sub_submain_trial_balance[$trial_balance['account_no']] as $value) @php $submain_debet = $value->getOriginal('debet') ?? 0; $submain_credit = $value->getOriginal('credit') ?? 0; if ($trial_balance->coa_type == 1) { $submain_ending_balance = ($submain_debet - $submain_credit); } else { $submain_ending_balance = ($submain_credit - $submain_debet); } $submain_total_ending_balance += $submain_ending_balance; $total_beg_balance += $value->beg_balance; $total_end_balance += $value->end_balance; @endphp @endforeach @endif @endforeach @php $submain_total_ending_balance = 0; $total_coa_beg_balance += $total_beg_balance; $total_coa_end_balance += $total_end_balance; @endphp @endforeach @php $total_all_beg_balance += $total_coa_beg_balance; $total_all_end_balance += $total_coa_end_balance; @endphp @endforeach
Date Account No Description Reference No Beginning Balance Debet Credit Net Change Ending Balance Budget Reference Description Note
{{-- {{ config('custom.main_account_coa')[$main]}} {{'-'}} {{$main}} --}}
{{ $trial_balance['account_no'] }} {{ $trial_balance['description'] }}
{{ \Carbon\Carbon::parse($value->getOriginal('date'))->format('d/m/y') }} {{@$value->draft->reference_no}} {{ ribuanWithComma($value->beg_balance) }} {{ ribuanWithComma($submain_debet) }} {{ ribuanWithComma($submain_credit) }} {{ ribuanWithComma($submain_ending_balance) }} {{ ribuanWithComma($value->end_balance) }} {{ ribuanWithComma($trial_balance->budget) }} {{@$value->draft->description}} {{ $value->getOriginal('remark') ?? "-"}}
TOTAL {{ ribuanWithComma(($total_beg_balance)) }} {{ ribuanWithComma(($trial_balance['debet'])) }} {{ ribuanWithComma(($trial_balance['credit'])) }} {{ ribuanWithComma(($submain_total_ending_balance ?? 0)) }} {{ ribuanWithComma(($total_end_balance)) }}
SUB TOTAL {{ ribuanWithComma(($total_coa_beg_balance)) }} {{ ribuanWithComma(($sub_total_debet)) }} {{ ribuanWithComma(($sub_total_credit)) }} {{ ribuanWithComma(($sub_total_ending_balance)) }} {{ ribuanWithComma(($total_coa_end_balance)) }}
TOTAL {{ ribuanWithComma(($total_all_beg_balance)) }} {{ ribuanWithComma(($total_debet)) }} {{ ribuanWithComma(($total_credit)) }} {{ ribuanWithComma(($total_ending_balance)) }} {{ ribuanWithComma(($total_all_end_balance)) }}