{{-- Print Controls (screen only) --}}
{{ count($ledgers) }} ledger(s) | {{ \Carbon\Carbon::parse($startDate)->format('d-M-Y') }} to {{ \Carbon\Carbon::parse($endDate)->format('d-M-Y') }}
@foreach($ledgers as $ledgerData) @php $party = $ledgerData['party']; $transactions = $ledgerData['ledger']; $netOpening = $ledgerData['netOpening']; $runningBalance = $netOpening; $totalDr = max($netOpening, 0); $totalCr = max(-$netOpening, 0); $formatBal = function($amount) { if ($amount == 0) return '-'; $suffix = $amount >= 0 ? ' Dr' : ' Cr'; return indian_number(abs($amount), 2) . $suffix; }; @endphp
{{-- Header --}} {{-- Ledger Table --}} {{-- Opening Balance --}} {{-- Transactions --}} @foreach($transactions as $entry) @php $runningBalance += ($entry['debit'] - $entry['credit']); $totalDr += $entry['debit']; $totalCr += $entry['credit']; @endphp @endforeach {{-- Period Totals --}} {{-- Closing Balance --}}
Date Type Particulars Ref No. Debit Credit Balance
{{ \Carbon\Carbon::parse($startDate)->format('d-M-Y') }} OPENING Balance Brought Forward - {{ $netOpening > 0 ? indian_number(abs($netOpening), 2) : '-' }} {{ $netOpening < 0 ? indian_number(abs($netOpening), 2) : '-' }} {{ $formatBal($runningBalance) }}
{{ $entry['date']->format('d-M-Y') }} {{ $entry['type'] }} {{ $entry['desc'] }} {{ $entry['ref'] ?: '-' }} {{ $entry['debit'] > 0 ? indian_number($entry['debit'], 2) : '-' }} {{ $entry['credit'] > 0 ? indian_number($entry['credit'], 2) : '-' }} {{ $formatBal($runningBalance) }}
Period Totals: {{ indian_number($totalDr, 2) }} {{ indian_number($totalCr, 2) }} {{ $formatBal($runningBalance) }}
Closing Balance: @if($runningBalance >= 0) {{ indian_number(abs($runningBalance), 2) }} Dr (Party owes you) @else {{ indian_number(abs($runningBalance), 2) }} Cr (You owe party) @endif {{ $formatBal($runningBalance) }}
{{-- Footer --}}
@endforeach