@php $org = auth()->user()->organization ?? \App\Models\System\Organization::find(auth()->user()->organization_id); @endphp @extends('documents.procurement._layout', [ 'documentTitle' => 'Three-Way Match Exceptions', 'reference' => null, 'documentDate' => $reportDate, 'noAutoPrint' => true, ]) @section('header-meta')
Period: {{ $from->format('d M Y') }}{{ $until->format('d M Y') }}
Advance and delivery invoices with quantity or price variances.
@endsection @section('content')
Invoices with Variances
{{ $exceptions->count() }}
@if($exceptions->isEmpty())

No match exceptions found for this period. ✓

@else @foreach($exceptions as $invoice)

{{ $invoice->invoice_reference }} — {{ $invoice->supplier?->name ?? '—' }} ({{ ucfirst($invoice->invoice_type) }} · {{ \Carbon\Carbon::parse($invoice->invoice_date)->format('d M Y') }})

{{ $invoice->matchResult->summary }} @if($invoice->lpo) · LPO: {{ $invoice->lpo->lpo_reference }} @endif @if($invoice->grn) · GRN: {{ $invoice->grn->grn_reference }} @endif

@foreach($invoice->matchResult->lines as $line) @php $rowClass = $line['has_variance'] ? 'bg-amber' : ''; @endphp @endforeach
Product Ref Qty Invoice Qty Qty Var Agreed Price Invoice Price Price Var
{{ $line['product_name'] }} {{ $line['ref_qty'] }} {{ $line['invoice_qty'] }} {{ $line['qty_variance'] != 0 ? ($line['qty_variance'] > 0 ? '+' : '') . $line['qty_variance'] : '✓' }} {{ $line['agreed_price'] !== null ? number_format($line['agreed_price'], 2) : '—' }} {{ number_format($line['invoice_price'], 2) }} @if($line['price_variance'] !== null) {{ $line['price_variance'] > 0.0001 ? '+' . number_format($line['price_variance'], 2) : ($line['price_variance'] < -0.0001 ? number_format($line['price_variance'], 2) : '✓') }} @else — @endif
@endforeach

All prices in source currency. Variances are informational — they do not block payment.

@endif @endsection