Support #1900 » Price Amount 20230124.js
1 |
var store = Ext.StoreMgr.lookup("storePTRSALESITEMS"); |
---|---|
2 |
var idx = store.getCount() - 1; |
3 |
var priceAmount = val.value; |
4 |
var discountPercentage = store.getAt(idx).get('DiscountPercentage'); |
5 |
var quantityTransaction = store.getAt(idx).get('QuantityTransaction'); |
6 |
var discount = priceAmount * quantityTransaction * discountPercentage / 100; |
7 |
var netAmount = (quantityTransaction * priceAmount) - discount; |
8 |
var taxPercent = parseFloat(Ext.ComponentQuery.query('[name=TaxPercentage][nameTable=PTRSALESHEADER]')[0].getValue()) / 100; |
9 |
console.log(taxPercent); |
10 |
if (taxPercent == undefined) { |
11 |
taxPercent = 0; |
12 |
} else { |
13 |
taxPercent = taxPercent; |
14 |
}
|
15 |
var tax = "0"; |
16 |
var totAmount = 0; |
17 |
if (store.getAt(idx).get('TaxType') == '1') { |
18 |
var _tax = Math.round(netAmount / (1 + taxPercent)); |
19 |
tax = Math.round(netAmount - _tax); |
20 |
totAmount = netAmount; |
21 |
} else if (store.getAt(idx).get('TaxType') == '2') { |
22 |
tax = Math.round(netAmount * taxPercent); |
23 |
totAmount = (netAmount + tax); |
24 |
} else { |
25 |
var _tax = Math.round(netAmount / (1 + taxPercent)); |
26 |
tax = Math.round(netAmount - _tax); |
27 |
totAmount = netAmount; |
28 |
}
|
29 |
store.getAt(idx).set('Discount', discount); |
30 |
store.getAt(idx).set('NetAmount', netAmount); |
31 |
store.getAt(idx).set('Tax', tax); |
32 |
store.getAt(idx).set('TotAmount', totAmount); |
- « Previous
- 1
- …
- 3
- 4
- 5
- Next »