Refactor Invoice Validation Logic and Update UI for Serial and Material Invoices

- Improved conditional checks for invoice processing in InvoiceValidationResource on completion (or pending).
- Enhanced notifications for completed scanning processes for both serial and material invoices.
- Updated CreateInvoiceValidation page to pass invoice type to serial and material invoice on completion (or pending).
- Modified InvoiceDataTable to include a new property for serial/material invoice handling.
- Adjusted Blade view to dynamically display the correct title and messages based on invoice type (serial/material).
This commit is contained in:
dhanabalan
2025-08-05 12:00:26 +05:30
parent d6c77bd6c3
commit 197184e2ed
4 changed files with 255 additions and 132 deletions

View File

@@ -8,6 +8,7 @@ use App\Imports\ExcelImport;
use App\Livewire\InvoiceDataTable;
use App\Models\InvoiceValidation;
use App\Models\Item;
use App\Models\Plant;
use App\Models\StickerMaster;
use Filament\Facades\Filament;
use Filament\Pages\Concerns\ExposesTableToWidgets;
@@ -74,6 +75,22 @@ class CreateInvoiceValidation extends CreateRecord
$this->plantId = $plantId;
$plant = Plant::find($plantId);
if ($plant)
{
$plantCode = $plant->code;
}
else
{
$plantCode = null;
}
//..GET SERIAL INVOICE API
//..
$updateStatus = $this->form->getState()['update_invoice'] ?? null;
$this->invoiceNumber = trim($this->form->getState()['invoice_number']) ?? $invoiceNumber;
@@ -116,7 +133,7 @@ class CreateInvoiceValidation extends CreateRecord
'scanned_quantity'=> $scanMQuan,
]);
if ($totQuan === $scanMQuan)
if ($totQuan == $scanMQuan)
{
Notification::make()
->title("Completed: Material Invoice")
@@ -134,7 +151,7 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: false);
}
else
{
@@ -147,7 +164,7 @@ class CreateInvoiceValidation extends CreateRecord
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
$this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
if($updateStatus === '1')
if($updateStatus == '1')
{
//'Material invoice update in progress...';
$filename = $invoiceNumber . '.xlsx';
@@ -185,7 +202,7 @@ class CreateInvoiceValidation extends CreateRecord
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
if ($index == 0) continue; // Skip header
$materialCode = trim($row[0]);
$materialQuantity = trim($row[1]);
@@ -390,7 +407,7 @@ class CreateInvoiceValidation extends CreateRecord
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
if ($index == 0) continue; // Skip header
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
@@ -399,16 +416,16 @@ class CreateInvoiceValidation extends CreateRecord
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
if ($excelCode == $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
}
}
if ($totalExcelQty === 0) {
if ($totalExcelQty == 0) {
$zeroQtyCodes[] = $code;
} elseif (!is_numeric($totalExcelQty)) {
$nonNumericQtyCodes[] = $code; // Here you may want to check divisibility condition too
} elseif ($bundleQty != 0 && $totalExcelQty % $bundleQty !== 0) {
} elseif ($bundleQty != 0 && $totalExcelQty % $bundleQty != 0) {
$notDivisibleCodes[] = $code;
}
}
@@ -420,7 +437,7 @@ class CreateInvoiceValidation extends CreateRecord
}
$showValidationNotification = function(array $codes, string $message) {
if (count($codes) === 0) return;
if (count($codes) == 0) return;
$uniqueCodes = array_unique($codes);
$codeList = implode(', ', $uniqueCodes);
@@ -452,7 +469,7 @@ class CreateInvoiceValidation extends CreateRecord
$inserted = 0;
foreach ($matchedItems as $sticker)
{
if ($newQuan === -1 && !$hasQuanTyp)
if ($newQuan == -1 && !$hasQuanTyp)
{
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where(function($query) {
$query->whereNull('serial_number')->orWhere('serial_number', '');
@@ -461,7 +478,7 @@ class CreateInvoiceValidation extends CreateRecord
$newQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
}
else if ($newQuan === -1 && $hasQuanTyp)
else if ($newQuan == -1 && $hasQuanTyp)
{
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where(function($query) {
$query->whereNull('serial_number')->orWhere('serial_number', '');
@@ -481,7 +498,7 @@ class CreateInvoiceValidation extends CreateRecord
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
if ($index == 0) continue; // Skip header
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
@@ -490,7 +507,7 @@ class CreateInvoiceValidation extends CreateRecord
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
if ($excelCode == $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
}
}
@@ -522,7 +539,7 @@ class CreateInvoiceValidation extends CreateRecord
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
if ($index == 0) continue; // Skip header
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
@@ -531,7 +548,7 @@ class CreateInvoiceValidation extends CreateRecord
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
if ($excelCode == $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
}
}
@@ -564,7 +581,7 @@ class CreateInvoiceValidation extends CreateRecord
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
if ($index == 0) continue; // Skip header
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
@@ -573,7 +590,7 @@ class CreateInvoiceValidation extends CreateRecord
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
if ($excelCode == $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty;
}
}
@@ -669,7 +686,7 @@ class CreateInvoiceValidation extends CreateRecord
}
}
if ($inserted > 0 || $oldQuan !== $newQuan)
if ($inserted > 0 || $oldQuan != $newQuan)
{
Notification::make()
->title("Material invoice successfully updatad.")
@@ -695,13 +712,13 @@ class CreateInvoiceValidation extends CreateRecord
'scanned_quantity'=> $scannedQuantity,
]);
if ($totalQuantity === $scannedQuantity)
if ($totalQuantity == $scannedQuantity)
{
if ($disk->exists($filePath)) {
$disk->delete($filePath);
}
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: false);
}
else
{
@@ -775,7 +792,7 @@ class CreateInvoiceValidation extends CreateRecord
//$hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
// $this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
if ($totQuan === $scanSQuan)
if ($totQuan == $scanSQuan)
{
Notification::make()
->title("Completed: Serial Invoice")
@@ -793,7 +810,7 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: true);
}
else
{
@@ -804,7 +821,7 @@ class CreateInvoiceValidation extends CreateRecord
->send();
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
if($updateStatus === '1')
if($updateStatus == '1')
{
$filename = $invoiceNumber . '.xlsx';
$directory = 'uploads/temp';
@@ -846,7 +863,7 @@ class CreateInvoiceValidation extends CreateRecord
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
if ($index == 0) continue; // Skip header
$materialCode = trim($row[0]);
$serialNumber = trim($row[1]);
@@ -1087,7 +1104,7 @@ class CreateInvoiceValidation extends CreateRecord
$inserted = 0;
foreach ($rows as $index => $row)
{
if ($index === 0) // Skip header;
if ($index == 0) // Skip header;
{
InvoiceValidation::where('invoice_number', $invoiceNumber)
->where(function($query) {
@@ -1138,7 +1155,7 @@ class CreateInvoiceValidation extends CreateRecord
}
}
if ($inserted > 0 || $oldQuan !== $newQuan)
if ($inserted > 0 || $oldQuan != $newQuan)
{
Notification::make()
->title("Serial invoice successfully updated.")
@@ -1165,13 +1182,13 @@ class CreateInvoiceValidation extends CreateRecord
'scanned_quantity'=> $scannedQuantity,
]);
if ($totalQuantity === $scannedQuantity)
if ($totalQuantity == $scannedQuantity)
{
if ($disk->exists($filePath)) {
$disk->delete($filePath);
}
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: true);
}
else
{
@@ -1283,7 +1300,7 @@ class CreateInvoiceValidation extends CreateRecord
$uploadedFilename = pathinfo($fullPath, PATHINFO_FILENAME);
// Compare with invoice number
if ($uploadedFilename !== $invoiceNumber) {
if ($uploadedFilename != $invoiceNumber) {
Notification::make()
->title("Uploaded file name does not match the invoice number.")
->danger()
@@ -1326,7 +1343,7 @@ class CreateInvoiceValidation extends CreateRecord
foreach ($rows as $index => $row)
{
if ($index === 0) continue;
if ($index == 0) continue;
$materialCode = trim($row[0]);
@@ -1365,7 +1382,7 @@ class CreateInvoiceValidation extends CreateRecord
}
}
if($invoiceType === 'M')
if($invoiceType == 'M')
{
$invalidMatCodes = [];
$materialCodes = [];
@@ -1375,7 +1392,7 @@ class CreateInvoiceValidation extends CreateRecord
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
if ($index == 0) continue; // Skip header
$materialCode = trim($row[0]);
$materialQuantity = trim($row[1]);
@@ -1578,7 +1595,7 @@ class CreateInvoiceValidation extends CreateRecord
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
if ($index == 0) continue; // Skip header
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
@@ -1587,23 +1604,23 @@ class CreateInvoiceValidation extends CreateRecord
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
if ($excelCode == $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
}
}
if ($totalExcelQty === 0) {
if ($totalExcelQty == 0) {
$zeroQtyCodes[] = $code;
} elseif (!is_numeric($totalExcelQty)) {
$nonNumericQtyCodes[] = $code; // Here you may want to check divisibility condition too
} elseif ($bundleQty != 0 && $totalExcelQty % $bundleQty !== 0) {
} elseif ($bundleQty != 0 && $totalExcelQty % $bundleQty != 0) {
$notDivisibleCodes[] = $code;
}
}
}
$showValidationNotification = function(array $codes, string $message) {
if (count($codes) === 0) return;
if (count($codes) == 0) return;
$uniqueCodes = array_unique($codes);
$codeList = implode(', ', $uniqueCodes);
@@ -1642,7 +1659,7 @@ class CreateInvoiceValidation extends CreateRecord
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
if ($index == 0) continue; // Skip header
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
@@ -1651,7 +1668,7 @@ class CreateInvoiceValidation extends CreateRecord
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
if ($excelCode == $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
}
}
@@ -1677,7 +1694,7 @@ class CreateInvoiceValidation extends CreateRecord
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
if ($index == 0) continue; // Skip header
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
@@ -1686,7 +1703,7 @@ class CreateInvoiceValidation extends CreateRecord
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
if ($excelCode == $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
}
}
@@ -1711,7 +1728,7 @@ class CreateInvoiceValidation extends CreateRecord
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
if ($index == 0) continue; // Skip header
$excelCode = trim($row[0]);
$excelMatQty = trim($row[1]);
@@ -1720,7 +1737,7 @@ class CreateInvoiceValidation extends CreateRecord
continue;
}
if ($excelCode === $code && is_numeric($excelMatQty)) {
if ($excelCode == $code && is_numeric($excelMatQty)) {
$totalExcelQty += $excelMatQty; // Sum up the quantities
}
}
@@ -1759,13 +1776,13 @@ class CreateInvoiceValidation extends CreateRecord
'scanned_quantity'=> $scannedQuantity,
]);
if ($totalQuantity === $scannedQuantity)
if ($totalQuantity == $scannedQuantity)
{
if ($disk->exists($filePath)) {
$disk->delete($filePath);
}
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: false);
}
else
{
@@ -1805,7 +1822,7 @@ class CreateInvoiceValidation extends CreateRecord
}
}
}
else if($invoiceType === 'S')
else if($invoiceType == 'S')
{
$invalidMatCodes = [];
$materialCodes = [];
@@ -1817,7 +1834,7 @@ class CreateInvoiceValidation extends CreateRecord
foreach ($rows as $index => $row)
{
if ($index === 0) continue; // Skip header
if ($index == 0) continue; // Skip header
$materialCode = trim($row[0]);
$serialNumber = trim($row[1]);
@@ -2077,7 +2094,7 @@ class CreateInvoiceValidation extends CreateRecord
$inserted = 0;
foreach ($rows as $index => $row)
{
if ($index === 0) continue;
if ($index == 0) continue;
$materialCode = trim($row[0]);
$serialNumber = trim($row[1]);
@@ -2123,13 +2140,13 @@ class CreateInvoiceValidation extends CreateRecord
'scanned_quantity'=> $scannedQuantity,
]);
if ($totalQuantity === $scannedQuantity)
if ($totalQuantity == $scannedQuantity)
{
if ($disk->exists($filePath)) {
$disk->delete($filePath);
}
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: true);
}
else
{
@@ -2201,9 +2218,9 @@ class CreateInvoiceValidation extends CreateRecord
{
$totalQuantity = InvoiceValidation::where('invoice_number', $this->invoiceNumber)->where('plant_id', $this->plantId)->count();
$scannedQuantity = InvoiceValidation::where('invoice_number', $this->invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $this->plantId)->count();
if ($totalQuantity === $scannedQuantity)
if ($totalQuantity == $scannedQuantity)
{
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $this->invoiceNumber, plantId: $this->plantId);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $this->invoiceNumber, plantId: $this->plantId, isSerial: true);
}
else
{
@@ -2255,7 +2272,7 @@ class CreateInvoiceValidation extends CreateRecord
{
if ($totMQuan > 0)
{
if ($totQuan === $scanMQuan)
if ($totQuan == $scanMQuan)
{
Notification::make()
->title('Completed: Material Invoice')
@@ -2282,7 +2299,7 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: false);
return;
}
else
@@ -2759,7 +2776,7 @@ class CreateInvoiceValidation extends CreateRecord
$scannedMQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $plantId)->count();
if($totQuan === $scannedMQuantity)
if($totQuan == $scannedMQuantity)
{
Notification::make()
->title('Completed: Material Invoice')
@@ -2786,7 +2803,7 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: false);
}
else
{
@@ -2804,7 +2821,7 @@ class CreateInvoiceValidation extends CreateRecord
}
else
{
if ($totQuan === $scanSQuan)
if ($totQuan == $scanSQuan)
{
Notification::make()
->title('Completed: Serial Invoice')
@@ -2831,7 +2848,7 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: true);
return;
}
else
@@ -3004,7 +3021,7 @@ class CreateInvoiceValidation extends CreateRecord
]);
return;
}
else if($hadMotorQr === $hasMotorQr)
else if($hadMotorQr == $hasMotorQr)
{
Notification::make()
->title('Duplicate: Motor QR')
@@ -3027,7 +3044,7 @@ class CreateInvoiceValidation extends CreateRecord
$packCnt = 1;
$scanCnt = 1;
$record->motor_scanned_status = 1;
//if($hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
//if($hadPumpQr == $hasPumpQr && $hadPumpSetQr == $hasPumpSetQr)
if($hasPumpQr || $hasPumpSetQr || $hasCapacitorQr)
{
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
@@ -3038,7 +3055,7 @@ class CreateInvoiceValidation extends CreateRecord
$scanCnt = $hadPumpSetQr ? $scanCnt + 1: $scanCnt;
$scanCnt = $hadCapacitorQr ? $scanCnt + 1: $scanCnt;
if($packCnt === $scanCnt)
if($packCnt == $scanCnt)
{
$record->scanned_status = 'Scanned';
}
@@ -3067,7 +3084,7 @@ class CreateInvoiceValidation extends CreateRecord
'scanned_quantity'=> $scannedQuantity,
]);
if($totQuan === $scannedQuantity)
if($totQuan == $scannedQuantity)
{
Notification::make()
->title('Completed: Serial Invoice')
@@ -3085,7 +3102,7 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: true);
}
else
{
@@ -3114,7 +3131,7 @@ class CreateInvoiceValidation extends CreateRecord
]);
return;
}
else if($hadPumpQr === $hasPumpQr)
else if($hadPumpQr == $hasPumpQr)
{
Notification::make()
->title('Duplicate: Pump QR')
@@ -3137,7 +3154,7 @@ class CreateInvoiceValidation extends CreateRecord
$packCnt = 1;
$scanCnt = 1;
$record->pump_scanned_status = 1;
// if($hadMotorQr === $hasMotorQr && $hadPumpSetQr === $hasPumpSetQr && ($hadCapacitorQr === '1' && $hasCapacitorQr))
// if($hadMotorQr == $hasMotorQr && $hadPumpSetQr == $hasPumpSetQr && ($hadCapacitorQr == '1' && $hasCapacitorQr))
if($hasMotorQr || $hasPumpSetQr || $hasCapacitorQr)
{
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
@@ -3148,7 +3165,7 @@ class CreateInvoiceValidation extends CreateRecord
$scanCnt = $hadPumpSetQr ? $scanCnt + 1: $scanCnt;
$scanCnt = $hadCapacitorQr ? $scanCnt + 1: $scanCnt;
if($packCnt === $scanCnt)
if($packCnt == $scanCnt)
{
$record->scanned_status = 'Scanned';
}
@@ -3177,7 +3194,7 @@ class CreateInvoiceValidation extends CreateRecord
'scanned_quantity'=> $scannedQuantity,
]);
if($totQuan === $scannedQuantity)
if($totQuan == $scannedQuantity)
{
Notification::make()
->title('Completed: Serial Invoice')
@@ -3195,7 +3212,7 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: true);
}
else
{
@@ -3226,7 +3243,7 @@ class CreateInvoiceValidation extends CreateRecord
]);
return;
}
else if($hadCapacitorQr === '1' && $hasCapacitorQr)
else if($hadCapacitorQr == '1' && $hasCapacitorQr)
{
Notification::make()
->title('Duplicate: Capacitor QR')
@@ -3285,7 +3302,7 @@ class CreateInvoiceValidation extends CreateRecord
]);
return;
}
else if($hadPumpSetQr === $hasPumpSetQr)
else if($hadPumpSetQr == $hasPumpSetQr)
{
Notification::make()
->title('Duplicate: Pump Set QR')
@@ -3308,7 +3325,7 @@ class CreateInvoiceValidation extends CreateRecord
$packCnt = 1;
$scanCnt = 1;
$record->scanned_status_set = 1;
// if($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && ($hadCapacitorQr === '1' && $hasCapacitorQr))
// if($hadMotorQr == $hasMotorQr && $hadPumpQr == $hasPumpQr && ($hadCapacitorQr == '1' && $hasCapacitorQr))
if($hasMotorQr || $hasPumpQr || $hasCapacitorQr)
{
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
@@ -3319,7 +3336,7 @@ class CreateInvoiceValidation extends CreateRecord
$scanCnt = $hadPumpQr ? $scanCnt + 1: $scanCnt;
$scanCnt = $hadCapacitorQr ? $scanCnt + 1: $scanCnt;
if($packCnt === $scanCnt)
if($packCnt == $scanCnt)
{
$record->scanned_status = 'Scanned';
}
@@ -3348,7 +3365,7 @@ class CreateInvoiceValidation extends CreateRecord
'scanned_quantity'=> $scannedQuantity,
]);
if($totQuan === $scannedQuantity)
if($totQuan == $scannedQuantity)
{
Notification::make()
->title('Completed: Serial Invoice')
@@ -3366,7 +3383,7 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: true);
}
else
{