{{ __('pdf.bill_to') }}
@if($invoice->client)
{{-- Buyer as it stood when the invoice was issued (issue #7). For VAT
the address and tax id on the document must be the ones that applied
on the invoice date, so these read the snapshot; invoices issued
before snapshots existed fall back to the live client record. --}}
{{ $invoice->buyer('first_name') }} {{ $invoice->buyer('last_name') }}
@if($invoice->buyer('company_name')){{ $invoice->buyer('company_name') }}
@endif
@if($invoice->buyer('address1')){{ $invoice->buyer('address1') }}
@endif
@if($invoice->buyer('address2')){{ $invoice->buyer('address2') }}
@endif
@if($invoice->buyer('city')){{ $invoice->buyer('city') }}, {{ $invoice->buyer('state') }} {{ $invoice->buyer('postcode') }}
@endif
@if($invoice->buyer('country')){{ $invoice->buyer('country') }}
@endif
@if($invoice->buyer('tax_id')){{ __('pdf.tax_id') ?? 'Tax ID' }}: {{ $invoice->buyer('tax_id') }}
@endif
{{-- Custom fields marked "show on invoice" (e.g. NIP), as frozen
at issue time; invoices before snapshots fall back to the
live client record. --}}
@foreach($invoice->buyerCustomFields() as $label => $value)
{{ $label }}: {{ $value }}
@endforeach
{{ $invoice->buyer('email') }}
@endif
{{ __('pdf.invoice_details') }}
| {{ __('common.table.description') }} |
{{ __('common.table.qty') }} |
{{ __('common.table.price') }} |
{{ __('common.table.tax') }} |
{{ __('common.table.total') }} |
@forelse($invoice->items as $item)
@php $rate = $item->tax_rate !== null ? (float)$item->tax_rate : ($item->taxed ? (float)$invoice->tax_rate : 0.0); @endphp
| {{ $item->description }} |
{{ (int) $item->qty }} |
{{ invoice_money_fmt((float)$item->amount, $invoice) }} |
{{ $rate > 0 ? rtrim(rtrim(number_format($rate, 2), '0'), '.') . '%' : '—' }} |
{{ invoice_money_fmt((float)$item->amount * (int)$item->qty, $invoice) }} |
@empty
| {{ __('pdf.no_items') }} |
@endforelse
@php
$vatGroups = [];
foreach ($invoice->items as $it) {
$r = $it->tax_rate !== null ? (float) $it->tax_rate : ($it->taxed ? (float) $invoice->tax_rate : 0.0);
$label = $it->tax_label ?: ($r > 0 ? rtrim(rtrim(number_format($r, 2), '0'), '.').'%' : null);
if ($label === null) { continue; }
$tx = (float) $it->amount * (int) $it->qty * $r / 100;
$net = (float) $it->amount * (int) $it->qty;
if (! isset($vatGroups[$label])) { $vatGroups[$label] = ['amount' => 0.0, 'rate' => $r, 'net' => 0.0]; }
$vatGroups[$label]['amount'] += $tx;
$vatGroups[$label]['net'] += $net;
}
uasort($vatGroups, fn ($a, $b) => $b['rate'] <=> $a['rate']);
@endphp
| {{ __('pdf.subtotal') }}: | | {{ invoice_money_fmt((float)$invoice->subtotal, $invoice) }} |
@foreach($vatGroups as $label => $g)
| {{ $label }}: | {{ invoice_money_fmt($g['amount'], $invoice) }} | {{ invoice_money_fmt($g['net'], $invoice) }} |
@endforeach
{{-- The second tax. An invoice has carried two since the tax screen
grew a level for each; this document showed only the first, so
the lines did not add up to the total being asked for. --}}
@if((float)($invoice->tax2 ?? 0) > 0)
| {{ __('pdf.tax') }} 2{{ $invoice->tax_rate2 ? ' ('.rtrim(rtrim(number_format((float)$invoice->tax_rate2, 2), '0'), '.').'%)' : '' }}: | {{ invoice_money_fmt((float)$invoice->tax2, $invoice) }} | |
@endif
@if((float)$invoice->credit > 0)
| {{ __('pdf.credit') }}: | -{{ invoice_money_fmt((float)$invoice->credit, $invoice) }} | |
@endif
| {{ __('pdf.total') }}: | | {{ invoice_money_fmt((float)$invoice->total, $invoice) }} |
@if(billing_rate_note($invoice))
{{-- What the customer actually pays, in the currency they pay in,
under the rate the document was struck at. --}}
| {{ __('pdf.amount_in') }} ({{ strtoupper($invoice->billing_currency) }}): | | {{ billing_money_fmt((float)$invoice->total, $invoice) }} |
@endif
@if(billing_rate_note($invoice))
{{ billing_rate_note($invoice) }}
@endif
@if($invoice->notes)
{{ __('pdf.notes') }}:
{{ $invoice->notes }}
@endif
@if(!empty($ksef) && $ksef['qr'] !== '')
{{ __('pdf.ksef_number') }}
{{ $ksef['number'] }}
@endif