@php $money = fn (int $cents) => 'AUD '.number_format($cents / 100, 2); $buckets = [ 'current' => ['Current', 'bg-emerald-500'], 'd1_30' => ['1–30 days', 'bg-amber-400'], 'd31_60' => ['31–60 days', 'bg-orange-500'], 'd61_plus' => ['61+ days', 'bg-red-600'], ]; @endphp

Balance owing

{{ $money($aging['total']) }}

{{ $outstanding->count() }} open {{ str('invoice')->plural($outstanding->count()) }}

@if($credit['on_account'])
Credit used{{ $money($credit['used_cents']) }} / {{ $money($credit['limit_cents']) }}
@endif

Aging

@foreach($buckets as $key => [$label, $color]) @if($aging['total'] > 0 && $aging[$key] > 0) @endif @endforeach
@foreach($buckets as $key => [$label, $color])
{{ $label }}
{{ $money($aging[$key]) }}
@endforeach
@if($credit['overdue_cents'] > 0)

{{ $money($credit['overdue_cents']) }} is overdue. Settling it restores your full credit line.

@endif

Open invoices

@if($outstanding->isEmpty())

Nothing owing — you're all square.

@else
@foreach($outstanding as $order) @endforeach
InvoicePOIssuedDueAmount
{{ $order->number }} {{ $order->po_number ?: '—' }} {{ $order->created_at->format('d M Y') }} @if($order->isOverdue()) {{ (int) $order->payment_due_at->diffInDays(now()) }}d overdue @else {{ $order->payment_due_at?->format('d M Y') ?? 'On receipt' }} @endif {{ $order->moneyFromCents($order->netTotalCents()) }}
@endif

Recently paid

@if($paid->isEmpty())

Paid invoices will appear here.

@else
@foreach($paid as $order) @endforeach
{{ $order->number }} {{ $order->created_at->format('d M Y') }} Paid {{ $order->money('total_cents') }}
@endif