@extends('layouts.master') @section('title', $title) @section('content') @if (!$po)
Purchase order not found.
@else @php $editable = in_array($po->status, ['Draft', 'Pending']) && $po->payment_status === 'Pending' && auth()->user()->can($access . '-update'); $statusColors = [ 'Draft' => 'secondary', 'Pending' => 'warning', 'Partially received' => 'info', 'Received' => 'success', ]; $statusColor = $statusColors[$po->status] ?? 'secondary'; @endphp

{{ $po->name }} {{ $po->status }}

{{ \Carbon\Carbon::parse($po->date)->format('Y-m-d') }} · @if ($po->suppl) {{ $po->suppl->name }} @else Deleted supplier #{{ $po->supplier }} @endif · Receiving Store: {{ $po->store?->name ?? '-' }} @if (!$po->suppl && auth()->user()->can($access . '-update'))
@endif
Back
Items
@if ($editable) @can($access . '-receive') Receive into Stock @endcan @endif
@if ($editable) @endif @foreach ($po->details as $detail) @if ($editable) @endif @endforeach @if ($editable) @endif
Product UOM Quantity Unit Cost Total
@if ($editable)
@else {{ $detail->products?->name }} @endif
{{-- Always the product's own registered purchase measurement, not whatever was saved on this line — so it can never drift out of sync if the product's UOM was changed after this PO was made. --}} @if ($editable) @else {{ $detail->quantity }} @endif @if ($editable) @else {{ number_format($detail->unit_price, 2) }} @endif {{ number_format($detail->quantity * $detail->unit_price, 2) }}
Total Amount {{ number_format($po->details->sum(fn($d) => $d->quantity * $d->unit_price), 2) }}
@if ($editable)
@endif
@if ($received_batches->isNotEmpty() || in_array($po->status, ['Received', 'Partially received']))
Received into Stock
@if ($received_batches->isEmpty())
This order is marked {{ $po->status }}, but no inventory batch from its receipts exists any more.
@else
@foreach ($received_batches as $b) @endforeach
Receipt Received Product Batch Store Received qty Current balance Unit cost Expiration
{{ $b->receipt }} {{ \Carbon\Carbon::parse($b->received_date)->format('d M, Y') }} {{ $b->product }} @can('pharmacy-inventory-view') Batch {{ $b->batch }} @else Batch {{ $b->batch }} @endcan {{ $b->store ?? '-' }} {{ number_format($b->received_quantity, 2) }} {{ $b->uom }} {{ number_format($b->balance, 2) }} {{ $b->uom }} {{ number_format($b->cost, 2) }} {{ $b->expiration_date ? \Carbon\Carbon::parse($b->expiration_date)->format('d M, Y') : '-' }}
@endif
@endif
Supplier Invoice
@if ($po->invoice_file)

{{ $po->invoice_file }}

@endif
@endif @endsection @section('page_js') @endsection