aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-04-18 13:37:12 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-04-18 13:37:12 +0530
commitb7c32d7ea171ce460d07af316220758ebde9893c (patch)
treef976df8b4bd28afcd62a4da6832bbd5235e26bde
parentbb331d9c61a0e38cbbfc891204819557327e1ca0 (diff)
Bug Fix: now the total price of an item is the multiple of it's unit price and quantity like it should be
-rw-r--r--package.json1
-rw-r--r--src/components/Display/DisplayItem.js2
-rw-r--r--src/components/Display/SummaryDisplay.js2
-rw-r--r--src/components/Form/AddNewItemForm.js3
4 files changed, 5 insertions, 3 deletions
diff --git a/package.json b/package.json
index 3a6b8e2..2b0dece 100644
--- a/package.json
+++ b/package.json
@@ -2,6 +2,7 @@
"name": "openbills",
"version": "0.1.0",
"private": true,
+ "proxy": "http://localhost:4000",
"dependencies": {
"@testing-library/jest-dom": "^5.11.10",
"@testing-library/react": "^11.2.5",
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) => {
<td className={item.Discount === 0 ? "disabledBorder" : ""}>{item.Discount}</td>
<td className={item.GST === props.defGSTValue ? "" : "warningBorder"}>{item.GST}</td>
<td>{item.HSN}</td>
- <td>{item.Price}</td>
+ <td>{item.TotalPrice}</td>
</tr>
);
}
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)