@php if (!function_exists('isCashAccount')) { function isCashAccount($ledger) { return $ledger && $ledger->accountTypeId == 4; } } if (!function_exists('isBankAccount')) { function isBankAccount($ledger) { return $ledger && $ledger->accountTypeId == 5; } } @endphp
{{ $bankBookReportLoadTableArr['company']->name }}
{{ $bankBookReportLoadTableArr['company']->address }}
Cash & Bank Book Report
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') }}

{{-- Debit sub-columns --}} {{-- Credit sub-columns --}} {{-- Balance sub-columns --}} @php $sl = 1; $totalDebit = $totalCredit = $totalDebitCash = $totaDebitBank = $totalCreditCash = $totalCreditBank = 0; $opCashDebitAmount = $openingBalanceInfo['cashDebitAmount']; $opBankDebitAmount = $openingBalanceInfo['bankDebitAmount']; $opCashCreditAmount = $openingBalanceInfo['cashCreditAmount']; $opBankCreditAmount = $openingBalanceInfo['bankCreditAmount']; $cashBalanceAmount = $openingBalanceInfo['openingCashBalance']; $bankBalanceAmount = $openingBalanceInfo['openingBankBalance']; $balanceAmount = $openingBalanceInfo['openingBalance']; @endphp {{-- opening balance row --}} @foreach ($voucherInfos as $voucherInfo) @php $ledgerInfo = in_array($voucherInfo->debitAcc, $ledgerIdArr) ? $ledgersInfo[$voucherInfo->creditAcc] : $ledgersInfo[$voucherInfo->debitAcc]; $debitAmountCash = 0; $debitAmountBank = 0; $creditAmountCash = 0; $creditAmountBank = 0; @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) { $ledgerInfo = $ledgersInfo[$voucherInfo->creditAcc]; $debitAmount = 0; $creditAmount = $voucherInfo->amount; $totalCredit += $creditAmount; $balanceAmount -= $creditAmount; $debitAmountCash = 0; $debitAmountBank = 0; if (isCashAccount($cashBankLedgers[$voucherInfo->creditAcc] ?? null)) { $creditAmountCash = $creditAmount; $creditAmountBank = 0; $cashBalanceAmount -= $creditAmount; $totalCreditCash += $creditAmount; } elseif (isBankAccount($cashBankLedgers[$voucherInfo->creditAcc] ?? null)) { $creditAmountBank = $creditAmount; $creditAmountCash = 0; $bankBalanceAmount -= $creditAmount; $totalCreditBank += $creditAmount; } } else { $ledgerInfo = $ledgersInfo[$voucherInfo->debitAcc]; $debitAmount = $voucherInfo->amount; $creditAmount = 0; $totalDebit += $debitAmount; $balanceAmount += $debitAmount; $creditAmountCash = 0; $creditAmountBank = 0; if (isCashAccount($cashBankLedgers[$voucherInfo->debitAcc] ?? null)) { $debitAmountCash = $debitAmount; $debitAmountBank = 0; $cashBalanceAmount += $debitAmount; $totalDebitCash += $debitAmount; } elseif (isBankAccount($cashBankLedgers[$voucherInfo->debitAcc] ?? null)) { $debitAmountBank = $debitAmount; $debitAmountCash = 0; $bankBalanceAmount += $debitAmount; $totaDebitBank += $debitAmount; } } @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 += $debitAmount; $balanceAmount += $debitAmount; if (isCashAccount($cashBankLedgers[$voucherInfo->debitAcc] ?? null)) { $debitAmountCash = $debitAmount; $debitAmountBank = 0; $cashBalanceAmount += $debitAmount; $totalDebitCash += $debitAmount; } elseif (isBankAccount($cashBankLedgers[$voucherInfo->debitAcc] ?? null)) { $debitAmountBank = $debitAmount; $debitAmountCash = 0; $bankBalanceAmount += $debitAmount; $totaDebitBank += $debitAmount; } } if (in_array($voucherInfo->creditAcc, $ledgerIdArr) && $voucherInfo->debitAcc != $voucherInfo->creditAcc) { $debitAmount = 0; $creditAmount = $voucherInfo->amount; $totalCredit += $creditAmount; $balanceAmount -= $creditAmount; if (isCashAccount($cashBankLedgers[$voucherInfo->creditAcc] ?? null)) { $creditAmountCash = $creditAmount; $creditAmountBank = 0; $cashBalanceAmount -= $creditAmount; $totalCreditCash += $creditAmount; } elseif (isBankAccount($cashBankLedgers[$voucherInfo->creditAcc] ?? null)) { $creditAmountBank = $creditAmount; $creditAmountCash = 0; $bankBalanceAmount -= $creditAmount; $totalCreditBank += $creditAmount; } } if ($voucherInfo->debitAcc == $voucherInfo->creditAcc) { $debitAmount = $voucherInfo->amount; $creditAmount = $voucherInfo->amount; $totalDebit += $voucherInfo->amount; $totalCredit += $voucherInfo->amount; if (isCashAccount($cashBankLedgers[$voucherInfo->debitAcc] ?? null)) { $debitAmountCash = $debitAmount; $creditAmountCash = $creditAmount; $debitAmountBank = 0; $creditAmountBank = 0; $cashBalanceAmount += $voucherInfo->amount; $totalDebitCash += $debitAmount; $totalCreditCash += $creditAmount; } elseif (isBankAccount($cashBankLedgers[$voucherInfo->debitAcc] ?? null)) { $debitAmountBank = $debitAmount; $creditAmountBank = $creditAmount; $debitAmountCash = 0; $creditAmountCash = 0; $bankBalanceAmount += $voucherInfo->amount; $totaDebitBank += $debitAmount; $totalCreditBank += $creditAmount; } } } @endphp @endif @endforeach {{-- Sub Total --}} {{-- Total / CLosing Balance --}}
SL# Date Voucher Code Account Head Receipt (Debit) Payment (Credit) Balance
Cash BankCash BankCash Bank
Opening Balance {{ number_format(abs($opCashDebitAmount), 2, '.', ',') }} {{ number_format(abs($opBankDebitAmount), 2, '.', ',') }} {{ number_format(abs($opCashCreditAmount), 2, '.', ',') }} {{ number_format(abs($opBankCreditAmount), 2, '.', ',') }} {{ number_format(abs($openingBalanceInfo['openingCashBalance']), 2, '.', ',') }} {{ number_format(abs($openingBalanceInfo['openingBankBalance']), 2, '.', ',') }}
{{ $sl++ }} {{ Carbon\Carbon::parse($voucherInfo->voucherDate)->format('d-m-Y') }} {{ $voucherInfo->voucherCode }} {{ @$ledgerInfo->name . ' [' . @$ledgerInfo->code . ']' }} {{ number_format($debitAmountCash, 2) }} {{ number_format($debitAmountBank, 2) }} {{ number_format($creditAmountCash, 2) }} {{ number_format($creditAmountBank, 2) }} {{ number_format($cashBalanceAmount, 2) }} {{ number_format($bankBalanceAmount, 2) }}
{{ $sl++ }} {{ Carbon\Carbon::parse($voucherInfo->voucherDate)->format('d-m-Y') }} {{ $voucherInfo->voucherCode }} {{ @$ledgerInfo->name . ' [' . @$ledgerInfo->code . ']' }} {{ number_format($debitAmountCash, 2) }} {{ number_format($debitAmountBank, 2) }} {{ number_format($creditAmountCash, 2) }} {{ number_format($creditAmountBank, 2) }} {{ number_format($cashBalanceAmount, 2) }} {{ number_format($bankBalanceAmount, 2) }}
Total (During this period) {{ number_format($totalDebitCash, 2) }} {{ number_format($totaDebitBank, 2) }} {{ number_format($totalCreditCash, 2) }} {{ number_format($totalCreditBank, 2) }} {{ number_format($cashBalanceAmount, 2) }} {{ number_format($bankBalanceAmount, 2) }}
Closing Balance {{ number_format($totalDebitCash + $opCashDebitAmount, 2) }} {{ number_format($totaDebitBank + $opBankDebitAmount, 2) }} {{ number_format($totalCreditCash + $opCashCreditAmount, 2) }} {{ number_format($totalCreditBank + $opBankCreditAmount, 2) }} {{ number_format($cashBalanceAmount, 2) }} {{ number_format($bankBalanceAmount, 2) }}
Description Amount
Total Receipt (Cash + Bank) {{ number_format($totalDebit, 2, '.', ',') }}
Total Payment (Cash + Bank) {{ number_format($totalCredit, 2, '.', ',') }}
Balance This Period {{ number_format($totalDebit - $totalCredit, 2, '.', ',') }}
Closing Cash Balance {{ number_format($cashBalanceAmount, 2) }}
Closing Bank Balance {{ number_format($bankBalanceAmount, 2) }}
Total Cash & Bank Balance {{ number_format($balanceAmount, 2) }}