Merge pull request 'ranjith-dev' (#776) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 21s

Reviewed-on: #776
This commit was merged in pull request #776.
This commit is contained in:
2026-06-18 15:50:01 +00:00
5 changed files with 98 additions and 4 deletions

View File

@@ -611,6 +611,7 @@ class CreateInvoiceValidation extends CreateRecord
'sticker_master_id' => $sticker->id,
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'invoice_quantity' => 1,
'quantity' => 1,
'operator_id' => $operatorName,
'created_by' => $operatorName,
@@ -653,6 +654,7 @@ class CreateInvoiceValidation extends CreateRecord
'sticker_master_id' => $sticker->id,
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'invoice_quantity' => $bundleQty,
'quantity' => $bundleQty,
'operator_id' => $operatorName,
'created_by' => $operatorName,
@@ -697,11 +699,13 @@ class CreateInvoiceValidation extends CreateRecord
// 8 = 3 + 5 // 8 = 5 + 3 // 8 = 0 + 8 // 8 = 8 + 0
// 8 = 3 + 5 // 8 = 5 + 3 // 8 = 0 + 8 // 8 = 8 + 0
// 0 = 0 + 0
// 4 = 1.5 + 2.5
$existQty = $existEmpQty + $existComQty;
// 8 <= 11 // 8 <= 8 // 8 <= 11 // 8 <= 9
// 8 <= 7 // 8 <= 7 // 8 <= 7 // 8 <= 7
// 0 <= 5
// 4 <= 2
if ($existQty <= $totalExcelQty) {
// 6 = 11 - 5 // 5 = 8 - 3 // 3 = 11 - 8 // 9 = 9 - 0
@@ -723,29 +727,46 @@ class CreateInvoiceValidation extends CreateRecord
'updated_by' => $operatorName,
'updated_at' => now(),
]);
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where('sticker_master_id', $sticker->id)
->update([
'invoice_quantity' => $totalExcelQty,
]);
$newQuan--;
$inserted++;
} elseif ($newInsQty > 0) { // if ($sticker) // create
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where('sticker_master_id', $sticker->id)
->update([
'invoice_quantity' => $totalExcelQty,
]);
InvoiceValidation::create([
'sticker_master_id' => $sticker->id,
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'invoice_quantity' => $totalExcelQty,
'quantity' => $newInsQty,
'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]);
$inserted++;
}
}
// 8 > 7 // 8 > 7 // 8 > 7 // 8 > 7
// 4 > 2
else {
// 2 = 7 - 5 // 4 = 7 - 3 // -1 = 7 - 8 // 7 = 7 - 0
// -0.5 = 2 - 2.5 //
$newInsQty = $totalExcelQty - $existComQty;
// 3 > 0 // 5 > 0 // 0 > 0 // 8 > 0
if ($existEmpQty > 0) { // update
// 1.5 > 0 //
if ($newInsQty > 0 && $existEmpQty > 0) { // update
// 3 = 2 // 5 = 4 // 0 = -1 // 8 = 7
// 1.5 == -0.5 //
if ($existEmpQty == $newInsQty) {
continue;
}
@@ -756,6 +777,12 @@ class CreateInvoiceValidation extends CreateRecord
'updated_by' => $operatorName,
'updated_at' => now(),
]);
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where('sticker_master_id', $sticker->id)
->update([
'invoice_quantity' => $totalExcelQty,
]);
$newQuan--;
$inserted++;
} elseif ($newInsQty > 0) { // create
@@ -763,11 +790,18 @@ class CreateInvoiceValidation extends CreateRecord
'sticker_master_id' => $sticker->id,
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'invoice_quantity' => $totalExcelQty,
'quantity' => $newInsQty,
'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]);
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where('sticker_master_id', $sticker->id)
->update([
'invoice_quantity' => $totalExcelQty,
]);
$inserted++;
}
}
@@ -1791,6 +1825,7 @@ class CreateInvoiceValidation extends CreateRecord
'sticker_master_id' => $sticker->id,
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'invoice_quantity' => 1,
'quantity' => 1,
'operator_id' => $operatorName,
'created_by' => $operatorName,
@@ -1826,6 +1861,7 @@ class CreateInvoiceValidation extends CreateRecord
'sticker_master_id' => $sticker->id,
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'invoice_quantity' => $bundleQty,
'quantity' => $bundleQty,
'operator_id' => $operatorName,
'created_by' => $operatorName,
@@ -1859,6 +1895,7 @@ class CreateInvoiceValidation extends CreateRecord
'sticker_master_id' => $sticker->id,
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'invoice_quantity' => $totalExcelQty,
'quantity' => $totalExcelQty,
'operator_id' => $operatorName,
'created_by' => $operatorName,
@@ -3347,6 +3384,7 @@ class CreateInvoiceValidation extends CreateRecord
$createdDt = $record->created_at;
$stickMasterId = $record->sticker_master_id;
$curExistQty = $record->quantity;
$curItemInvQty = $record->invoice_quantity;
// $curScanQty = 2;
if ($curExistQty > $curScanQty) { // 5 > 2
@@ -3362,6 +3400,7 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => $serialNumber,
'batch_number' => $batchNumber,
'invoice_quantity' => $curItemInvQty,
'quantity' => $curScanQty,
'created_at' => $createdDt,
'operator_id' => $operatorName,
@@ -3545,6 +3584,7 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
}
// TN01/BOX22/SERIAL999 >> PANEL BOX QR
// /^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/
if (! preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/', $serNo, $matches)) {
Notification::make()

View File

@@ -581,6 +581,9 @@ class InvoiceDataTable extends Component
return [
'sticker_master_id' => $record->sticker_master_id,
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
'invoice_quantity' => $record->invoice_quantity ?? 0,
'scanned_quantity' => ($record->invoice_quantity == null) ? 0 : ($record->invoice_quantity - $record->quantity) ?? 0,
// 'scanned_quantity' => number_format(($record->invoice_quantity == null ? 0 : ($record->invoice_quantity - $record->quantity)), 3, '.', ''),
'quantity' => $record->quantity ?? '',
'serial_number' => $record->serial_number ?? '',
'batch_number' => $record->batch_number ?? '',
@@ -597,12 +600,17 @@ class InvoiceDataTable extends Component
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
if ($matType == 1) {
$row['material_type'] = 'Individual';
$row['invoice_quantity'] = $row['quantity'];
} elseif ($matType == 2) {
$row['material_type'] = 'Bundle';
$row['invoice_quantity'] = $row['quantity'];
} elseif ($matType == 3) {
$row['material_type'] = 'Quantity';
$row['invoice_quantity'] = number_format($row['invoice_quantity'], 3, '.', '');
$row['scanned_quantity'] = number_format($row['scanned_quantity'], 3, '.', '');
} elseif ($matType == 4) {
$row['material_type'] = 'Bundle Individual';
$row['invoice_quantity'] = $row['quantity'];
} else {
$row['material_type'] = 'N/A';
}

View File

@@ -30,6 +30,7 @@ class InvoiceValidation extends Model
'upload_status',
'batch_number',
'quantity',
'invoice_quantity',
'operator_id',
'created_by',
'updated_by',

View File

@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
DB::statement(<<<'SQL'
ALTER TABLE invoice_validations
ADD COLUMN invoice_quantity NUMERIC(10,3) NULL;
SQL);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Schema::table('invoice_validations', function (Blueprint $table) {
// //
// });
}
};

View File

@@ -229,7 +229,9 @@
<th class="border px-4 py-2">No</th>
<th class="border px-4 py-2">Material Code</th>
<th class="border px-4 py-2">Material Type</th>
<th class="border px-4 py-2">Material Quantity</th>
<th class="border px-4 py-2">Invoice Quantity</th>
<th class="border px-4 py-2">To Be Scanned</th>
<th class="border px-4 py-2">Scanned Quantity</th>
<th class="border px-4 py-2">Serial Number</th>
<th class="border px-4 py-2">Batch Number</th>
<th class="border px-4 py-2">TimeStamp</th>
@@ -244,9 +246,23 @@
<td class="border px-4 py-2">{{ $row['material_type'] ?? 'N/A' }}</td>
<td class="border px-4 py-2">
@if(($row['material_type'] ?? '') == 'Individual' || ($row['material_type'] ?? '') == 'Bundle' || ($row['material_type'] ?? '') == 'Bundle Individual')
{{ number_format((float)($row['quantity'] ?? 0), 0) }}
{{ number_format((float)($row['invoice_quantity'] ?? 0), 0) }}
@else
{{ $row['quantity'] ?? 'N/A' }}
{{ $row['invoice_quantity'] ?? 'N/A' }}
@endif
</td>
<td class="border px-4 py-2">
@if(($row['material_type'] ?? '') == 'Individual' || ($row['material_type'] ?? '') == 'Bundle' || ($row['material_type'] ?? '') == 'Bundle Individual')
{{ number_format((float)($row['quantity'] ?? 0), 0) }}
@else
{{ $row['quantity'] ?? 'N/A' }}
@endif
</td>
<td class="border px-4 py-2">
@if(($row['material_type'] ?? '') == 'Individual' || ($row['material_type'] ?? '') == 'Bundle' || ($row['material_type'] ?? '') == 'Bundle Individual')
{{ number_format((float)($row['scanned_quantity'] ?? 0), 0) }}
@else
{{ $row['scanned_quantity'] ?? 'N/A' }}
@endif
</td>
<td class="border px-4 py-2">{{ $row['serial_number'] ?? 'N/A' }}</td>