+
-
diff --git a/src/components/QuoteSummary.jsx b/src/components/QuoteSummary.jsx
index 8dc8245..b029b67 100644
--- a/src/components/QuoteSummary.jsx
+++ b/src/components/QuoteSummary.jsx
@@ -24,7 +24,11 @@ export default function QuoteSummary({ items, customer, shippingCost, onShipping
};
const calculateSubtotal = () => {
- return items.reduce((total, item) => total + (item.Price * item.quantity), 0);
+ return items.reduce((total, item) => {
+ const itemTotal = item.Price * item.quantity;
+ const discountAmount = itemTotal * ((item.discount || 0) / 100);
+ return total + (itemTotal - discountAmount);
+ }, 0);
};
const subtotal = calculateSubtotal();
@@ -55,30 +59,37 @@ export default function QuoteSummary({ items, customer, shippingCost, onShipping
Item ID |
Description |
Unit Price |
+
Discount |
Quantity |
Total |
Action |
- {items.map((item, index) => (
-
- | {item['Item ID']} |
- {item.Description} |
- {formatCurrency(item.Price)} |
- {item.quantity} |
- {formatCurrency(item.Price * item.quantity)} |
-
-
- |
-
- ))}
+ {items.map((item, index) => {
+ const itemTotal = item.Price * item.quantity;
+ const discountAmount = itemTotal * ((item.discount || 0) / 100);
+ const finalPrice = itemTotal - discountAmount;
+ return (
+
+ | {item['Item ID']} |
+ {item.Description} |
+ {formatCurrency(item.Price)} |
+ {item.discount ? `${item.discount}%` : '-'} |
+ {item.quantity} |
+ {formatCurrency(finalPrice)} |
+
+
+ |
+
+ );
+ })}