From 2392a96eb86e7f1dad8b05c5972a8a9ead6334f8 Mon Sep 17 00:00:00 2001 From: "pramod.mahajan" Date: Wed, 3 Dec 2025 16:02:36 +0530 Subject: [PATCH] added new column proform amount --- src/components/purchase/Purchasetable.jsx | 11 ++ src/components/purchase/ViewPurchase.jsx | 123 +++++++++++++++++----- src/utils/appUtils.js | 2 +- 3 files changed, 107 insertions(+), 29 deletions(-) diff --git a/src/components/purchase/Purchasetable.jsx b/src/components/purchase/Purchasetable.jsx index 614cc269..abc1176b 100644 --- a/src/components/purchase/Purchasetable.jsx +++ b/src/components/purchase/Purchasetable.jsx @@ -49,6 +49,17 @@ export const PurchaseColumn = [ ); }, }, + { + key: "proformaInvoiceAmount", + label: "Proforma Amount", + className: "text-end", + render: (item) => ( + + {formatFigure(item?.proformaInvoiceAmount, { type: "currency" })} + + ), + }, + { key: "totalAmount", label: "Total Amount", diff --git a/src/components/purchase/ViewPurchase.jsx b/src/components/purchase/ViewPurchase.jsx index 3d5c7507..d2a16ec6 100644 --- a/src/components/purchase/ViewPurchase.jsx +++ b/src/components/purchase/ViewPurchase.jsx @@ -2,7 +2,7 @@ import React from "react"; import { usePurchase } from "../../hooks/usePurchase"; import { SpinnerLoader } from "../common/Loader"; import { formatUTCToLocalTime } from "../../utils/dateUtils"; -import { getColorNameFromHex } from "../../utils/appUtils"; +import { formatFigure, getColorNameFromHex } from "../../utils/appUtils"; const ViewPurchase = ({ purchaseId }) => { const { data, isLoading, isError, error } = usePurchase(purchaseId); @@ -25,11 +25,14 @@ const ViewPurchase = ({ purchaseId }) => {

- + {data?.status?.displayName || "NA"}
- @@ -38,11 +41,15 @@ const ViewPurchase = ({ purchaseId }) => {

Purchase Details

-

Title:

+

+ Title: +

{data?.title}

-

Description:

+

+ Description: +

{data?.description}

@@ -56,68 +63,87 @@ const ViewPurchase = ({ purchaseId }) => {
{/* Project Name */}
-

Project Name:

+

+ Project Name: +

{data?.project?.name}

{/* Organization Name */}
-

Organization:

+

+ Organization: +

{data?.organization?.name}

{/* Email */}
-

Email:

+

+ Email: +

{data?.organization?.email}

{/* Contact Number */}
-

Contact:

+

+ Contact: +

{data?.organization?.contactNumber}

{/* Address */}
-

Address:

+

+ Address: +

{data?.organization?.address}

-

Supplier

{/* Supplier Name */}
-

Name:

+

+ Name: +

{data?.supplier?.name}

{/* Contact Person */}
-

Contact Person:

+

+ Contact Person: +

{data?.supplier?.contactPerson}

{/* Email */}
-

Email:

+

+ Email: +

{data?.supplier?.email}

{/* Contact Number */}
-

Contact:

+

+ Contact: +

{data?.supplier?.contactNumber}

{/* Address */}
-

Address:

+

+ Address: +

{data?.supplier?.address}

@@ -132,22 +158,26 @@ const ViewPurchase = ({ purchaseId }) => {

Invoice No:

-

{data?.invoiceNumber}

+

{data?.invoiceNumber ?? "NA"}

Proforma No:

-

{data?.proformaInvoiceNumber}

+

+ {data?.proformaInvoiceNumber ?? "NA"} +

E-Way Bill:

-

{data?.eWayBillNumber}

+

{data?.eWayBillNumber ?? "NA"}

PO No:

-

{data?.purchaseOrderNumber}

+

+ {data?.purchaseOrderNumber ?? "NA"} +

@@ -156,28 +186,36 @@ const ViewPurchase = ({ purchaseId }) => {

Invoice Date:

- {formatUTCToLocalTime(data?.invoiceDate)} + {data?.invoiceDate + ? formatUTCToLocalTime(data?.invoiceDate) + : "NA"}

Proforma Date:

- {formatUTCToLocalTime(data?.proformaInvoiceDate)} + {data?.proformaInvoiceDate + ? formatUTCToLocalTime(data?.proformaInvoiceDate) + : "NA"}

E-Way Date:

- {formatUTCToLocalTime(data?.eWayBillDate)} + {data?.eWayBillDate + ? formatUTCToLocalTime(data?.eWayBillDate) + : "NA"}

PO Date:

- {formatUTCToLocalTime(data?.purchaseOrderDate)} + {data?.purchaseOrderDate + ? formatUTCToLocalTime(data?.purchaseOrderDate) + : "NA"}

@@ -189,26 +227,55 @@ const ViewPurchase = ({ purchaseId }) => {

Amount Summary

+
+

Proforma Amount

+

+ {formatFigure(data?.proformaInvoiceAmount, { + type: "currency", + currency: "INR", + })} +

+

Base Amount

-

₹ {data?.baseAmount}

+

+ {formatFigure(data?.baseAmount, { + type: "currency", + currency: "INR", + })} +

Tax

-

₹ {data?.taxAmount}

+

+ {formatFigure(data?.taxAmount, { + type: "currency", + currency: "INR", + })} +

Transport

-

₹ {data?.transportCharges}

+

+ {formatFigure(data?.transportCharges, { + type: "currency", + currency: "INR", + })} +


Total - ₹ {data?.totalAmount} + + {formatFigure(data?.totalAmount, { + type: "currency", + currency: "INR", + })} +
diff --git a/src/utils/appUtils.js b/src/utils/appUtils.js index 7daa6f5e..0a3fc50c 100644 --- a/src/utils/appUtils.js +++ b/src/utils/appUtils.js @@ -137,7 +137,7 @@ export const formatFigure = ( maximumFractionDigits = 2, } = {} ) => { - if (amount == null || isNaN(amount)) return "-"; + if (amount == null || isNaN(amount)) return "--"; const formatterOptions = { style: