{{-- div for Company --}} {{ $cashBookReportLoadTableArr['company']->name }}
{{ $cashBookReportLoadTableArr['company']->address }}
Cash Book Report
{{-- div for Reporting Info --}}
Ledger Head:     {{ $cashBookReportLoadTableArr['ledgerHead'] }} Branch:     {{ $cashBookReportLoadTableArr['branchName'] }}
Project:     {{ $cashBookReportLoadTableArr['projectName'] }} Reporting Date :     {{ date('d-m-Y', strtotime($cashBookReportLoadTableArr['dateFrom'])) . ' to ' . date('d-m-Y', strtotime($cashBookReportLoadTableArr['dateTo'])) }}
Project Type:       {{ $cashBookReportLoadTableArr['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 // if it is opening balance as transaction if ($voucherInfo->voucherCode == 'Opening Transaction') { $ledgerNameWithCode = $ledgersInfo[$voucherInfo->debitAcc]; $balanceAmount = $voucherInfo->amount; $debitAmount = 0; $creditAmount = 0; } else { // account head if (!in_array($voucherInfo->debitAcc,$ledgerId)) { $ledgerNameWithCode = $ledgersInfo[$voucherInfo->debitAcc]; } elseif (!in_array($voucherInfo->creditAcc,$ledgerId)) { $ledgerNameWithCode = $ledgersInfo[$voucherInfo->creditAcc]; } elseif ($voucherInfo->debitAcc == $voucherInfo->creditAcc) { $ledgerNameWithCode = $ledgersInfo[$voucherInfo->debitAcc]; } // debit and credit amount if (in_array($voucherInfo->debitAcc,$ledgerId) && $voucherInfo->debitAcc != $voucherInfo->creditAcc) { $debitAmount = $voucherInfo->amount; $creditAmount = 0; $totalDebit += $voucherInfo->amount; $balanceAmount += $voucherInfo->amount; } elseif (in_array($voucherInfo->creditAcc,$ledgerId) && $voucherInfo->debitAcc != $voucherInfo->creditAcc) { $debitAmount = 0; $creditAmount = $voucherInfo->amount; $totalCredit += $voucherInfo->amount; $balanceAmount -= $voucherInfo->amount; } elseif ($voucherInfo->debitAcc == $voucherInfo->creditAcc) { $debitAmount = $voucherInfo->amount; $creditAmount = $voucherInfo->amount; $totalDebit += $voucherInfo->amount; $totalCredit += $voucherInfo->amount; } } // balance type(dr/cr) $balanceType = $balanceAmount < 0 ? 'Cr' : 'Dr'; @endphp @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 ?? 0, 2) }} {{ number_format($creditAmount ?? 0, 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