{{-- div for Company --}} {{ $bankBookReportLoadTableArr['company']->name }}
{{ $bankBookReportLoadTableArr['company']->address }}
Bank Book Report
{{-- div for Reporting Info --}}
Ledger Head:     {{ $bankBookReportLoadTableArr['ledgerHead'] }} Branch:     {{ $bankBookReportLoadTableArr['branchName'] }}
Project:     {{ $bankBookReportLoadTableArr['projectName'] }} Reporting Date :     {{ date('d-m-Y', strtotime($bankBookReportLoadTableArr['dateFrom'])) . ' to ' . date('d-m-Y', strtotime($bankBookReportLoadTableArr['dateTo'])) }}
Project Type:       {{ $bankBookReportLoadTableArr['projectType'] }} Print Date:       {{ \Carbon\Carbon::now()->format('d-m-Y g:i A') }}

{{-- opening balance row --}} @php $sl = 1; $totalDebit = 0; $totalCredit = 0; $balanceAmount = $openingBalance; @endphp @foreach ($voucherInfos as $voucherInfo) @php $ledgerNameWithCode = in_array($voucherInfo->debitAcc, $ledgerIdArr) ? $ledgersInfo[$voucherInfo->creditAcc] : $ledgersInfo[$voucherInfo->debitAcc]; @endphp {{-- if both 'debitAcc' and 'creditAcc' are in '$ledgerIdArr' then we need to print twice --}} @if (in_array($voucherInfo->debitAcc, $ledgerIdArr) && in_array($voucherInfo->creditAcc, $ledgerIdArr) && $voucherInfo->voucherCode != 'Opening Transaction') @for ($i = 0; $i < 2; $i++) @php // let '$i = 0' for debit if ($i == 0) { $ledgerNameWithCode = $ledgersInfo[$voucherInfo->creditAcc]; $debitAmount = $voucherInfo->amount; $creditAmount = 0; $totalDebit += $voucherInfo->amount; $balanceAmount += $voucherInfo->amount; } else { $ledgerNameWithCode = $ledgersInfo[$voucherInfo->debitAcc]; $debitAmount = 0; $creditAmount = $voucherInfo->amount; $totalCredit += $voucherInfo->amount; $balanceAmount -= $voucherInfo->amount; } $balanceType = $balanceAmount < 0 ? 'Cr' : 'Dr'; @endphp @endfor @else @php if ($voucherInfo->voucherCode == 'Opening Transaction') { $balanceAmount = $voucherInfo->amount; $debitAmount = 0; $creditAmount = 0; } else { // debit and credit amount if (in_array($voucherInfo->debitAcc, $ledgerIdArr) && $voucherInfo->debitAcc != $voucherInfo->creditAcc) { $debitAmount = $voucherInfo->amount; $creditAmount = 0; $totalDebit += $voucherInfo->amount; $balanceAmount += $voucherInfo->amount; } if (in_array($voucherInfo->creditAcc, $ledgerIdArr) && $voucherInfo->debitAcc != $voucherInfo->creditAcc) { $debitAmount = 0; $creditAmount = $voucherInfo->amount; $totalCredit += $voucherInfo->amount; $balanceAmount -= $voucherInfo->amount; } if ($voucherInfo->debitAcc == $voucherInfo->creditAcc) { $debitAmount = $voucherInfo->amount; $creditAmount = $voucherInfo->amount; $totalDebit += $voucherInfo->amount; $totalCredit += $voucherInfo->amount; } } // balance type(dr/cr) $balanceType = $balanceAmount == 0 ? '' : ($balanceAmount < 0 ? 'Cr' : 'Dr'); @endphp @endif @endforeach {{-- sub-total --}} {{-- total --}}
SL# Date Voucher Code Account Head Narration/Cheque Details Debit Amount Credit Amount Balance Dr/Cr
Opening Balance {{ number_format(0, 2, '.', ',') }} {{ number_format(0, 2, '.', ',') }} {{ number_format(abs($openingBalance), 2, '.', ',') }} @if ($openingBalance == 0) {{ '' }} @elseif ($openingBalance < 0) {{ 'Cr' }} @else {{ 'Dr' }} @endif
{{ $sl++ }} {{ Carbon\Carbon::parse($voucherInfo->voucherDate)->format('d-m-Y') }} {{ $voucherInfo->voucherCode }} {{ $ledgerNameWithCode }} {{ $voucherInfo->globalNarration }} {{ number_format($debitAmount, 2) }} {{ number_format($creditAmount, 2) }} {{ number_format(abs($balanceAmount), 2) }} {{ $balanceType }}
{{ $sl++ }} {{ Carbon\Carbon::parse($voucherInfo->voucherDate)->format('d-m-Y') }} {{ $voucherInfo->voucherCode }} {{ $ledgerNameWithCode }} {{ $voucherInfo->globalNarration }} {{ number_format($debitAmount, 2) }} {{ number_format($creditAmount, 2) }} {{ number_format(abs($balanceAmount), 2) }} {{ $balanceType }}
Sub Total {{ number_format($totalDebit, 2, '.', ',') }} {{ number_format($totalCredit, 2, '.', ',') }} {{ number_format(abs($balanceAmount), 2, '.', ',') }} @if ($balanceAmount < 0) {{ 'Cr' }} @else {{ 'Dr' }} @endif
Total {{ number_format($totalDebit, 2, '.', ',') }} {{ number_format($totalCredit, 2, '.', ',') }} {{ number_format(abs($balanceAmount), 2, '.', ',') }} @if ($balanceAmount < 0) {{ 'Cr' }} @else {{ 'Dr' }} @endif