@extends('documents.inventory._layout', [ 'documentTitle' => 'Receipt Confirmation', 'reference' => $order->transfer_reference, 'documentDate' => $order->received_date ? \Carbon\Carbon::parse($order->received_date)->format('d M Y') : now()->format('d M Y'), ]) @section('header-meta')
✓ Received
@endsection @section('content') @php // Quantities may be fractional (kg, litres): show what is there, no trailing zeros. $qty = fn ($value) => rtrim(rtrim(number_format((float) $value, 4), '0'), '.'); @endphp @include('documents.inventory.transfer-orders._approvals', ['order' => $order]) {{-- Header details --}} @if($order->receiver_comment) @endif
From Location {{ $order->fromLocation?->name ?? '—' }}
Received At {{ $order->toLocation?->name ?? '—' }}
Type {{ $order->isPush() ? 'Stock send — raised by the sending branch' : 'Stock request — raised by the receiving branch' }}
Received By {{ $order->receivedBy?->name ?? '—' }}
Receipt Date {{ $order->received_date ? \Carbon\Carbon::parse($order->received_date)->format('d M Y') : '—' }}
Receiver Notes {{ $order->receiver_comment }}
{{-- Summary strip --}} @php $totalDispatched = $order->items->sum('dispatched_quantity'); $totalReceived = $order->items->sum('received_quantity'); $totalVariance = $totalReceived - $totalDispatched; $hasAnyVariance = $order->items->filter(fn($i) => ($i->received_quantity ?? 0) < ($i->dispatched_quantity ?? 0))->isNotEmpty(); @endphp
Total Dispatched: {{ $qty($totalDispatched) }} Total Received: {{ $qty($totalReceived) }} Net Variance: {{ $totalVariance >= 0 ? '+' : '' }}{{ $qty($totalVariance) }}
{{-- Items table --}}

Items Received

@foreach($order->items as $i => $item) @php $dispatched = $item->dispatched_quantity ?? 0; $received = $item->received_quantity ?? 0; $variance = $received - $dispatched; $rowClass = $variance < 0 ? 'bg-amber' : ($variance > 0 ? 'bg-green' : ''); @endphp @endforeach
# Product Lot Dispatched Received Variance Variance Reason
{{ $i + 1 }} {{ $item->product?->name ?? '—' }} @if($item->product?->sku)
{{ $item->product->sku }}@endif
@include('documents.inventory.transfer-orders._lots', ['item' => $item, 'field' => 'quantity_received', 'qty' => $qty, 'fallback' => '—']) {{ $qty($dispatched) }} {{ $qty($received) }} {{ $variance >= 0 ? '+' : '' }}{{ $qty($variance) }} {{ $item->reception_variance_reason ?? (abs($variance) < 0.00001 ? '—' : 'Not specified') }}
Totals {{ $qty($totalDispatched) }} {{ $qty($totalReceived) }} {{ $totalVariance >= 0 ? '+' : '' }}{{ $qty($totalVariance) }}
{{-- Signature block --}}
Received by
Name: {{ $order->receivedBy?->name ?? '___________________________' }}
Date: ___________________________
Signature: ______________________
Confirmed by (Inventory Manager)
Name: ___________________________
Date: ___________________________
Signature: ______________________
@endsection