@if($stockRequest->is_test_data)QA TEST DATA - NOT FOR OPERATIONAL USE
@endif
@php($receiptItems=$stockRequest->receipts->flatMap->items) @php($shipped=$stockRequest->items->sum(fn($i)=>(float)$i->shipped_qty)) @php($received=$receiptItems->sum(fn($i)=>(float)$i->received_qty)) @php($accepted=$receiptItems->sum(fn($i)=>(float)$i->accepted_qty))
Stock Receiving Report
{{ $stockRequest->request_number }} · {{ strtoupper(str_replace('_',' ',$stockRequest->status)) }}
@if($stockRequest->dispatch_note)Dispatch Notes: {!! nl2br(e($stockRequest->dispatch_note)) !!}
@endif
| SKU | Product | Shipped Qty | Received Qty | Accepted Qty | Difference | Discrepancy |
@foreach($stockRequest->items as $i) @php($lineReceipts=$receiptItems->where('stock_replenishment_item_id',$i->id)) @php($lineReceived=$lineReceipts->sum(fn($r)=>(float)$r->received_qty)) @php($lineAccepted=$lineReceipts->sum(fn($r)=>(float)$r->accepted_qty)) @php($types=$lineReceipts->pluck('discrepancy_type')->unique()->map(fn($v)=>str_replace('_',' ',ucwords($v,'_')))->implode(', ') ?: 'Pending') @php($diff=$lineAccepted-(float)$i->shipped_qty)| {{ $i->sku_snapshot }} | {{ $i->name_snapshot }} | {{ number_format($i->shipped_qty,2) }} | {{ number_format($lineReceived,2) }} | {{ number_format($lineAccepted,2) }} | {{ number_format($diff,2) }} | {{ $types }}@foreach($lineReceipts->whereNotNull('notes') as $ri) {{ $ri->notes }}@endforeach |
@endforeach
@php($short=max(0,$shipped-$received)) @php($excess=max(0,$received-$shipped)) @php($damaged=$receiptItems->where('discrepancy_type','damaged')->sum(fn($r)=>max(0,(float)$r->received_qty-(float)$r->accepted_qty)))
Summary: Shipped Pieces {{ number_format($shipped,2) }} · Received Pieces {{ number_format($received,2) }} · Accepted Pieces {{ number_format($accepted,2) }} · Short Pieces {{ number_format($short,2) }} · Excess Pieces {{ number_format($excess,2) }} · Damaged Pieces {{ number_format($damaged,2) }} · Wrong Item Lines {{ $receiptItems->where('discrepancy_type','wrong_item')->count() }} · Not Received Lines {{ $receiptItems->where('discrepancy_type','not_received')->count() }}
@if(in_array($stockRequest->status,['receiving','partially_received','in_transit'],true))OPEN DISCREPANCIES — this shipment is not fully reconciled.
@endif @if($stockRequest->receiving_note)Receiving Notes: {{ $stockRequest->receiving_note }}
@endif