Added no of packages serial invoice validation and notification time increased

This commit is contained in:
dhanabalan
2025-11-14 15:19:57 +05:30
parent cd48b9bdf6
commit fc8b6382ac
3 changed files with 131 additions and 62 deletions

View File

@@ -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')