diff --git a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
index d60b3f487..541e273f5 100644
--- a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
+++ b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
@@ -87,6 +87,7 @@ class CreateInvoiceValidation extends CreateRecord
Notification::make()
->title("New invoice detected.")
->info()
+ ->seconds(1)
->send();
$this->form->fill([
@@ -121,6 +122,7 @@ class CreateInvoiceValidation extends CreateRecord
->title("Completed: Material Invoice")
->body("Material invoice '$invoiceNumber' completed the scanning process.
Scan the next 'Material Invoice' to proceed!")
->warning()
+ ->seconds(2)
->send();
$filename = $invoiceNumber . '.xlsx';
@@ -147,7 +149,7 @@ class CreateInvoiceValidation extends CreateRecord
if($updateStatus === '1')
{
- //dd('Material invoice update in progress...');
+ //'Material invoice update in progress...';
$filename = $invoiceNumber . '.xlsx';
$directory = 'uploads/temp';
$disk = Storage::disk('local');
@@ -165,6 +167,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Records Not Found')
->body("Import the valid updated 'Material Invoice' file to proceed..!")
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -227,6 +230,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid Material Invoice')
->danger() // This makes the notification red to indicate an error
->body('Uploaded Excel sheet is empty or
contains no valid data.')
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
$disk->delete($filePath);
@@ -241,6 +245,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body('The following item codes should contain minimum 6 digit alpha numeric values:
' . implode(', ', $uniqueInvalidCodes))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -256,6 +261,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Missing Material Quantity')
->body("The following item codes doesn't have valid material quantity:
" . implode(', ', $uniqueMissingQuanCodes))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -271,6 +277,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid Material Quantity')
->body("The following item codes doesn't have valid material quantity:
" . implode(', ', $uniqueInvalidMatQuan))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -302,6 +309,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -331,6 +339,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -355,6 +364,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -419,6 +429,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid Bundle Quantity')
->body("$message
$codeList")
->danger()
+ ->seconds(2)
->send();
};
@@ -663,12 +674,14 @@ class CreateInvoiceValidation extends CreateRecord
Notification::make()
->title("Material invoice successfully updatad.")
->success()
+ ->seconds(1)
->send();
Notification::make()
->title("Start the scanning process!")
->body("'$inserted' new material invoice records were inserted.")
->info()
// ->success()
+ ->seconds(1)
->send();
// Update total quantity in the form
@@ -705,6 +718,7 @@ class CreateInvoiceValidation extends CreateRecord
->title("Update Failed: Material Invoice")
->body("No new records were inserted for Material Invoice : '$invoiceNumber'.")
->danger()
+ ->seconds(2)
->send();
$totalQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
@@ -732,6 +746,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Updated Invoice Not Found')
->body("Import the updated 'Material Invoice' file to proceed..!")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -766,6 +781,7 @@ class CreateInvoiceValidation extends CreateRecord
->title("Completed: Serial Invoice")
->body("Serial invoice '$invoiceNumber' completed the scanning process.
Scan the next 'Serial Invoice' to proceed.!")
->warning()
+ ->seconds(2)
->send();
$filename = $invoiceNumber . '.xlsx';
@@ -784,6 +800,7 @@ class CreateInvoiceValidation extends CreateRecord
Notification::make()
->title("Start the scanning process!")
->info()
+ ->seconds(1)
->send();
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
@@ -799,7 +816,7 @@ class CreateInvoiceValidation extends CreateRecord
if ($fullPath && file_exists($fullPath))
{
// /home/iot-dev/projects/pds/storage/app/private/uploads/temp/3RA0018735.xlsx
- // dd('Serial invoice update in progress...');
+ // 'Serial invoice update in progress...'
// Now you can read/process the file here
$rows = Excel::toArray(null, $fullPath)[0];
@@ -810,6 +827,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Records Not Found')
->body("Import the valid updated 'Serial Invoice' file to proceed..!")
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -880,6 +898,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid Serial Invoice')
->danger() // This makes the notification red to indicate an error
->body('Uploaded excel sheet is empty or
contains no valid data.')
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -895,6 +914,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body('The following item codes should contain minimum 6 digit alpha numeric values:
' . implode(', ', $uniqueInvalidCodes))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -926,6 +946,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -955,6 +976,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -978,6 +1000,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1001,6 +1024,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1016,6 +1040,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Missing Serial Numbers')
->body("The following item codes doesn't have valid serial number:
" . implode(', ', $uniqueMissingSerials))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1031,6 +1056,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid Serial Numbers')
->body('The following serial numbers should contain minimum 9 digit alpha numeric values:
' . implode(', ', $uniqueInvalidSerCodes))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1046,6 +1072,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Duplicate Serial Numbers')
->body('The following serial numbers are already exist in invoice excel:
' . implode(', ', $uniqueDupSerCodes))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1116,6 +1143,7 @@ class CreateInvoiceValidation extends CreateRecord
Notification::make()
->title("Serial invoice successfully updated.")
->success()
+ ->seconds(1)
->send();
Notification::make()
@@ -1123,6 +1151,7 @@ class CreateInvoiceValidation extends CreateRecord
->body("'$inserted' new serial invoice records were inserted.")
->info()
// ->success()
+ ->seconds(1)
->send();
// Update total quantity in the form
@@ -1160,6 +1189,7 @@ class CreateInvoiceValidation extends CreateRecord
->title("Update Failed: Serial Invoice")
->body("No new records were inserted for Serial Invoice : '$invoiceNumber'.")
->danger()
+ ->seconds(2)
->send();
$totalQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
@@ -1186,6 +1216,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Updated Invoice Not Found')
->body("Import the updated 'Serial Invoice' file to proceed..!")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -1217,12 +1248,14 @@ class CreateInvoiceValidation extends CreateRecord
// Notification::make()
// ->title('File exists.')
// ->success()
+ // ->seconds(2)
// ->send();
} else {
Notification::make()
->title('Invoice Not Found')
->body("Import the scanned 'Invoice' file to proceed..!")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -1241,6 +1274,7 @@ class CreateInvoiceValidation extends CreateRecord
Notification::make()
->title('Invoice file doesn\'t exist.')
->danger()
+ ->seconds(2)
->send();
return;
}
@@ -1253,6 +1287,7 @@ class CreateInvoiceValidation extends CreateRecord
Notification::make()
->title("Uploaded file name does not match the invoice number.")
->danger()
+ ->seconds(2)
->send();
return;
}
@@ -1280,6 +1315,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Records Not Found')
->body("Import the valid 'Invoice' file to proceed..!")
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1384,6 +1420,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid Material Invoice')
->danger() // This makes the notification red to indicate an error
->body('Uploaded Excel sheet is empty or
contains no valid data.')
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
$disk->delete($filePath);
@@ -1398,6 +1435,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body('The following item codes should contain minimum 6 digit alpha numeric values:
' . implode(', ', $uniqueInvalidCodes))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1413,6 +1451,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Missing Material Quantity')
->body("The following item codes doesn't have valid material quantity:
" . implode(', ', $uniqueMissingQuanCodes))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1428,6 +1467,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid Material Quantity')
->body("The following item codes doesn't have valid material quantity:
" . implode(', ', $uniqueInvalidMatQuan))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1459,6 +1499,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1488,6 +1529,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1511,6 +1553,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1569,6 +1612,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid Bundle Quantity')
->body("$message
$codeList")
->danger()
+ ->seconds(2)
->send();
};
@@ -1701,6 +1745,7 @@ class CreateInvoiceValidation extends CreateRecord
->body("'$inserted' material invoice records were inserted.")
->info()
// ->success()
+ ->seconds(1)
->send();
// Update total quantity in the form
@@ -1738,6 +1783,7 @@ class CreateInvoiceValidation extends CreateRecord
->title("Import Failed: Material Invoice")
->body("No new records were inserted for Material Invoice: '$invoiceNumber'.")
->danger()
+ ->seconds(2)
->send();
$totalQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
@@ -1818,6 +1864,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid Serial Invoice')
->danger() // This makes the notification red to indicate an error
->body('Uploaded excel sheet is empty or
contains no valid data.')
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1833,6 +1880,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body('The following item codes should contain minimum 6 digit alpha numeric values:
' . implode(', ', $uniqueInvalidCodes))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1874,6 +1922,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1903,6 +1952,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1926,6 +1976,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1949,6 +2000,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body($message)
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1964,6 +2016,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Missing Serial Numbers')
->body("The following item codes doesn't have valid serial number:
" . implode(', ', $uniqueMissingSerials))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1979,6 +2032,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid Serial Numbers')
->body('The following serial numbers should contain minimum 9 digit alpha numeric values:
' . implode(', ', $uniqueInvalidSerCodes))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -1994,6 +2048,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Duplicate Serial Numbers')
->body('The following serial numbers are already exist in invoice excel:
' . implode(', ', $uniqueDupSerCodes))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -2010,6 +2065,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Duplicate Serial Numbers')
->body('The following serial numbers are already exist in database:
' . implode(', ', $existingSerialNumbers))
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -2053,6 +2109,7 @@ class CreateInvoiceValidation extends CreateRecord
->body("'$inserted' serial invoice records were inserted.")
->info()
// ->success()
+ ->seconds(1)
->send();
// Update total quantity in the form
@@ -2090,6 +2147,7 @@ class CreateInvoiceValidation extends CreateRecord
->title("Import Failed: Serial Invoice")
->body("No new records were inserted for Serial Invoice : '$invoiceNumber'.")
->danger()
+ ->seconds(2)
->send();
$totalQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
@@ -2116,6 +2174,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invoice Type Not Found')
->body("Import the valid 'Invoice' file to proceed..!")
->danger()
+ ->seconds(2)
->send();
if ($disk->exists($filePath)) {
@@ -2157,6 +2216,7 @@ class CreateInvoiceValidation extends CreateRecord
public function processSerialNumber($serNo)
{
+ $serNo = trim($serNo);
$user = Filament::auth()->user();
$operatorName = $user->name;
@@ -2177,6 +2237,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invoice Not Found')
->body("Invoice file '$invoiceNumber' doesn't exist.
Scan the valid 'Invoice' file to proceed!")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2200,6 +2261,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Completed: Material Invoice')
->body("Material invoice '$invoiceNumber' completed the scanning process.
Scan the next 'Material Invoice' to proceed!")
->warning()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2250,6 +2312,7 @@ class CreateInvoiceValidation extends CreateRecord
$batchNumber = $matches['batch_number'];
$serialNumber = $matches['batch_id'] . '-' . $matches['batch_count'];
$curScanQty = $matches['batch_quantity'];
+ $serNo = null;
if(empty($matches['batch_id']) || !$matches['batch_id'])
{
@@ -2257,6 +2320,7 @@ class CreateInvoiceValidation extends CreateRecord
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!
Sample formats are:
123456|12345|12345678|1/1 (or)
123456|12345|12345678|1 (or)
123456|12345678-1')
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2275,6 +2339,7 @@ class CreateInvoiceValidation extends CreateRecord
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!
Sample formats are:
123456|12345|12345678|1/1 (or)
123456|12345|12345678|1 (or)
123456|12345678-1')
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2293,6 +2358,7 @@ class CreateInvoiceValidation extends CreateRecord
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!
Sample formats are:
123456|12345|12345678|1/1 (or)
123456|12345|12345678|1 (or)
123456|12345678-1')
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2310,6 +2376,7 @@ class CreateInvoiceValidation extends CreateRecord
$this->currentItemCode = $itemCode;
$batchNumber = $matches['batch_number'];
$serialNumber = $matches['batch_id'] . '-' . $matches['batch_count'];
+ $serNo = null;
if(empty($matches['batch_id']) || !$matches['batch_id'])
{
@@ -2317,6 +2384,7 @@ class CreateInvoiceValidation extends CreateRecord
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!
Sample formats are:
123456|12345|12345678|1/1 (or)
123456|12345|12345678|1 (or)
123456|12345678-1')
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2335,6 +2403,7 @@ class CreateInvoiceValidation extends CreateRecord
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!
Sample formats are:
123456|12345|12345678|1/1 (or)
123456|12345|12345678|1 (or)
123456|12345678-1')
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2352,6 +2421,7 @@ class CreateInvoiceValidation extends CreateRecord
$this->currentItemCode = $itemCode;
$batchNumber = null; // batch_number not present in this pattern
$serialNumber = $matches['batch_id'] . '-' . $matches['batch_count'];
+ $serNo = null;
if(empty($matches['batch_id']) || !$matches['batch_id'])
{
@@ -2359,6 +2429,7 @@ class CreateInvoiceValidation extends CreateRecord
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!
Sample formats are:
123456|12345|12345678|1/1 (or)
123456|12345|12345678|1 (or)
123456|12345678-1')
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2377,6 +2448,7 @@ class CreateInvoiceValidation extends CreateRecord
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!
Sample formats are:
123456|12345|12345678|1/1 (or)
123456|12345|12345678|1 (or)
123456|12345678-1')
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2400,6 +2472,7 @@ class CreateInvoiceValidation extends CreateRecord
->danger()
->title('Invalid Material QR Format')
->body('Scan valid Material QR code proceed!
Sample formats are:
123456|12345|12345678|1/1 (or)
123456|12345|12345678|1 (or)
123456|12345678-1')
+ ->seconds(1)
->send();
$this->form->fill([
@@ -2423,6 +2496,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Code')
->body("Item code '$itemCode' not found in database.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2445,6 +2519,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Code')
->body("Item code '$itemCode' not found in database for choosed plant.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2466,6 +2541,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Code')
->body("Item code '$itemCode' doesn't have a valid material type.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2492,6 +2568,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Code')
->body("Item code '$itemCode' doesn't exist in invoice.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2517,6 +2594,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Item Code Limit Exceeds')
->body("Scanned item code '$itemCode' already reached its scanning quantity for the invoice '$invoiceNumber'.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2537,6 +2615,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Duplicate: Material QR')
->body("Scanned 'Material QR' already completed the scanning process.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2552,6 +2631,26 @@ class CreateInvoiceValidation extends CreateRecord
if($hasQuanTyp)
{
+ if(!is_numeric($curScanQty))
+ {
+ Notification::make()
+ ->danger()
+ ->title('Invalid Quantity Material QR Format')
+ ->body('Scan valid Quantity Material QR code proceed!
Ex:123456|12345|12345678|1/1')
+ ->seconds(2)
+ ->send();
+
+ $this->form->fill([
+ 'plant_id' => $plantId,
+ 'invoice_number' => $invoiceNumber,
+ 'serial_number' => null,
+ 'total_quantity' => $totQuan,
+ 'update_invoice' => false,
+ 'scanned_quantity'=> $scanMQuan,
+ ]);
+ return;
+ }
+
$createdDt = $record->created_at;
$stickMasterId = $record->sticker_master_id;
$curExistQty = $record->quantity;
@@ -2599,6 +2698,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Item Code Limit Exceeds')
->body("Scanned item code '$itemCode' has '$curScanQty' quantity.
But, '$curExistQty' quantity only available for the invoice '$invoiceNumber'.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2614,6 +2714,32 @@ class CreateInvoiceValidation extends CreateRecord
}
else
{
+ if(str_contains($serialNumber, '|'))
+ {
+ $itemCode = null;
+ $this->currentItemCode = '';
+ $batchNumber = null;
+ $serNo = null;
+ $serialNumber = null;
+
+ Notification::make()
+ ->title('Duplicate: Material QR')
+ ->body("Scanned 'Material QR' already completed the scanning process.")
+ ->danger()
+ ->seconds(2)
+ ->send();
+
+ $this->form->fill([
+ 'plant_id' => $plantId,
+ 'invoice_number' => $invoiceNumber,
+ 'serial_number' => null,
+ 'total_quantity' => $totQuan,
+ 'update_invoice' => false,
+ 'scanned_quantity'=> $scanMQuan,
+ ]);
+ return;
+ }
+
$record->serial_number = $serialNumber;
// if($batchNumber && !empty($batchNumber)) {}
$record->batch_number = $batchNumber;
@@ -2626,6 +2752,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Success: Material QR')
->body("'Material QR' scanned status updated, Scan next QR.")
->success()
+ ->seconds(2)
->send();
$totQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
@@ -2638,6 +2765,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Completed: Material Invoice')
->body("Material invoice '$invoiceNumber' completed the scanning process.
Scan the next 'Material Invoice' to proceed!")
->success()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2682,6 +2810,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Completed: Serial Invoice')
->body("Serial invoice '$invoiceNumber' completed the scanning process.
Scan the next 'Serial Invoice' to proceed!")
->warning()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2719,11 +2848,12 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch( 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
}
- if (!preg_match('/^([a-zA-Z0-9]{6,})\|([a-zA-Z0-9]{8,})(?:\/[MmPpCc])?$/', $serNo, $matches)) {
+ if (!preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?$/', $serNo, $matches)) {
Notification::make()
->danger()
->title('Invalid Serial QR Format')
->body('Scan valid Serial QR code proceed!
Sample formats are:
123456|1234567890123/M (or)
123456|1234567890123/P (or)
123456|1234567890123/C (or)
123456|1234567890123')
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2737,16 +2867,21 @@ class CreateInvoiceValidation extends CreateRecord
return;
}
- if (preg_match('/^([a-zA-Z0-9]+)\|([a-zA-Z0-9]+(?:\/[MmPpCc]?)?)$/', $serNo, $matches))
+ //'/^([a-zA-Z0-9]+)\|([a-zA-Z0-9]+(?:\/[MmPpCc]?)?)$/'
+ if (preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?$/', $serNo, $matches))
{
$itemCode = $matches[1];
$serialNumber = $matches[2];
- // Check if it ends with /M, /P, /C etc.
- $isMarkM = preg_match('/\/[Mm]$/', $serialNumber);
- $isMarkP = preg_match('/\/[Pp]$/', $serialNumber);
- $isMarkC = preg_match('/\/[Cc]$/', $serialNumber);
+ // // Check if it ends with /M, /P, /C etc.
+ // $isMarkM = preg_match('/\/[Mm]$/', $serialNumber);
+ // $isMarkP = preg_match('/\/[Pp]$/', $serialNumber);
+ // $isMarkC = preg_match('/\/[Cc]$/', $serialNumber);
+ $isMarkM = preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})\/[Mm]?$/', $serNo) ? true : false;
+ $isMarkP = preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})\/[Pp]?$/', $serNo) ? true : false;
+ $isMarkC = preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})\/[Cc]?$/', $serNo) ? true : false;
$isMarkPs = (!$isMarkM && !$isMarkP && !$isMarkC) ? true : false;
+ //dd($serialNumber, $isMarkM, $isMarkP, $isMarkC, $isMarkPs);
$serialNumber = preg_replace('/\/[MmPpCc]$/', '', $serialNumber);
@@ -2757,6 +2892,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Serial Number Not Found')
->body("Serial '$serialNumber' not found in database for choosed plant.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2778,6 +2914,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Serial Number')
->body("Serial '$serialNumber' not found in invoice.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2803,6 +2940,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Code')
->body("Item code '$itemCode' with serial number '$serialNumber' not found.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2832,6 +2970,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Code')
->body("Scanned 'Item Code' doesn't have valid package type to proceed!")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2852,6 +2991,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Motor QR')
->body("Scanned 'Item Code' doesn't have 'Motor' QR to proceed!")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2870,6 +3010,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Duplicate: Motor QR')
->body("Scanned 'Motor' serial number already completed the scanning process.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2913,6 +3054,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Success: Motor QR')
->body("'Motor' QR scanned status updated, Scan next QR.")
->success()
+ ->seconds(2)
->send();
$scannedQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
@@ -2931,6 +3073,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Completed: Serial Invoice')
->body("Serial invoice '$invoiceNumber' completed the scanning process.
Scan the next 'Serial Invoice' to proceed!")
->success()
+ ->seconds(2)
->send();
$filename = $invoiceNumber . '.xlsx';
@@ -2958,6 +3101,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Pump QR')
->body("Scanned 'Item Code' doesn't have 'Pump' QR to proceed!")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -2976,6 +3120,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Duplicate: Pump QR')
->body("Scanned 'Pump' serial number already completed the scanning process.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -3019,6 +3164,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Success: Pump QR')
->body("'Pump' QR scanned status updated, Scan next QR.")
->success()
+ ->seconds(2)
->send();
$scannedQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
@@ -3037,6 +3183,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Completed: Serial Invoice')
->body("Serial invoice '$invoiceNumber' completed the scanning process.
Scan the next 'Serial Invoice' to proceed!")
->success()
+ ->seconds(2)
->send();
$filename = $invoiceNumber . '.xlsx';
@@ -3066,6 +3213,7 @@ class CreateInvoiceValidation extends CreateRecord
// ->body("Panel Box Code is not available for Item Code : '$itemCode'.")
->body("Scanned 'Item Code' doesn't have 'Panel Box Code' to proceed!")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -3084,6 +3232,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Duplicate: Capacitor QR')
->body("Scanned 'Capacitor' serial number already completed the scanning process.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -3122,6 +3271,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Pump Set QR')
->body("Scanned 'Item Code' doesn't have 'Pump Set' QR to proceed!")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -3140,6 +3290,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Duplicate: Pump Set QR')
->body("Scanned 'Pump Set' serial number already completed the scanning process.")
->danger()
+ ->seconds(2)
->send();
$this->form->fill([
@@ -3183,6 +3334,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Success: Pump Set QR')
->body("'Pump Set' QR scanned status updated, Scan next QR.")
->success()
+ ->seconds(2)
->send();
$scannedQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
@@ -3201,6 +3353,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Completed: Serial Invoice')
->body("Serial invoice '$invoiceNumber' completed the scanning process.
Scan the next 'Serial Invoice' to proceed!")
->success()
+ ->seconds(2)
->send();
$filename = $invoiceNumber . '.xlsx';