diff --git a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
index bc925ac8f..c7c2b208c 100644
--- a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
+++ b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
@@ -823,7 +823,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)
+ ->seconds(3)
->send();
$this->dispatch('playNotificationSound');
@@ -872,7 +872,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Records Not Found')
->body("Import the valid updated 'Serial Invoice' file to proceed..!")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -944,7 +944,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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -961,7 +961,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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -995,7 +995,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Codes')
->body($message)
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -1027,7 +1027,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Codes')
->body($message)
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -1052,7 +1052,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body($message)
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -1077,7 +1077,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body($message)
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -1094,7 +1094,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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -1112,7 +1112,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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -1129,7 +1129,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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -1250,7 +1250,7 @@ class CreateInvoiceValidation extends CreateRecord
->title("Update Failed: Serial Invoice")
->body("No new records were inserted for Serial Invoice : '$invoiceNumber'.")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -1278,7 +1278,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Updated Invoice Not Found')
->body("Import the updated 'Serial Invoice' file to proceed..!")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -1312,14 +1312,14 @@ class CreateInvoiceValidation extends CreateRecord
// Notification::make()
// ->title('File exists.')
// ->success()
- // ->seconds(2)
+ // ->seconds(3)
// ->send();
} else {
Notification::make()
->title('Invoice Not Found')
->body("Import the scanned 'Invoice' file to proceed..!")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
$this->form->fill([
@@ -1338,7 +1338,7 @@ class CreateInvoiceValidation extends CreateRecord
Notification::make()
->title('Invoice file doesn\'t exist.')
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
return;
@@ -1353,7 +1353,7 @@ class CreateInvoiceValidation extends CreateRecord
Notification::make()
->title("Uploaded file name does not match the invoice number.")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
return;
@@ -1382,7 +1382,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Records Not Found')
->body("Import the valid 'Invoice' file to proceed..!")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -1941,7 +1941,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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -1958,7 +1958,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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -2001,7 +2001,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Codes')
->body($message)
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -2032,7 +2032,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Codes')
->body($message)
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -2057,7 +2057,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body($message)
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -2082,7 +2082,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Codes')
->body($message)
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -2099,7 +2099,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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -2116,7 +2116,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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -2133,7 +2133,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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -2151,7 +2151,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Duplicate Serial Numbers')
->body('The following serial numbers are already exist in database:
' . implode(', ', $existingSerialNumbers))
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -2235,7 +2235,7 @@ class CreateInvoiceValidation extends CreateRecord
->title("Import Failed: Serial Invoice")
->body("No new records were inserted for Serial Invoice : '$invoiceNumber'.")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -2263,7 +2263,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invoice Type Not Found')
->body("Import the valid 'Invoice' file to proceed..!")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -2352,7 +2352,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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -3174,7 +3174,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)
+ ->seconds(3)
->send();
$this->dispatch('playNotificationSound');
@@ -3220,7 +3220,7 @@ class CreateInvoiceValidation extends CreateRecord
->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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -3281,7 +3281,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Serial Number Not Found
Serial \''.$serialNumber.'\' not found in database for choosed plant.')
// ->body("Serial '$serialNumber' not found in database for choosed plant.")..........
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('play-warn-sound');
@@ -3325,7 +3325,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Serial Number
Serial \''.$serialNumber.'\' not found in invoice.')
// ->body("Serial '$serialNumber' not found in invoice.")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -3370,7 +3370,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Item Code')
->body("Item code '$itemCode' with serial number '$serialNumber' not found.")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -3425,7 +3425,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Invalid: Item Code')
->body("Scanned 'Item Code' doesn't have valid package type to proceed!")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -3464,7 +3464,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Motor QR')
->body("Scanned 'Item Code' doesn't have 'Motor' QR to proceed!")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
$mInvoiceType = 'Serial';
@@ -3499,7 +3499,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Duplicate: Motor QR')
->body("Scanned 'Motor' serial number already completed the scanning process.")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -3563,7 +3563,7 @@ class CreateInvoiceValidation extends CreateRecord
// ->title('Success: Motor QR')
// ->body("'Motor' QR scanned status updated, Scan next QR.")
// ->success() // commented
- // ->seconds(2)
+ // ->seconds(3)
// ->send();
$scannedQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
@@ -3582,7 +3582,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)
+ ->seconds(3)
->send();
$this->dispatch('playNotificationSound');
@@ -3628,7 +3628,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Unknown: Pump QR')
->body("Scanned 'Item Code' doesn't have 'Pump' QR to proceed!")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -3666,7 +3666,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Duplicate: Pump QR')
->body("Scanned 'Pump' serial number already completed the scanning process.")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -3728,7 +3728,7 @@ class CreateInvoiceValidation extends CreateRecord
// ->title('Success: Pump QR')
// ->body("'Pump' QR scanned status updated, Scan next QR.")
// ->success() // commented
- // ->seconds(2)
+ // ->seconds(3)
// ->send();
$scannedQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
@@ -3747,7 +3747,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)
+ ->seconds(3)
->send();
$this->dispatch('playNotificationSound');
@@ -3796,7 +3796,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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -3834,7 +3834,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Duplicate: Capacitor QR')
->body("Scanned 'Capacitor' serial number already completed the scanning process.")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -3893,7 +3893,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)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -3931,7 +3931,7 @@ class CreateInvoiceValidation extends CreateRecord
->title('Duplicate: Pump Set QR')
->body("Scanned 'Pump Set' serial number already completed the scanning process.")
->danger()
- ->seconds(2)
+ ->seconds(3)
->send();
$this->dispatch('playWarnSound');
@@ -3994,7 +3994,7 @@ class CreateInvoiceValidation extends CreateRecord
// ->title('Success: Pump Set QR')
// ->body("'Pump Set' QR scanned status updated, Scan next QR.")
// ->success() // commented
- // ->seconds(2)
+ // ->seconds(3)
// ->send();
$scannedQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
@@ -4013,7 +4013,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)
+ ->seconds(3)
->send();
$this->dispatch('playNotificationSound');
diff --git a/app/Livewire/InvoiceDataTable.php b/app/Livewire/InvoiceDataTable.php
index a636873de..7067f69b0 100644
--- a/app/Livewire/InvoiceDataTable.php
+++ b/app/Livewire/InvoiceDataTable.php
@@ -8,6 +8,7 @@ use App\Models\StickerMaster;
use Filament\Facades\Filament;
use Filament\Notifications\Notification;
use Livewire\Component;
+use Str;
class InvoiceDataTable extends Component
{
@@ -15,6 +16,8 @@ class InvoiceDataTable extends Component
public $plantId = 0;
+ public $packageCount = 0;
+
public string $invoiceNumber = '';
public bool $completedInvoice = false;
@@ -60,6 +63,7 @@ class InvoiceDataTable extends Component
$this->emptyInvoice = false;
$this->hasSearched = false;
$this->materialInvoice = false;
+ $this->packageCount = 0;
// $this->showCapacitorInput = false;
}
@@ -71,6 +75,7 @@ class InvoiceDataTable extends Component
$this->emptyInvoice = true;
$this->hasSearched = false;
$this->materialInvoice = false;
+ $this->packageCount = 0;
// $this->showCapacitorInput = false;
}
@@ -106,11 +111,75 @@ class InvoiceDataTable extends Component
})
->toArray();
+ $this->packageCount = 0;
+
//Loop through and replace 'code' using related StickerMaster > Item > code
foreach ($this->invoiceData as &$row) {
+ $stickCount = 0;
+ $scannedCount = 0;
+
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
- $row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
+ $row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
+ $curStick = StickerMaster::where('id', $row['sticker_master_id'])->first();
+ if ($curStick)
+ {
+ if ($curStick->tube_sticker_motor == 1 || $curStick->tube_sticker_pump == 1 || $curStick->tube_sticker_pumpset == 1 || Str::length($curStick->panel_box_code) > 0)
+ {
+ if ($curStick->tube_sticker_motor == 1)
+ {
+ $stickCount++;
+ }
+ if ($curStick->tube_sticker_pump == 1)
+ {
+ $stickCount++;
+ }
+ if ($curStick->tube_sticker_pumpset == 1)
+ {
+ $stickCount++;
+ }
+ if (Str::length($curStick->panel_box_code) > 0)
+ {
+ $stickCount++;
+ }
+ }
+ else if ($curStick->pack_slip_motor == 1 || $curStick->pack_slip_pump == 1 || $curStick->pack_slip_pumpset == 1)
+ {
+ if ($curStick->pack_slip_motor == 1)
+ {
+ $stickCount++;
+ }
+ if ($curStick->pack_slip_pump == 1)
+ {
+ $stickCount++;
+ }
+ if ($curStick->pack_slip_pumpset == 1)
+ {
+ $stickCount++;
+ }
+ }
+
+ }
+
+ if ($row['motor_scanned_status'] == 1)
+ {
+ $scannedCount++;
+ }
+ if ($row['pump_scanned_status'] == 1)
+ {
+ $scannedCount++;
+ }
+ if ($row['capacitor_scanned_status'] == 1)
+ {
+ $scannedCount++;
+ }
+ if ($row['scanned_status_set'] == 1)
+ {
+ $scannedCount++;
+ }
+
+ $this->packageCount += $stickCount - $scannedCount;
}
+
}
public function loadMaterialData($invoiceNumber, $plantId)
@@ -145,15 +214,15 @@ class InvoiceDataTable extends Component
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
- if($matType === 1)
+ if ($matType === 1)
{
$row['material_type'] = 'Individual';
}
- else if($matType === 2)
+ else if ($matType === 2)
{
$row['material_type'] = 'Bundle';
}
- else if($matType === 3)
+ else if ($matType === 3)
{
$row['material_type'] = 'Quantity';
}
@@ -263,8 +332,8 @@ class InvoiceDataTable extends Component
$packCnt = 1;
$scanCnt = 1;
- // if($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
- if($hasMotorQr || $hasPumpQr || $hasPumpSetQr)
+ // if ($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
+ if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr)
{
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
@@ -274,7 +343,7 @@ class InvoiceDataTable extends Component
$scanCnt = $hadPumpQr ? $scanCnt + 1: $scanCnt;
$scanCnt = $hadPumpSetQr ? $scanCnt + 1: $scanCnt;
- if($packCnt === $scanCnt)
+ if ($packCnt === $scanCnt)
{
$matchingValidation->update([
'panel_box_supplier' => $supplier,
@@ -326,7 +395,7 @@ class InvoiceDataTable extends Component
// 'scanned_quantity'=> $scannedQuantity,
// ]);
- if($totalQuantity === $scannedQuantity)
+ if ($totalQuantity === $scannedQuantity)
{
Notification::make()
->title('Completed: Serial Invoice')
diff --git a/resources/views/livewire/invoice-data-table.blade.php b/resources/views/livewire/invoice-data-table.blade.php
index f0a9a2deb..1e68d6fe9 100644
--- a/resources/views/livewire/invoice-data-table.blade.php
+++ b/resources/views/livewire/invoice-data-table.blade.php
@@ -3,18 +3,18 @@