@include('templates.pdf_header', [ 'organisation' => $organisation, 'title' => 'GENERAL LEDGER', 'currency_code' => $currency ]) @php // Split entries into chunks of 40 per page to avoid PDF memory issues $chunkSize = 40; @endphp @foreach ($ledger as $account) @php $entriesChunks = collect($account['entries'])->chunk($chunkSize); @endphp @foreach ($entriesChunks as $chunkIndex => $entries)
@if($chunkIndex === 0)

{{ $account['account_name'] }} ({{ $account['code'] }})

@endif @foreach ($entries as $entry) @endforeach @if($chunkIndex === $entriesChunks->count() - 1) @endif
Date Description Reference Debit Credit Running Balance
{{ $entry['date'] }} {{ $entry['description'] }} {{ $entry['reference'] }} {{ number_format($entry['debit'], 2) }} {{ number_format($entry['credit'], 2) }} {{ number_format($entry['running_balance'], 2) }}
Closing Balance {{ number_format($account['balance'], 2) }}
@endforeach @endforeach