@php $total_debet = 0; $total_credit = 0; $total_ending_balance = 0; $submain_debet = 0; $submain_credit = 0; $submain_total_ending_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; @endphp @foreach ($sub_trial_balance as $trial_balance) @php $total_debet += $trial_balance['debet'] ?? 0; $total_credit += $trial_balance['credit'] ?? 0; $ending_balance = ($trial_balance['debet'] - $trial_balance['credit'] ); $total_ending_balance += $ending_balance; $sub_total_debet += $trial_balance['debet']; $sub_total_credit += $trial_balance['credit']; $sub_total_ending_balance += $ending_balance; @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; $submain_ending_balance = ($submain_debet - $submain_credit); $submain_total_ending_balance += $submain_ending_balance; @endphp @endforeach @endif @endforeach @php $submain_total_ending_balance = 0; @endphp @endforeach @endforeach
Date Account No Description Debet Credit Ending Balance 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') }} {{ ribuanWithComma($submain_debet) }} {{ ribuanWithComma($submain_credit) }} {{ ribuanWithComma($submain_ending_balance) }} {{ $value->getOriginal('remark') ?? "-"}}
TOTAL {{ ribuanWithComma(($trial_balance['debet'])) }} {{ ribuanWithComma(($trial_balance['credit'])) }} {{ ribuanWithComma(($submain_total_ending_balance ?? 0)) }}
SUB TOTAL {{ ribuanWithComma(($sub_total_debet)) }} {{ ribuanWithComma(($sub_total_credit)) }} {{ ribuanWithComma(($sub_total_ending_balance)) }}
TOTAL {{ ribuanWithComma(($total_debet)) }} {{ ribuanWithComma(($total_credit)) }} {{ ribuanWithComma(($total_ending_balance)) }}