Project

General

Profile

Bug #4023 » salesitems-priceamount.js

Tri Rizqiaty, 12/03/2025 02:06 PM

 
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); if (selection == undefined) { idx = index; } var taxtype; if (taxtype != '') { taxtype = store.getAt(idx).get('TaxType'); } else { taxtype = '1'; } 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 priceAmount = val.value; var quantityTransaction = store.getAt(idx).get('QuantityTransaction'); var discountpercentage = store.getAt(idx).get('DiscountPercentage'); var discount = (quantityTransaction * priceAmount) * (discountpercentage / 100); var netamount = (quantityTransaction * priceAmount) - discount; netamount = Math.round(netamount); var tax = "0"; var totAmount = 0; if (taxtype === '2') { tax = Math.round(netamount * (parseFloat(persenparam) / 100)); totAmount = (netamount + tax); } else if (taxtype === '1') { var _tax = netamount / ((100 + parseFloat(persenparam)) / 100); tax = Math.round(netamount - _tax); totAmount = netamount; } store.getAt(idx).set('Discount', discount); store.getAt(idx).set('NetAmount', netamount); store.getAt(idx).set('Tax', tax); store.getAt(idx).set('TotAmount', totAmount);
(12-12/12)