@extends('pdf._base') @section('title', 'Invoice '.$invoice->number) @php $eff = $invoice->effectiveStatus(); $plan = $invoice->paymentPlan; $qty = fn ($q) => rtrim(rtrim(number_format((float) $q, 2), '0'), '.'); @endphp @section('body') @include('pdf._letterhead', ['title' => 'INVOICE', 'number' => $invoice->number, 'subtitle' => (float) $invoice->tax_amount > 0 ? 'Tax invoice' : 'Training fee invoice']) @if($eff === 'paid')
PAID
@elseif($eff === 'void')
VOID
@elseif($eff === 'overdue')
OVERDUE
@endif
@include('pdf._keyfigs', ['figs' => [ ['Invoice total', money2($invoice->total), 'blue'], [$invoice->balance() > 0 ? 'Balance due' : 'Balance', money2($invoice->balance()), $invoice->balance() > 0 ? ($eff === 'overdue' ? 'red' : 'gold') : 'green'], ['Due date', $invoice->due_date?->format('d M Y') ?? 'On receipt', $eff === 'overdue' ? 'red' : ''], ['Status', ucfirst(str_replace('_', ' ', $eff)), $eff === 'paid' ? 'green' : ($eff === 'overdue' || $eff === 'void' ? 'red' : '')], ]])
@include('pdf._from')
Billed to
{{ $invoice->customer_name }}
@if($invoice->company){{ $invoice->company }}
@endif{{ $invoice->customer_email }}@if($invoice->customer_phone)
{{ $invoice->customer_phone }}@endif @if($invoice->user?->student_code)
Student ID {{ $invoice->user->student_code }}@endif
@if($invoice->enrollment)@endif @if($invoice->quote)@endif
Invoice no.{{ $invoice->number }}
Issue date{{ $invoice->issue_date?->format('d M Y') }}
Due date{{ $invoice->due_date?->format('d M Y') ?? 'On receipt' }}
Enrollment{{ $invoice->enrollment->code }}
Quotation{{ $invoice->quote->number }}
Status{{ str_replace('_', ' ', $eff) }}
@foreach($invoice->items as $n => $it) @endforeach
#DescriptionQtyUnit priceAmount
{{ $n + 1 }}{{ $it->description }}{{ $qty($it->quantity) }}{{ money2($it->unit_price) }}{{ money2($it->amount) }}
How to pay
@if(\App\Payments\GatewayManager::available() && $invoice->balance() > 0)
Pay online instantly with {{ collect(\App\Payments\GatewayManager::available())->map->label()->implode(', ') }}: scan the QR code below or open your invoice link. Your receipt is emailed automatically.
@endif @foreach($methods as $m)
• {{ $m }}
@endforeach
Please quote {{ $invoice->number }} as the payment reference.
@if((float) $invoice->discount > 0)@endif @if((float) $invoice->tax_amount > 0)@endif @if((float) $invoice->waived_amount > 0)@endif @if((float) $invoice->amount_paid > 0)@endif
Subtotal{{ money2($invoice->subtotal) }}
Discount− {{ money2($invoice->discount) }}
Tax ({{ $qty($invoice->tax_percent) }}%){{ money2($invoice->tax_amount) }}
Waived (authorised)− {{ money2($invoice->waived_amount) }}
Total{{ money2($invoice->total) }}
Paid to date− {{ money2($invoice->amount_paid) }}
Balance due{{ money2($invoice->balance()) }}
{{ amount_in_words($invoice->total, $invoice->currency) }}
@if($plan && $plan->installments->count() > 1)
Installment schedule · {{ $plan->code }}
@foreach($plan->installments->where('status', '!=', 'cancelled')->values() as $n => $x) @endforeach
InstallmentDue dateAmountPaidStatus
{{ $x->label }}{{ $x->due_date->format('d M Y') }}{{ money2($x->amount) }}{{ money2($x->paid_amount) }}{{ $x->statusLabel() }}
@endif @if($invoice->notes)
Notes. {!! nl2br(e($invoice->notes)) !!}
@endif @include('pdf._verify', ['qr' => $qr, 'verifyUrl' => $verifyUrl, 'docId' => $invoice->number, 'docType' => 'invoice', 'hint' => 'Scan to verify this invoice, see live payment status or pay online.'])
@include('pdf._footer') @endsection