diff --git a/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdInvoice.jsx b/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdInvoice.jsx index 1ea447b..afdb24e 100644 --- a/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdInvoice.jsx +++ b/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdInvoice.jsx @@ -16,7 +16,7 @@ const PurchaseOrdInvoice = ({ BranchData, printDatas, BankDetails -}) => { +}) => { const GlobaldummyData = useSelector(GlobalPritdummyData); let BillName = printDatas?.PrintHdrName // Function to convert number to words @@ -52,9 +52,9 @@ const PurchaseOrdInvoice = ({ city: BranchData?.City || "", state: BranchData?.State || "", zip: BranchData?.Zip || "" - }, + }, companyGSTIN: BranchData?.CompGSTIN || BranchData?.BrGSTIN || "", - companyEmail: BranchData?.companyEmail || BranchData?.companyEmail ||"", + companyEmail: BranchData?.companyEmail || BranchData?.companyEmail || "", companyMobile: BranchData?.BrMobile || "", companyMobile2: BranchData?.BrMobile2 || "", @@ -67,7 +67,7 @@ const PurchaseOrdInvoice = ({ // Customer Details - mapped from A4Standard CustomerDetails array customerName: table2Data?.CustomerDetails?.[0]?.CustSuppName || table2Data?.CustSuppName - || "", + || "", customerMobile: table2Data?.CustomerDetails?.[0]?.MobileNo || table2Data?.BrMobile || "", customerGSTIN: table2Data?.CustomerDetails?.[0]?.CustGSTNo || table2Data?.CustGSTIN || "", customerAddress: { @@ -82,13 +82,13 @@ const PurchaseOrdInvoice = ({ // Totals - mapped from A4Standard totalAmount: Number(table2Data?.BillAmount || table2Data?.TotalAmt || 0), taxAmount: Number(OrderDetailGST), - grandTotal: Number(table2Data?.NetAmount || table2Data?.GrandTotal|| 0), + grandTotal: Number(table2Data?.NetAmount || table2Data?.GrandTotal || 0), totalBillAmount: Number(table2Data?.BillAmount || table2Data?.NetAmount || 0), // Bank Details - mapped from A4Standard bankDetails: BankDetails?.[0] || "" }; - console.log(printDatas, "Date1Date1", invoiceData, ) + console.log(printDatas, "Date1Date1", invoiceData,) let PageSize = printDatas?.PageSize @@ -135,7 +135,7 @@ const PurchaseOrdInvoice = ({ dataSource = []; } - console.log("Final DataSource:", table2Data, ); + console.log("Final DataSource:", table2Data,); const paginatedChunks = []; @@ -159,6 +159,36 @@ const PurchaseOrdInvoice = ({ paginatedChunks.push([]); // Empty chunk for footer-only page } + let printColors = printDatas?.PrintColors; + const headerColor = printColors?.find(obj => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find(obj => obj.tableHeaderColor)?.tableHeaderColor; + const tableBodyColor = printColors?.find(obj => obj.tableBodyColor)?.tableBodyColor; + const footerColor = printColors?.find(obj => obj.footerColor)?.footerColor; + const netAmtColor = printColors?.find(obj => obj.netAmtColor)?.netAmtColor; + + const headerStyle = { + backgroundColor: headerColor?.background, + color: headerColor?.font, + } + const tableHeaderStyle = { + backgroundColor: tableHeaderColor?.background, + color: tableHeaderColor?.font, + } + const tableBodyStyle = { + backgroundColor: tableBodyColor?.background, + color: tableBodyColor?.font, + } + const rowtypeStyle = tableBodyColor?.rowType; + const footerColorStyle = { + backgroundColor: footerColor?.background, + color: footerColor?.font, + } + const netAmountStyle = { + backgroundColor: netAmtColor?.background, + color: netAmtColor?.font, + } + + return (
-
+

{table2Data?.OrderType === "E" ? "Estimate" : (BillName ? BillName : "Tax Invoice")}

@@ -232,7 +262,7 @@ const PurchaseOrdInvoice = ({ textAlign: 'left' }}> -
+
{invoiceData.companyName}
{invoiceData.companyspecname}
@@ -375,6 +405,7 @@ const PurchaseOrdInvoice = ({ // borderRight: '1px solid #000', borderBottom: '1px solid #000', borderTop: '1px solid #000', + ...tableHeaderStyle }}>
SI.No
Description of Goods
@@ -393,6 +424,11 @@ const PurchaseOrdInvoice = ({ display: 'grid', gridTemplateColumns: '5% 40% 12% 10% 12% 8% 13%', // borderRight: '1px solid #000', + ...(index % 2 === 0 && rowtypeStyle === "even" + ? tableBodyStyle + : index % 2 === 1 && rowtypeStyle === "odd" + ? tableBodyStyle + : {}) }}>
{chunkIndex * chunkSize + index + 1}
@@ -431,7 +467,7 @@ const PurchaseOrdInvoice = ({
{/* CGST */} - {OrderDetailGST[0]?.TaxTypeName === "WithTax" &&
{
- { OrderDetailGST && OrderDetailGST.length > 0 + {OrderDetailGST && OrderDetailGST.length > 0 ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.CGST || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : "0.00"}
}
} {/* SGST */} - { OrderDetailGST[0]?.TaxTypeName === "WithTax" &&
} {/* IGST */} - { OrderDetailGST[0]?.TaxTypeName === "WithTax" && ( + {OrderDetailGST[0]?.TaxTypeName === "WithTax" && (
-
+
₹ {Number(invoiceData.grandTotal).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
@@ -803,6 +839,7 @@ const PurchaseOrdInvoice = ({ textAlign: 'center', fontSize: '10px', padding: '8px', + ...footerColorStyle }}>
This is a Computer Generated Invoice
diff --git a/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdPrintA4.jsx b/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdPrintA4.jsx index f6f5797..efbf0dc 100644 --- a/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdPrintA4.jsx +++ b/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdPrintA4.jsx @@ -153,7 +153,34 @@ const PurchaseOrdPrintA4 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; const shouldFooterBeOnNewPage = lastChunkRows > 6; - + let printColors = printDatas?.PrintColors; + const headerColor = printColors?.find(obj => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find(obj => obj.tableHeaderColor)?.tableHeaderColor; + const tableBodyColor = printColors?.find(obj => obj.tableBodyColor)?.tableBodyColor; + const footerColor = printColors?.find(obj => obj.footerColor)?.footerColor; + const netAmtColor = printColors?.find(obj => obj.netAmtColor)?.netAmtColor; + + const headerStyle = { + backgroundColor: headerColor?.background, + color: headerColor?.font, + } + const tableHeaderStyle = { + backgroundColor: tableHeaderColor?.background, + color: tableHeaderColor?.font, + } + const tableBodyStyle = { + backgroundColor: tableBodyColor?.background, + color: tableBodyColor?.font, + } + const rowtypeStyle = tableBodyColor?.rowType; + const footerColorStyle = { + backgroundColor: footerColor?.background, + color: footerColor?.font, + } + const netAmountStyle = { + backgroundColor: netAmtColor?.background, + color: netAmtColor?.font, + } return ( @@ -169,7 +196,7 @@ const PurchaseOrdPrintA4 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image
-
+
- + {GlobaldummyData ? GlobalSlNo && : SLNO == true && } @@ -321,7 +348,18 @@ const PurchaseOrdPrintA4 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image {dataChunk?.map((item, index) => ( - + {GlobaldummyData ? GlobalSlNo && (
S.NoS.No
@@ -594,19 +632,8 @@ const PurchaseOrdPrintA4 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image } -
- {GlobaldummyData ? GlobaltermsAndConditions && - (
-

- Terms & Conditions -

-
    -
  1. Once goods are sold, they are not exchangeable or refundable.
  2. -
  3. Please check the product before leaving the counter.
  4. -
-
) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
+
+ {(TermsnAdCondition == true && TermsAndConditions?.length > 0) && (

Terms & Conditions

@@ -768,19 +795,8 @@ const PurchaseOrdPrintA4 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image } -
- {GlobaldummyData ? GlobaltermsAndConditions && - (
-

- Terms & Conditions -

-
    -
  1. Once goods are sold, they are not exchangeable or refundable.
  2. -
  3. Please check the product before leaving the counter.
  4. -
-
) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
+
+ {(TermsnAdCondition == true && TermsAndConditions?.length > 0) && (

Terms & Conditions

@@ -932,19 +948,8 @@ const PurchaseOrdPrintA4 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image } -
- {GlobaldummyData ? GlobaltermsAndConditions && - (
-

- Terms & Conditions -

-
    -
  1. Once goods are sold, they are not exchangeable or refundable.
  2. -
  3. Please check the product before leaving the counter.
  4. -
-
) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
+
+ {(TermsnAdCondition == true && TermsAndConditions?.length > 0) && (

Terms & Conditions

diff --git a/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdPrintA5.jsx b/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdPrintA5.jsx index 046e496..6e8c435 100644 --- a/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdPrintA5.jsx +++ b/src/Pages/PurchaseOrder/PurchsasePrintStyle/PurchaseOrdPrintA5.jsx @@ -162,6 +162,36 @@ const PurchaseOrdPrintA5 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image const calculatedTotalQuantity = purchaseData?.reduce((total, item) => { return total + (Number(item?.SalesQty) || 0); }, 0); + let printColors = printDatas?.PrintColors; + const headerColor = printColors?.find(obj => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find(obj => obj.tableHeaderColor)?.tableHeaderColor; + const tableBodyColor = printColors?.find(obj => obj.tableBodyColor)?.tableBodyColor; + const footerColor = printColors?.find(obj => obj.footerColor)?.footerColor; + const netAmtColor = printColors?.find(obj => obj.netAmtColor)?.netAmtColor; + + const headerStyle = { + backgroundColor: headerColor?.background, + color: headerColor?.font, + } + const tableHeaderStyle = { + backgroundColor: tableHeaderColor?.background, + color: tableHeaderColor?.font, + } + const tableBodyStyle = { + backgroundColor: tableBodyColor?.background, + color: tableBodyColor?.font, + } + const rowtypeStyle = tableBodyColor?.rowType; + const footerColorStyle = { + backgroundColor: footerColor?.background, + color: footerColor?.font, + } + const netAmountStyle = { + backgroundColor: netAmtColor?.background, + color: netAmtColor?.font, + } + + return (
@@ -171,7 +201,7 @@ const PurchaseOrdPrintA5 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image
-
+
- + {GlobaldummyData ? GlobalSlNo && : SLNO == true && } @@ -332,7 +362,18 @@ const PurchaseOrdPrintA5 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image {dataChunk?.map((item, index) => ( - + {GlobaldummyData ? GlobalSlNo && (
S.NoS.No
@@ -556,7 +597,7 @@ const PurchaseOrdPrintA5 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image } -
+
{TermsnAdCondition == true && (

Terms & Conditions @@ -621,25 +662,7 @@ const PurchaseOrdPrintA5 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image }} > <> -

-
-
-
-
ITEMS
-
Qty
- {(TotalOfferAmount > 0 || table2Data?.OverallDisc) ? (
OFFER
) : ""} - {/*
Amount
*/} -
-
-
{GlobaldummyData ? "7" : totalQuantityFilter?.length}
-
{GlobaldummyData ? "9" : calculatedTotalQuantity}
- {(TotalOfferAmount > 0 || table2Data?.OverallDisc) ? (
{Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
) : ""} - {/*
{GlobaldummyData ? "1066" : Number(table2Data?.NetAmount).toFixed(2)}
*/} -
-
-
Purchase Order
-
-
+
@@ -689,33 +712,15 @@ const PurchaseOrdPrintA5 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image
{Date1}
- {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

- -
-
) : - Notestext && (
+ {Notestext && (

{Notestext}


) } - -
- {GlobaldummyData ? GlobaltermsAndConditions && - (
-

- Terms & Conditions -

-
    -
  1. Once goods are sold, they are not exchangeable or refundable.
  2. -
  3. Please check the product before leaving the counter.
  4. -
-
) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
+
+ {(TermsnAdCondition == true && TermsAndConditions?.length > 0) && (

Terms & Conditions