@extends('layouts.app') @section('title', 'Pharmacy | Edit ' . $receipt->receipt_number) @section('content')

Edit Draft

{{ $receipt->receipt_number }} Draft

Changes will not affect stock until you complete the GRN

@if($errors->any())
Please fix the following:

Your entries have been preserved. Scroll down to see highlighted fields.

@endif
@csrf @method('PUT') {{-- Order Information --}}

Order Information

{{-- Products --}}

Products

@php // If old() has items (validation error), use those. Otherwise use saved items. $sourceItems = old('items'); if (!$sourceItems) { $sourceItems = $receipt->items->map(function($item) { return [ 'drug_item_id' => $item->drug_item_id, 'batch_number' => $item->batch_number, 'quantity' => $item->quantity, 'unit_cost' => $item->unit_cost, 'selling_price' => $item->selling_price, 'expiry_date' => optional($item->expiry_date)->format('Y-m-d'), 'drug_display' => ($item->drugItem->name ?? '') . ($item->drugItem->generic_name ? ' – ' . $item->drugItem->generic_name : ''), ]; })->toArray(); } @endphp @foreach($sourceItems as $idx => $it) @php $drugId = $it['drug_item_id'] ?? ''; $drugDisplay = $it['drug_display'] ?? ''; if (!$drugDisplay && $drugId && isset($drugLookup[$drugId])) { $info = $drugLookup[$drugId]; $drugDisplay = $info['name'] . ($info['generic_name'] ? ' – ' . $info['generic_name'] : ''); } @endphp @endforeach
Drug Name Qty Received Unit Buying (KES) Selling Price (KES) Line Total (KES) Expiry Date
KES 0
Grand Total: KES {{ number_format($receipt->grand_total, 2) }}
{{-- Payment --}}

Payment Details

KES {{ number_format($receipt->grand_total, 2) }}
{{-- Actions --}}
Cancel
@endsection