1
0
forked from poc/pds

Refactor invoice processing to reset form fields after completion

This commit is contained in:
dhanabalan
2025-11-20 18:08:52 +05:30
parent e20e402233
commit c7391b113f

View File

@@ -171,6 +171,16 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => null,
'serial_number' => null,
'total_quantity' => 0,
'update_invoice' => false,
'scanned_quantity'=> 0
]);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: false);
}
else
@@ -829,7 +839,7 @@ class CreateInvoiceValidation extends CreateRecord
{
Notification::make()
->title("Completed: Serial Invoice")
->body("Serial invoice '$invoiceNumber' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed.!")
->body("Serial invoice '$invoiceNumber' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed..!")
->warning()
->seconds(3)
->send();
@@ -845,6 +855,16 @@ class CreateInvoiceValidation extends CreateRecord
$disk->delete($filePath);
}
$this->dispatch('playNotificationSound');
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => null,
'serial_number' => null,
'total_quantity' => 0,
'update_invoice' => false,
'scanned_quantity'=> 0
]);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: true);
}
else
@@ -2388,15 +2408,6 @@ class CreateInvoiceValidation extends CreateRecord
->send();
$this->dispatch('playNotificationSound');
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanMQuan,
]);
$filename = $invoiceNumber . '.xlsx';
$directory = 'uploads/temp';
$disk = Storage::disk('local');
@@ -2406,6 +2417,16 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => null,
'serial_number' => null,
'total_quantity' => 0,
'update_invoice' => false,
'scanned_quantity'=> 0
]);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: false);
return;
}
@@ -3139,15 +3160,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound');
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scannedMQuantity,
]);
$filename = $invoiceNumber . '.xlsx';
$directory = 'uploads/temp';
$disk = Storage::disk('local');
@@ -3157,6 +3169,16 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => null,
'serial_number' => null,
'total_quantity' => 0,
'update_invoice' => false,
'scanned_quantity'=> 0
]);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: false);
}
else
@@ -3186,15 +3208,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound');
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan,
]);
$filename = $invoiceNumber . '.xlsx';
$directory = 'uploads/temp';
$disk = Storage::disk('local');
@@ -3204,6 +3217,16 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => null,
'serial_number' => null,
'total_quantity' => 0,
'update_invoice' => false,
'scanned_quantity'=> 0
]);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: true);
return;
}
@@ -3640,6 +3663,16 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => null,
'serial_number' => null,
'total_quantity' => 0,
'update_invoice' => false,
'scanned_quantity'=> 0
]);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: true);
}
else
@@ -3806,6 +3839,16 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => null,
'serial_number' => null,
'total_quantity' => 0,
'update_invoice' => false,
'scanned_quantity'=> 0
]);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: true);
}
else
@@ -4074,6 +4117,16 @@ class CreateInvoiceValidation extends CreateRecord
//$fullPath = $disk->path($filePath);
$disk->delete($filePath);
}
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => null,
'serial_number' => null,
'total_quantity' => 0,
'update_invoice' => false,
'scanned_quantity'=> 0
]);
$this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: true);
}
else