@extends('documents.procurement._layout', [ 'documentTitle' => 'Payment Receipt', 'reference' => $payment->payment_reference, 'documentDate' => \Carbon\Carbon::parse($payment->payment_date)->format('d M Y'), ]) @section('header-meta')
Method: {{ ucwords(str_replace('_', ' ', $payment->payment_method)) }}
@if($payment->external_reference)
Bank Ref: {{ $payment->external_reference }}
@endif @endsection @section('content') @php $supplier = $payment->supplier; $inv = $payment->supplierInvoice; $src = $payment->payment_currency_code; $base = $inv?->currency_code ?? $src; $isForeign = $src !== $base; $prevPaidSrc = $inv ? max(0, (float) $inv->amount_paid_source - (float) $payment->amount) : 0; $prevPaidBase = $inv ? max(0, (float) $inv->amount_paid_base - (float) $payment->amount_base) : 0; $remainingSrc = $inv ? max(0, (float) $inv->total_amount_source - (float) $inv->amount_paid_source) : 0; $remainingBase = $inv ? max(0, (float) $inv->total_amount - (float) $inv->amount_paid_base) : 0; @endphp {{-- Received from block --}}
Payment To (Supplier):
{{ $supplier?->name ?? '—' }}
@if($supplier?->contact_name) {{ $supplier->contact_name }}
@endif @if($supplier?->contact_email) {{ $supplier->contact_email }}
@endif @if($supplier?->city) {{ $supplier->city }} @endif
Payment Details:
Date: {{ \Carbon\Carbon::parse($payment->payment_date)->format('d M Y') }}
Method: {{ ucwords(str_replace('_', ' ', $payment->payment_method)) }}
@if($payment->bankAccount) Bank: {{ $payment->bankAccount->bank_name }} — {{ $payment->bankAccount->account_name }}
@endif @if($payment->external_reference) Reference: {{ $payment->external_reference }}
@endif
{{-- Payment amount block --}} @if($isForeign) @endif @if($isForeign) @endif
Invoice Ref Invoice Total ({{ $src }}) This Payment ({{ $src }})Rate Base Amount ({{ $base }})
{{ $inv?->invoice_reference ?? '—' }} {{ number_format((float) ($inv?->total_amount_source ?? 0), 2) }} {{ number_format((float) $payment->amount, 2) }}{{ number_format((float) $payment->exchange_rate, 4) }} {{ number_format((float) $payment->amount_base, 2) }}
{{-- Invoice summary --}} @if($inv) @if($prevPaidSrc > 0) @endif
Invoice Total {{ $src }} {{ number_format((float) $inv->total_amount_source, 2) }}
Previously Paid ({{ $src }} {{ number_format($prevPaidSrc, 2) }})
This Payment {{ $src }} {{ number_format((float) $payment->amount, 2) }}
Remaining Balance {{ $src }} {{ number_format($remainingSrc, 2) }}
@endif {{-- Notes --}} @if($payment->notes)

Notes

{{ $payment->notes }}

@endif {{-- Authorisation --}}
Authorised By
 
Date
{{ \Carbon\Carbon::parse($payment->payment_date)->format('d M Y') }}
@endsection