diff --git a/src/Pages/PurchaseQuotation/PurchasePrintTemplate/PurPrintstyle7.jsx b/src/Pages/PurchaseQuotation/PurchasePrintTemplate/PurPrintstyle7.jsx index 2780b01..1513837 100644 --- a/src/Pages/PurchaseQuotation/PurchasePrintTemplate/PurPrintstyle7.jsx +++ b/src/Pages/PurchaseQuotation/PurchasePrintTemplate/PurPrintstyle7.jsx @@ -4,7 +4,18 @@ import { useDispatch, useSelector } from "react-redux"; import { GlobalPritdummyData, changeReprintDataFound, - GlobalprinttermsAndConditions + GlobalprinttermsAndConditions, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalSelectedNetAmountColor, + GlobalSelectedNetAmountFontColor, } from '../../../Features/ThemeChange/ThemeChange'; import "../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.scss" import { extractLastNumber } from "../../../Services/Others"; @@ -16,10 +27,10 @@ const PurPrintStyle7 = ({ index, ExtraChargeTotal, Date1, totalQuantityFilter, C const dispatch = useDispatch(); - const FieldDetails = printDatas?.FieldDetails?.reduce((acc, item) => { - acc[item.ConfigName] = true; - return acc; - }, {}); + const FieldDetails = printDatas?.FieldDetails?.reduce((acc, item) => { + acc[item.ConfigName] = true; + return acc; + }, {}); const SLNO = FieldDetails?.["Sl.No"]; const Item = FieldDetails?.["Item"]; @@ -29,12 +40,27 @@ const PurPrintStyle7 = ({ index, ExtraChargeTotal, Date1, totalQuantityFilter, C const Rate = FieldDetails?.["Rate"]; const Amount = FieldDetails?.["Amount"]; const HsnCode = FieldDetails?.["HsnCode"]; - - + 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 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 let SignatureImg = printDatas?.Signature let Notestext = printDatas?.Notes @@ -43,41 +69,66 @@ const PurPrintStyle7 = ({ index, ExtraChargeTotal, Date1, totalQuantityFilter, C let PageSize = printDatas?.PageSize const Signature = FieldDetails?.["signature"]; const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - - const keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } - - - const TakeawayData = table2Data?.[0]?.ProductDetails - console.log(TakeawayData, "TakeawayData", table2Data) - - - - - + const TakeawayData = table2Data?.[0]?.ProductDetails let TotalOfferAmount = 0; - - - - - const chunkSize = PageSize == "A5" ? 8 : 11; let dataSource = table2Data?.[0]?.ProductDetails; - - - // Paginate the data const paginatedChunks = []; - for (let i = 0; i < dataSource?.length; i += chunkSize) { - paginatedChunks.push(dataSource?.slice(i, i + chunkSize)); + for (let i = 0; i < dataSource?.length; i += chunkSize) { + paginatedChunks.push(dataSource?.slice(i, i + chunkSize)); } 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 ( <> @@ -87,15 +138,15 @@ const PurPrintStyle7 = ({ index, ExtraChargeTotal, Date1, totalQuantityFilter, C
| S | } - { Item == true &&Item | } - { HsnCode == true &&HSN | } - { Quantity == true &&Qty | } - {GlobaldummyData ? GlobalMRP &&MRP | : MRP == true &&MRP | } - {GlobaldummyData ? GlobalRate &&Rate | : Rate == true &&Rate | } - { Discount == true &&Dis | } - { Amount == true &&Amt | } + {SLNO == true &&S.No | } + {Item == true &&Item | } + {HsnCode == true &&HSN | } + {Quantity == true &&Qty | } + {GlobaldummyData ? GlobalMRP &&MRP | : MRP == true &&MRP | } + {GlobaldummyData ? GlobalRate &&Rate | : Rate == true &&Rate | } + {Discount == true &&Dis | } + {Amount == true &&Amt | }
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {chunkIndex * chunkSize + index + 1} | } - { Item == true &&
- {item?.ProdName}
- ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
- | }
- { HsnCode == true && {item?.HSN} | } - { Quantity == true &&{item?.Qty} | } - { MRP == true &&{item?.SinglePc === 'Y' ? item?.Price : item?.MRP} | } +|||||||||||||||
| {chunkIndex * chunkSize + index + 1} | } + {Item == true &&
+ {item?.ProdName}
+ ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
+ | }
+ {HsnCode == true && {item?.HSN} | } + {Quantity == true &&{item?.Qty} | } + {MRP == true &&{item?.SinglePc === 'Y' ? item?.Price : item?.MRP} | } {Rate == true &&{item?.Price} | } - { Discount == true &&{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0} | } - { Amount == true &&{item?.NetAmt?.toFixed(2)} | } + {Discount == true &&{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0} | } + {Amount == true &&{item?.NetAmt?.toFixed(2)} | }
| S | } - { Item == true &&Item | } - { HsnCode == true &&HSN | } - { Quantity == true &&Qty | } - { MRP == true &&MRP | } - { Rate == true &&Rate | } - { Discount == true &&Dis | } - { Amount == true &&Amt | } + {SLNO == true &&S.No | } + {Item == true &&Item | } + {HsnCode == true &&HSN | } + {Quantity == true &&Qty | } + {MRP == true &&MRP | } + {Rate == true &&Rate | } + {Discount == true &&Dis | } + {Amount == true &&Amt | }
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {index + 1} | } - { Item == true &&
- {item?.ProdName}
- ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
- | }
- { HsnCode == true && {item?.HSN} | } - { Quantity == true &&{item?.Qty} | } - { MRP == true &&{item?.SinglePc === 'Y' ? item?.Price : item?.MRP} | } +|||||||||||
| {index + 1} | } + {Item == true &&
+ {item?.ProdName}
+ ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
+ | }
+ {HsnCode == true && {item?.HSN} | } + {Quantity == true &&{item?.Qty} | } + {MRP == true &&{item?.SinglePc === 'Y' ? item?.Price : item?.MRP} | } {Rate == true &&{item?.Price} | } - { Discount == true &&{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0} | } - { Amount == true &&{item?.NetAmt?.toFixed(2)} | } + {Discount == true &&{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0} | } + {Amount == true &&{item?.NetAmt?.toFixed(2)} | }