{{-- resources/views/invoices/aging.blade.php --}} @extends('layouts.app') @section('title', 'Unpaid / Aging') @section('content')
{{-- Page Header --}}

Unpaid / Aging

{{-- Summary Buckets --}} @php $buckets = [ ['label' => '0–30 days', 'count' => 18, 'amount' => 156250.0, 'icon' => 'bi-0-circle'], ['label' => '31–60 days', 'count' => 9, 'amount' => 112500.0, 'icon' => 'bi-1-circle'], ['label' => '61–90 days', 'count' => 6, 'amount' => 94800.0, 'icon' => 'bi-2-circle'], ['label' => '90+ days', 'count' => 4, 'amount' => 123200.0, 'icon' => 'bi-exclamation-octagon'], ]; $totalAmount = array_sum(array_column($buckets, 'amount')); $totalCount = array_sum(array_column($buckets, 'count')); @endphp
@foreach ($buckets as $b)
{{ $b['label'] }}
{{ $b['count'] }} inv
₱ {{ number_format($b['amount'], 2) }}
@endforeach
Total Outstanding: ₱ {{ number_format($totalAmount, 2) }} ({{ $totalCount }} invoices)
{{-- Filters --}}
{{-- Table --}}

Unpaid / Aging Detail

@php $agingRows = [ [ 'INV-2025-0002', 'BIN-000124', 'Mercury Drug', 'San Isidro', 'Renewal', '2025-01-08', '2025-01-23', 18600, 60, '31–60', ], [ 'INV-2025-0003', 'BIN-000125', 'Sari-Sari ni Aling Nena', 'San Roque', 'New', '2025-01-12', '2025-01-27', 3250, 90, '61–90', ], [ 'INV-2025-0010', 'BIN-000138', 'ABC Water Refilling', 'Poblacion', 'Renewal', '2025-02-01', '2025-02-16', 5400, 25, '0–30', ], [ 'INV-2025-0015', 'BIN-000145', 'XYZ Printing', 'San Isidro', 'Renewal', '2025-02-10', '2025-02-25', 12400, 110, '90+', ], [ 'INV-2025-0018', 'BIN-000149', 'Kusina ni Mang Bert', 'Poblacion', 'Additional Line', '2025-02-15', '2025-03-02', 6800, 15, '0–30', ], ]; function bucketBadge($b) { return match ($b) { '0–30' => '0–30', '31–60' => '31–60', '61–90' => '61–90', '90+' => '90+', default => '' . $b . '', }; } @endphp @foreach ($agingRows as $r) @endforeach
Invoice # BIN Business Name Barangay Permit Type Issue Date Due Date Amount (₱) Days Past Due Aging Bucket Actions
{{ $r[0] }} {{ $r[1] }} {{ $r[2] }} {{ $r[3] }} {{ $r[4] }} {{ \Carbon\Carbon::parse($r[5])->format('M d, Y') }} {{ \Carbon\Carbon::parse($r[6])->format('M d, Y') }} {{ number_format($r[7], 2) }} {{ $r[8] }} {!! bucketBadge($r[9]) !!}
Total ₱ {{ number_format(array_sum(array_column($agingRows, 7)), 2) }} {{ array_sum(array_column($agingRows, 8)) }}
{{-- Follow Up Modal (Static) --}} @endsection @push('scripts') @endpush