@php $firstInvoice = $invoices->first(); $total = $invoices->sum(fn($inv) => $inv->payment->total_amount ?? 0); $paid = $invoices->sum(fn($inv) => $inv->payment->paid_amount ?? 0); $due = $invoices->sum(fn($inv) => $inv->payment->due_amount ?? 0); @endphp
{{-- ===== HEADER ===== --}}
INVOICE
Victory Travel Pte Ltd
Company Logo
{{-- ===== INVOICE META ===== --}}
Invoice Date: {{ date('d M Y', strtotime($firstInvoice->invoice_date)) }}
Invoice No: {{ $firstInvoice->ticket_no }}
Reference: {{ $firstInvoice->carrier->name ?? 'N/A' }}
{{-- ===== TABLE ===== --}}
@foreach($invoices as $invoice) @endforeach
Description Quantity Unit Price Amount SGD
Ticket Type: {{ $invoice->ticket_type ?? 'Economy' }}
PNR: {{ $invoice->pnr ?? 'N/A' }}
Flight Date: {{ date('d M Y', strtotime($invoice->flight_date)) }}
1 {{ number_format($invoice->sales_amount, 2) }} {{ number_format($invoice->payment->total_amount ?? 0, 2) }}
{{-- ===== TOTALS ===== --}}
Invoice Total {{ number_format($total, 2) }}
Total Paid {{ number_format($paid, 2) }}
Amount Due {{ number_format($due, 2) }}
{{-- ===== FOOTER ===== --}}