Project

General

Profile

Bug #1525 ยป PTRSALESITEMS - DiscountPercentage.js

Tri Rizqiaty, 08/26/2022 11:25 AM

 
1
var store = Ext.StoreMgr.lookup("storePTRSALESITEMS");
2
var grid = Ext.getCmp(gridName);
3
var selection = grid.getView().getSelectionModel().getSelection()[0];
4
var idx = grid.store.indexOf(selection);
5
var discountPercentage = val.value;
6
var priceAmount = store.getAt(idx).get('PriceAmount');
7
var quantityTransaction = store.getAt(idx).get('QuantityTransaction');
8
var discount = priceAmount * quantityTransaction * discountPercentage / 100;
9
store.getAt(idx).set('Discount', discount);
10
var netAmount = (quantityTransaction * priceAmount) - discount;
11
if (store.getAt(idx).get('TaxType') == '1') {
12
    var totAmount = netAmount;
13
    store.getAt(idx).set('TotAmount', totAmount);
14
}
15
store.getAt(idx).set('NetAmount', netAmount);
    (1-1/1)