From f2b4fdc33e0fe970828b925e5d69a628553fea94 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Fri, 20 Nov 2026 10:22:44 +0530 Subject: [PATCH] Added not ok logic in invoice validation --- .../Pages/CreateInvoiceValidation.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php index b61653b1..a18dfe89 100644 --- a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php +++ b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php @@ -12,6 +12,7 @@ use App\Models\Item; use App\Models\Plant; use App\Models\StickerMaster; use App\Models\WireMasterPacking; +use App\Models\PanelBoxValidation; use DB; use Filament\Facades\Filament; use Filament\Notifications\Notification; @@ -4093,6 +4094,30 @@ class CreateInvoiceValidation extends CreateRecord return; } + $notOkPanelBox = PanelBoxValidation::where('plant_id', $plantId)->where('panel_box_supplier', $supplierNo)->where('panel_box_serial_number', $supplierSNo)->first(); + + if($notOkPanelBox->status == 'NotOK'){ + Notification::make() + ->title('Not Ok Serial Number') + ->body("scanned panel box serial number '$serialNumber' failed testing (NOT OK). Please scan the serial number of an OK panel box..") + ->danger() + ->seconds(3) + ->send(); + + $this->dispatch('playWarnSound'); + + $this->form->fill([ + 'plant_id' => $plantId, + 'invoice_number' => $invoiceNumber, + 'serial_number' => null, + 'total_quantity' => $totQuan, + 'update_invoice' => false, + 'scanned_quantity' => $scanSQuan, + ]); + + return; + } + $invoiceUpdate = InvoiceValidation::where('plant_id', $plantId) ->where('invoice_number', $invoiceNumber) ->where('sticker_master_id', $record1->sticker_master_id)