From 3845063af8422f9317c36f9429516805a3263b02 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Tue, 10 Feb 2026 12:24:38 +0530 Subject: [PATCH 1/2] Added invoice number upper-case conversion logic on import and scanning --- .../Resources/InvoiceValidationResource.php | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/app/Filament/Resources/InvoiceValidationResource.php b/app/Filament/Resources/InvoiceValidationResource.php index 0670fd3..53fc5cf 100644 --- a/app/Filament/Resources/InvoiceValidationResource.php +++ b/app/Filament/Resources/InvoiceValidationResource.php @@ -136,10 +136,15 @@ class InvoiceValidationResource extends Resource // $invNo = $get('invoice_number'); $set('serial_number', null); $set('update_invoice', null); - // Session::put('invoice_number', $state); - session(['invoice_number' => $state]); + if (strlen($state) <= 15) { + $set('invoice_number', strtoupper($state)); + session(['invoice_number' => strtoupper($state)]); + } else { + // Session::put('invoice_number', $state); + session(['invoice_number' => $state]); - // if (!$invNo) { return; } else { } + // if (!$invNo) { return; } else { } + } }), Forms\Components\TextInput::make('serial_number') @@ -194,18 +199,18 @@ class InvoiceValidationResource extends Resource return; } - + $invoiceNumber = $get('invoice_number'); if ($get('update_invoice') == '1') { - $totQuan = InvoiceValidation::where('invoice_number', $get('invoice_number'))->where('plant_id', $get('plant_id'))->count(); + $totQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $get('plant_id'))->count(); if ($totQuan <= 0) { $set('update_invoice', null); return; } - $totMQuan = InvoiceValidation::where('invoice_number', $get('invoice_number'))->whereNotNull('quantity')->where('plant_id', $get('plant_id'))->count(); - $scanMQuan = InvoiceValidation::where('invoice_number', $get('invoice_number'))->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $get('plant_id'))->count(); - $scanSQuan = InvoiceValidation::where('invoice_number', $get('invoice_number'))->where('scanned_status', 'Scanned')->where('plant_id', $get('plant_id'))->count(); + $totMQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->whereNotNull('quantity')->where('plant_id', $get('plant_id'))->count(); + $scanMQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $get('plant_id'))->count(); + $scanSQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $get('plant_id'))->count(); if ($totMQuan > 0) { if ($totQuan == $scanMQuan) { @@ -429,7 +434,7 @@ class InvoiceValidationResource extends Resource throw new \Exception('Only .xlsx files allowed.'); } - $originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME); + $originalNameOnly = strtoupper(pathinfo($originalName, PATHINFO_FILENAME)); $originalName = "{$originalNameOnly}.xlsx"; @@ -769,7 +774,7 @@ class InvoiceValidationResource extends Resource throw new \Exception('Only .xlsx files allowed.'); } - $originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME); + $originalNameOnly = strtoupper(pathinfo($originalName, PATHINFO_FILENAME)); $originalName = "{$originalNameOnly}.xlsx"; -- 2.49.1 From ddf256c209fae8899ebe7fda4d948758447e78f0 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Tue, 10 Feb 2026 12:26:17 +0530 Subject: [PATCH 2/2] Removed strict comparison for excel extension on import --- app/Filament/Resources/InvoiceValidationResource.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Filament/Resources/InvoiceValidationResource.php b/app/Filament/Resources/InvoiceValidationResource.php index 53fc5cf..eca071d 100644 --- a/app/Filament/Resources/InvoiceValidationResource.php +++ b/app/Filament/Resources/InvoiceValidationResource.php @@ -430,7 +430,7 @@ class InvoiceValidationResource extends Resource $originalName = $uploadedFile->getClientOriginalName(); // e.g. 3RA0018732.xlsx $extension = strtolower(pathinfo($originalName, PATHINFO_EXTENSION)); - if ($extension !== 'xlsx') { + if ($extension != 'xlsx') { throw new \Exception('Only .xlsx files allowed.'); } @@ -770,7 +770,7 @@ class InvoiceValidationResource extends Resource $originalName = $uploadedFile->getClientOriginalName(); $extension = strtolower(pathinfo($originalName, PATHINFO_EXTENSION)); - if ($extension !== 'xlsx') { + if ($extension != 'xlsx') { throw new \Exception('Only .xlsx files allowed.'); } -- 2.49.1