From 240d7d56459c656c86330755c7a0b9000a090f77 Mon Sep 17 00:00:00 2001
From: MikunoNaka <bokuwakanojogahoshii@yahoo.com>
Date: Sun, 27 Jun 2021 13:27:33 +0530
Subject: Bug Fix: Discount not being calculated for every item but only one

---
 src/components/Form/Items/AddNewItemForm.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/components/Form/Items/AddNewItemForm.tsx')

diff --git a/src/components/Form/Items/AddNewItemForm.tsx b/src/components/Form/Items/AddNewItemForm.tsx
index 2c4669d..3d4e65f 100644
--- a/src/components/Form/Items/AddNewItemForm.tsx
+++ b/src/components/Form/Items/AddNewItemForm.tsx
@@ -70,7 +70,7 @@ const AddNewItemForm: React.FC<props> = (props) => {
           const totalValue: number = itemPriceValue * itemQTYValue;
 
           // the values below are being rounded to two decimal places
-          const discountValue: number = parseFloat(((itemDiscountPercentage / 100) * itemPriceValue).toFixed(2))
+          const discountValue: number = parseFloat(((itemDiscountPercentage / 100) * totalValue).toFixed(2))
           const totalGSTValue: number = parseFloat(((itemGSTPercentage / 100) * totalValue).toFixed(2))
 
           const newInvoiceItem: Item = {
-- 
cgit v1.2.3

