@extends('documents.procurement._layout', [ 'documentTitle' => 'Local Purchase Order', 'reference' => $lpo->lpo_reference, 'documentDate' => \Carbon\Carbon::parse($lpo->purchase_date)->format('d M Y'), ]) @section('header-meta') @if($lpo->expected_delivery_date)
Expected Delivery: {{ \Carbon\Carbon::parse($lpo->expected_delivery_date)->format('d M Y') }}
@endif
{{ strtoupper(str_replace('_', ' ', $lpo->status)) }}
@endsection @section('content') @php $src = $lpo->source_currency_code; $base = $lpo->currency_code; $isForeign = $src !== $base; $supplier = $lpo->supplier; $location = $lpo->deliveryLocation; @endphp {{-- Supplier + Delivery block --}}
Supplier:
{{ $supplier?->name ?? '—' }}
@if($supplier?->contact_name) {{ $supplier->contact_name }}
@endif @if($supplier?->contact_email) {{ $supplier->contact_email }}
@endif @if($supplier?->contact_phone) {{ $supplier->contact_phone }}
@endif @if($supplier?->city) {{ $supplier->city }} @endif
Delivery Details:
@if($location) Location: {{ $location->name }}
@endif Currency: {{ $src }} @if($isForeign) (Base: {{ $base }}, Rate: {{ number_format((float) $lpo->exchange_rate, 4) }}) @endif
{{-- Items table --}} @foreach($lpo->items as $i => $item) @endforeach
# Product SKU UoM Qty Unit Price ({{ $src }}) Line Total ({{ $src }})
{{ $i + 1 }} {{ $item->product?->name ?? '—' }} {{ $item->product?->sku ?? '—' }} {{ $item->product?->uom ?? $item->quantity_uom ?? '—' }} {{ number_format((float) $item->quantity, 0) }} {{ number_format((float) $item->unit_cost_source, 2) }} {{ number_format((float) $item->total_cost_source, 2) }}
{{-- Totals --}} @if((float) $lpo->tax_amount_source > 0) @endif @if((float) $lpo->freight_amount_source > 0) @endif @if((float) $lpo->insurance_amount_source > 0) @endif @if((float) $lpo->other_charges_source > 0) @endif @if($isForeign) @endif
Subtotal {{ $src }} {{ number_format((float) $lpo->subtotal_source, 2) }}
Tax {{ $src }} {{ number_format((float) $lpo->tax_amount_source, 2) }}
Freight {{ $src }} {{ number_format((float) $lpo->freight_amount_source, 2) }}
Insurance {{ $src }} {{ number_format((float) $lpo->insurance_amount_source, 2) }}
Other Charges {{ $src }} {{ number_format((float) $lpo->other_charges_source, 2) }}
Grand Total {{ $src }} {{ number_format((float) $lpo->total_amount_source, 2) }}
Equivalent ({{ $base }}) {{ $base }} {{ number_format((float) $lpo->total_amount, 2) }}
{{-- Notes --}} @if($lpo->notes)

Notes / Terms

{{ $lpo->notes }}

@endif {{-- Signatures --}}
Prepared by
{{ $lpo->submittedBy?->name ?? '—' }}
Approved by
{{ $lpo->approvedBy?->name ?? '—' }}
Date
{{ $lpo->approved_at ? \Carbon\Carbon::parse($lpo->approved_at)->format('d M Y') : '—' }}
@endsection