fixing bugs in custom po for unit price consistency

This commit is contained in:
rowell_m_soriano 2026-05-21 13:55:15 +08:00
parent f2aee9645d
commit 6710f04bd7
2 changed files with 12 additions and 8 deletions

View File

@ -23,7 +23,7 @@
<script src="~/jsfunctions/po/POVarV6.js"></script>
<script src="~/jsfunctions/po/POViewV5.js"></script>
<script src="~/jsfunctions/po/PopulateDopdownV4.js"></script>
<script src="~/jsfunctions/po/POPutPostV5.js"></script>
<script src="~/jsfunctions/po/POPutPostV6.js"></script>
<script src="~/jsfunctions/po/rowCallBackV6.js"></script>
<script src="~/jsfunctions/utilities/NewStyle.js"></script>

View File

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