From b944cfb33efd63c335305f9535054ea4f02acd59 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Mon, 24 Oct 2022 08:49:21 +0530 Subject: fix calculation mistakes --- src/classes/item.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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)), -- cgit v1.2.3