aboutsummaryrefslogtreecommitdiff
path: root/src/components/Display
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/Display')
-rw-r--r--src/components/Display/DisplayItem.js6
-rw-r--r--src/components/Display/ItemsDisplay.js7
-rw-r--r--src/components/Display/SummaryDisplay.js7
3 files changed, 16 insertions, 4 deletions
diff --git a/src/components/Display/DisplayItem.js b/src/components/Display/DisplayItem.js
index 04a7d8b..02693ab 100644
--- a/src/components/Display/DisplayItem.js
+++ b/src/components/Display/DisplayItem.js
@@ -20,7 +20,11 @@ const DisplayItem = (props) => {
<td className={item.Description === "" ? "leftAlign disabledBorder" : "leftAlign"}>{item.Description}</td>
<td>{item.Quantity}</td>
<td className={item.Discount === 0 ? "disabledBorder" : ""}>{item.Discount}</td>
- <td className={item.GST === props.defGSTValue ? "" : "warningBorder"}>{item.GST}</td>
+
+ <td className={item.cgst === "" ? "disabledBorder" : (props.defGSTValue / 2 ? "" : "warningBorder")}>{item.sgst}</td>
+ <td className={item.sgst === "" ? "disabledBorder" : (props.defGSTValue / 2 ? "" : "warningBorder")}>{item.cgst}</td>
+ <td className={item.igst === "" ? "disabledBorder" : (item.igst === props.defGSTValue ? "" : "warningBorder")}>{item.igst}</td>
+
<td>{item.HSN}</td>
<td>{item.TotalPrice}</td>
</tr>
diff --git a/src/components/Display/ItemsDisplay.js b/src/components/Display/ItemsDisplay.js
index 7afc341..0b2fbf0 100644
--- a/src/components/Display/ItemsDisplay.js
+++ b/src/components/Display/ItemsDisplay.js
@@ -13,6 +13,7 @@ import {SummaryDisplayTR} from "./SummaryDisplay";
const ItemsDisplay = (props) => {
const items = props.items;
+ // TODO: remove mutability
let itemNumber = 0;
// TODO: Add HSN Support
@@ -26,7 +27,9 @@ const ItemsDisplay = (props) => {
<th className={"leftAlign"}>Description</th>
<th>Quantity(NOS)</th>
<th>Discount(%)</th>
- <th>GST(%)</th>
+ <th>sgst(%)</th>
+ <th>cgst(%)</th>
+ <th>igst(%)</th>
<th>HSN</th>
<th>Price</th>
</tr>
@@ -35,7 +38,7 @@ const ItemsDisplay = (props) => {
(item) => {
itemNumber++
return (
- <DisplayItem itemNumber={itemNumber} item={item} defGSTValue={props.defGSTValue}/>
+ <DisplayItem key={itemNumber} itemNumber={itemNumber} item={item} defGSTValue={props.defGSTValue}/>
);
}
)}
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>
);