Journal entries @php $typeLabels = [ 'asset' => 'Assets', 'liability' => 'Liabilities', 'equity' => 'Equity / fund balance', 'revenue' => 'Revenue', 'expense' => 'Expenses', ]; $amount = fn (float $value): string => abs($value) < 0.004 ? 'โ€”' : money(abs($value), false); $side = fn (float $value): string => abs($value) < 0.004 ? '' : ($value > 0 ? 'Dr' : 'Cr'); $balanced = abs($totals['closing_debits'] - $totals['closing_credits']) < 0.01; @endphp
From {{ $from->format('d M Y') }} to {{ $asOf->format('d M Y') }}
Opening balances
{{ money($totals['opening_debits'], false) }}
Period debits
{{ money($totals['debits'], false) }}
Period credits
{{ money($totals['credits'], false) }}
Closing balances
{{ money($totals['closing_debits'], false) }}
@if ($balanced) Debits and credits agree โ€” the ledger is in balance. @else Out of balance by {{ money(abs($totals['closing_debits'] - $totals['closing_credits'])) }} โ€” review the most recent postings. @endif
@if (request()->hasAny(['from', 'as_of'])) Clear @endif
@if ($rows->isEmpty()) @else
@foreach ($typeLabels as $type => $label) @if ($rows->has($type)) @foreach ($rows[$type] as $row) @endforeach @endif @endforeach
Account Opening Debits Credits Closing
{{ $label }} ยท {{ $rows[$type]->count() }} account(s)
{{ $row['account']->name }}
{{ $row['account']->code }}
{{ $amount($row['opening']) }} {{ $side($row['opening']) }} {{ $amount($row['debits']) }} {{ $amount($row['credits']) }} {{ $amount($row['closing']) }} {{ $side($row['closing']) }}
Totals {{ money($totals['opening_debits'], false) }} {{ money($totals['debits'], false) }} {{ money($totals['credits'], false) }} {{ money($totals['closing_debits'], false) }}
@endif