diff --git a/CPRNIMS.WebApps/Views/Shared/PagesView/PO/_POScripts.cshtml b/CPRNIMS.WebApps/Views/Shared/PagesView/PO/_POScripts.cshtml
index 0724689..f78d49c 100644
--- a/CPRNIMS.WebApps/Views/Shared/PagesView/PO/_POScripts.cshtml
+++ b/CPRNIMS.WebApps/Views/Shared/PagesView/PO/_POScripts.cshtml
@@ -23,7 +23,7 @@
-
+
diff --git a/CPRNIMS.WebApps/wwwroot/JsFunctions/PO/POPutPostV5.js b/CPRNIMS.WebApps/wwwroot/JsFunctions/PO/POPutPostV6.js
similarity index 98%
rename from CPRNIMS.WebApps/wwwroot/JsFunctions/PO/POPutPostV5.js
rename to CPRNIMS.WebApps/wwwroot/JsFunctions/PO/POPutPostV6.js
index 3cdc6e9..4088ea6 100644
--- a/CPRNIMS.WebApps/wwwroot/JsFunctions/PO/POPutPostV5.js
+++ b/CPRNIMS.WebApps/wwwroot/JsFunctions/PO/POPutPostV6.js
@@ -291,8 +291,7 @@ function updateExistingPO() {
}
let Discount = $('#discount').val();
let IsUpdate = true;
- console.log('Discount', Discount);
- console.log('countryOrigin', CountryOrigin);
+
showConfirmation({
title: 'Update Purchase Order',
message: 'Are you sure you want to update this PO? This action cannot be undone.',
@@ -463,36 +462,41 @@ function prItemList() {
PRItemList = [];
poDataTable = $('#PODataTable').DataTable();
- poDataTable.rows().data().each(function (data, index) {
- var $row = $(poDataTable.row(index).node());
+ poDataTable.rows().every(function () {
+ var data = this.data();
+ var $row = $(this.node());
+
var Quantity = parseFloat($row.find('.qty').eq(0).val());
var UnitPrice = parseFloat($row.find('.unitPrice').eq(0).val());
var Specification = $row.find('.specification').eq(0).val();
- if (isNaN(Quantity) || Quantity <= 0 || Quantity == '0') {
+ if (isNaN(Quantity) || Quantity <= 0) {
showToast('error', 'Item for ' + data.specification + ' Qty cannot be empty or zero!',
'Creation of purchase order failed!', 4000);
isValid = false;
}
- if (isNaN(UnitPrice) || UnitPrice <= 0 || UnitPrice == '0') {
+ if (isNaN(UnitPrice) || UnitPrice <= 0) {
showToast('error', 'Item for ' + data.itemNo + ' Unit Price cannot be empty or zero!',
'Creation of purchase order failed!', 4000);
isValid = false;
}
- if (!Specification || Specification=='undefined') {
+ if (!Specification || Specification === 'undefined') {
showToast('error', 'Item for ' + data.itemNo + ' Specification cannot be empty or undefined!',
'Creation of purchase order failed!', 4000);
isValid = false;
}
+
PRItemList.push({
PRNo: data.prNo,
PRDetailsId: data.prDetailsId,
+ ItemNo: data.itemNo,
Specification: Specification,
Quantity: Quantity,
UnitPrice: UnitPrice,
Amount: parseFloat(Quantity * UnitPrice)
});
});
+
if (PRItemList.length === 0) {
showToast('error', 'Please select an item in the list!',
'Creation of purchase order failed!', 4000);