Project

General

Profile

Bug #4023 » purchitem-materialqty.js

Tri Rizqiaty, 11/28/2025 03:33 PM

 
1
var store = Ext.StoreMgr.lookup("storePTRPURCHITEM"); if (store != undefined) { var grid = Ext.getCmp(gridName); var selection = grid.getView().getSelectionModel().getSelection()[0]; var idx = grid.store.indexOf(selection); var val = Number(val.value); var materialQuantity = isNaN(val) ? 0 : val; var priceAmount = store.getAt(idx).get('PriceAmount'); var discount = store.getAt(idx).get('Discount'); var discountpercentage = store.getAt(idx).get('DiscountPercentage'); if (discountpercentage > 0) { discount = (materialQuantity * priceAmount) * (discountpercentage / 100) } else { discount = 0 } var netAmount = (materialQuantity * priceAmount) - discount; store.getAt(idx).set('NetAmount', netAmount); var persenparam = '0'; Ext.Ajax.request({ async: false, method: 'POST', url: '/UserControl/GetStore', params: { tableName: 'PCMEPGENPARAM', param: 'Parameter[=]TAXPPNPERCENTAGE' }, success: function (response) { var results = Ext.decode(response.responseText); persenparam = results.data[0].Value1; console.log(persenparam); } }); var taxtype = undefined; if (taxtype != '') { taxtype = store.getAt(idx).get('TaxType'); } else { taxtype = '1'; } var totAmount = '0'; if (taxtype === '2') { tax = Math.round(netAmount * (parseFloat(persenparam) / 100)); totAmount = (netAmount + tax); } else if (taxtype === '1') { tax = Math.round(netAmount - (netAmount / ((100 + parseFloat(persenparam)) / 100))); totAmount = netAmount + tax; } store.getAt(idx).set('TotAmount', totAmount); store.getAt(idx).set('Tax', tax); store.getAt(idx).set('Discount', discount); }
(4-4/12)