{{-- An invoice or receipt as a PDF (plan TB, TB4; App\Modules\Subscription\Invoice\InvoicePdf): the same paper the page shows, drawn for A4. A credit note (TB8) is the same paper with its lines going back, the invoice it adjusts, and what went back. --}} @php($seller = $p['parties']['seller'] ?? []) @php($buyer = $p['parties']['buyer'] ?? []) @php($credit = $p['kind'] === 'credit') @php($c = $p['credit']) @php($back = fn (int $pesewas) => ($credit ? '− ' : '').$money($pesewas))
{{ $seller['name'] ?? '' }}

{{ __($credit ? 'billing.invoice.paper_credit' : ($p['cleared'] ? 'billing.invoice.paper_invoice' : 'billing.invoice.paper_receipt')) }}

@if (! $credit && ! empty($p['refunds']['notes'])){{ __(($p['refunds']['returned'] ?? 0) >= $p['paid'] ? 'billing.invoice.stamp_refunded' : 'billing.invoice.stamp_part') }} · {{ collect($p['refunds']['notes'])->pluck('number')->implode(' · ') }}@endif
{{ $p['number'] }}
{{ $date($p['issued_on']) }}@if ($credit)
{{ __('billing.invoice.against', ['number' => $c['credits'], 'date' => $date($c['credits_on'])]) }}@elseif ($p['last4'] && $p['method'] === 'card')
{{ __('billing.invoice.card_meta', ['last4' => $p['last4']]) }}@endif
{{ __('billing.invoice.from') }}{{ $seller['name'] ?? '' }}{{ $seller['address'] ?? '' }} @if (! empty($seller['tin']))
{{ __('billing.invoice.tin', ['tin' => $seller['tin']]) }}@endif @if (! empty($seller['vat_number']))
{{ __('billing.invoice.vat', ['number' => $seller['vat_number']]) }}@endif @if (! empty($seller['registration']))
{{ $seller['registration'] }}@endif
{{ __('billing.invoice.to') }}{{ $buyer['name'] ?? '' }} @foreach (['address', 'district', 'region', 'digital_address'] as $k)@if (! empty($buyer[$k])){{ $buyer[$k] }}
@endif @endforeach @if (! empty($buyer['registration'])){{ __('billing.invoice.registration', ['number' => $buyer['registration']]) }}@endif
@if ($p['lines']['credit'] > 0) @endif @foreach ($p['lines']['taxes'] as $t) @endforeach @if ($p['withholding']) @endif @if ($credit) @if ($c['withheld'] > 0) @endif @else @endif
{{ __($credit ? 'billing.invoice.credited_col' : 'billing.invoice.what_col') }}{{ __('billing.invoice.amount_col') }}
{{ $p['what'] }}{{ $back($p['lines']['price']) }}
{{ __('billing.invoice.credit_line', ['offering' => (string) $p['lines']['replaces_offering']]) }}− {{ $money($p['lines']['credit']) }}
{{ __('billing.invoice.tax_line', ['name' => $t['name'], 'rate' => $rate((float) $t['rate'])]) }}{{ $back((int) $t['amount']) }}
{{ __($credit ? 'billing.invoice.total_credited' : 'billing.invoice.total_taxed') }}{{ $back($p['lines']['total']) }}
{{ __(($p['withholding']['state'] ?? null) === 'owed' ? 'billing.invoice.withheld_owed' : (! empty($p['withholding']['settled_by_payment']) ? 'billing.invoice.withheld_paid' : ($p['withholding']['received_at'] ? 'billing.invoice.withheld_sent' : 'billing.invoice.withheld_line')), ['name' => $p['withholding']['name'], 'organisation' => $buyer['name'] ?? '', 'rate' => $rate($p['withholding']['rate'])]) }}− {{ $money($p['withholding']['amount']) }}
{{ __('billing.invoice.credit_withheld', ['name' => (string) $c['withholding_name'], 'organisation' => $buyer['name'] ?? '']) }}{{ $money($c['withheld']) }}
{{ $c['how'] === 'hand' ? __('billing.invoice.returned_hand', ['channel' => (string) $c['channel'], 'date' => $date($c['returned_on'])]) : ($c['how'] === 'card' && $c['last4'] ? __('billing.invoice.returned_card', ['last4' => $c['last4'], 'date' => $date($c['returned_on'])]) : __('billing.invoice.returned_momo', ['network' => (string) $c['network'], 'date' => $date($c['returned_on'])])) }}{{ $money($c['returned']) }}
{{ $p['method'] === 'card' && $p['last4'] ? __('billing.invoice.paid_card', ['last4' => $p['last4']]) : ($p['network'] ? __('billing.invoice.paid_momo', ['network' => $p['network']]) : __('billing.invoice.paid_plain')) }}{{ $money($p['paid']) }}
@if ($p['evat'])
@if ($qr)@endif {{ __('billing.invoice.cleared_by') }}{{ $p['evat']['number'] }} · {{ $when($p['evat']['cleared_at']) }}
{{ __('billing.invoice.sdc', ['sdc' => $p['evat']['sdc'], 'signature' => $p['evat']['signature']]) }}
@else
{{ __('billing.invoice.waiting_title') }}{{ __($credit ? 'billing.invoice.waiting_credit' : 'billing.invoice.waiting_line') }}
@endif

{{ $seller['name'] ?? '' }} · {{ $seller['registration'] ?? '' }}