{{ $company ?? 'Medical Center' }}
@if($data['type'] === 'receivable') Accounts Receivable Aging Report @else Accounts Payable Aging Report @endif
As of: {{ $data['as_of_date'] ?? 'N/A' }}
@php $buckets = [ 'current' => 'Current (0-30 days)', '31_60' => '31-60 days', '61_90' => '61-90 days', 'over_90' => 'Over 90 days', ]; @endphp @foreach($buckets as $key => $label) @php $bucket = $data['aging_buckets'][$key] ?? null; @endphp @if($bucket)
{{ $label }} - Total: {{ number_format($bucket['total'] ?? 0, 2) }}
@php $items = $bucket['items'] ?? []; $subtotal = 0; @endphp @forelse($items as $item) @php $amount = ($data['type'] === 'receivable') ? ($item['debit'] - $item['credit']) : ($item['credit'] - $item['debit']); $subtotal += $amount; @endphp @empty @endforelse
Date Journal No Reference Debit Credit Days Old Amount
{{ $item['entry_date'] ?? '-' }} {{ $item['journal_no'] ?? '-' }} {{ $item['reference'] ?? '-' }} {{ number_format($item['debit'] ?? 0, 2) }} {{ number_format($item['credit'] ?? 0, 2) }} {{ $item['days_old'] ?? 0 }} {{ number_format($amount, 2) }}
No items
Subtotal {{ number_format($subtotal, 2) }}
@endif @endforeach
Total Outstanding {{ number_format($data['total_outstanding'] ?? 0, 2) }}