{{-- resources/views/exports/cash-flow-pdf.blade.php
Rendered by ReportsController::exportCashFlow(). $data holds cash_flows
(inflows and outflows, each a map of category => {name, amount,
transactions}) and summary (opening_cash, total_inflows, total_outflows,
net_cash_flow, closing_cash). --}}
Cash Flow
@include('exports._report-styles')
{{ \Carbon\Carbon::parse($data['from_date'])->format('d/m/Y') }}
to
{{ \Carbon\Carbon::parse($data['to_date'])->format('d/m/Y') }}
@php
$money = fn ($v) => number_format((float) $v, 2);
$summary = $data['summary'] ?? [];
@endphp
| Opening Cash & Bank |
{{ $money($summary['opening_cash'] ?? 0) }} |
@foreach ([['inflows', 'CASH INFLOWS', 'total_inflows'], ['outflows', 'CASH OUTFLOWS', 'total_outflows']] as [$key, $label, $totalKey])
| {{ $label }} |
Amount |
@php $categories = $data['cash_flows'][$key] ?? []; @endphp
@forelse ($categories as $category)
{{-- Categories are pre-seeded by the controller and stay in the
list at zero, so they are skipped here rather than printing
a page of nil lines. --}}
@if ((float) ($category['amount'] ?? 0) != 0.0)
| {{ $category['name'] ?? '' }} |
{{ $money($category['amount']) }} |
@endif
@empty
| No {{ strtolower($label) }} in this period. |
@endforelse
| Total {{ ucfirst(strtolower($label)) }} |
{{ $money($summary[$totalKey] ?? 0) }} |
@endforeach
| Net Cash Flow |
{{ $money($summary['net_cash_flow'] ?? 0) }} |
| Closing Cash & Bank |
{{ $money($summary['closing_cash'] ?? 0) }} |