@extends('pdf.layout', [ 'documentTitle' => 'Invoice', 'documentNo' => $invoice->invoice_no, 'documentStatus' => ucfirst($invoice->status), 'documentStatusTone' => match($invoice->status) { 'paid' => 'paid', 'refunded' => 'void', 'overdue' => 'void', 'partial' => 'due', default => 'due', }, ]) @section('body') @php $paid = (float) $invoice->paid_amount; $refunded = (float) $invoice->refunded_amount; $total = (float) $invoice->amount; // What the customer still owes: refunds give money back, so they do not // reduce the debt the invoice records. $due = max(0, round($total - $paid, 2)); $symbol = currency_symbol(); @endphp
Billed to
{{ $invoice->customer_name ?: optional($invoice->customer)->name ?: 'Walk-in' }}
@if(optional($invoice->customer)->phone)
{{ $invoice->customer->phone }}
@endif @if(optional($invoice->customer)->email)
{{ $invoice->customer->email }}
@endif
Issued
{{ dateFormat($invoice->issue_date) }}
Due
{{ $invoice->due_date ? dateFormat($invoice->due_date) : '—' }}

What this covers

Description Amount
{{ $lineDescription }} {{ $symbol }}{{ number_format($total, 2) }}
@if($invoice->receipts->isNotEmpty())

Payments received

@foreach($invoice->receipts as $receipt) @endforeach
Receipt Date Method Amount
{{ $receipt->receipt_no }} {{ dateFormat($receipt->received_on) }} {{ $receipt->method }} {{ $symbol }}{{ number_format((float) $receipt->amount, 2) }}
@endif @if($invoice->refunds->isNotEmpty())

Refunded

@foreach($invoice->refunds as $refund) @endforeach
Reference Date Method Amount
{{ $refund->reference }} {{ dateFormat($refund->refunded_on) }} {{ $refund->method }} {{ $symbol }}{{ number_format((float) $refund->amount, 2) }}
@endif @if($refunded > 0) @endif
Invoice total {{ $symbol }}{{ number_format($total, 2) }}
Paid {{ $symbol }}{{ number_format($paid, 2) }}
Refunded {{ $symbol }}{{ number_format($refunded, 2) }}
Balance due {{ $symbol }}{{ number_format($due, 2) }}
@if($due > 0)
Please settle the balance by {{ $invoice->due_date ? dateFormat($invoice->due_date) : 'the due date' }}. Quote {{ $invoice->invoice_no }} with your payment.
@endif @endsection