@extends('documents.procurement._layout', [ 'documentTitle' => 'Proforma Invoice', 'reference' => $proformaInvoice->pi_reference, 'documentDate' => \Carbon\Carbon::parse($proformaInvoice->pi_date)->format('d M Y'), ]) @section('header-meta') @if($proformaInvoice->supplier_pi_number)
Supplier Ref: {{ $proformaInvoice->supplier_pi_number }}
@endif
Valid Until: {{ \Carbon\Carbon::parse($proformaInvoice->validity_date)->format('d M Y') }}
{{ strtoupper($proformaInvoice->status) }}
@endsection @section('content') @php $currency = $proformaInvoice->currency; $supplier = $proformaInvoice->supplier; $balanceDue = $proformaInvoice->total_amount - $proformaInvoice->amount_paid; @endphp {{-- Supplier block --}}
Bill To / Supplier:
{{ $supplier?->name ?? '—' }}
@if($supplier?->contact_email) {{ $supplier->contact_email }}
@endif @if($supplier?->contact_phone) {{ $supplier->contact_phone }}
@endif @if($supplier?->city) {{ $supplier->city }} @endif
Payment Details:
Currency: {{ $currency?->code ?? '—' }} ({{ $currency?->name ?? '' }})
@if($proformaInvoice->exchange_rate) Exchange Rate: {{ number_format($proformaInvoice->exchange_rate, 4) }} to base
@endif @if($proformaInvoice->sourcingTrip) Trip Ref: {{ $proformaInvoice->sourcingTrip->trip_reference }} @endif
{{-- Line items --}} @foreach($proformaInvoice->items as $i => $item) @endforeach
# Product SKU Qty UoM Unit Price ({{ $currency?->code ?? '' }}) Line Total ({{ $currency?->code ?? '' }}) Availability
{{ $i + 1 }} {{ $item->product?->name ?? '—' }} {{ $item->product?->sku ?? '—' }} {{ number_format($item->quantity, 0) }} {{ $item->quantity_uom ?? '—' }} {{ number_format($item->unit_price, 2) }} {{ number_format($item->total_price, 2) }} {{ ucwords(str_replace('_', ' ', $item->availability_status ?? '')) }}
{{-- Totals --}} @if($proformaInvoice->amount_paid > 0) @endif
Subtotal {{ number_format($proformaInvoice->subtotal, 2) }} {{ $currency?->code ?? '' }}
Total Amount {{ number_format($proformaInvoice->total_amount, 2) }} {{ $currency?->code ?? '' }}
Amount Paid ({{ number_format($proformaInvoice->amount_paid, 2) }}) {{ $currency?->code ?? '' }}
Balance Due {{ number_format($balanceDue, 2) }} {{ $currency?->code ?? '' }}
{{-- Payments received --}} @if($proformaInvoice->payments && $proformaInvoice->payments->count())

Payments Received

@foreach($proformaInvoice->payments as $payment) @endforeach
Date Reference Method Amount
{{ $payment->payment_date ? \Carbon\Carbon::parse($payment->payment_date)->format('d M Y') : '—' }} {{ $payment->payment_reference ?? '—' }} {{ $payment->payment_method ?? '—' }} {{ number_format($payment->amount, 2) }} {{ $payment->payment_currency_code ?? '' }}
@endif {{-- Notes / payment terms --}} @if($proformaInvoice->notes)

Notes / Payment Terms

{{ $proformaInvoice->notes }}

@endif @endsection