Support #1900 » Discount 20230124.js
1 |
var store = Ext.StoreMgr.lookup("storePTRSALESITEMS"); var grid = Ext.getCmp(gridName); var selection = grid.getView().getSelectionModel().getSelection()[0]; var idx = grid.store.indexOf(selection); var discount = val.value; var priceAmount = store.getAt(idx).get('PriceAmount'); var quantityTransaction = store.getAt(idx).get('QuantityTransaction'); var netAmount = (quantityTransaction * priceAmount) - discount; var taxPercent = parseFloat(Ext.ComponentQuery.query('[name=TaxPercentage][nameTable=PTRSALESHEADER]')[0].getValue()) / 100; console.log(taxPercent); if (taxPercent == undefined) { taxPercent = 0; } else { taxPercent = taxPercent; } var tax = "0"; var totAmount = 0; if (store.getAt(idx).get('TaxType') == '1') { var _tax = Math.round(netAmount / (1 + taxPercent)); tax = Math.round(netAmount - _tax); totAmount = netAmount; } else if (store.getAt(idx).get('TaxType') == '2') { tax = Math.round(netAmount * taxPercent); totAmount = (netAmount + tax); } else { var _tax = Math.round(netAmount / (1 + taxPercent)); tax = Math.round(netAmount - _tax); totAmount = netAmount; } store.getAt(idx).set('NetAmount', netAmount); store.getAt(idx).set('Tax', tax); store.getAt(idx).set('TotAmount', totAmount); |
---|---|
2 |
|