@php $c = $meta['company'] ?? []; $cust = $meta['customer'] ?? []; $t = $meta['totals'] ?? []; $o = $meta['order'] ?? []; $cur = $t['currency'] ?? 'USD'; $fmt = fn ($n) => ($n < 0 ? '-' : '').$cur.' '.number_format(abs((float) $n), 2); @endphp
|
@if(!empty($c['logo'])) {{ $c['name'] ?? config('app.name') }}
@if(!empty($c['address'])){!! nl2br(e($c['address'])) !!} @endif
@if(!empty($c['email'])){{ $c['email'] }} @endif
@if(!empty($c['phone'])){{ $c['phone'] }} @endif
@if(!empty($c['tax_id']))Tax ID: {{ $c['tax_id'] }} @endif
|
INVOICE{{ $invoice->number }}
Issued: {{ $invoice->issued_at?->format('M j, Y') }}
PAID
|
|
Billed to
{{ $cust['name'] ?? '' }}
@if(!empty($cust['email'])){{ $cust['email'] }} @endif
@if(!empty($cust['workspace']))Workspace: {{ $cust['workspace'] }} @endif
@if(!empty($cust['billing_details']) && is_array($cust['billing_details']))
@foreach($cust['billing_details'] as $k => $v)
@if(is_scalar($v) && $v !== ''){{ ucfirst(str_replace('_',' ',$k)) }}: {{ $v }} @endif
@endforeach
@endif
|
Details
Order #{{ $o['id'] ?? $invoice->order_id }}
@if(!empty($o['gateway']))Paid via {{ ucfirst($o['gateway']) }} @endif
@if(!empty($o['period_start']) && !empty($o['period_end']))
Period: {{ \Illuminate\Support\Carbon::parse($o['period_start'])->format('M j, Y') }} – {{ \Illuminate\Support\Carbon::parse($o['period_end'])->format('M j, Y') }}
@endif
|
| Description | Qty | Unit price | Amount |
|---|---|---|---|
| {{ $line['description'] }} | {{ $line['quantity'] ?? 1 }} | {{ $fmt($line['unit_price'] ?? 0) }} | {{ $fmt($line['amount'] ?? 0) }} |
| Subtotal | {{ $fmt($t['subtotal'] ?? 0) }} |
| Discount @if(!empty($t['coupon_code']))({{ $t['coupon_code'] }})@endif | -{{ $fmt($t['discount']) }} |
| {{ $t['tax_label'] ?? 'Tax' }} ({{ rtrim(rtrim(number_format((float) ($t['tax_rate'] ?? 0), 2), '0'), '.') }}%) | {{ $fmt($t['tax']) }} |
| Total | {{ $fmt($t['total'] ?? 0) }} |