diff --git a/src/Pages/DeliveryChallanToInvoice/PrintTemplates/PrintStyleDCToInvoice1.jsx b/src/Pages/DeliveryChallanToInvoice/PrintTemplates/PrintStyleDCToInvoice1.jsx index abfa699..250c566 100644 --- a/src/Pages/DeliveryChallanToInvoice/PrintTemplates/PrintStyleDCToInvoice1.jsx +++ b/src/Pages/DeliveryChallanToInvoice/PrintTemplates/PrintStyleDCToInvoice1.jsx @@ -1,6 +1,6 @@ import React, { useMemo } from "react"; import { useSelector } from "react-redux"; -import { GloabalFieldDetails } from "../../../Features/ThemeChange/ThemeChange"; +import { GloabalDCtoInvoiceFieldDetails, GloabalFieldDetails } from "../../../Features/ThemeChange/ThemeChange"; import { dateFormatChange1 } from "../../../Services/Others"; const PrintStyleDCToInvoice1 = ({ invoiceData, preference, printDatas }) => { @@ -17,8 +17,7 @@ const PrintStyleDCToInvoice1 = ({ invoiceData, preference, printDatas }) => { CustName, VehicleNo } = invoiceData; - - const fieldDetails = useSelector(GloabalFieldDetails); + const fieldDetails = useSelector(GloabalDCtoInvoiceFieldDetails); const signature = fieldDetails?.["signature"]; const termsAndConditions = fieldDetails?.["terms&conditions"]; const termsAndConditionsData = printDatas?.TermsandConditions; @@ -28,7 +27,6 @@ const PrintStyleDCToInvoice1 = ({ invoiceData, preference, printDatas }) => { const pageSize = printDatas?.PageSize; const branch = AddressDetails[0]; const logo = branch?.CompLogo; - const printGreeting = preference?.[0]?.SettingDtlDetails?.find( (i) => i.SettingIdName === 'PrintGreetings' ); @@ -54,9 +52,37 @@ const PrintStyleDCToInvoice1 = ({ invoiceData, preference, printDatas }) => { maxHeight: "97vh" }); + 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, + } + const HeaderSection = () => ( <> -
+

{ const renderFooter = () => ( <>
- + {(notesText || termsAndConditions || signature || printGreeting?.SettingValue === "Y") && ( <> -
+
+
{notesText &&

{notesText}

}
{termsAndConditions && termsAndConditionsData?.length > 0 && ( @@ -99,6 +126,7 @@ const PrintStyleDCToInvoice1 = ({ invoiceData, preference, printDatas }) => { {printGreeting?.SettingValue === "Y" && (
Thank You Visit Again
)} +
)} @@ -119,7 +147,7 @@ const PrintStyleDCToInvoice1 = ({ invoiceData, preference, printDatas }) => { >
{(chunkIndex === 0 || formatTheme) && } - + {!formatTheme && isFinalFooterPage && renderFooter()}
{formatTheme && isFinalFooterPage &&
{renderFooter()}
} @@ -129,7 +157,7 @@ const PrintStyleDCToInvoice1 = ({ invoiceData, preference, printDatas }) => { ) : (
- + {renderFooter()}
)} @@ -141,8 +169,8 @@ export default PrintStyleDCToInvoice1; // -------------------- COMPONENTS -------------------- -const Header = ({ logo, branch }) => ( -
+const Header = ({ logo, branch, headerStyle }) => ( +
{/* {logo && {`${branch?.CompName}} */}
{branch.CompName}
@@ -172,7 +200,7 @@ const InvoiceMeta = ({ InvoiceNo, DCNo, InvoiceDate, CustMobile, VehicleNo, Cust
); -const ProductTable = ({ data }) => { +const ProductTable = ({ data, tableHeaderStyle, tableBodyStyle, rowtypeStyle }) => { const columns = [ { label: "S.No", key: "sno", width: "5%" }, { label: "Product", key: "ProdName", width: "20%" }, @@ -186,7 +214,7 @@ const ProductTable = ({ data }) => { return ( - + {columns.map(col => ( ))} @@ -194,7 +222,18 @@ const ProductTable = ({ data }) => { {data.map((prod, index) => ( - + @@ -209,8 +248,8 @@ const ProductTable = ({ data }) => { ); }; -const Summary = ({ TotalAmount, TaxAmount, GrandTotal }) => ( -
+const Summary = ({ TotalAmount, TaxAmount, GrandTotal,netAmountStyle }) => ( +
Subtotal: ₹ {TotalAmount.toFixed(2)}
Tax Amount: ₹ {TaxAmount.toFixed(2)}
Grand Total: ₹ {GrandTotal.toFixed(2)}
{col.label}
{index + 1} {prod.ProdName} {prod.ProdVariantName}