@extends('layouts.app') @section('title', "Correct POS Sale #{$sale->sale_id}") @php $fmt = fn ($n) => rtrim(rtrim(number_format((float) $n, 2), '0'), '.'); // Rows to show: the sale's own lines (or what was typed, after a validation error). $oldQty = old('qty'); $rows = $sale->items->map(fn ($i) => ['item_id' => $i->item_id, 'name' => $i->item_name, 'price' => (float) $i->unit_price, 'qty' => $oldQty[$i->item_id] ?? (float) $i->quantity, 'original' => true]); if (is_array($oldQty)) { foreach ($oldQty as $id => $q) { if (!$rows->contains('item_id', (int) $id) && ($item = $catalog->firstWhere('item_id', (int) $id))) { $rows->push(['item_id' => $item->item_id, 'name' => $item->item_name, 'price' => (float) $item->price, 'qty' => $q, 'original' => false]); } } } @endphp @section('content') @if ($blocker)
{{ $blocker }}
@else
@csrf

Items

Change quantities, set a quantity to 0 to remove an item, or add one that was missed. Items already on the sale keep the price they were sold at; added items take today's price.

@foreach ($rows as $r) @endforeach
ItemPriceQuantityLine total
{{ $r['name'] }}@unless ($r['original'])Added@endunless ₦{{ number_format($r['price'], 2) }} ₦0.00

Payment

Subtotal₦0.00
@if ($walkIn)
@endif
New total₦0.00
Was ₦{{ number_format((float) $sale->total_amount, 2) }} · VAT inclusive
@if ($walkIn)
@else
Still on the guest's folio: the folio charge is updated to the new total and billed at check-out as usual.
@endif

Correction

Date the correction
The sale's date keeps that day's takings right; choose today if that day has already been reported.

The stock the sale used goes back on the shelf and its postings are reversed; the corrected sale is then recorded under the same receipt number. Both stay in the journal.

@endif @endsection @if (!$blocker) @push('scripts') @endpush @endif