@extends('layouts.app') @section('title', $invoice->invoice_number) @section('content')

{{ $invoice->invoice_number }}

{{ $invoice->customer->display_name }} · {{ $invoice->status }} · {{ title_case_words($invoice->type) }}

Print / PDF @if ($invoice->balance > 0 && ! in_array($invoice->status, ['draft', 'cancelled'])) Record payment @endif
@include('components.kpi', ['label' => 'Invoice total', 'value' => money($invoice->total, $invoice->currency), 'variant' => 'info', 'href' => '#']) @include('components.kpi', ['label' => 'Paid to date', 'value' => money($invoice->amount_paid, $invoice->currency), 'variant' => 'good', 'href' => '#payments']) @include('components.kpi', ['label' => 'Outstanding', 'value' => money($invoice->balance, $invoice->currency), 'variant' => $invoice->balance > 0 ? ($invoice->is_overdue ? 'bad' : 'warn') : 'good', 'href' => '#']) @include('components.kpi', ['label' => 'Due date', 'value' => $invoice->due_date->format('d M Y'), 'variant' => $invoice->is_overdue ? 'bad' : '', 'delta' => $invoice->is_overdue ? (int) $invoice->due_date->diffInDays(now()).' days late' : 'Not overdue', 'href' => '#'])

Line items

{{ $invoice->period_start?->format('d M Y') ?? '' }} @if ($invoice->period_end) to {{ $invoice->period_end->format('d M Y') }} @endif
@foreach ($invoice->items as $item) @endforeach
DescriptionQtyUnit priceAmount
{{ $item->description }} {{ rtrim(rtrim(number_format($item->quantity, 2), '0'), '.') }} {{ money($item->unit_price, $invoice->currency) }} {{ money($item->amount, $invoice->currency) }}
Subtotal {{ money($invoice->subtotal, $invoice->currency) }}
Tax {{ money($invoice->tax, $invoice->currency) }}
Total {{ money($invoice->total, $invoice->currency) }}
Paid −{{ money($invoice->amount_paid, $invoice->currency) }}
Balance due {{ money($invoice->balance, $invoice->currency) }}
@if ($invoice->notes)
Notes: {{ $invoice->notes }}
@endif

Payments applied

@forelse ($invoice->allocations as $allocation) @empty @endforelse
ReferenceDateMethodApplied
{{ $allocation->payment?->reference ?? '—' }} {{ $allocation->payment?->paid_at?->format('d M Y') ?? '—' }} {{ title_case_words($allocation->payment?->method) }} {{ money($allocation->amount_allocated, $invoice->currency) }}
@csrf @method('DELETE')
@include('components.empty-state', ['icon' => '💳', 'title' => 'No payments applied'])

Invoice control

@if ($invoice->status === 'draft')
@csrf
@endif @if (! in_array($invoice->status, ['cancelled', 'refunded', 'paid']))
@csrf
@endif
@if (! in_array($invoice->status, ['cancelled', 'refunded']))
@csrf
@endif @if ($invoice->amount_paid > 0) @endif

Metadata

Invoice number
{{ $invoice->invoice_number }}
Issue date
{{ $invoice->issue_date->format('d M Y') }}
Due date
{{ $invoice->due_date->format('d M Y') }}
Currency
{{ $invoice->currency }}
Exchange rate
{{ $invoice->exchange_rate }}
Branch
{{ $invoice->branch?->name ?: 'Head office' }}
Service
@if ($invoice->service) {{ $invoice->service->service_number }} @else — @endif
Created by
{{ $invoice->creator?->name ?? 'Billing cycle' }}
@if ($invoice->cancelled_at)
Cancelled
{{ $invoice->cancelled_at->format('d M Y H:i') }} — {{ $invoice->cancellation_reason }}
@endif
@endsection