diff --git a/App/pelagia-portal/components/po/po-line-items-editor.tsx b/App/pelagia-portal/components/po/po-line-items-editor.tsx index bbfbfd5..ebddbbe 100644 --- a/App/pelagia-portal/components/po/po-line-items-editor.tsx +++ b/App/pelagia-portal/components/po/po-line-items-editor.tsx @@ -127,18 +127,18 @@ export function LineItemsEditor({ items, onChange, readOnly = false, originalIte {item.description} - {qtyChanged && {Number(orig.quantity)}} - {item.quantity} + {qtyChanged && {Number(orig.quantity)}} + {item.quantity} {item.unit} {hasSize && {item.size ?? "—"}} - {priceChanged && {formatCurrency(Number(orig.unitPrice))}} - {formatCurrency(item.unitPrice)} + {priceChanged && {formatCurrency(Number(orig.unitPrice))}} + {formatCurrency(item.unitPrice)} - {formatCurrency(taxableAmt)} + {formatCurrency(taxableAmt)} {Math.round((item.gstRate ?? 0.18) * 100)}% - {formatCurrency(taxableAmt + gstAmt)} + {formatCurrency(taxableAmt + gstAmt)} ); })} @@ -146,15 +146,15 @@ export function LineItemsEditor({ items, onChange, readOnly = false, originalIte Taxable subtotal - {formatCurrency(taxable)} + {formatCurrency(taxable)} GST - {formatCurrency(gst)} + {formatCurrency(gst)} Grand Total - {formatCurrency(grand)} + {formatCurrency(grand)} @@ -248,7 +248,7 @@ export function LineItemsEditor({ items, onChange, readOnly = false, originalIte - + {formatCurrency(taxableAmt * (1 + gstR))} @@ -269,15 +269,15 @@ export function LineItemsEditor({ items, onChange, readOnly = false, originalIte Taxable subtotal - {formatCurrency(taxable)} + {formatCurrency(taxable)} GST - {formatCurrency(gst)} + {formatCurrency(gst)} Grand Total - {formatCurrency(grand)} + {formatCurrency(grand)} diff --git a/App/pelagia-portal/lib/utils.ts b/App/pelagia-portal/lib/utils.ts index c79ea91..5ad136e 100644 --- a/App/pelagia-portal/lib/utils.ts +++ b/App/pelagia-portal/lib/utils.ts @@ -6,12 +6,10 @@ export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } -export function formatCurrency(amount: number | string, _currency = "INR"): string { - const formatted = new Intl.NumberFormat("en-IN", { - minimumFractionDigits: 2, - maximumFractionDigits: 2, - }).format(Number(amount)); - return `₹${formatted}`; +export function formatCurrency(amount: number | string, currency = "INR"): string { + return new Intl.NumberFormat("en-IN", { style: "currency", currency }).format( + Number(amount) + ); } export function formatDate(date: Date | string): string {