fixing bugs in custom po for unit price consistency
This commit is contained in:
parent
f2aee9645d
commit
6710f04bd7
@ -23,7 +23,7 @@
|
|||||||
<script src="~/jsfunctions/po/POVarV6.js"></script>
|
<script src="~/jsfunctions/po/POVarV6.js"></script>
|
||||||
<script src="~/jsfunctions/po/POViewV5.js"></script>
|
<script src="~/jsfunctions/po/POViewV5.js"></script>
|
||||||
<script src="~/jsfunctions/po/PopulateDopdownV4.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/po/rowCallBackV6.js"></script>
|
||||||
|
|
||||||
<script src="~/jsfunctions/utilities/NewStyle.js"></script>
|
<script src="~/jsfunctions/utilities/NewStyle.js"></script>
|
||||||
|
|||||||
@ -291,8 +291,7 @@ function updateExistingPO() {
|
|||||||
}
|
}
|
||||||
let Discount = $('#discount').val();
|
let Discount = $('#discount').val();
|
||||||
let IsUpdate = true;
|
let IsUpdate = true;
|
||||||
console.log('Discount', Discount);
|
|
||||||
console.log('countryOrigin', CountryOrigin);
|
|
||||||
showConfirmation({
|
showConfirmation({
|
||||||
title: 'Update Purchase Order',
|
title: 'Update Purchase Order',
|
||||||
message: 'Are you sure you want to update this PO? This action cannot be undone.',
|
message: 'Are you sure you want to update this PO? This action cannot be undone.',
|
||||||
@ -463,36 +462,41 @@ function prItemList() {
|
|||||||
PRItemList = [];
|
PRItemList = [];
|
||||||
poDataTable = $('#PODataTable').DataTable();
|
poDataTable = $('#PODataTable').DataTable();
|
||||||
|
|
||||||
poDataTable.rows().data().each(function (data, index) {
|
poDataTable.rows().every(function () {
|
||||||
var $row = $(poDataTable.row(index).node());
|
var data = this.data();
|
||||||
|
var $row = $(this.node());
|
||||||
|
|
||||||
var Quantity = parseFloat($row.find('.qty').eq(0).val());
|
var Quantity = parseFloat($row.find('.qty').eq(0).val());
|
||||||
var UnitPrice = parseFloat($row.find('.unitPrice').eq(0).val());
|
var UnitPrice = parseFloat($row.find('.unitPrice').eq(0).val());
|
||||||
var Specification = $row.find('.specification').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!',
|
showToast('error', 'Item for ' + data.specification + ' Qty cannot be empty or zero!',
|
||||||
'Creation of purchase order failed!', 4000);
|
'Creation of purchase order failed!', 4000);
|
||||||
isValid = false;
|
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!',
|
showToast('error', 'Item for ' + data.itemNo + ' Unit Price cannot be empty or zero!',
|
||||||
'Creation of purchase order failed!', 4000);
|
'Creation of purchase order failed!', 4000);
|
||||||
isValid = false;
|
isValid = false;
|
||||||
}
|
}
|
||||||
if (!Specification || Specification=='undefined') {
|
if (!Specification || Specification === 'undefined') {
|
||||||
showToast('error', 'Item for ' + data.itemNo + ' Specification cannot be empty or undefined!',
|
showToast('error', 'Item for ' + data.itemNo + ' Specification cannot be empty or undefined!',
|
||||||
'Creation of purchase order failed!', 4000);
|
'Creation of purchase order failed!', 4000);
|
||||||
isValid = false;
|
isValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRItemList.push({
|
PRItemList.push({
|
||||||
PRNo: data.prNo,
|
PRNo: data.prNo,
|
||||||
PRDetailsId: data.prDetailsId,
|
PRDetailsId: data.prDetailsId,
|
||||||
|
ItemNo: data.itemNo,
|
||||||
Specification: Specification,
|
Specification: Specification,
|
||||||
Quantity: Quantity,
|
Quantity: Quantity,
|
||||||
UnitPrice: UnitPrice,
|
UnitPrice: UnitPrice,
|
||||||
Amount: parseFloat(Quantity * UnitPrice)
|
Amount: parseFloat(Quantity * UnitPrice)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (PRItemList.length === 0) {
|
if (PRItemList.length === 0) {
|
||||||
showToast('error', 'Please select an item in the list!',
|
showToast('error', 'Please select an item in the list!',
|
||||||
'Creation of purchase order failed!', 4000);
|
'Creation of purchase order failed!', 4000);
|
||||||
Loading…
Reference in New Issue
Block a user