aboutsummaryrefslogtreecommitdiff
path: root/src/components/Display/SummaryDisplay.js
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-06-10 08:03:19 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-06-10 08:03:19 +0530
commit33c10cfa027d769c1d02a54bad766f431b1196ee (patch)
treebb487bcecf9944250c5a94267295ec917e087529 /src/components/Display/SummaryDisplay.js
parent86e800430360ac3af422faf1f6f7317aea9b1a19 (diff)
added sgst, cgst, igst support instead of GST as a whole
Diffstat (limited to 'src/components/Display/SummaryDisplay.js')
-rw-r--r--src/components/Display/SummaryDisplay.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/components/Display/SummaryDisplay.js b/src/components/Display/SummaryDisplay.js
index 9b1ca6b..1bcc713 100644
--- a/src/components/Display/SummaryDisplay.js
+++ b/src/components/Display/SummaryDisplay.js
@@ -28,6 +28,7 @@ const getBasicSummary = (items) => {
);
}
+// TODO: remove mutability from this function
const getFullSummary = (items) => {
let totalRawPrice = 0;
let totalDiscount = 0; // to be subtracted from totalRawPrice
@@ -39,7 +40,9 @@ const getFullSummary = (items) => {
totalRawPrice += itemTotalPrice;
totalDiscount += itemDiscount;
- totalTax += (i.GST / 100) * (itemTotalPrice - itemDiscount);
+ totalTax += i.igst === ""
+ ? ((i.sgst + i.cgst) / 100) * (itemTotalPrice - itemDiscount)
+ : (i.igst / 100) * (itemTotalPrice - itemDiscount);
return null;
})
@@ -72,6 +75,8 @@ export const SummaryDisplayTR = (props) => {
<td className={"disabledBorder"}></td>
<td className={"disabledBorder"}></td>
<td className={"disabledBorder"}></td>
+ <td className={"disabledBorder"}></td>
+ <td className={"disabledBorder"}></td>
<td>{summary.TotalRawPrice}</td>
</tr>
);