From eb467cf11587489581ff655e6caec67851a53329 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 25 Nov 2026 17:39:32 +0530 Subject: [PATCH] chnaged logic in invoice validation --- .../Pages/CreateInvoiceValidation.php | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php index 0636d3d5..7023ca1b 100644 --- a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php +++ b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php @@ -4097,12 +4097,12 @@ class CreateInvoiceValidation extends CreateRecord return; } - $notOkPanelBox = PanelBoxValidation::where('plant_id', $plantId)->where('panel_box_supplier', $supplierNo)->where('panel_box_serial_number', $pBoxSNo)->first(); + $panelBoxExist = PanelBoxValidation::where('plant_id', $plantId)->where('panel_box_supplier', $supplierNo)->where('panel_box_serial_number', $pBoxSNo)->first(); - if($notOkPanelBox->status == 'NotOk'){ + if(!$panelBoxExist){ Notification::make() - ->title('Not Ok Serial Number') - ->body("scanned panel box serial number '$serNo' failed testing (NOT OK). Please scan the serial number of an OK panel box..") + ->title('Unknwon : Serial Number') + ->body("Scanned Panel Box Serial Number '$serNo' was not found in Panel Box Validation.
Please complete the testing process for this Panel Box before proceeding.") ->danger() ->seconds(3) ->send(); @@ -4121,6 +4121,30 @@ class CreateInvoiceValidation extends CreateRecord return; } + // $notOkPanelBox = PanelBoxValidation::where('plant_id', $plantId)->where('panel_box_supplier', $supplierNo)->where('panel_box_serial_number', $pBoxSNo)->first(); + + // if($notOkPanelBox->status == 'NotOk'){ + // Notification::make() + // ->title('Not Ok Serial Number') + // ->body("scanned panel box serial number '$serNo' 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)