diff --git a/src/Pages/PurchaseQuotation/PurchasePrintTemplate/PurPrintstyle3.jsx b/src/Pages/PurchaseQuotation/PurchasePrintTemplate/PurPrintstyle3.jsx index 218b84d..f4282ff 100644 --- a/src/Pages/PurchaseQuotation/PurchasePrintTemplate/PurPrintstyle3.jsx +++ b/src/Pages/PurchaseQuotation/PurchasePrintTemplate/PurPrintstyle3.jsx @@ -8,6 +8,17 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalSelectedNetAmountColor, + GlobalSelectedNetAmountFontColor, } from "../../../Features/ThemeChange/ThemeChange"; import "../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.scss" import { extractLastNumber } from "../../../Services/Others"; @@ -37,6 +48,17 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ const GlobaldummyData = useSelector(GlobalPritdummyData); const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector(GlobalSelectedPrintHeaderFontColor); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector(GlobalSelectedTableHeaderFontColor); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector(GlobalSelectedTableBodyFontColor); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector(GlobalSelectedFooterFontColor); + const SelectedNetAmountColor = useSelector(GlobalSelectedNetAmountColor); + const SelectedNetAmountFontColor = useSelector(GlobalSelectedNetAmountFontColor); let TermsAndConditions = printDatas?.TermsandConditions @@ -47,7 +69,12 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ let PageSize = printDatas?.PageSize const Signature = FieldDetails?.["signature"]; const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - + 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 keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { @@ -60,28 +87,10 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ const year = currentDate.getFullYear().toString().slice(-2); const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; - const TakeawayData = table2Data?.[0]?.ProductDetails - console.log(TakeawayData, "TakeawayData", table2Data) - - - - - let TotalOfferAmount = 0; - - // Calculate SalesWiseOffers total amount - - - - const chunkSize = PageSize == "A5" ? 11 : 16; - let dataSource = table2Data?.[0]?.ProductDetails; - - console.log(table2Data,"FieldDetailsFieldDetails") - - // Paginate the data const paginatedChunks = []; for (let i = 0; i < dataSource?.length; i += chunkSize) { @@ -89,9 +98,52 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ } const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == "A5" ? 5 : 10); - {console.log(TakeawayData,"TakeawayDataTakeawayData")} + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + color: GlobaldummyData + ? SelectedHeaderFontColor + : headerColor?.font, + } + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + } + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData + ? SelectedTableBodyFontColor + : tableBodyColor?.font, + } + const rowtypeStyle = GlobaldummyData ? SelectedRowType : tableBodyColor?.rowType; + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + + color: GlobaldummyData + ? SelectedTableFooterFontColor + : footerColor?.font, + } + const netAmountStyle = { + backgroundColor: GlobaldummyData + ? SelectedNetAmountColor + : netAmtColor?.background, + + color: GlobaldummyData + ? SelectedNetAmountFontColor + : netAmtColor?.font, + } return ( <> {FormatTheme ? @@ -101,91 +153,149 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ {/*
*/}
-
+
- { table2Data?.[0]?.BrName} - + {table2Data?.[0]?.BrName} +
{GlobaldummyData ? 'BranchAddress, Town- 635XXX City - State' : (table2Data?.[0]?.AddressDetails?.[0]?.Address1 || '') + (table2Data?.[0]?.AddressDetails?.[0]?.City ? (table2Data?.[0]?.AddressDetails?.[0]?.Address1 && table2Data?.[0]?.AddressDetails?.[0]?.City ? '-' : '') + table2Data?.[0]?.AddressDetails?.[0]?.City : '') + (table2Data?.[0]?.AddressDetails?.[0]?.Zip ? (table2Data?.[0]?.AddressDetails?.[0]?.City && table2Data?.[0]?.AddressDetails?.[0]?.Zip ? '-' : '') + table2Data?.[0]?.AddressDetails?.[0]?.Zip : '')} - {table2Data?.[0]?.BrGSTIN &&
GST NO :{ table2Data?.[0]?.BrGSTIN}, CIN :u00045hhsgbubufsdug
} -
Mobile : +91 { table2Data?.[0]?.BrMobile}
- {
{BillName}
} + {table2Data?.[0]?.BrGSTIN &&
GST NO :{table2Data?.[0]?.BrGSTIN}, CIN :u00045hhsgbubufsdug
} +
Mobile : +91 {table2Data?.[0]?.BrMobile}
+ {
{BillName}
}

BILL NO : - { - table2Data?.[0]?.QuotationNo && extractLastNumber(table2Data?.[0]?.QuotationNo) - - }
-
{ Date1}
+ { + table2Data?.[0]?.QuotationNo && extractLastNumber(table2Data?.[0]?.QuotationNo) + + }
+
{Date1}

-
+
- {(TakeawayData?.length > 0 ) && + {(TakeawayData?.length > 0) &&
-
- { SLNO &&
S.No
} - { Item &&
ITEM
} - { HsnCode &&
HSN
} - { MRP &&
MRP
} - { Quantity &&
QTY
} - { Rate &&
RATE
} - { Discount &&
DIS
} - { Amount &&
AMT
} +
+ {SLNO &&
S.No
} + {Item &&
ITEM
} + {HsnCode &&
HSN
} + {MRP &&
MRP
} + {Quantity &&
QTY
} + {Rate &&
RATE
} + {Discount &&
DIS
} + {Amount &&
AMT
}
- {dataChunk?.map((item, index) => ( -
- { SLNO &&
{chunkIndex * chunkSize + index + 1}
} - { Item && -
-
{item?.ProdName}
-
({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}) -   {item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
{a.SerialNumber}
) })) : ""} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter((item1) => item1.IMEI1 !== "" || item1.IMEI2 !== "") - ?.map(item2 => { - const imei1 = item2.IMEI1 || ""; - const imei2 = item2.IMEI2 || ""; - return (
{[imei1, imei2].filter(Boolean).join(",")}
); - } - ) : ""} + {dataChunk?.map((item, index) => { + const isMatch = + (index % 2 === 0 && rowtypeStyle === "even") || + (index % 2 === 1 && rowtypeStyle === "odd"); + + return ( +
+ {SLNO && ( +
+ {chunkIndex * chunkSize + index + 1}
-
} - { HsnCode &&
{item?.HSN}
} - { MRP &&
{item?.SinglePc === 'Y' ? item?.Price : item?.MRP}
} - { Quantity &&
{item?.Qty}
} - { Rate &&
{item?.Price}
} - { Discount &&
{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}
} - { Amount &&
{item?.NetAmt?.toFixed(2)}
} -
- ))} + )} + + {Item && ( +
+
{item?.ProdName}
+
+ ({item?.Size ? item?.Size : "1"}{" "} + {item?.SinglePc === "Y" + ? "PCS" + : item?.Type !== "C" + ? item?.UomName + : "COMBO"}) +  {item?.BrandName ?? ""} +
+
+ )} + + {HsnCode && ( +
+ {item?.HSN} +
+ )} + + {MRP && ( +
+ {item?.SinglePc === "Y" ? item?.Price : item?.MRP} +
+ )} + + {Quantity && ( +
+ {item?.Qty} +
+ )} + + {Rate && ( +
+ {item?.Price} +
+ )} + + {Discount && ( +
+ {item?.Type !== "C" + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
+ )} + + {Amount && ( +
+ {item?.NetAmt?.toFixed(2)} +
+ )} +
+ ); + })}
} - +
- +
{((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && <> -
+
Items :
Qty :
@@ -319,24 +429,15 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ

- -
-
- {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData &&
Customer : {table2Data?.CustSuppName}
} - -
- -
{/*
*/} -
{ @@ -356,7 +458,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ } -
+
{ (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (

@@ -369,7 +471,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ

) } - { Signature == true && (
+ {Signature == true && (

Signature

)} @@ -378,7 +480,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
- + } @@ -405,7 +507,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ }} > <> -
+
Items :
Qty :
@@ -413,10 +515,10 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
Amount :
-
{ totalQuantityFilter?.length}
-
{ totalQuantity}
- {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
{ Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
} -
{ Number(table2Data?.[0]?.NetAmount).toFixed(2)}
+
{totalQuantityFilter?.length}
+
{totalQuantity}
+ {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
{Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
} +
{Number(table2Data?.[0]?.NetAmount).toFixed(2)}
@@ -543,27 +645,27 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ {/*
*/} - +
- - + + {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData &&
Customer : {table2Data?.CustSuppName}
} - -
- +
+ +
{/*
*/} - +
{ @@ -595,7 +698,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
) } - { Signature == true && (
+ {Signature == true && (

Signature

)} @@ -604,7 +707,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
- +
@@ -614,79 +717,137 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ :
-
+
{table2Data?.[0]?.BrName}
{ (table2Data?.[0]?.AddressDetails?.[0]?.Address1 || '') + (table2Data?.[0]?.AddressDetails?.[0]?.City ? (table2Data?.[0]?.AddressDetails?.[0]?.Address1 && table2Data?.[0]?.AddressDetails?.[0]?.City ? '-' : '') + table2Data?.[0]?.AddressDetails?.[0]?.City : '') + (table2Data?.[0]?.AddressDetails?.[0]?.Zip ? (table2Data?.[0]?.AddressDetails?.[0]?.City && table2Data?.[0]?.AddressDetails?.[0]?.Zip ? '-' : '') + table2Data?.[0]?.AddressDetails?.[0]?.Zip : '')} - {table2Data?.[0]?.BrGSTIN &&
GST NO :{ table2Data?.[0]?.BrGSTIN}, CIN :u00045hhsgbubufsdug
} -
Mobile : +91 { table2Data?.[0]?.BrMobile}
- {
{BillName}
} + {table2Data?.[0]?.BrGSTIN &&
GST NO :{table2Data?.[0]?.BrGSTIN}, CIN :u00045hhsgbubufsdug
} +
Mobile : +91 {table2Data?.[0]?.BrMobile}
+ {
{BillName}
}

BILL NO : - { - table2Data?.[0]?.QuotationNo && extractLastNumber(table2Data?.[0]?.QuotationNo) - - } -
-
{ Date1}
+ { + table2Data?.[0]?.QuotationNo && extractLastNumber(table2Data?.[0]?.QuotationNo) + + } +
+
{Date1}

{(TakeawayData?.length > 0) &&
-
- { SLNO &&
S.No
} - { Item &&
ITEM
} - { HsnCode &&
HSN
} - { MRP &&
MRP
} - { Quantity &&
QTY
} - { Rate &&
RATE
} - { Discount &&
DIS
} - { Amount &&
AMT
} +
+ {SLNO &&
S.No
} + {Item &&
ITEM
} + {HsnCode &&
HSN
} + {MRP &&
MRP
} + {Quantity &&
QTY
} + {Rate &&
RATE
} + {Discount &&
DIS
} + {Amount &&
AMT
}
- {( TakeawayData)?.map((item, index) => ( -
- { SLNO &&
{index + 1}
} - { Item && -
-
{item?.ProdName}
-
({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}) -   {item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
{a.SerialNumber}
) })) : ""} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter((item1) => item1.IMEI1 !== "" || item1.IMEI2 !== "") - ?.map(item2 => { - const imei1 = item2.IMEI1 || ""; - const imei2 = item2.IMEI2 || ""; - return (
{[imei1, imei2].filter(Boolean).join(",")}
); - } - ) : ""} + {dataChunk?.map((item, index) => { + const isMatch = + (index % 2 === 0 && rowtypeStyle === "even") || + (index % 2 === 1 && rowtypeStyle === "odd"); + + return ( +
+ {SLNO && ( +
+ {chunkIndex * chunkSize + index + 1}
-
} - { HsnCode &&
{item?.HSN}
} - { MRP &&
{item?.SinglePc === 'Y' ? item?.Price : item?.MRP}
} - { Quantity &&
{item?.Qty}
} - { Rate &&
{item?.Price}
} - { Discount &&
{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}
} - { Amount &&
{item?.NetAmt?.toFixed(2)}
} -
- ))} + )} + + {Item && ( +
+
{item?.ProdName}
+
+ ({item?.Size ? item?.Size : "1"}{" "} + {item?.SinglePc === "Y" + ? "PCS" + : item?.Type !== "C" + ? item?.UomName + : "COMBO"}) +  {item?.BrandName ?? ""} +
+
+ )} + + {HsnCode && ( +
+ {item?.HSN} +
+ )} + + {MRP && ( +
+ {item?.SinglePc === "Y" ? item?.Price : item?.MRP} +
+ )} + + {Quantity && ( +
+ {item?.Qty} +
+ )} + + {Rate && ( +
+ {item?.Price} +
+ )} + + {Discount && ( +
+ {item?.Type !== "C" + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
+ )} + + {Amount && ( +
+ {item?.NetAmt?.toFixed(2)} +
+ )} +
+ ); + })}
} - +
- + {/*
*/} -
+
Items :
Qty :
@@ -819,7 +980,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ }
- + {/*
*/} @@ -827,27 +988,28 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
- - + + {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData &&
Customer : {table2Data?.CustSuppName}
} - +
- +
{/*
*/} - +
{ @@ -859,7 +1021,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ } -
+
{ (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (

@@ -872,7 +1034,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ

) } - { Signature == true && (
+ {Signature == true && (

Signature

)} @@ -880,8 +1042,8 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
- - + + {/*
print
*/}
}