@php $org = auth()->user()->organization ?? \App\Models\System\Organization::find(auth()->user()->organization_id); @endphp @extends('documents.procurement._layout', [ 'documentTitle' => 'Outstanding Purchase Orders', 'reference' => null, 'documentDate' => $reportDate, 'noAutoPrint' => true, ]) @section('header-meta')
Statuses: Ordered, Partially Received
@endsection @section('content') @php $overdueCount = $lpos->filter(fn($l) => $l->expected_delivery_date && $l->expected_delivery_date->lt($today))->count(); @endphp {{-- Summary --}} @if($overdueCount > 0) @endif
Total Outstanding
{{ $lpos->count() }}
Partially Received
{{ $lpos->where('status','partially_received')->count() }}
⚠ Overdue
{{ $overdueCount }}
@if($lpos->isEmpty())

No outstanding purchase orders.

@else @foreach($lpos as $lpo) @php $isOverdue = $lpo->expected_delivery_date && $lpo->expected_delivery_date->lt($today); $rowClass = $isOverdue ? 'bg-red' : ($lpo->status === 'partially_received' ? 'bg-amber' : ''); @endphp @endforeach
LPO Reference Supplier Delivery Location Status Items Order Date Expected Delivery Total
{{ $lpo->lpo_reference }} {{ $lpo->supplier?->name ?? '—' }} {{ $lpo->deliveryLocation?->name ?? '—' }} {{ ucwords(str_replace('_', ' ', $lpo->status)) }} {{ $lpo->items_count }} {{ \Carbon\Carbon::parse($lpo->purchase_date)->format('d M Y') }} {{ $lpo->expected_delivery_date ? $lpo->expected_delivery_date->format('d M Y') : '—' }} @if($isOverdue) ⚠ @endif {{ $lpo->source_currency_code }} {{ number_format((float)$lpo->total_amount_source, 2) }}
@endif @endsection