@extends('layouts.app') @section('title', $order->po_number) @section('content')

{{ $order->po_number }}

{{ $order->supplier->name }} · {{ $order->store->name }}

{{ ucfirst($order->status) }}
@foreach ($order->items as $item) @endforeach
ProductOrderedReceivedExpiryUnit costLine total
{{ $item->product->name }} {{ number_format($item->quantity, 2) }} {{ number_format($item->received_quantity, 2) }} {{ $item->expiry_date?->format('d M Y') ?? '—' }} {{ number_format($item->unit_cost, 2) }} {{ number_format($item->line_total, 2) }}
Total{{ number_format($order->total_amount, 2) }}
@if ($order->status === 'pending' && auth()->user()->can('purchase_orders.approve'))
@csrf
@endif @if (in_array($order->status, ['approved']) && $order->items->sum('received_quantity') < $order->items->sum('quantity')) @can('purchase_orders.receive') @endcan @endif @if ($order->items->sum(fn ($i) => $i->returnableQuantity()) > 0) @can('supplier_returns.create') @endcan @endif
@if ($order->goodsReceivedNotes->isNotEmpty())

Goods received notes

@foreach ($order->goodsReceivedNotes as $grn)
{{ $grn->grn_number }} · {{ $grn->receivedBy->name ?? '—' }} {{ $grn->received_date->format('d M Y') }}
@endforeach
@endif
@csrf
@foreach ($order->items as $item) @php $outstanding = $item->quantity - $item->received_quantity; @endphp @if ($outstanding > 0)
{{ $item->product->name }} (outstanding: {{ number_format($outstanding, 2) }})
@endif @endforeach
@csrf
@foreach ($order->items as $item) @php $returnable = $item->returnableQuantity(); @endphp @if ($returnable > 0)
{{ $item->product->name }} (returnable: {{ number_format($returnable, 2) }} of {{ number_format($item->received_quantity, 2) }} received)
@endif @endforeach

Leave a line at 0 to skip it. Returned stock is deducted immediately and the supplier's balance is reduced by the returned value.

@endsection