From b7c32d7ea171ce460d07af316220758ebde9893c Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Sun, 18 Apr 2021 13:37:12 +0530 Subject: Bug Fix: now the total price of an item is the multiple of it's unit price and quantity like it should be --- src/components/Display/DisplayItem.js | 2 +- src/components/Display/SummaryDisplay.js | 2 +- src/components/Form/AddNewItemForm.js | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/components') diff --git a/src/components/Display/DisplayItem.js b/src/components/Display/DisplayItem.js index 472ae47..4bd1b97 100644 --- a/src/components/Display/DisplayItem.js +++ b/src/components/Display/DisplayItem.js @@ -14,7 +14,7 @@ const DisplayItem = (props) => { {item.Discount} {item.GST} {item.HSN} - {item.Price} + {item.TotalPrice} ); } diff --git a/src/components/Display/SummaryDisplay.js b/src/components/Display/SummaryDisplay.js index 1110358..27ebe0b 100644 --- a/src/components/Display/SummaryDisplay.js +++ b/src/components/Display/SummaryDisplay.js @@ -6,7 +6,7 @@ const getSummary = (items) => { let totalQuantity = 0; for (let i = 0; i < items.length; i++) { - totalRawPrice += items[i].Price; + totalRawPrice += items[i].TotalPrice; totalQuantity += items[i].Quantity } diff --git a/src/components/Form/AddNewItemForm.js b/src/components/Form/AddNewItemForm.js index 798bfc9..32784ca 100644 --- a/src/components/Form/AddNewItemForm.js +++ b/src/components/Form/AddNewItemForm.js @@ -60,7 +60,8 @@ const AddNewItemForm = (props) => { "Model": itemNameValue, "Description": itemDescValue, "Quantity": parseInt(itemQtyValue), - "Price": parseFloat(itemPriceValue), + "SinglePrice": parseFloat(itemPriceValue), + "TotalPrice": parseFloat(itemPriceValue * itemQtyValue), "Discount": parseInt(itemDiscountValue), "HSN": parseInt(itemHSNValue), "GST": parseInt(itemGSTValue) -- cgit v1.2.3