aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-10-24 08:49:21 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-10-24 08:49:21 +0530
commitb944cfb33efd63c335305f9535054ea4f02acd59 (patch)
tree1adbb1db9b40c9c858b1de7436953f50c28bc42b
parente9a121ab7b924f189959a936743fcf70cb99f7ae (diff)
fix calculation mistakes
-rw-r--r--src/classes/item.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/classes/item.js b/src/classes/item.js
index aa0dd0c..63f65ca 100644
--- a/src/classes/item.js
+++ b/src/classes/item.js
@@ -79,10 +79,10 @@ export const getDiscountValue = (item) =>
currency(item.UnitPrice).multiply(item.Quantity).divide(100).multiply(item.DiscountPercentage)
export const getGSTValue = (item) => item.GSTPercentage > 0
- ? currency(item.UnitPrice).multiply(item.Quantity).subtract(getDiscountValue).divide(100).multiply(item.GSTPercentage) : currency(0.00)
+ ? currency(item.UnitPrice).multiply(item.Quantity).subtract(getDiscountValue(item)).divide(100).multiply(item.GSTPercentage) : currency(0.00)
export const getAmount = (item) =>
- currency(item.UnitPrice).multiply(item.Quantity).add(getDiscountValue(item)).add(getGSTValue(item))
+ currency(item.UnitPrice).multiply(item.Quantity).subtract(getDiscountValue(item)).add(getGSTValue(item))
export const calcSum = (items) => items.reduce((prev, current, id, arr) => ({
GST: prev.GST.add(getGSTValue(current)),