From 33437f28a662bd1f3173034e35cc6faae69aaca8 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 4 Mar 2026 11:05:43 +0530 Subject: [PATCH] Delivery Challan Color Print --- .../DCPrintTemplates/DCA4/DCA4Standard.jsx | 1559 +++++++--- .../DCA4/DCPrintA4Style11.jsx | 118 +- .../DCPrintTemplates/DCA4/DCPrintStyleA5.jsx | 1523 +++++++--- .../DCThermalPrinter/DCInvicePrint.jsx | 2699 ++++++++++++----- .../DCThermalPrinter/DCPrintStyle1.jsx | 902 ++++-- .../DCThermalPrinter/DCPrintStyle10.jsx | 138 +- .../DCThermalPrinter/DCPrintStyle11.jsx | 145 +- .../DCThermalPrinter/DCPrintStyle12.jsx | 142 +- .../DCThermalPrinter/DCPrintStyle2.jsx | 1235 +++++--- .../DCThermalPrinter/DCPrintStyle3.jsx | 82 +- .../DCThermalPrinter/DCPrintStyle4.jsx | 140 +- .../DCThermalPrinter/DCPrintStyle5.jsx | 122 +- .../DCThermalPrinter/DCPrintStyle6.jsx | 125 +- .../DCThermalPrinter/DCPrintStyle7.jsx | 147 +- .../DCThermalPrinter/DCPrintStyle8.jsx | 1180 +++++-- .../DCThermalPrinter/DCPrintStyle9.jsx | 933 ++++-- src/Pages/DeliveryChallan/DeliveryPrint.jsx | 337 +- 17 files changed, 8400 insertions(+), 3127 deletions(-) diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCA4Standard.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCA4Standard.jsx index 5cb21a2..3176e9a 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCA4Standard.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCA4Standard.jsx @@ -1,9 +1,9 @@ -import React from "react"; -import { useDispatch, useSelector } from "react-redux"; +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; import { extractLastNumber, extractLastNumberOrderId, -} from "../../../../Services/Others"; +} from '../../../../Services/Others'; import { GlobalprintSlNo, GlobalprintItem, @@ -23,13 +23,33 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, -} from "../../../../Features/ThemeChange/ThemeChange"; + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedFooterColor, + GlobalRowType, + GlobalSelectedFooterFontColor, +} from '../../../../Features/ThemeChange/ThemeChange'; // import "../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/DCPrintStyle1.scss"; -import QRCode from "react-qr-code"; -import { GlobalUpiIDprint } from "../../../../Features/BookingScreen/BookingData/BookingData"; -import signature from "../../../../Images/signatureimage.jpg" -const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCity, BranchZip, Date1, - table2Data, PaymentStatus, PrintGreeting, printDatas, DCPrintTemplateDtl }) => { +import QRCode from 'react-qr-code'; +import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import signature from '../../../../Images/signatureimage.jpg'; +const DCInvoiceTemplate = ({ + BranchName, + BranchDetails, + BranchAddress, + BranchCity, + BranchZip, + Date1, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + DCPrintTemplateDtl, +}) => { const formatDate = (dateString = '') => { const date = new Date(dateString); const day = date.getDate().toString().padStart(2, '0'); @@ -57,17 +77,17 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit acc[item.ConfigName] = true; return acc; }, {}); - console.log(table2Data, "FieldDetails") - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - console.log(Item, "Item") - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; + console.log(table2Data, 'FieldDetails'); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + console.log(Item, 'Item'); + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; const GlobalSlNo = useSelector(GlobalprintSlNo); const GlobalItem = useSelector(GlobalprintItem); const GlobalMRP = useSelector(GlobalprintMRP); @@ -82,41 +102,41 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); const GlobalSignatureImages = useSelector(GlobalSignatureImage); const GlobalIsnotes = useSelector(Globalnotes); - const GlobalthemeFormatr = useSelector(GlobalthemeFormat) - const GlobalBilltext = useSelector(GlobalBillName) + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); + const GlobalBilltext = useSelector(GlobalBillName); const keysLength = Object.keys(table2Data ?? {}).length; - console.log(GlobalDiscount, Discount, "Discount"); + console.log(GlobalDiscount, Discount, 'Discount'); - let BankDetails = BranchDetails?.BankDetails - let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions - let SignatureImg = DCPrintTemplateDtl?.Signature - let Notestext = DCPrintTemplateDtl?.Notes - let BillName = DCPrintTemplateDtl?.PrintHdrName - let FormatTheme = DCPrintTemplateDtl?.PrintType == "S" ? true : false - let PageSize = DCPrintTemplateDtl?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - console.log(BranchDetails, "BranchDetails"); - console.log(table2Data, "FormatThemekjhjk", PaymentStatus) + let BankDetails = BranchDetails?.BankDetails; + let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions; + let SignatureImg = DCPrintTemplateDtl?.Signature; + let Notestext = DCPrintTemplateDtl?.Notes; + let BillName = DCPrintTemplateDtl?.PrintHdrName; + let FormatTheme = DCPrintTemplateDtl?.PrintType == 'S' ? true : false; + let PageSize = DCPrintTemplateDtl?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + console.log(BranchDetails, 'BranchDetails'); + console.log(table2Data, 'FormatThemekjhjk', PaymentStatus); if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } const currentDate = new Date(); - const day = currentDate.getDate().toString().padStart(2, "0"); + const day = currentDate.getDate().toString().padStart(2, '0'); const monthNames = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', ]; const monthIndex = currentDate.getMonth(); const year = currentDate.getFullYear().toString().slice(-2); @@ -124,13 +144,13 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; const TakeawayData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === "takeaway" + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' ); const DineInData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === "dine in" + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' ); let PaymentStatusSuccess = PaymentStatus?.filter( - (ps) => ps.PaymentStatus === "S" + (ps) => ps.PaymentStatus === 'S' ); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, @@ -159,63 +179,71 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit const offers = table2Data?.OrderOfferDetails || []; let TotalOfferAmount = 0; - console.log(table2Data, "productsDatakl") + console.log(table2Data, 'productsDatakl'); // Calculate SalesWiseOffers total amount - offers.forEach(offer => { + offers.forEach((offer) => { if (offer.TableName === 'SalesWiseOffers') { TotalOfferAmount += offer.OfferAmount; } }); - const hasMappedOffer = offers.some(offer => - ["ItemWiseOffers", "BundleOffers", "QuantityWiseOffers"].includes(offer.TableName) + const hasMappedOffer = offers.some((offer) => + ['ItemWiseOffers', 'BundleOffers', 'QuantityWiseOffers'].includes( + offer.TableName + ) ); if (hasMappedOffer) { - - const productTotal = productsData?.reduce((acc, item) => acc + (item?.Type != "C" ? item.OfferAmt : item.OfferValue || 0), 0); + const productTotal = productsData?.reduce( + (acc, item) => + acc + (item?.Type != 'C' ? item.OfferAmt : item.OfferValue || 0), + 0 + ); TotalOfferAmount += productTotal; } else { - const Combothere = productsData?.filter(item => item?.Type == "C") - const CombothereTotal = Combothere?.reduce((acc, item) => acc + (item.OfferValue || 0), 0); + const Combothere = productsData?.filter((item) => item?.Type == 'C'); + const CombothereTotal = Combothere?.reduce( + (acc, item) => acc + (item.OfferValue || 0), + 0 + ); TotalOfferAmount += CombothereTotal; } - const invoiceData = { company: { - name: "Prematix Software Solution Pvt Ltd.", - address: "#589, 2nd floor, VP Chambers, 1st cross, 3rd block, Koramangala, Bengaluru- 560034.", - phone: "9344270900", - email: "info@prematix.com", - gstin: "29AAICP0469K1ZX" + name: 'Prematix Software Solution Pvt Ltd.', + address: + '#589, 2nd floor, VP Chambers, 1st cross, 3rd block, Koramangala, Bengaluru- 560034.', + phone: '9344270900', + email: 'info@prematix.com', + gstin: '29AAICP0469K1ZX', }, invoice: { - state: "Karnataka", - stateCode: "29", - date: "13/04/2024", - number: "BLR/01/2024-25", - reverseCharge: "", - placeOfSupply: "", - dateOfSupply: "", - vehicleNumber: "", - transportationMode: "" + state: 'Karnataka', + stateCode: '29', + date: '13/04/2024', + number: 'BLR/01/2024-25', + reverseCharge: '', + placeOfSupply: '', + dateOfSupply: '', + vehicleNumber: '', + transportationMode: '', }, billTo: { - name: "Ooty Boat House", - address: "No:2, North Lake Road,", - state: "Tamil Nadu", - stateCode: "33", - gstin: "", - poNumber: "BLR/14/2024", - poDate: "11/04/2024" + name: 'Ooty Boat House', + address: 'No:2, North Lake Road,', + state: 'Tamil Nadu', + stateCode: '33', + gstin: '', + poNumber: 'BLR/14/2024', + poDate: '11/04/2024', }, items: [ { sr: 1, - name: "Acrylic Scanner Box", - hsn: "39204900", - uom: "INR", + name: 'Acrylic Scanner Box', + hsn: '39204900', + uom: 'INR', qty: 1, rate: 6501, amount: 6501, @@ -225,15 +253,15 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit cgstAmount: 0, sgstRate: 0, sgstAmount: 0, - igstRate: 18.00, + igstRate: 18.0, igstAmount: 1170, - totalAmount: 7671 + totalAmount: 7671, }, { sr: 2, name: '32" Wide Angle view display FHD', - hsn: "84716030", - uom: "INR", + hsn: '84716030', + uom: 'INR', qty: 1, rate: 48317, amount: 48317, @@ -243,15 +271,15 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit cgstAmount: 0, sgstRate: 0, sgstAmount: 0, - igstRate: 18.00, + igstRate: 18.0, igstAmount: 8697, - totalAmount: 57014 + totalAmount: 57014, }, { sr: 3, - name: "Service charges", - hsn: "999630", - uom: "INR", + name: 'Service charges', + hsn: '999630', + uom: 'INR', qty: 1, rate: 25000, amount: 25000, @@ -261,11 +289,10 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit cgstAmount: 0, sgstRate: 0, sgstAmount: 0, - igstRate: 18.00, + igstRate: 18.0, igstAmount: 4500, - totalAmount: 29500 + totalAmount: 29500, }, - ], totals: { beforeTax: 83660, @@ -274,63 +301,110 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit cgst: 0, totalGst: 15059, afterTax: 98719, - amountInWords: "Ninety Eight Thousand Seven Hundred and Nineteen Rupees Only" + amountInWords: + 'Ninety Eight Thousand Seven Hundred and Nineteen Rupees Only', }, bankDetails: { - bankName: "State Bank of India", - accountNo: "34850253701", - ifscCode: "SBIN0006242", - branchName: "Mookandapalli" - } + bankName: 'State Bank of India', + accountNo: '34850253701', + ifscCode: 'SBIN0006242', + branchName: 'Mookandapalli', + }, }; - const chunkSize = PageSize == "A5" ? 8 : 9; + const chunkSize = PageSize == 'A5' ? 8 : 9; let dataSource = table2Data?.ProductDetails || []; - const paginatedChunks = []; 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" ? 4 : 6); + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 4 : 6); - console.log(table2Data, "table2Datah") + console.log(table2Data, 'table2Datah'); const companyName = table2Data?.CompName; - const companyAddress = table2Data?.AddressDetails?.[0]?.Address1 + table2Data?.AddressDetails?.[0]?.Address2 || "#589, 2nd floor, VP Chambers, 1st cross, 3rd block, Koramangala, Bengaluru- 560034."; - const companyPhone = table2Data?.BrMobile + "," + table2Data?.BrMobile2 !== null ? table2Data?.BrMobile2 : ""; - const companyEmail = table2Data?.CompanyEmail || "info@prematix.com"; + const companyAddress = + table2Data?.AddressDetails?.[0]?.Address1 + + table2Data?.AddressDetails?.[0]?.Address2 || + '#589, 2nd floor, VP Chambers, 1st cross, 3rd block, Koramangala, Bengaluru- 560034.'; + const companyPhone = + table2Data?.BrMobile + ',' + table2Data?.BrMobile2 !== null + ? table2Data?.BrMobile2 + : ''; + const companyEmail = table2Data?.CompanyEmail || 'info@prematix.com'; const companyGSTIN = table2Data?.CompGSTIN; - - const InvoiceAmountWords = ({ amount }) => { const numberToWords = (num) => { const a = [ - "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", - "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", - "Eighteen", "Nineteen" + '', + 'One', + 'Two', + 'Three', + 'Four', + 'Five', + 'Six', + 'Seven', + 'Eight', + 'Nine', + 'Ten', + 'Eleven', + 'Twelve', + 'Thirteen', + 'Fourteen', + 'Fifteen', + 'Sixteen', + 'Seventeen', + 'Eighteen', + 'Nineteen', + ]; + const b = [ + '', + '', + 'Twenty', + 'Thirty', + 'Forty', + 'Fifty', + 'Sixty', + 'Seventy', + 'Eighty', + 'Ninety', ]; - const b = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"]; - if (num === 0) return "Zero"; + if (num === 0) return 'Zero'; if (num < 20) return a[num]; - if (num < 100) return b[Math.floor(num / 10)] + (num % 10 ? " " + a[num % 10] : ""); + if (num < 100) + return b[Math.floor(num / 10)] + (num % 10 ? ' ' + a[num % 10] : ''); if (num < 1000) - return a[Math.floor(num / 100)] + " Hundred" + (num % 100 ? " and " + numberToWords(num % 100) : ""); + return ( + a[Math.floor(num / 100)] + + ' Hundred' + + (num % 100 ? ' and ' + numberToWords(num % 100) : '') + ); if (num < 100000) - return numberToWords(Math.floor(num / 1000)) + " Thousand" + (num % 1000 ? " " + numberToWords(num % 1000) : ""); + return ( + numberToWords(Math.floor(num / 1000)) + + ' Thousand' + + (num % 1000 ? ' ' + numberToWords(num % 1000) : '') + ); - return "Number too large"; + return 'Number too large'; }; return (

Total Invoice Amount in Words:

-

+

{numberToWords(amount)}

@@ -339,53 +413,117 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit const products = [ { - ProdName: "ITEM 1", + ProdName: 'ITEM 1', Rate: 88.0, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, - HSN: "01", + HSN: '01', }, { - ProdName: "ITEM 2", + ProdName: 'ITEM 2', Rate: 300.0, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, - HSN: "02", + HSN: '02', }, { - ProdName: "ITEM 3", + ProdName: 'ITEM 3', Rate: 200.0, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, - HSN: "03", + HSN: '03', }, { - ProdName: "ITEM 4", + ProdName: 'ITEM 4', Rate: 30.0, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, - HSN: "04", + HSN: '04', }, { - ProdName: "ITEM 5", + ProdName: 'ITEM 5', Rate: 30.0, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, - HSN: "05", + HSN: '05', }, - ]; + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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 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, + }; return ( <> @@ -718,127 +856,236 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit <> -
+
{paginatedChunks.map((dataChunk, chunkIndex) => ( -
0 ? ' print-page-break' : ''}`} style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: FormatTheme ? PageSize == "A5" ? '170mm' : "255mm" : "", }} key={chunkIndex}> - +
0 ? ' print-page-break' : ''}`} + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: FormatTheme + ? PageSize == 'A5' + ? '170mm' + : '255mm' + : '', + }} + key={chunkIndex} + > {/*
*/} {/* Header */} -
-
-

{GlobaldummyData ? "XYZ Shop" : BranchName}

-

{GlobaldummyData - ? "BranchAddress, Town- 635XXX City - State" - : (BranchAddress || "") + - (BranchCity - ? (BranchAddress && BranchCity ? "-" : "") + BranchCity - : "") + - (BranchZip - ? (BranchCity && - BranchZip - ? "-" - : "") + BranchZip - : "")}

+
+
+

+ {GlobaldummyData ? 'XYZ Shop' : BranchName} +

+

+ {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +

- {BranchDetails?.BrGSTIN &&
GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : BranchDetails?.BrGSTIN}, CIN :u00045hhsgbubufsdug
} - {BranchDetails?.BrMobile && -
- {" "} - Mobile : +91 {GlobaldummyData ? "986XXXXXXX" : BranchDetails?.BrMobile} + {BranchDetails?.BrGSTIN && ( +
+ GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : BranchDetails?.BrGSTIN} + , CIN :u00045hhsgbubufsdug
- } + )} + {BranchDetails?.BrMobile && ( +
+ {' '} + Mobile : +91{' '} + {GlobaldummyData + ? '986XXXXXXX' + : BranchDetails?.BrMobile} +
+ )}
-
{GlobaldummyData ? 'Cash Bill' : BillName ? BillName : "Delivery Challan"}
- {table2Data?.dispatchPrint !== true &&
-
+
+ {GlobaldummyData + ? 'Cash Bill' + : BillName + ? BillName + : 'Delivery Challan'}{' '} +
+ {table2Data?.dispatchPrint !== true && ( +
+
+
+ {' '} + Delivery ChallanNo: + {GlobaldummyData ? '121' : table2Data?.DCNo} +
+
-
- {" "} - Delivery ChallanNo: - {GlobaldummyData - ? "121" - : table2Data?.DCNo} +
+
+ {' '} + Date :{' '} + {GlobaldummyData ? formattedDate : Date1}{' '} +
+ )} + {table2Data?.dispatchPrint === true && ( +
+
+
+ {' '} + Dispatch No: + {table2Data?.DispatchId} +
+
-
-
- {" "} - Date : {GlobaldummyData ? formattedDate : Date1}{" "} +
+
+ {' '} + Dispatch Date :{' '} + {formatDate(table2Data?.CreatedDate)}{' '} +
+
+
+
+ {' '} + Ref No #: {table2Data?.RequestId}{' '} +
+
+
+
+ {' '} + Requested Date :{' '} + {formatDate(table2Data?.RequestedDate)}{' '} +
-
} - {table2Data?.dispatchPrint === true &&
-
- -
- {" "} - Dispatch No: - {table2Data?.DispatchId} -
-
- -
-
- {" "} - Dispatch Date : {formatDate(table2Data?.CreatedDate)}{" "} -
-
-
-
- {" "} - Ref No #: {table2Data?.RequestId}{" "} -
-
-
-
- {" "} - Requested Date : {formatDate(table2Data?.RequestedDate)}{" "} -
-
-
} - - + )}
-
- {table2Data?.ToBranchDtl?.length > 0 &&
-
-
Delivery To :
-
-
{table2Data?.ToBranchDtl?.[0]?.BranchName}
- {table2Data?.ToBranchDtl?.[0]?.Address1 &&
{table2Data?.ToBranchDtl?.[0]?.Address1}
} - {(table2Data?.ToBranchDtl?.[0]?.City || table2Data?.ToBranchDtl?.[0]?.Dist || table2Data?.ToBranchDtl?.[0]?.Zip) &&
{`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
} - {table2Data?.ToBranchDtl?.[0]?.BrGSTIN &&
{table2Data?.ToBranchDtl?.[0]?.BrGSTIN}
} + {table2Data?.ToBranchDtl?.length > 0 && ( +
+
+
+ Delivery To : +
+
+
+ {table2Data?.ToBranchDtl?.[0]?.BranchName} +
+ {table2Data?.ToBranchDtl?.[0]?.Address1 && ( +
+ {table2Data?.ToBranchDtl?.[0]?.Address1} +
+ )} + {(table2Data?.ToBranchDtl?.[0]?.City || + table2Data?.ToBranchDtl?.[0]?.Dist || + table2Data?.ToBranchDtl?.[0]?.Zip) && ( +
{`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
+ )} + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN && ( +
+ {table2Data?.ToBranchDtl?.[0]?.BrGSTIN} +
+ )} +
-
} + )}
- {(table2Data?.CustName || table2Data?.CustMobile) && -
+ {(table2Data?.CustName || table2Data?.CustMobile) && ( +

Details of Customer

- {table2Data?.CustName ?
Name : - {GlobaldummyData ? ( - - {"XXXYYY"} - - ) : table2Data?.CustName} -
: ""} + {table2Data?.CustName ? ( +
+ Name : + {GlobaldummyData ? ( + + {'XXXYYY'} + + ) : ( + table2Data?.CustName + )} +
+ ) : ( + '' + )} - {table2Data?.CustMobile ?
Mobile No: {table2Data?.CustMobile}
: ""} + {table2Data?.CustMobile ? ( +
+ Mobile No:{' '} + {table2Data?.CustMobile} +
+ ) : ( + '' + )} {/*
Address: {table2Data?.CustomerDetails?.length > 0 && !GlobaldummyData && ( @@ -848,40 +1095,96 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit
State: {table2Data?.CustomerDetails?.[0]?.State}
*/} -
-
- } + )}
-
- - {/* Items Table */} -
+
- +
{GlobaldummyData - ? GlobalSlNo && : - SLNO == true && } + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} {GlobaldummyData - ? GlobalItem && : - Item == true && } - + ? GlobalItem && ( + + ) + : Item == true && ( + + )} {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } */} {GlobaldummyData - ? GlobalQuantity && - : Quantity == true && } + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} {/* */} @@ -901,80 +1204,110 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit {GlobaldummyData ? GlobalAmount && : Amount == true && } */} - - - {((GlobaldummyData ? products : dataChunk) || []).map((item, idx) => ( - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && ( - - - )} - {/* {GlobaldummyData + {((GlobaldummyData ? products : dataChunk) || []).map( + (item, idx) => ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item == true && ( + + )} + {/* {GlobaldummyData ? GlobalHsnCode && ( )} */} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity == true && ( - - )} - {/* {GlobaldummyData + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {/* {GlobaldummyData ? GlobalMRP && ( )} */} - - ))} - - - + + ) + )}
S.NoS.No + S.No + + S.No + ItemItem + Item + + Item + HSN HSN QtyQty + Qty + + Qty + UOM UOMAmountAmount
- {chunkIndex * chunkSize + idx + 1} - - {chunkIndex * chunkSize + idx + 1} - {item?.ProdName} -
{item?.ProdName}
-
- ({item?.Size ? item?.Size : "1"}{" "} - {item?.SinglePc == "Y" - ? "PCS" - : item?.Type != "C" - ? item?.UomName - : "COMBO"} - ) {item?.RequestVariantName ? item?.RequestVariantName : ""} -
-  {" "} - {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(",")} -
- ); - }) - : ""} -
+ {chunkIndex * chunkSize + idx + 1} + + {chunkIndex * chunkSize + idx + 1} + + {item?.ProdName} + +
{item?.ProdName}
+
+ ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + )  + {item?.RequestVariantName + ? item?.RequestVariantName + : ''} +
+  {' '} + {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(',')} +
+ ); + }) + : ''} +
{item?.HSN} @@ -985,18 +1318,27 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit {item?.HSN} - {item?.SalesQty} - - {item?.Qty || item?.DispatchedQty} - + {item?.SalesQty} + + {item?.Qty || item?.DispatchedQty} + {item?.MRP} @@ -1039,11 +1381,9 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
@@ -1103,28 +1443,32 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit
)} - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - -
- - {/* Summary */} -
- {/* {GlobaldummyData ?
+ {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( +
+ {/* Summary */} +
+ {/* {GlobaldummyData ?
:
} */} -
- - - {/*
+
+ {/*
Total Amount Before Tax
{GlobaldummyData ? 736 : table2Data?.BillAmount}
*/} - {/*
+ {/*
{OrderDetailGST?.map((item, index) => (
@@ -1158,135 +1502,254 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit ))}
*/} - {/*
+ {/*
GST Payable on Reverse Charge
*/} - {/*
*/} + {/*
*/} - {/*
+ {/*
Total Amount After Tax :
{GlobaldummyData ? 736 : table2Data?.NetAmount}
*/} - {/*
+ {/*
Total Amount After Tax {GlobaldummyData ? 736 : table2Data?.NetAmount}
*/} - {/*
+ {/*
{GlobaldummyData ? 736 : table2Data?.NetAmount}
*/} -
-
- - {/* Footer */} -
-
- {(BankDetails?.length > 0) && (<> -

Bank Details:

-
-
Bank Name: {BankDetails?.[0]?.BankName}
-
Account No.: {BankDetails?.[0]?.AccountNo}
-
IFSC Code: {BankDetails?.[0]?.IFSCCode}
-
Branch Name: {BankDetails?.[0]?.BankBranch}
-
-
- )} - -
- {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) && (
-

- Terms & Conditions -

-
    - {TermsAndConditions?.map(item => (
  1. {item?.TermsandConditions}
  2. ))} - {/*
  3. Please check the product before leaving the counter.
  4. */} -
-
) - }
-
-
-

Certified that the particulars given above are true and correct.

-
-
- {GlobaldummyData ?

Company Name

- :

"For" {companyName}

} -

Authorised Signatory

- {GlobaldummyData ? GlobalSignature && (
- -
) : Signature == true && ( -
- -
+ {/* Footer */} +
+
+ {BankDetails?.length > 0 && ( + <> +

+ Bank Details: +

+
+
+ Bank Name:{' '} + {BankDetails?.[0]?.BankName} +
+
+ Account No.:{' '} + {BankDetails?.[0]?.AccountNo} +
+
+ IFSC Code:{' '} + {BankDetails?.[0]?.IFSCCode} +
+
+ Branch Name:{' '} + {BankDetails?.[0]?.BankBranch} +
+
+
+ )} -

(Common Seal)

+ +
+ {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 && ( +
+

+ Terms & Conditions +

+
    + {TermsAndConditions?.map((item) => ( +
  1. + {item?.TermsandConditions} +
  2. + ))} + {/*
  3. Please check the product before leaving the counter.
  4. */} +
+
+ )} +
+
+
+
+

+ Certified that the particulars given above are + true and correct. +

+
+
+ {GlobaldummyData ? ( +

Company Name

+ ) : ( +

+ {' '} + "For" {companyName} +

+ )} +

+ Authorised Signatory +

+ + {GlobaldummyData + ? GlobalSignature && ( +
+ +
+ ) + : Signature == true && ( +
+ +
+ )} +

(Common Seal)

+
+ {/*
*/} + + {/* Copy Labels */} +
+ {GlobaldummyData + ? GlobalIsnotes && ( +
+

+ Notes : 10 days Return policy +

+ +
+
+ ) + : Notestext && ( +
+

+ {Notestext} +

+ + {/*
*/} +
+ )} +
- {/*
*/} - - - - - {/* Copy Labels */} -
- {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

- -
-
) : - Notestext && (
-

{Notestext}

- - {/*
*/} -
) - } -
-
- } + )}
//
))}
{/*
*/} - {shouldFooterBeOnNewPage && FormatTheme && + {shouldFooterBeOnNewPage && FormatTheme && (
-
<> - {/*
*/} {/* Summary */} {/*
*/} @@ -1297,7 +1760,6 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit
} */} {/*
*/} - {/*
Total Amount Before Tax @@ -1354,55 +1816,169 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit {/*
*/} {/* Footer */} -
+
- {BankDetails?.length > 0 && (<> -

Bank Details:

-
-
Bank Name: {BankDetails?.[0]?.BankName}
-
Account No.: {BankDetails?.[0]?.AccountNo}
-
IFSC Code: {BankDetails?.[0]?.IFSCCode}
-
Branch Name: {BankDetails?.[0]?.BankBranch}
-
-
- )} + {BankDetails?.length > 0 && ( + <> +

Bank Details:

+
+
+ Bank Name:{' '} + {BankDetails?.[0]?.BankName} +
+
+ Account No.:{' '} + {BankDetails?.[0]?.AccountNo} +
+
+ IFSC Code:{' '} + {BankDetails?.[0]?.IFSCCode} +
+
+ Branch Name:{' '} + {BankDetails?.[0]?.BankBranch} +
+
+
+ + )}
- {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) && (
-

- Terms & Conditions -

-
    - {TermsAndConditions?.map(item => (
  1. {item?.TermsandConditions}
  2. ))} - {/*
  3. Please check the product before leaving the counter.
  4. */} -
-
) - } + {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 && ( +
+

+ Terms & Conditions +

+
    + {TermsAndConditions?.map((item) => ( +
  1. + {item?.TermsandConditions} +
  2. + ))} + {/*
  3. Please check the product before leaving the counter.
  4. */} +
+
+ )}
-
+
-

Certified that the particulars given above are true and correct.

+

+ Certified that the particulars given above are true + and correct. +

- {GlobaldummyData ?

Company Name

- :

"For" {companyName}

} + {GlobaldummyData ? ( +

Company Name

+ ) : ( +

"For" {companyName}

+ )}

Authorised Signatory

- {GlobaldummyData ? GlobalSignature && (
- -
) : Signature == true && (
- -
)} + {GlobaldummyData + ? GlobalSignature && ( +
+ +
+ ) + : Signature == true && ( +
+ +
+ )}

(Common Seal)

@@ -1411,28 +1987,39 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit {/* Copy Labels */}
- {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

+ {GlobaldummyData + ? GlobalIsnotes && ( +
+

+ Notes : 10 days Return policy +

-
-
) : - Notestext && (
-

{Notestext}

+
+
+ ) + : Notestext && ( +
+

+ {Notestext} +

- {/*
*/} -
) - } + {/*
*/} +
+ )}
- } - + )}
); }; -export default DCInvoiceTemplate; \ No newline at end of file +export default DCInvoiceTemplate; diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintA4Style11.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintA4Style11.jsx index b999801..8f99621 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintA4Style11.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintA4Style11.jsx @@ -20,6 +20,15 @@ import { GlobalprintSlNo, GlobalprinttermsAndConditions, GlobalPritdummyData, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, GlobalSignatureImage, GlobalthemeFormat, } from '../../../../Features/ThemeChange/ThemeChange'; @@ -200,6 +209,72 @@ const DCPrintA4Style11 = ({ lastChunkRows > (!isMobile ? 10 : PageSize === 'A5' ? 5 : 14); console.log(lastChunkRows, shouldFooterBeOnNewPage, 'dataSourcedataSource'); + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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 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, + }; + return (
@@ -248,6 +324,8 @@ const DCPrintA4Style11 = ({ alignItems: 'center', padding: '12px 0', borderBottom: '1px solid black', + ...headerStyle, + width: '100%', }} > {/* Logo Image */} @@ -583,6 +661,7 @@ const DCPrintA4Style11 = ({ style={{ width: '10%', textAlign: 'center', + ...tableHeaderStyle, }} > S.No @@ -593,25 +672,30 @@ const DCPrintA4Style11 = ({ style={{ width: '10%', textAlign: 'center', + ...tableHeaderStyle, }} > S.No )} {GlobaldummyData - ? GlobalItem && Item - : Item == true && Item} - {/* {GlobaldummyData - ? GlobalHsnCode && HSN - : HsnCode == true && ( - HSN - )} */} + ? GlobalItem && ( + + Item + + ) + : Item == true && ( + + Item + + )} {GlobaldummyData ? GlobalQuantity && ( Qty @@ -622,6 +706,7 @@ const DCPrintA4Style11 = ({ style={{ width: '10%', textAlign: 'center', + ...tableHeaderStyle, }} > Qty @@ -656,7 +741,22 @@ const DCPrintA4Style11 = ({ {dataChunk?.map((item, index) => ( - + {GlobaldummyData ? GlobalSlNo && ( @@ -1070,6 +1170,7 @@ const DCPrintA4Style11 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData @@ -1260,6 +1361,7 @@ const DCPrintA4Style11 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintStyleA5.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintStyleA5.jsx index 133dd7f..8686133 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintStyleA5.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintStyleA5.jsx @@ -1,20 +1,62 @@ import React, { useEffect, useState } from 'react'; import { useDispatch } from 'react-redux'; -import moment from "moment"; -import { extractLastNumberOrderId, getSession } from '../../../../Services/Others'; +import moment from 'moment'; +import { + extractLastNumberOrderId, + getSession, +} from '../../../../Services/Others'; import { getBranchDetail } from '../../../../Features/BrachLogin/BranchLogin'; -import QRcode from '../../../../Images/QRcode.png' -import { printDiv } from "../../../../Services/Others"; +import QRcode from '../../../../Images/QRcode.png'; +import { printDiv } from '../../../../Services/Others'; // import HpyImg from "../../../../Images/happyemoji.png" -import '../../../../Styles/BookingScreen/PrintTemplates/A4/DCPrintA4Style11.scss' +import '../../../../Styles/BookingScreen/PrintTemplates/A4/DCPrintA4Style11.scss'; import { useSelector } from 'react-redux'; -import { GloabalFieldDetails, GlobalBillName, Globalnotes, GlobalprintAmount, GlobalprintDiscount, GlobalprintHsnCode, GlobalprintItem, GlobalprintMRP, GlobalprintQrcodet, GlobalprintQuantity, GlobalprintRate, GlobalprintSignature, GlobalprintSlNo, GlobalprinttermsAndConditions, GlobalPritdummyData, GlobalSignatureImage, GlobalthemeFormat } from '../../../../Features/ThemeChange/ThemeChange'; -import signature from "../../../../Images/signatureimage.jpg" +import { + GloabalFieldDetails, + GlobalBillName, + Globalnotes, + GlobalprintAmount, + GlobalprintDiscount, + GlobalprintHsnCode, + GlobalprintItem, + GlobalprintMRP, + GlobalprintQrcodet, + GlobalprintQuantity, + GlobalprintRate, + GlobalprintSignature, + GlobalprintSlNo, + GlobalprinttermsAndConditions, + GlobalPritdummyData, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSignatureImage, + GlobalthemeFormat, +} from '../../../../Features/ThemeChange/ThemeChange'; +import signature from '../../../../Images/signatureimage.jpg'; import QRCode from 'react-qr-code'; -const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, BranchZip, Date1, base64Image, - table2Data, PaymentStatus, PrintGreeting, printDatas, DCPrintTemplateDtl }) => { - const GlobalthemeFormatr = useSelector(GlobalthemeFormat) +const DCPrintStyleA5 = ({ + BranchName, + BranchDetails, + BranchAddress, + BranchCity, + BranchZip, + Date1, + base64Image, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + DCPrintTemplateDtl, +}) => { + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); const GlobalSignature = useSelector(GlobalprintSignature); const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { @@ -23,19 +65,19 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, {}); const GlobalIsnotes = useSelector(Globalnotes); const GlobalSignatureImages = useSelector(GlobalSignatureImage); - console.log(FieldDetails, "FieldDetails") - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - const isNotes = FieldDetails?.["Notes"]; + console.log(FieldDetails, 'FieldDetails'); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + const isNotes = FieldDetails?.['Notes']; const GlobalSlNo = useSelector(GlobalprintSlNo); const GlobalItem = useSelector(GlobalprintItem); const GlobalMRP = useSelector(GlobalprintMRP); @@ -46,23 +88,23 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, const GlobalHsnCode = useSelector(GlobalprintHsnCode); const GlobalQrcodet = useSelector(GlobalprintQrcodet); const GlobaldummyData = useSelector(GlobalPritdummyData); - const GlobalBilltext = useSelector(GlobalBillName) + const GlobalBilltext = useSelector(GlobalBillName); const currentDate = new Date(); - console.log(FieldDetails, "FieldDetails") - const day = currentDate.getDate().toString().padStart(2, "0"); + console.log(FieldDetails, 'FieldDetails'); + const day = currentDate.getDate().toString().padStart(2, '0'); const monthNames = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', ]; const monthIndex = currentDate.getMonth(); const year = currentDate.getFullYear().toString().slice(-2); @@ -90,13 +132,13 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, return day && month && year ? `${day}-${month}-${year}` : '-'; }; const TakeawayData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === "takeaway" + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' ); const DineInData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === "dine in" + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' ); let PaymentStatusSuccess = PaymentStatus?.filter( - (ps) => ps.PaymentStatus === "S" + (ps) => ps.PaymentStatus === 'S' ); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, @@ -121,14 +163,14 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, {} ); - let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions - let SignatureImg = DCPrintTemplateDtl?.Signature - let Notestext = DCPrintTemplateDtl?.Notes - let BillName = DCPrintTemplateDtl?.PrintHdrName - let FormatTheme = DCPrintTemplateDtl?.PrintType == "S" ? true : false - let PageSize = DCPrintTemplateDtl?.PageSize + let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions; + let SignatureImg = DCPrintTemplateDtl?.Signature; + let Notestext = DCPrintTemplateDtl?.Notes; + let BillName = DCPrintTemplateDtl?.PrintHdrName; + let FormatTheme = DCPrintTemplateDtl?.PrintType == 'S' ? true : false; + let PageSize = DCPrintTemplateDtl?.PageSize; - console.log(FormatTheme, "TermsAndConditions") + console.log(FormatTheme, 'TermsAndConditions'); const productsData = table2Data?.productDetails || []; const offers = table2Data?.OrderOfferDetails || []; @@ -137,7 +179,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, const products = [ { id: 1, - name: "Butter Naan", + name: 'Butter Naan', price: 88.0, quantity: 2, mrp: 50, @@ -146,7 +188,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, { id: 2, - name: "Grill Chicken (f)", + name: 'Grill Chicken (f)', price: 300.0, quantity: 1, mrp: 50, @@ -155,7 +197,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, { id: 3, - name: "Tandoori Chicken (H) ", + name: 'Tandoori Chicken (H) ', price: 200.0, quantity: 1, mrp: 50, @@ -164,7 +206,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, { id: 4, - name: "Kulfi", + name: 'Kulfi', price: 30.0, quantity: 1, mrp: 50, @@ -173,7 +215,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, { id: 1, - name: "Butter Naan", + name: 'Butter Naan', price: 88.0, quantity: 2, mrp: 50, @@ -182,7 +224,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, { id: 2, - name: "Grill Chicken (f)", + name: 'Grill Chicken (f)', price: 300.0, quantity: 1, mrp: 50, @@ -194,39 +236,136 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, const chunkSize = 11; let dataSource = table2Data?.ProductDetails || []; - - // Paginate the data const paginatedChunks = []; 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 lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; const shouldFooterBeOnNewPage = lastChunkRows > 6; + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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 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, + }; + return ( - -
- -
+
+
{paginatedChunks.map((dataChunk, chunkIndex) => ( -
-
- -
- -
+
+
+ textAlign: 'left', + }} + > +
{/* Logo Image */} {/* {base64Image && (
@@ -244,148 +383,376 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, )} */} {/* Store Info */} -
-
- {GlobaldummyData ? "XYZ Shop" : BranchName} +
+
+ {GlobaldummyData ? 'XYZ Shop' : BranchName}
{/* Address */} -
+
{GlobaldummyData - ? "BranchAddress, Town- 635XXX City - State" - : [ - BranchAddress, - BranchCity, - BranchZip - ].filter(Boolean).join(' - ') - } + ? 'BranchAddress, Town- 635XXX City - State' + : [BranchAddress, BranchCity, BranchZip] + .filter(Boolean) + .join(' - ')}
- {BranchDetails?.BrGSTIN &&
GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : BranchDetails?.BrGSTIN}, CIN :u00045hhsgbubufsdug
} - - {BranchDetails?.BrMobile &&
Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile}
} + {BranchDetails?.BrGSTIN && ( +
+ GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : BranchDetails?.BrGSTIN} + , CIN :u00045hhsgbubufsdug +
+ )} + {BranchDetails?.BrMobile && ( +
+ {' '} + Mobile : +91{' '} + {GlobaldummyData + ? '986XXXXXXX' + : BranchDetails?.BrMobile} +
+ )}
{/* Order Type */} - - -
- - - -
- {table2Data?.ToBranchDtl?.length > 0 && <> -
-
Delivery To :
-
-
{table2Data?.ToBranchDtl?.[0]?.BranchName}
- {table2Data?.ToBranchDtl?.[0]?.Address1 &&
{table2Data?.ToBranchDtl?.[0]?.Address1}
} - {(table2Data?.ToBranchDtl?.[0]?.City || table2Data?.ToBranchDtl?.[0]?.Dist || table2Data?.ToBranchDtl?.[0]?.Zip) &&
{`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
} - {table2Data?.ToBranchDtl?.[0]?.BrGSTIN &&
{table2Data?.ToBranchDtl?.[0]?.BrGSTIN}
} -
-
-
- } - {(table2Data?.CustMobile || table2Data?.CustName || table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && + {table2Data?.ToBranchDtl?.length > 0 && ( <> -
- {(table2Data?.CustMobile || table2Data?.CustName) && -
-
Delivery Details
- {table2Data?.CustMobile &&
Mobile NO :{table2Data?.CustMobile}
} - {table2Data?.CustName &&
Name:{table2Data?.CustName}
} +
+
+ Delivery To : +
+
+
+ {table2Data?.ToBranchDtl?.[0]?.BranchName}
- } - {(table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && -
-
Vehicle Details
- {table2Data?.VehicleNo &&
Vehicle No :{table2Data?.VehicleNo}
} - {table2Data?.TransporterId &&
Transporter Id :{table2Data?.TransporterId}
} - {table2Data?.TransporterName &&
Transporter Name :{table2Data?.TransporterName}
} -
- } + {table2Data?.ToBranchDtl?.[0]?.Address1 && ( +
+ {table2Data?.ToBranchDtl?.[0]?.Address1} +
+ )} + {(table2Data?.ToBranchDtl?.[0]?.City || + table2Data?.ToBranchDtl?.[0]?.Dist || + table2Data?.ToBranchDtl?.[0]?.Zip) && ( +
{`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
+ )} + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN && ( +
+ {table2Data?.ToBranchDtl?.[0]?.BrGSTIN} +
+ )} +

- } + )} + {(table2Data?.CustMobile || + table2Data?.CustName || + table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( + <> +
+ {(table2Data?.CustMobile || table2Data?.CustName) && ( +
+
+ Delivery Details +
+ {table2Data?.CustMobile && ( +
+ {' '} + Mobile NO :{table2Data?.CustMobile}{' '} +
+ )} + {table2Data?.CustName && ( +
+ {' '} + Name:{table2Data?.CustName} +
+ )} +
+ )} + {(table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( +
+
+ Vehicle Details +
+ {table2Data?.VehicleNo && ( +
+ {' '} + Vehicle No :{table2Data?.VehicleNo} +
+ )} + {table2Data?.TransporterId && ( +
+ {' '} + Transporter Id :{table2Data?.TransporterId} +
+ )} + {table2Data?.TransporterName && ( +
+ {' '} + Transporter Name :{table2Data?.TransporterName} +
+ )} +
+ )} +
+
+ + )} - {table2Data?.dispatchPrint !== true &&
-
Delivery Challan NO :{GlobaldummyData ? '51' : table2Data?.DCNo}
-
{GlobaldummyData ? 'Cash Bill' : BillName ? BillName : "Delivery Challan"}
-
{Date1}
-
} - - {table2Data?.dispatchPrint === true &&
-
Dispatch No #:{table2Data?.DispatchId}
-
{"Delivery Challan"}
-
Dispatch Date: {formatDate(table2Data?.CreatedDate)}
-
} - {table2Data?.dispatchPrint === true &&
-
Ref No #:{table2Data?.RequestId}
-
-
Requested Date: {formatDate(table2Data?.RequestedDate)}
-
} + {table2Data?.dispatchPrint !== true && ( +
+
+ {' '} + Delivery Challan NO : + {GlobaldummyData ? '51' : table2Data?.DCNo}{' '} +
+
+ {GlobaldummyData + ? 'Cash Bill' + : BillName + ? BillName + : 'Delivery Challan'}{' '} +
+
+ {' '} +
{Date1}
{' '} +
+
+ )} + {table2Data?.dispatchPrint === true && ( +
+
+ {' '} + Dispatch No #:{table2Data?.DispatchId}{' '} +
+
+ {'Delivery Challan'}{' '} +
+
+ {' '} +
+ Dispatch Date: {formatDate(table2Data?.CreatedDate)} +
{' '} +
+
+ )} + {table2Data?.dispatchPrint === true && ( +
+
+ {' '} + Ref No #:{table2Data?.RequestId}{' '} +
+
+
+ {' '} +
+ Requested Date: {formatDate(table2Data?.RequestedDate)} +
{' '} +
+
+ )}
- < br /> +
-
- {(table2Data?.ProductDetails?.length > 0 || GlobaldummyData) && ( <> - 0) ? "6rem" : "2rem" }}> +
0 + ? '6rem' + : '2rem', + }} + > -
{/* Placeholder for the fixed-position header */} -
+
- -
- + -
+
+ - + {GlobaldummyData - ? GlobalSlNo && - : SLNO == true && } + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} {GlobaldummyData - ? GlobalItem && - : Item == true && } - {/* {GlobaldummyData - ? GlobalHsnCode && - : HsnCode == true && ( - - )} */} + ? GlobalItem && ( + + ) + : Item == true && ( + + )} {GlobaldummyData - ? GlobalQuantity && + ? GlobalQuantity && ( + + ) : Quantity == true && ( - - )} + + )} {/* {GlobaldummyData ? GlobalMRP && : MRP == true && } @@ -410,37 +777,63 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, Amt )} */} - {dataChunk?.map((item, index) => ( - + {GlobaldummyData ? GlobalSlNo && ( - - ) + + ) : SLNO == true && ( - - )} + + )} {GlobaldummyData ? GlobalItem && : Item == true && ( - - )} + + )} {/* {GlobaldummyData ? GlobalHsnCode && ( - ) + + ) : Quantity == true && ( - - )} + + )} {/* {GlobaldummyData ? GlobalMRP && ( @@ -551,68 +944,205 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, )} */} - ))}
S.NoS.No + S.No + + S.No + ItemItemHSNHSN + Item + + Item + Qty + Qty + Qty + Qty + MRPMRP
- {index + 1} - + {index + 1} + - {chunkIndex * chunkSize + index + 1} - + {chunkIndex * chunkSize + index + 1} + {item?.name} - -
{item?.ProdName}
-
{!(item?.ProdVariantName || item?.RequestVariantName)?.toLowerCase()?.includes('variant') && Variant:{item?.ProdVariantName || item?.RequestVariantName} }
- {/*
+
+
{item?.ProdName}
+
+ {!( + item?.ProdVariantName || + item?.RequestVariantName + ) + ?.toLowerCase() + ?.includes('variant') && ( + + Variant: + {item?.ProdVariantName || + item?.RequestVariantName}{' '} + + )} +
+ {/*
({item?.Size ? item?.Size : "1"}{" "} {item?.SinglePc == "Y" ? "PCS" @@ -449,12 +842,12 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, : "COMBO"} )
*/} -  {" "} - {/* {item?.BrandName !== null +  {' '} + {/* {item?.BrandName !== null ? item?.BrandName : ""}   */} - {/* {item?.ProductIdentifierDtls?.length > 0 + {/* {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls?.filter( (items) => !( @@ -465,7 +858,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, return
{a.SerialNumber}
; }) : ""}{" "} */} - {/* {item?.ProductIdentifierDtls?.length > 0 + {/* {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( (item1) => item1.IMEI1 !== "" || item1.IMEI2 !== "" @@ -481,8 +874,8 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, ); }) : ""} */} -
@@ -496,15 +889,15 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, )} */} {GlobaldummyData ? GlobalQuantity && ( - - {item?.quantity} - + {item?.quantity} + - {item?.Qty || item?.DispatchedQty} - + {item?.Qty || item?.DispatchedQty} +
- {((!FormatTheme) && (chunkIndex === paginatedChunks.length - 1)) && -
+ {!FormatTheme && + chunkIndex === paginatedChunks.length - 1 && ( +
+ {GlobaldummyData + ? GlobalIsnotes && ( +
+

+ Notes : 10 days Return policy +

- {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

+
+
+ ) + : Notestext && ( +
+

+ {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) && (
-

- Terms & Conditions -

-
    - {TermsAndConditions?.map(item => (
  1. {item?.TermsandConditions}
  2. ))} - {/*
  3. Please check the product before leaving the counter.
  4. */} -
-
) - } - - {GlobaldummyData ? GlobalSignature && (
-

Signature

- -
) : Signature == true && (
-

Signature

- -
)} +
+ {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 && ( +
+

+ Terms & Conditions +

+
    + {TermsAndConditions?.map( + (item) => ( +
  1. + {item?.TermsandConditions} +
  2. + ) + )} + {/*
  3. Please check the product before leaving the counter.
  4. */} +
+
+ )} + {GlobaldummyData + ? GlobalSignature && ( +
+

+ Signature +

+ +
+ ) + : Signature == true && ( +
+

+ Signature +

+ +
+ )} +
-
} + )}
{/* {(chunkIndex === paginatedChunks.length - 1) && ( @@ -630,152 +1160,387 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity,
+
)} - -
+ {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( +
+ {GlobaldummyData + ? GlobalIsnotes && ( +
+

+ Notes : 10 days Return policy +

+
+
+ ) + : 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 && ( +
+

+ Terms & Conditions +

+
    + {TermsAndConditions?.map((item) => ( +
  1. + {item?.TermsandConditions} +
  2. + ))} + {/*
  3. Please check the product before leaving the counter.
  4. */} +
+
+ )} - - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && ( -
- - {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

- -
-
) : - 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) && (
-

- Terms & Conditions -

-
    - {TermsAndConditions?.map(item => (
  1. {item?.TermsandConditions}
  2. ))} - {/*
  3. Please check the product before leaving the counter.
  4. */} -
-
) - } - - {GlobaldummyData ? GlobalSignature && (
-

Signature

- -
) : Signature == true && (
-

Signature

- -
)} - + {GlobaldummyData + ? GlobalSignature && ( +
+

+ Signature +

+ +
+ ) + : Signature == true && ( +
+

+ Signature +

+ +
+ )} +
-
- )} -
+ )} +
))} {shouldFooterBeOnNewPage && FormatTheme && (
-
+ {GlobaldummyData + ? GlobalIsnotes && ( +
+

+ Notes : 10 days Return policy +

- {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

+
+
+ ) + : Notestext && ( +
+

+ {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) && (
-

- Terms & Conditions -

-
    - {TermsAndConditions?.map(item => (
  1. {item?.TermsandConditions}
  2. ))} - {/*
  3. Please check the product before leaving the counter.
  4. */} -
-
) - } - - {GlobaldummyData ? GlobalSignature && (
-

Signature

- -
) : Signature == true && (
-

Signature

- -
)} +
+ {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 && ( +
+

+ Terms & Conditions +

+
    + {TermsAndConditions?.map((item) => ( +
  1. + {item?.TermsandConditions} +
  2. + ))} + {/*
  3. Please check the product before leaving the counter.
  4. */} +
+
+ )} + {GlobaldummyData + ? GlobalSignature && ( +
+

+ Signature +

+ +
+ ) + : Signature == true && ( +
+

+ Signature +

+ +
+ )}
)}
-
- ); }; diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCInvicePrint.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCInvicePrint.jsx index 524dd96..873ae12 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCInvicePrint.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCInvicePrint.jsx @@ -1,815 +1,1980 @@ - import { useSelector } from 'react-redux'; import { isMobile } from 'react-device-detect'; import moment from 'moment'; -import { GlobalPritdummyData } from '../../../../Features/ThemeChange/ThemeChange'; +import { + GlobalPritdummyData, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, +} from '../../../../Features/ThemeChange/ThemeChange'; import { extractLastNumberOrderId } from '../../../../Services/Others'; const DCInvicePrint = ({ - index, - table2Data, - Date1, - totalQuantity, - OrderDetailGST, - OrderDetailIGST, - PaymentStatus, - printDatas, - BranchDetails, - BankDetails + index, + table2Data, + Date1, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + PaymentStatus, + printDatas, + BranchDetails, + BankDetails, + DCPrintTemplateDtl, }) => { - const GlobaldummyData = useSelector(GlobalPritdummyData); - let BillName = printDatas?.PrintHdrName - console.log(table2Data, 'table2Datatable2Data'); + const GlobaldummyData = useSelector(GlobalPritdummyData); + let BillName = printDatas?.PrintHdrName; + console.log(table2Data, 'table2Datatable2Data'); - const numberToWords = (num) => { - const a = [ - "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", - "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", - "Eighteen", "Nineteen" - ]; - const b = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"]; + let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { + acc[item.ConfigName] = true; + return acc; + }, {}); - if (num === 0) return "Zero"; - if (num < 20) return a[num]; - if (num < 100) return b[Math.floor(num / 10)] + (num % 10 ? " " + a[num % 10] : ""); - if (num < 1000) - return a[Math.floor(num / 100)] + " Hundred" + (num % 100 ? " and " + numberToWords(num % 100) : ""); - if (num < 100000) - return numberToWords(Math.floor(num / 1000)) + " Thousand" + (num % 1000 ? " " + numberToWords(num % 1000) : ""); - if (num < 10000000) - return numberToWords(Math.floor(num / 100000)) + " Lakh" + (num % 100000 ? " " + numberToWords(num % 100000) : ""); - if (num < 1000000000) - return numberToWords(Math.floor(num / 10000000)) + " Crore" + (num % 10000000 ? " " + numberToWords(num % 10000000) : ""); + const numberToWords = (num) => { + const a = [ + '', + 'One', + 'Two', + 'Three', + 'Four', + 'Five', + 'Six', + 'Seven', + 'Eight', + 'Nine', + 'Ten', + 'Eleven', + 'Twelve', + 'Thirteen', + 'Fourteen', + 'Fifteen', + 'Sixteen', + 'Seventeen', + 'Eighteen', + 'Nineteen', + ]; + const b = [ + '', + '', + 'Twenty', + 'Thirty', + 'Forty', + 'Fifty', + 'Sixty', + 'Seventy', + 'Eighty', + 'Ninety', + ]; - return "Number too large"; - }; + if (num === 0) return 'Zero'; + if (num < 20) return a[num]; + if (num < 100) + return b[Math.floor(num / 10)] + (num % 10 ? ' ' + a[num % 10] : ''); + if (num < 1000) + return ( + a[Math.floor(num / 100)] + + ' Hundred' + + (num % 100 ? ' and ' + numberToWords(num % 100) : '') + ); + if (num < 100000) + return ( + numberToWords(Math.floor(num / 1000)) + + ' Thousand' + + (num % 1000 ? ' ' + numberToWords(num % 1000) : '') + ); + if (num < 10000000) + return ( + numberToWords(Math.floor(num / 100000)) + + ' Lakh' + + (num % 100000 ? ' ' + numberToWords(num % 100000) : '') + ); + if (num < 1000000000) + return ( + numberToWords(Math.floor(num / 10000000)) + + ' Crore' + + (num % 10000000 ? ' ' + numberToWords(num % 10000000) : '') + ); - const invoiceData = { - // Company Details - mapped from A4Standard - companyName: table2Data?.CompName || BranchDetails?.BrName || "", - companyspecname: table2Data?.AppSpecificName || "", - companyAddress: { - address1: BranchDetails?.Address1 || "", - address2: BranchDetails?.Address2 || "", - city: BranchDetails?.City || "", - state: BranchDetails?.State || "", - zip: BranchDetails?.Zip || "" - }, - companyGSTIN: table2Data?.CompGSTIN || BranchDetails?.GSTIN || "", - companyEmail: table2Data?.CompanyEmail || BranchDetails?.BrEmail || "", - companyMobile: BranchDetails?.BrMobile || "", - companyMobile2: BranchDetails?.BrMobile2 || "", + return 'Number too large'; + }; - // Invoice Details - mapped from A4Standard - invoiceNo: table2Data?.[0]?.DCNo ? - extractLastNumberOrderId( - table2Data?.[0]?.DCNo, - ) : "", - invoiceDate: moment(Date1).format('DD-MM-YYYY') || "", + const invoiceData = { + // Company Details - mapped from A4Standard + companyName: table2Data?.CompName || BranchDetails?.BrName || '', + companyspecname: table2Data?.AppSpecificName || '', + companyAddress: { + address1: BranchDetails?.Address1 || '', + address2: BranchDetails?.Address2 || '', + city: BranchDetails?.City || '', + state: BranchDetails?.State || '', + zip: BranchDetails?.Zip || '', + }, + companyGSTIN: table2Data?.CompGSTIN || BranchDetails?.GSTIN || '', + companyEmail: table2Data?.CompanyEmail || BranchDetails?.BrEmail || '', + companyMobile: BranchDetails?.BrMobile || '', + companyMobile2: BranchDetails?.BrMobile2 || '', - // Customer Details - mapped from A4Standard CustomerDetails array - customerName: table2Data?.[0]?.CustName || table2Data?.CustName - || "", - customerMobile: table2Data?.[0]?.CustMobile || table2Data?.CustMobile || "", - customerGSTIN: table2Data?.[0]?.SuppGSTIN || table2Data?.CustGSTIN || "", - VehicleNo: table2Data?.[0]?.VehicleNo || table2Data?.VehicleNo || "", - TransporterId: table2Data?.[0]?.TransporterId || table2Data?.TransporterId || "", - TransporterName: table2Data?.[0]?.TransporterName || table2Data?.TransporterName || "", - customerAddress: { - address1: table2Data?.CustomerDetails?.[0]?.Address1 || "", - address2: table2Data?.CustomerDetails?.[0]?.Address2 || "", - state: table2Data?.CustomerDetails?.[0]?.State || "" - }, + // Invoice Details - mapped from A4Standard + invoiceNo: table2Data?.[0]?.DCNo + ? extractLastNumberOrderId(table2Data?.[0]?.DCNo) + : '', + invoiceDate: moment(Date1).format('DD-MM-YYYY') || '', - // Product Details - mapped from A4Standard productDetails - productDetails: table2Data?.[0]?.ProductDetails || [], + // Customer Details - mapped from A4Standard CustomerDetails array + customerName: table2Data?.[0]?.CustName || table2Data?.CustName || '', + customerMobile: table2Data?.[0]?.CustMobile || table2Data?.CustMobile || '', + customerGSTIN: table2Data?.[0]?.SuppGSTIN || table2Data?.CustGSTIN || '', + VehicleNo: table2Data?.[0]?.VehicleNo || table2Data?.VehicleNo || '', + TransporterId: + table2Data?.[0]?.TransporterId || table2Data?.TransporterId || '', + TransporterName: + table2Data?.[0]?.TransporterName || table2Data?.TransporterName || '', + customerAddress: { + address1: table2Data?.CustomerDetails?.[0]?.Address1 || '', + address2: table2Data?.CustomerDetails?.[0]?.Address2 || '', + state: table2Data?.CustomerDetails?.[0]?.State || '', + }, - // Totals - mapped from A4Standard - totalAmount: Number(table2Data?.[0]?.TotalAmount || table2Data?.TotalAmt), - taxAmount: Number(OrderDetailGST), - grandTotal: Number(table2Data?.[0]?.TotalAmount || table2Data?.GrandTotal), - totalBillAmount: Number(table2Data?.[0]?.BillAmount || table2Data?.NetAmount || 0), - // Bank Details - mapped from A4Standard - bankDetails: BankDetails?.[0] || null - }; + // Product Details - mapped from A4Standard productDetails + productDetails: table2Data?.[0]?.ProductDetails || [], - console.log(table2Data, "Date1Date1", invoiceData,) + // Totals - mapped from A4Standard + totalAmount: Number(table2Data?.[0]?.TotalAmount || table2Data?.TotalAmt), + taxAmount: Number(OrderDetailGST), + grandTotal: Number(table2Data?.[0]?.TotalAmount || table2Data?.GrandTotal), + totalBillAmount: Number( + table2Data?.[0]?.BillAmount || table2Data?.NetAmount || 0 + ), + // Bank Details - mapped from A4Standard + bankDetails: BankDetails?.[0] || null, + }; - let PageSize = printDatas?.PageSize + console.log(table2Data, 'Date1Date1', invoiceData); + let PageSize = printDatas?.PageSize; - const cgstTotal = OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.CGST || 0), 0))?.toFixed(2) - : 0; - const sgstTotal = OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.SGST || 0), 0))?.toFixed(2) - : 0; - const igstTotal = OrderDetailIGST && OrderDetailIGST.length > 0 - ? Number(OrderDetailIGST.reduce((sum, item) => sum + (item.IGST || 0), 0))?.toFixed(2) - : 0; + const cgstTotal = + OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce((sum, item) => sum + (item.CGST || 0), 0) + )?.toFixed(2) + : 0; + const sgstTotal = + OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce((sum, item) => sum + (item.SGST || 0), 0) + )?.toFixed(2) + : 0; + const igstTotal = + OrderDetailIGST && OrderDetailIGST.length > 0 + ? Number( + OrderDetailIGST.reduce((sum, item) => sum + (item.IGST || 0), 0) + )?.toFixed(2) + : 0; - // Calculate round off value - const roundOffValue = Number(invoiceData.grandTotal) - ( - Number(invoiceData.totalBillAmount) + - Number(cgstTotal) + - Number(sgstTotal) + - Number(igstTotal) + // Calculate round off value + const roundOffValue = + Number(invoiceData.grandTotal) - + (Number(invoiceData.totalBillAmount) + + Number(cgstTotal) + + Number(sgstTotal) + + Number(igstTotal)); + + function RoundOffFun(amount) { + const roundedAmount = Math.round(amount); + const roundOffValue = parseFloat((roundedAmount - amount).toFixed(2)); + // const symbol = roundOffValue > 0 ? '+' : ''; // Add "+" symbol for positive values ${symbol} + console.log( + 'Rounded Amount:', + roundedAmount, + 'Round Off Value:', + roundOffValue + ); + return `${roundOffValue.toFixed(2)}`; + } + + // Allow up to 10 items per page + const chunkSize = isMobile ? 7 : PageSize == 'A5' ? 9 : 8; + let dataSource = []; + dataSource = table2Data?.[0]?.ProductDetails || []; + if (!Array.isArray(dataSource)) { + dataSource = []; + } + + console.log('Final DataSource:', table2Data); + + const paginatedChunks = []; + + // Always create at least one chunk, even if empty + if (dataSource.length === 0) { + paginatedChunks.push([]); + } else { + // Split data into chunks + for (let i = 0; i < dataSource.length; i += chunkSize) { + const chunk = dataSource.slice(i, i + chunkSize); + paginatedChunks.push(chunk); + } + } + + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + // If last page has more than 6 items, move footer to new page + const shouldFooterBeOnNewPage = lastChunkRows === chunkSize; + + // If footer should be on new page, add an empty chunk for footer-only page + if (shouldFooterBeOnNewPage && paginatedChunks.length > 0) { + paginatedChunks.push([]); // Empty chunk for footer-only page + } + + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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 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, + }; + + return ( +
+ {paginatedChunks.map((dataChunk, chunkIndex) => ( +
0 ? ' print-page-break' : ''}` + } + style={{ + display: 'flex', + flexDirection: 'column', + // justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) ? "space-between" : "", + height: isMobile ? '275mm' : PageSize == 'A5' ? '130mm' : '245mm', + marginBottom: '0', + pageBreakAfter: + chunkIndex < paginatedChunks.length - 1 ? 'always' : 'auto', + }} + > + {renderInvoiceContent(dataChunk, chunkIndex)} +
+ ))} +
+ ); + + function renderInvoiceContent(dataChunk, chunkIndex) { + console.log( + `Rendering page ${chunkIndex + 1}, chunk has ${dataChunk.length} items:`, + dataChunk ); - function RoundOffFun(amount) { - const roundedAmount = Math.round(amount); - const roundOffValue = parseFloat((roundedAmount - amount).toFixed(2)); - // const symbol = roundOffValue > 0 ? '+' : ''; // Add "+" symbol for positive values ${symbol} - console.log("Rounded Amount:", roundedAmount, "Round Off Value:", roundOffValue); - return `${roundOffValue.toFixed(2)}`; - - } - - // Allow up to 10 items per page - const chunkSize = isMobile ? 7 : PageSize == "A5" ? 9 : 8; - let dataSource = []; - dataSource = table2Data?.[0]?.ProductDetails || []; - if (!Array.isArray(dataSource)) { - dataSource = []; - } - - console.log("Final DataSource:", table2Data,); - - const paginatedChunks = []; - - // Always create at least one chunk, even if empty - if (dataSource.length === 0) { - paginatedChunks.push([]); - } else { - // Split data into chunks - for (let i = 0; i < dataSource.length; i += chunkSize) { - const chunk = dataSource.slice(i, i + chunkSize); - paginatedChunks.push(chunk); - } - } - - const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; - // If last page has more than 6 items, move footer to new page - const shouldFooterBeOnNewPage = lastChunkRows === chunkSize; - - // If footer should be on new page, add an empty chunk for footer-only page - if (shouldFooterBeOnNewPage && paginatedChunks.length > 0) { - paginatedChunks.push([]); // Empty chunk for footer-only page - } + const isFirstPage = chunkIndex === 0; + const isLastPage = chunkIndex === paginatedChunks.length - 1; + const isFooterOnlyPage = + isLastPage && dataChunk.length === 0 && shouldFooterBeOnNewPage; + console.log( + `Page ${chunkIndex + 1}: isFirstPage=${isFirstPage}, isLastPage=${isLastPage}, isFooterOnlyPage=${isFooterOnlyPage}` + ); return ( -
- {paginatedChunks.map((dataChunk, chunkIndex) => ( -
0 ? ' print-page-break' : ''}`} - style={{ - display: "flex", - flexDirection: "column", - // justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) ? "space-between" : "", - height: isMobile ? "275mm" : PageSize == "A5" ? '130mm' : "245mm", - marginBottom: "0", - pageBreakAfter: chunkIndex < paginatedChunks.length - 1 ? 'always' : 'auto' - }} - > - {renderInvoiceContent(dataChunk, chunkIndex)} + <> + {/* Header - Only on first page */} + {isFirstPage && ( + <> +
+
+

+ {table2Data?.OrderType === 'E' + ? 'Estimate' + : BillName + ? BillName + : 'Tax Invoice'} +

+
+
+ (ORIGINAL FOR RECIPIENT)
- ))} -
- ); +
+
+ + )} - function renderInvoiceContent(dataChunk, chunkIndex) { - console.log(`Rendering page ${chunkIndex + 1}, chunk has ${dataChunk.length} items:`, dataChunk); + {/* Main Container - Always show */} +
+ {/* Top Section - Company and Invoice Details - Only on first page */} + {isFirstPage && ( +
+ {/* Left - Company Details */} +
+
+
+ {invoiceData.companyName} +
+
+ {invoiceData.companyspecname} +
+
{invoiceData.companyAddress.address1}
+
{invoiceData.companyAddress.address2}
+
+ {invoiceData.companyAddress.city}{' '} + {invoiceData.companyAddress.zip + ? ` - ${invoiceData.companyAddress.zip}` + : ''} +
+
{invoiceData.companyAddress.state}
+
GSTIN/UIN: {invoiceData.companyGSTIN}
+ {/*
State Name: Tamil Nadu, Code: 33
*/} + {invoiceData.companyEmail && ( +
E-Mail: {invoiceData.companyEmail}
+ )} + {invoiceData.companyMobile && ( +
+ Mobile: +91 {invoiceData.companyMobile} + {invoiceData.companyMobile2 + ? `, ${invoiceData.companyMobile2}` + : ''} +
+ )} +
+ {/* Buyer Details */} +
+
+ Buyer (Bill to) +
+
+ {invoiceData.customerName} +
+ {invoiceData.customerAddress.address1 && ( +
{invoiceData.customerAddress.address1}
+ )} + {invoiceData.customerAddress.address2 && ( +
{invoiceData.customerAddress.address2}
+ )} + {invoiceData.customerMobile && ( +
Mobile: {invoiceData.customerMobile}
+ )} + {invoiceData.customerGSTIN && ( +
GSTIN/UIN: {invoiceData.customerGSTIN}
+ )} + {invoiceData.customerAddress.state && ( +
State Name: {invoiceData.customerAddress.state}
+ )} + {invoiceData.VehicleNo && ( +
Vehicle No : {invoiceData.VehicleNo}
+ )} + {invoiceData.TransporterName && ( +
Transporter Name: {invoiceData.TransporterName}
+ )} + {invoiceData.TransporterId && ( +
Transporter Id: {invoiceData.TransporterId}
+ )} +
+
- console.log(`Page ${chunkIndex + 1}: isFirstPage=${isFirstPage}, isLastPage=${isLastPage}, isFooterOnlyPage=${isFooterOnlyPage}`); + {/* Right - Invoice Details */} +
+ {/* Invoice No and Date */} +
+
+
+ Invoice No. +
+
+ {invoiceData.invoiceNo} +
+
+
+
Dated
+
+ {invoiceData.invoiceDate} +
+
+
- return ( - <> - {/* Header - Only on first page */} - {isFirstPage && ( + {/* Delivery Note and Payment Terms */} +
+
+
+ Delivery Note +
+
+
+
+
+ Mode/Terms of Payment +
+
+
+
+ + {/* Reference and Other References */} +
+
+
+ Reference No. & Date +
+
+
+
+
+ Other References +
+
+
+
+ + {/* Buyer's Order */} +
+
+
+ Buyer's Order No. +
+
+
+
+
+ Dated +
+
+
+
+ + {/* Dispatch Details */} +
+
+
+ Dispatch Doc No. +
+
+
+
+
+ Delivery Note Date +
+
+
+
+ + {/* Dispatched through and Destination */} +
+
+
+ Dispatched through +
+
+
+
+
+ Destination +
+
+
+
+ + {/* Terms of Delivery */} +
+
+ Terms of Delivery +
+
+
+
+
+ )} + + {/* Continuation header for non-first pages */} + {!isFirstPage && ( +
+

+ {isFooterOnlyPage ? 'Tax Invoice' : 'Tax Invoice '} +

+
+ Invoice No: {invoiceData.invoiceNo} +
+
+ )} + + {/* Items Table - Show only if there are items or not a footer-only page */} + {(dataChunk.length > 0 || !isFooterOnlyPage) && ( +
+ {/* Table Header */} +
+
+ Sl.No +
+
+ Description of Goods +
+
+ HSN/SAC +
+
+ Quantity +
+
+ Rate +
+
+ per +
+
+ Amount +
+
+ + {/* Table Rows - Dynamic data from dataChunk */} + {dataChunk && dataChunk.length > 0 ? ( + <> + {dataChunk?.map((item, index) => ( +
+
+ {chunkIndex * chunkSize + index + 1} +
+
+
+ {item.ProdName || 'Product Name'} +
+ {item.BrandName && ( +
+ {item.BrandName} +
+ )} +
+
+ {item.HSN || ''} +
+
+ {item.Qty || 0} {item.UomName || 'NOS'} +
+
+ {Number(item.ProductRate || 0)?.toLocaleString( + 'en-IN', + { minimumFractionDigits: 2, maximumFractionDigits: 2 } + )} +
+
+ {item.UomName || 'NOS'} +
+
+ {Number(item.TotalAmount || 0)?.toLocaleString( + 'en-IN', + { minimumFractionDigits: 2, maximumFractionDigits: 2 } + )} +
+
+ ))} + {/* Tax summary */} + {isLastPage && ( <> -
-
-

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

-
-
(ORIGINAL FOR RECIPIENT)
-
+ {/* Total without tax amount */} +
+
+
+
+
+
+
+
+ ₹{' '} + {Number(invoiceData?.totalAmount).toLocaleString( + 'en-IN', + { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + } + )}
+
+ {/* CGST */} + {OrderDetailGST && OrderDetailGST.length > 0 && ( +
+
+
+ CGST +
+
+
+
+
+ { +
+ {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 && OrderDetailGST.length > 0 && ( +
+
+
+ SGST +
+
+
+
+
+
+ {OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce( + (sum, item) => sum + (item.SGST || 0), + 0 + ) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : '0.00'} +
+
+ )} + {/* IGST */} + {OrderDetailIGST && OrderDetailIGST.length > 0 && ( +
+
+
+ IGST +
+
+
+
+
+ +
+ {OrderDetailIGST && OrderDetailIGST.length > 0 + ? Number( + OrderDetailIGST.reduce( + (sum, item) => sum + (item.IGST || 0), + 0 + ) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : '0.00'} +
+
+ )} + {/* Rounding Off */} +
+
+
+ ROUNDING OFF +
+
+
+
+
+ +
+ {RoundOffFun(roundOffValue)} +
+
+ {Array.from({ + length: chunkSize - dataChunk.length, + })?.map((_, idx) => ( +
+
+   +
+
+   +
+
+   +
+
+   +
+
+   +
+
+   +
+
+   +
+
+ ))} + {/* Total */} +
+
+
+ Total +
+
+
+ {totalQuantity || + invoiceData.productDetails?.reduce( + (sum, item) => sum + (item.Qty || 0), + 0 + ) || + 0}{' '} + NOS +
+
+
+
+ ₹{' '} + {Number(invoiceData.grandTotal).toLocaleString( + 'en-IN', + { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + } + )} +
+
- )} + )} + + ) : ( + // Show empty row when no data +
+
+ - +
+
+ No items to display +
+
+ - +
+
+ - +
+
+ - +
+
+ - +
+
+ - +
+
+ )} +
+ )} + {/* Tax summary - Only on last page */} - {/* Main Container - Always show */} -
+ {/* Footer content - Only on last page */} + {isLastPage && ( + <> + {/* Amount in Words */} +
+
+
+ Amount Chargeable (in words) +
+
+ INR {numberToWords(Math.floor(invoiceData.grandTotal))} Only +
+
+

E. & O.E

+
- {/* Top Section - Company and Invoice Details - Only on first page */} - {isFirstPage && ( -
+ {/* Tax Breakdown Table */} + {OrderDetailIGST && OrderDetailIGST.length > 0 && ( +
+ {/* Tax Table Header - Main Headers */} +
+
+ HSN/SAC +
+
+ Taxable Value +
+
+ CGST +
+
+ SGST/UTGST +
+
+ Tax Amount +
+
- {/* Left - Company Details */} -
-
+
+
+
+ Rate +
+
+ Amount +
+
+ Rate +
+
+ Amount +
+
+
- fontSize: '11px', - textAlign: 'left' - }}> - -
- {invoiceData.companyName} -
-
{invoiceData.companyspecname}
-
{invoiceData.companyAddress.address1}
-
{invoiceData.companyAddress.address2}
-
{invoiceData.companyAddress.city} {invoiceData.companyAddress.zip ? ` - ${invoiceData.companyAddress.zip}` : ""}
-
{invoiceData.companyAddress.state}
-
GSTIN/UIN: {invoiceData.companyGSTIN}
- {/*
State Name: Tamil Nadu, Code: 33
*/} - {invoiceData.companyEmail &&
E-Mail: {invoiceData.companyEmail}
} - {invoiceData.companyMobile &&
Mobile: +91 {invoiceData.companyMobile}{invoiceData.companyMobile2 ? `, ${invoiceData.companyMobile2}` : ""}
} -
- {/* Buyer Details */} -
-
Buyer (Bill to)
-
{invoiceData.customerName}
- {invoiceData.customerAddress.address1 &&
{invoiceData.customerAddress.address1}
} - {invoiceData.customerAddress.address2 &&
{invoiceData.customerAddress.address2}
} - {invoiceData.customerMobile &&
Mobile: {invoiceData.customerMobile}
} - {invoiceData.customerGSTIN &&
GSTIN/UIN: {invoiceData.customerGSTIN}
} - {invoiceData.customerAddress.state &&
State Name: {invoiceData.customerAddress.state}
} - {invoiceData.VehicleNo &&
Vehicle No : {invoiceData.VehicleNo}
} - {invoiceData.TransporterName &&
Transporter Name: {invoiceData.TransporterName}
} - {invoiceData.TransporterId &&
Transporter Id: {invoiceData.TransporterId}
} -
- -
- - {/* Right - Invoice Details */} -
- - {/* Invoice No and Date */} -
-
-
Invoice No.
-
{invoiceData.invoiceNo}
-
-
-
Dated
-
{invoiceData.invoiceDate}
-
-
- - {/* Delivery Note and Payment Terms */} -
-
-
Delivery Note
-
-
-
-
Mode/Terms of Payment
-
-
-
- - {/* Reference and Other References */} -
-
-
Reference No. & Date
-
-
-
-
Other References
-
-
-
- - {/* Buyer's Order */} -
-
-
Buyer's Order No.
-
-
-
-
Dated
-
-
-
- - {/* Dispatch Details */} -
-
-
Dispatch Doc No.
-
-
-
-
Delivery Note Date
-
-
-
- - {/* Dispatched through and Destination */} -
-
-
Dispatched through
-
-
-
-
Destination
-
-
-
- - {/* Terms of Delivery */} -
-
Terms of Delivery
-
-
- -
+ {/* Tax Table Rows - Dynamic from OrderDetailGST */} + {OrderDetailGST && OrderDetailGST.length > 0 ? ( + OrderDetailGST?.map((taxItem, index) => ( +
+
+ {taxItem.HSN || ''}
- )} - - {/* Continuation header for non-first pages */} - {!isFirstPage && ( -
-

- {isFooterOnlyPage ? 'Tax Invoice' : 'Tax Invoice '} -

-
Invoice No: {invoiceData.invoiceNo}
+
+ {Number(taxItem.WithoutTaxRate || 0).toLocaleString( + 'en-IN', + { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + } + )}
- )} - - {/* Items Table - Show only if there are items or not a footer-only page */} - {(dataChunk.length > 0 || !isFooterOnlyPage) && ( -
- {/* Table Header */} -
-
Sl.No
-
Description of Goods
-
HSN/SAC
-
Quantity
-
Rate
-
per
-
Amount
-
- - {/* Table Rows - Dynamic data from dataChunk */} - {(dataChunk && dataChunk.length > 0) ? ( - <> - {dataChunk?.map((item, index) => ( -
-
{chunkIndex * chunkSize + index + 1}
-
-
{item.ProdName || 'Product Name'}
- {item.BrandName &&
{item.BrandName}
} -
-
{item.HSN || ''}
-
{item.Qty || 0} {item.UomName || 'NOS'}
-
{Number(item.ProductRate || 0)?.toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
-
{item.UomName || 'NOS'}
-
{Number(item.TotalAmount || 0)?.toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
-
- ))} - {/* Tax summary */} - {isLastPage && - ( - <> - {/* Total without tax amount */} -
-
-
-
-
-
-
-
- ₹ {Number(invoiceData?.totalAmount).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })} -
-
- {/* CGST */} - {OrderDetailGST && OrderDetailGST.length > 0 &&
-
-
CGST
-
-
-
-
- {
- {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 && OrderDetailGST.length > 0 &&
-
-
SGST
-
-
-
-
-
- {OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.SGST || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - : "0.00"} -
-
} - {/* IGST */} - {OrderDetailIGST && OrderDetailIGST.length > 0 && ( -
-
-
IGST
-
-
-
-
- -
- {OrderDetailIGST && OrderDetailIGST.length > 0 - ? Number(OrderDetailIGST.reduce((sum, item) => sum + (item.IGST || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - : "0.00"} -
-
- )} - {/* Rounding Off */} -
-
-
ROUNDING OFF
-
-
-
-
- -
- {RoundOffFun(roundOffValue)} -
-
- {Array.from({ length: chunkSize - dataChunk.length })?.map((_, idx) => ( -
-
 
-
 
-
 
-
 
-
 
-
 
-
 
-
- ))} - {/* Total */} -
-
-
Total
-
-
- {totalQuantity || - (invoiceData.productDetails?.reduce((sum, item) => sum + (item.Qty || 0), 0)) || - 0} NOS -
-
-
-
- ₹ {Number(invoiceData.grandTotal).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })} -
-
- - )} - - ) : ( - - // Show empty row when no data -
-
-
-
No items to display
-
-
-
-
-
-
-
-
-
-
-
- )} +
+ {taxItem.TaxPercentage + ? taxItem.TaxPercentage / 2 + '%' + : '0%'}
+
+ {Number(taxItem.CGST || 0).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + })} +
+
+ {taxItem.TaxPercentage + ? taxItem.TaxPercentage / 2 + '%' + : '0%'} +
+
+ {Number(taxItem.SGST || 0).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + })} +
+
+ {Number( + (taxItem.CGST || 0) + (taxItem.SGST || 0) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + })} +
+
+ )) + ) : ( + // Show 0 values when no GST data +
+
+ - +
+
+ 0.00 +
+
+ 0% +
+
+ 0.00 +
+
+ 0% +
+
+ 0.00 +
+
+ 0.00 +
+
+ )} + + {/* Tax Table Total */} +
+
+ Total +
+
+ {OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce( + (sum, item) => sum + (item.WithoutTaxRate || 0), + 0 + ) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : '0.00'} +
+
+
+ {OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce( + (sum, item) => sum + (item.CGST || 0), + 0 + ) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : '0.00'} +
+
+
+ {OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce( + (sum, item) => sum + (item.SGST || 0), + 0 + ) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : '0.00'} +
+
+ {OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce( + (sum, item) => + sum + + (item.CGST || 0) + + (item.SGST || 0) + + (item.WithoutTaxRate || 0), + 0 + ) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : '0.00'} +
+
+
+ )} + + {/* Tax Amount in Words */} + {OrderDetailIGST && OrderDetailIGST.length > 0 && ( +
+
+ Tax Amount (in words): INR{' '} + {numberToWords( + Math.floor( + invoiceData.taxAmount || + OrderDetailGST?.reduce( + (sum, item) => + sum + (item.CGST || 0) + (item.SGST || 0), + 0 + ) || + 0 + ) + )}{' '} + Only +
+
+ )} + + {/* Bank Details and Signature */} +
+ {/* Declaration */} +
+
+
+ Declaration +
+
+ We declare that this invoice shows the actual price of the + goods described and that all particulars are true and + correct. +
+
+
+ + {/* Signature Section */} +
+ {/* Bank Details */} +
+
+ Company's Bank Details +
+
+ + A/c Holder's Name: + {' '} + {invoiceData.companyName} +
+
+ Bank Name:{' '} + {invoiceData.bankDetails?.BankName || ''} +
+
+ A/c No.:{' '} + {invoiceData.bankDetails?.AccountNo || ''} +
+
+ + Branch & IFS Code: + {' '} + {invoiceData.bankDetails?.BankBranch || ''} &{' '} + {invoiceData.bankDetails?.IFSCCode || ''} +
+ {invoiceData.bankDetails?.SWIFTCode && ( +
+ SWIFT Code:{' '} + {invoiceData.bankDetails?.SWIFTCode || ''} +
)} - {/* Tax summary - Only on last page */} - - {/* Footer content - Only on last page */} - {isLastPage && ( - <> - {/* Amount in Words */} -
-
-
Amount Chargeable (in words)
-
INR {numberToWords(Math.floor(invoiceData.grandTotal))} Only
-
-

E. & O.E

-
- - - {/* Tax Breakdown Table */} - {OrderDetailIGST && OrderDetailIGST.length > 0 &&
- - {/* Tax Table Header - Main Headers */} -
-
HSN/SAC
-
Taxable Value
-
CGST
-
SGST/UTGST
-
Tax Amount
-
- - {/* Tax Table Sub-Headers */} -
-
-
-
Rate
-
Amount
-
Rate
-
Amount
-
-
- - {/* Tax Table Rows - Dynamic from OrderDetailGST */} - {OrderDetailGST && OrderDetailGST.length > 0 ? ( - OrderDetailGST?.map((taxItem, index) => ( -
-
{taxItem.HSN || ''}
-
{Number(taxItem.WithoutTaxRate || 0).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
-
{taxItem.TaxPercentage ? (taxItem.TaxPercentage / 2) + '%' : '0%'}
-
{Number(taxItem.CGST || 0).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
-
{taxItem.TaxPercentage ? (taxItem.TaxPercentage / 2) + '%' : '0%'}
-
{Number(taxItem.SGST || 0).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
-
{Number((taxItem.CGST || 0) + (taxItem.SGST || 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
-
- )) - ) : ( - // Show 0 values when no GST data -
-
-
-
0.00
-
0%
-
0.00
-
0%
-
0.00
-
0.00
-
- )} - - {/* Tax Table Total */} -
-
Total
-
- {OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.WithoutTaxRate || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - : "0.00" - } -
-
-
- {OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.CGST || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - : "0.00" - } -
-
-
- {OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.SGST || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - : "0.00" - } -
-
- {OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.CGST || 0) + (item.SGST || 0) + (item.WithoutTaxRate || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - : "0.00" - } -
-
-
} - - {/* Tax Amount in Words */} - {OrderDetailIGST && OrderDetailIGST.length > 0 &&
-
- Tax Amount (in words): INR {numberToWords(Math.floor(invoiceData.taxAmount || (OrderDetailGST?.reduce((sum, item) => sum + (item.CGST || 0) + (item.SGST || 0), 0) || 0)))} Only -
-
} - - {/* Bank Details and Signature */} -
- {/* Declaration */} -
-
-
Declaration
-
We declare that this invoice shows the actual price of the goods described and that all particulars are true and correct.
-
-
- - - {/* Signature Section */} -
- {/* Bank Details */} -
-
Company's Bank Details
-
A/c Holder's Name: {invoiceData.companyName}
-
Bank Name: {invoiceData.bankDetails?.BankName || ""}
-
A/c No.: {invoiceData.bankDetails?.AccountNo || ""}
-
Branch & IFS Code: {invoiceData.bankDetails?.BankBranch || ""} & {invoiceData.bankDetails?.IFSCCode || ""}
- {invoiceData.bankDetails?.SWIFTCode &&
SWIFT Code: {invoiceData.bankDetails?.SWIFTCode || ""}
} -
-
-
for {invoiceData.companyName}
-
-
-
- {/*
DD
+
+
+
+ for {invoiceData.companyName} +
+
+
+
+ {/*
DD
TECHNOLOGIES
ELECTRONICS
*/} -
-
-
Authorised Signatory
-
-
-
-
- - )} - -
- - {/* Footer - Only on last page */} - {isLastPage && ( -
-
This is a Computer Generated Invoice
+
+
+
+ Authorised Signatory +
- )} +
+
+
- ); - } + )} +
+ + {/* Footer - Only on last page */} + {isLastPage && ( +
+
This is a Computer Generated Invoice
+
+ )} + + ); + } }; export default DCInvicePrint; diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle1.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle1.jsx index b0f451b..e7dca4e 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle1.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle1.jsx @@ -1,9 +1,9 @@ -import React from "react"; -import { useDispatch, useSelector } from "react-redux"; +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; import { extractLastNumber, extractLastNumberOrderId, -} from "../../../../Services/Others"; +} from '../../../../Services/Others'; import { GlobalprintSlNo, GlobalprintItem, @@ -23,33 +23,52 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, -} from "../../../../Features/ThemeChange/ThemeChange"; -import "../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.scss"; -import QRCode from "react-qr-code"; -import { GlobalUpiIDprint } from "../../../../Features/BookingScreen/BookingData/BookingData"; -import signature from "../../../../Images/signatureimage.jpg" -import { ApplicationPreferences } from "../../../../Features/BrachLogin/BranchLogin"; -import { isMobile } from "react-device-detect"; -const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalSelectedNetAmountColor, + GlobalSelectedNetAmountFontColor, +} from '../../../../Features/ThemeChange/ThemeChange'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.scss'; +import QRCode from 'react-qr-code'; +import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import signature from '../../../../Images/signatureimage.jpg'; +import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; +import { isMobile } from 'react-device-detect'; +const DCPrintStyle1 = ({ + BranchName, + BranchDetails, + BranchAddress, BranchCity, - BranchZip, Date1, - table2Data, PaymentStatus, PrintGreeting, printDatas, DCPrintTemplateDtl }) => { - + BranchZip, + Date1, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + DCPrintTemplateDtl, +}) => { const dispatch = useDispatch(); let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { acc[item.ConfigName] = true; return acc; }, {}); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - console.log(Item, "Item") - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + console.log(Item, 'Item'); + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; const GlobalSlNo = useSelector(GlobalprintSlNo); const GlobalItem = useSelector(GlobalprintItem); const GlobalMRP = useSelector(GlobalprintMRP); @@ -64,20 +83,51 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); const GlobalSignatureImages = useSelector(GlobalSignatureImage); const GlobalIsnotes = useSelector(Globalnotes); - const GlobalthemeFormatr = useSelector(GlobalthemeFormat) - const GlobalBilltext = useSelector(GlobalBillName) + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); + const GlobalBilltext = useSelector(GlobalBillName); + // + 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 + ); const keysLength = Object.keys(table2Data ?? {}).length; - console.log(GlobalDiscount, Discount, "Discount"); - console.log(printDatas, "GlobalthemeFormatr"); - let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions - let SignatureImg = DCPrintTemplateDtl?.Signature - let Notestext = DCPrintTemplateDtl?.Notes - let BillName = DCPrintTemplateDtl?.PrintHdrName - let FormatTheme = DCPrintTemplateDtl?.PrintType == "S" ? true : false - let PageSize = DCPrintTemplateDtl?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; + let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions; + let SignatureImg = DCPrintTemplateDtl?.Signature; + let Notestext = DCPrintTemplateDtl?.Notes; + let BillName = DCPrintTemplateDtl?.PrintHdrName; + let FormatTheme = DCPrintTemplateDtl?.PrintType == 'S' ? true : false; + let PageSize = DCPrintTemplateDtl?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + // + let printColors = DCPrintTemplateDtl?.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 formatDate = (dateString = '') => { const date = new Date(dateString); @@ -99,26 +149,26 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, const month = months[date.getMonth()]; const year = date.getFullYear(); return day && month && year ? `${day}-${month}-${year}` : '-'; - } + }; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } const currentDate = new Date(); - const day = currentDate.getDate().toString().padStart(2, "0"); + const day = currentDate.getDate().toString().padStart(2, '0'); const monthNames = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', ]; const monthIndex = currentDate.getMonth(); const year = currentDate.getFullYear().toString().slice(-2); @@ -132,74 +182,73 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, 0 ); - const products = [ { - ProdName: "ITEM 1", + ProdName: 'ITEM 1', Rate: 88.0, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, - HSN: "01", + HSN: '01', }, { - ProdName: "ITEM 2", + ProdName: 'ITEM 2', Rate: 300.0, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, - HSN: "02", + HSN: '02', }, { - ProdName: "ITEM 3", + ProdName: 'ITEM 3', Rate: 200.0, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, - HSN: "03", + HSN: '03', }, { - ProdName: "ITEM 4", + ProdName: 'ITEM 4', Rate: 30.0, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, - HSN: "04", + HSN: '04', }, { - ProdName: "ITEM 5", + ProdName: 'ITEM 5', Rate: 30.0, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, - HSN: "05", + HSN: '05', }, { - ProdName: "ITEM 6", + ProdName: 'ITEM 6', Rate: 130.0, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, - HSN: "06", + HSN: '06', }, { - ProdName: "ITEM 7", + ProdName: 'ITEM 7', Rate: 230.0, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, - HSN: "08", + HSN: '08', }, ]; - const chunkSize = PageSize == "A5" ? 9 : 13; + const chunkSize = PageSize == 'A5' ? 9 : 13; let dataSource = table2Data?.ProductDetails || []; @@ -208,185 +257,346 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, 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); + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 10); + // + 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 ( - - <>
{paginatedChunks.map((dataChunk, chunkIndex) => ( -
0 ? ' print-page-break' : ''}`} style={{ display: "flex", flexDirection: "column", height: FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> - - +
0 ? ' print-page-break' : ''}`} + style={{ + display: 'flex', + flexDirection: 'column', + height: FormatTheme ? (PageSize == 'A5' ? '170mm' : '257mm') : '', + }} + key={chunkIndex} + > {/*
*/} -
-
+
+
- {" "} - {GlobaldummyData ? "XYZ Shop" : BranchName} + {' '} + {GlobaldummyData ? 'XYZ Shop' : BranchName}
-
+
{GlobaldummyData - ? "BranchAddress, Town- 635XXX City - State" - : (BranchAddress || "") + - (BranchCity - ? (BranchAddress && BranchCity ? "-" : "") + BranchCity - : "") + - (BranchZip - ? (BranchCity && - BranchZip - ? "-" - : "") + BranchZip - : "")} + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')}
- {BranchDetails?.BrGSTIN &&
GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : BranchDetails?.BrGSTIN}, CIN :u00045hhsgbubufsdug
} - {BranchDetails?.BrMobile && -
- {" "} - Mobile : +91 {GlobaldummyData ? "986XXXXXXX" : BranchDetails?.BrMobile} + {BranchDetails?.BrGSTIN && ( +
+ GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : BranchDetails?.BrGSTIN} + , CIN :u00045hhsgbubufsdug
- } + )} + {BranchDetails?.BrMobile && ( +
+ {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile} +
+ )}
-
{GlobaldummyData ? 'Cash Bill' : BillName ? BillName : "Delivery Challan"}
- +
+ {GlobaldummyData + ? 'Cash Bill' + : BillName + ? BillName + : 'Delivery Challan'}{' '} +
-
- {table2Data?.ToBranchDtl?.length > 0 && <> -
-
-
Delivery To :
-
-
{table2Data?.ToBranchDtl?.[0]?.BranchName}
- {table2Data?.ToBranchDtl?.[0]?.Address1 &&
{table2Data?.ToBranchDtl?.[0]?.Address1}
} - {(table2Data?.ToBranchDtl?.[0]?.City || table2Data?.ToBranchDtl?.[0]?.Dist || table2Data?.ToBranchDtl?.[0]?.Zip) &&
{`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
} - {table2Data?.ToBranchDtl?.[0]?.BrGSTIN &&
{table2Data?.ToBranchDtl?.[0]?.BrGSTIN}
} + {table2Data?.ToBranchDtl?.length > 0 && ( + <> +
+
+
+ Delivery To : +
+
+
+ {table2Data?.ToBranchDtl?.[0]?.BranchName} +
+ {table2Data?.ToBranchDtl?.[0]?.Address1 && ( +
+ {table2Data?.ToBranchDtl?.[0]?.Address1} +
+ )} + {(table2Data?.ToBranchDtl?.[0]?.City || + table2Data?.ToBranchDtl?.[0]?.Dist || + table2Data?.ToBranchDtl?.[0]?.Zip) && ( +
{`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
+ )} + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN && ( +
+ {table2Data?.ToBranchDtl?.[0]?.BrGSTIN} +
+ )} +
-
- } + + )}
{/* orderdetails */} - {(((GlobaldummyData - ? "121" - : table2Data?.DCNo) || (GlobaldummyData ? formattedDate : Date1)) && table2Data?.dispatchPrint !== true) &&
-
+ {((GlobaldummyData ? '121' : table2Data?.DCNo) || + (GlobaldummyData ? formattedDate : Date1)) && + table2Data?.dispatchPrint !== true && ( +
+
+
+ {' '} + Delivery ChallanNo: + {GlobaldummyData ? '121' : table2Data?.DCNo} +
+
-
- {" "} - Delivery ChallanNo: - {GlobaldummyData - ? "121" - : table2Data?.DCNo} +
+
+ {' '} + Date : {GlobaldummyData ? formattedDate : Date1}{' '} +
+ )} -
-
- {" "} - Date : {GlobaldummyData ? formattedDate : Date1}{" "} + {table2Data?.dispatchPrint === true && + (table2Data?.RequestId || + formatDate(table2Data?.CreatedDate)) && ( +
+
+
+ {' '} + Ref No #: + {table2Data?.RequestId} +
+
+ +
+
+ {' '} + Dispatched Date :{' '} + {formatDate(table2Data?.CreatedDate)}{' '} +
-
} - - {(table2Data?.dispatchPrint === true && ((table2Data?.RequestId) || (formatDate(table2Data?.CreatedDate)))) &&
-
-
- {" "} - Ref No #: - {table2Data?.RequestId} + )} + {table2Data?.dispatchPrint === true && table2Data?.DispatchId && ( +
+
+
+ {' '} + Dispatch No #: + {table2Data?.DispatchId} +
- -
-
- {" "} - Dispatched Date : {formatDate(table2Data?.CreatedDate)}{" "} -
-
-
} - {((table2Data?.dispatchPrint === true && table2Data?.DispatchId)) &&
-
-
- {" "} - Dispatch No #: - {table2Data?.DispatchId} -
-
-
} + )} {/* orderdetails */}
- {(table2Data?.CustMobile || table2Data?.CustName || table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && + {(table2Data?.CustMobile || + table2Data?.CustName || + table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( <>
- {(table2Data?.CustMobile || table2Data?.CustName) && + {(table2Data?.CustMobile || table2Data?.CustName) && (
-
Delivery Details
- {table2Data?.CustMobile &&
Mobile NO :{table2Data?.CustMobile}
} - {table2Data?.CustName &&
Name:{table2Data?.CustName}
} +
+ Delivery Details +
+ {table2Data?.CustMobile && ( +
+ {' '} + Mobile NO :{table2Data?.CustMobile}{' '} +
+ )} + {table2Data?.CustName && ( +
+ {' '} + Name:{table2Data?.CustName} +
+ )}
- } - {(table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && + )} + {(table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && (
-
Vehicle Details
- {table2Data?.VehicleNo &&
Vehicle No :{table2Data?.VehicleNo}
} - {table2Data?.TransporterId &&
Transporter Id :{table2Data?.TransporterId}
} - {table2Data?.TransporterName &&
Transporter Name :{table2Data?.TransporterName}
} +
+ Vehicle Details +
+ {table2Data?.VehicleNo && ( +
+ {' '} + Vehicle No :{table2Data?.VehicleNo} +
+ )} + {table2Data?.TransporterId && ( +
+ {' '} + Transporter Id :{table2Data?.TransporterId} +
+ )} + {table2Data?.TransporterName && ( +
+ {' '} + Transporter Name :{table2Data?.TransporterName} +
+ )}
- } + )}

- } + )} {/* itemdata (loop) */} -
-
- +
{(table2Data?.ProductDetails?.length > 0 || GlobaldummyData) && ( <> - -
- + {GlobaldummyData - ? GlobalSlNo && - : SLNO == true && } + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} {GlobaldummyData ? GlobalItem && - : Item == true && } + : Item == true && ( + + )} {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && ( )} */} {GlobaldummyData - ? GlobalQuantity && + ? GlobalQuantity && ( + + ) : Quantity == true && ( - - )} + + )} {/* {GlobaldummyData ? GlobalMRP && : MRP == true && } @@ -414,38 +624,58 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, - {dataChunk?.map( - (item, index) => ( - - {GlobaldummyData - ? GlobalSlNo && ( - + {GlobaldummyData + ? GlobalSlNo && ( + ) - : SLNO == true && ( - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && ( + {GlobaldummyData + ? GlobalItem && + : Item == true && ( )} - {/* {GlobaldummyData + {/* {GlobaldummyData ? GlobalHsnCode && ( )} */} - {GlobaldummyData - ? GlobalQuantity && ( - ) - : Quantity == true && ( - )} - {/* {GlobaldummyData + {/* {GlobaldummyData ? GlobalMRP && ( )} */} - - ) - )} + + ))}
S.NoS.No + S.No + + S.No + ItemItemItemHSNHSNQtyQtyQty + Qty + MRPMRP
+ {dataChunk?.map((item, index) => ( +
{index + 1} + : SLNO == true && ( + {chunkIndex * chunkSize + index + 1} {item?.ProdName}{item?.ProdName}
{item?.ProdName}
- {!(item?.ProdVariantName || item?.RequestVariantName)?.toLowerCase()?.includes( - 'variant' - ) && Variant:{item?.ProdVariantName || item?.RequestVariantName} } -  {" "} -   + {!( + item?.ProdVariantName || + item?.RequestVariantName + ) + ?.toLowerCase() + ?.includes('variant') && ( + + Variant: + {item?.ProdVariantName || + item?.RequestVariantName}{' '} + + )} +    
{item?.HSN} @@ -456,18 +686,18 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, {item?.HSN} + {GlobaldummyData + ? GlobalQuantity && ( + {item?.SalesQty} + : Quantity == true && ( + {item?.Qty || item?.DispatchedQty} {item?.MRP} @@ -511,9 +741,8 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress,
@@ -521,97 +750,212 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, )} {/* itemdata */} - -
- - {((chunkIndex === paginatedChunks.length - 1)) && - + {chunkIndex === paginatedChunks.length - 1 && ( <>
- {/* {ExtraChargeTotal > 0 &&

Extra Charges:{ExtraChargeTotal}

} */} - - - -
- - -
- {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

+ {GlobaldummyData + ? GlobalIsnotes && ( +
+

+ Notes : 10 days Return policy +

-
-
) : - Notestext && (
-

{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 && ( +
+

+ Terms & Conditions +

+
    + {TermsAndConditions?.map((item) => ( +
  1. + {item?.TermsandConditions} +
  2. + ))} + {/*
  3. Please check the product before leaving the counter.
  4. */} +
+
+ )} -
- {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) && (
-

- Terms & Conditions -

-
    - {TermsAndConditions?.map(item => (
  1. {item?.TermsandConditions}
  2. ))} - {/*
  3. Please check the product before leaving the counter.
  4. */} -
-
) - } - - {GlobaldummyData ? GlobalSignature && (
-

Signature

- -
) : Signature == true && (
-

Signature

- -
)} - + {GlobaldummyData + ? GlobalSignature && ( +
+

+ Signature +

+ +
+ ) + : Signature == true && ( +
+

+ Signature +

+ +
+ )}
- {PrintGreeting?.SettingValue === "Y" && ( + {PrintGreeting?.SettingValue === 'Y' && (
Thank You Visit Again @@ -619,16 +963,10 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, )}
- - } - + )}
))} - - -
- ); }; diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle10.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle10.jsx index f4389c8..9a5ddfb 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle10.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle10.jsx @@ -23,6 +23,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.scss'; @@ -304,6 +313,72 @@ const DCPrintStyle10 = ({ const shouldFooterBeOnNewPage = lastChunkRows > (!isMobile ? 15 : PageSize == 'A5' ? 5 : 10); + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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 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, + }; + return ( <> {FormatTheme ? ( @@ -353,7 +428,7 @@ const DCPrintStyle10 = ({ width: '100%', }} > -
+
{GlobaldummyData ? GlobalSlNo && ( - S.N + + S.N + ) - : SLNO && S.N} + : SLNO && ( + + S.N + + )} {GlobaldummyData ? GlobalItem && ( - Item + + Item + ) - : Item && Item} + : Item && ( + + Item + + )} {GlobaldummyData ? GlobalQuantity && ( Qty ) : Quantity && ( Qty )} - {/* {GlobaldummyData ? GlobalHsnCode && HSN : HsnCode && HSN} - {GlobaldummyData ? GlobalMRP && MRP : MRP && MRP} - {GlobaldummyData ? GlobalDiscount && Dis : Discount && Dis } - {GlobaldummyData ? GlobalRate && Rate : Rate && Rate} - {GlobaldummyData ? GlobalAmount && Amt : Amount && Amt} */} {dataChunk?.map((item, index) => { return ( - + {GlobaldummyData ? GlobalSlNo && ( {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle11.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle11.jsx index b7c9ce6..10ded40 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle11.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle11.jsx @@ -25,6 +25,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalSelectedTableBodyFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.scss'; @@ -287,6 +296,72 @@ const DCPrintStyle11 = ({ : 0; const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 10); + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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 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, + }; + return ( <> {FormatTheme ? ( @@ -331,6 +406,7 @@ const DCPrintStyle11 = ({ padding: 0, fontWeight: 600, textAlign: 'center', + ...headerStyle, }} >
{GlobaldummyData @@ -360,7 +437,7 @@ const DCPrintStyle11 = ({ width: '100%', }} > -
+
{base64Image ? ( {GlobaldummyData ? GlobalSlNo && ( - S.No + + S.No + ) - : SLNO && S.No} + : SLNO && ( + + S.No + + )} {GlobaldummyData ? GlobalItem && ( - Item + + Item + ) - : Item && Item} + : Item && ( + + Item + + )} {GlobaldummyData ? GlobalQuantity && ( Qty ) : Quantity && ( Qty )} - {/* {GlobaldummyData ? GlobalHsnCode && HSN : HsnCode && HSN} - {GlobaldummyData ? GlobalMRP && MRP : MRP && MRP} - {GlobaldummyData ? GlobalDiscount && Dis : Discount && Dis } - {GlobaldummyData ? GlobalRate && Rate : Rate && Rate} - {GlobaldummyData ? GlobalAmount && Amt : Amount && Amt} */} {dataChunk?.map((item, index) => { return ( - + {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( @@ -695,11 +808,6 @@ const DCPrintStyle11 = ({ {item?.Qty || item?.DispatchedQty} )} - {/* {GlobaldummyData ? GlobalHsnCode && {item?.HSN} : HsnCode && {item?.HSN}} - {GlobaldummyData ? GlobalMRP && {item?.MRP} : MRP && {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}} - {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount && {item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}} - {GlobaldummyData ? GlobalRate && {item?.Rate} : Rate && {item?.Rate}} - {GlobaldummyData ? GlobalAmount && {item?.TotalAmt} : Amount && {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}} */} ); })} @@ -751,6 +859,7 @@ const DCPrintStyle11 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle12.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle12.jsx index 84d0a69..0ec42e5 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle12.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle12.jsx @@ -26,6 +26,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.scss'; @@ -433,6 +442,72 @@ const DCPrintstyle12 = ({ await printDiv('DCPrintStyle12', style12, 'FontApply'); }; + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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 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, + }; + return ( <> {FormatTheme ? ( @@ -483,7 +558,10 @@ const DCPrintstyle12 = ({ width: '100%', }} > -
+
{GlobaldummyData - ? GlobalSlNo && S.No - : SLNO && S.No} + ? GlobalSlNo && ( + S.No + ) + : SLNO && ( + S.No + )} {GlobaldummyData - ? GlobalItem && Description - : Item && Des} + ? GlobalItem && ( + + Description + + ) + : Item && ( + Des + )} {GlobaldummyData ? GlobalQuantity && ( - Qty + + Qty + ) : Quantity && ( - Qty + + Qty + )} - {/* {GlobaldummyData ? GlobalMRP && MRP : MRP && MRP} - {GlobaldummyData ? GlobalRate && Rate : Rate && Rate} - {GlobaldummyData ? GlobalHsnCode && HSN : HsnCode && HSN} - {GlobaldummyData ? GlobalDiscount && (%) : Discount && (%)} - {GlobaldummyData ? GlobalAmount && Amt : Amount && Amt} */} {dataChunk?.map((item, index) => { return ( - + {GlobaldummyData ? GlobalSlNo && ( @@ -841,11 +951,6 @@ const DCPrintstyle12 = ({ {item?.Qty || item?.DispatchedQty} )} - {/* {GlobaldummyData ? GlobalMRP && {item?.MRP} : MRP && {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}} - {GlobaldummyData ? GlobalRate && {item?.Rate} : Rate && {item?.Rate}} - {GlobaldummyData ? GlobalHsnCode && {item?.HSN} : HsnCode && {item?.HSN}} - {GlobaldummyData ? GlobalDiscount && {item?.discount} : Discount && {item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}} - {GlobaldummyData ? GlobalAmount && {item?.TotalAmt} : Amount && {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}} */} ); })} @@ -898,6 +1003,7 @@ const DCPrintstyle12 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle2.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle2.jsx index e75c9c4..e3a3c1d 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle2.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle2.jsx @@ -1,383 +1,912 @@ -import React from "react"; -import { useDispatch, useSelector } from "react-redux"; +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; import { - GlobalprintSlNo, - GlobalprintItem, - GlobalprintMRP, - GlobalprintDiscount, - GlobalprintQuantity, - GlobalprintRate, - GlobalprintAmount, - GlobalprintHsnCode, - GlobalprintQrcodet, - GlobalPritdummyData, - changeReprintDataFound, - GloabalFieldDetails, - GlobalprintSignature, - GlobalprinttermsAndConditions, - GlobalSignatureImage, - Globalnotes, - GlobalthemeFormat, - GlobalBillName, -} from "../../../../Features/ThemeChange/ThemeChange"; + GlobalprintSlNo, + GlobalprintItem, + GlobalprintMRP, + GlobalprintDiscount, + GlobalprintQuantity, + GlobalprintRate, + GlobalprintAmount, + GlobalprintHsnCode, + GlobalprintQrcodet, + GlobalPritdummyData, + changeReprintDataFound, + GloabalFieldDetails, + GlobalprintSignature, + GlobalprinttermsAndConditions, + GlobalSignatureImage, + Globalnotes, + GlobalthemeFormat, + GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableBodyColor, + GlobalSelectedFooterColor, + GlobalSelectedNetAmountColor, + GlobalSelectedFooterFontColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedPrintHeaderFontColor, + GlobalRowType, +} from '../../../../Features/ThemeChange/ThemeChange'; +import signature from '../../../../Images/signatureimage.jpg'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.scss'; +import { isMobile } from 'react-device-detect'; +const DCPrintstyle2 = ({ + BranchName, + BranchDetails, + BranchAddress, + BranchCity, + BranchZip, + Date1, + table2Data, + PaymentStatus, + PrintGreeting, + base64Image, + DCPrintTemplateDtl, +}) => { + const dispatch = useDispatch(); + let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { + acc[item.ConfigName] = true; + return acc; + }, {}); -import signature from "../../../../Images/signatureimage.jpg" -import "../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.scss"; -import { isMobile } from "react-device-detect"; -const DCPrintstyle2 = ({ BranchName, BranchDetails, BranchAddress, - BranchCity, - BranchZip, Date1, - table2Data, PaymentStatus, PrintGreeting, base64Image, DCPrintTemplateDtl }) => { - - const dispatch = useDispatch(); - let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { - acc[item.ConfigName] = true; - return acc; - }, {}); - - const formatDate = (dateString = '') => { - const date = new Date(dateString); - const day = date.getDate().toString().padStart(2, '0'); - const months = [ - 'Jan', - 'Feb', - 'Mar', - 'Apr', - 'May', - 'Jun', - 'Jul', - 'Aug', - 'Sep', - 'Oct', - 'Nov', - 'Dec', - ]; - const month = months[date.getMonth()]; - const year = date.getFullYear(); - return day && month && year ? `${day}-${month}-${year}` : '-'; - } - - - console.log(FieldDetails, "FieldDetails") - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - console.log(Item, "Item") - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const GlobalSlNo = useSelector(GlobalprintSlNo); - const GlobalItem = useSelector(GlobalprintItem); - const GlobalMRP = useSelector(GlobalprintMRP); - const GlobalDiscount = useSelector(GlobalprintDiscount); - const GlobalQuantity = useSelector(GlobalprintQuantity); - const GlobalRate = useSelector(GlobalprintRate); - const GlobalAmount = useSelector(GlobalprintAmount); - const GlobalHsnCode = useSelector(GlobalprintHsnCode); - const GlobalQrcodet = useSelector(GlobalprintQrcodet); - const GlobaldummyData = useSelector(GlobalPritdummyData); - const GlobalSignature = useSelector(GlobalprintSignature); - const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); - const GlobalSignatureImages = useSelector(GlobalSignatureImage); - const GlobalIsnotes = useSelector(Globalnotes); - const GlobalthemeFormatr = useSelector(GlobalthemeFormat) - const GlobalBilltext = useSelector(GlobalBillName) - - let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions - let SignatureImg = DCPrintTemplateDtl?.Signature - let Notestext = DCPrintTemplateDtl?.Notes - let BillName = DCPrintTemplateDtl?.PrintHdrName - let FormatTheme = DCPrintTemplateDtl?.PrintType == "S" ? true : false - let PageSize = DCPrintTemplateDtl?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - console.log(Signature, TermsnAdCondition, TermsAndConditions, SignatureImg, "FormatTheme"); - - - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") - const keysLength = Object.keys(table2Data ?? {}).length; - if (keysLength > 0) { - dispatch(changeReprintDataFound(true)); - } - const currentDate = new Date(); - const day = currentDate.getDate().toString().padStart(2, "0"); - const monthNames = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", + const formatDate = (dateString = '') => { + const date = new Date(dateString); + const day = date.getDate().toString().padStart(2, '0'); + const months = [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', ]; - const monthIndex = currentDate.getMonth(); - const year = currentDate.getFullYear().toString().slice(-2); + const month = months[date.getMonth()]; + const year = date.getFullYear(); + return day && month && year ? `${day}-${month}-${year}` : '-'; + }; - const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; + console.log(FieldDetails, 'FieldDetails'); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + console.log(Item, 'Item'); + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalMRP = useSelector(GlobalprintMRP); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalQuantity = useSelector(GlobalprintQuantity); + const GlobalRate = useSelector(GlobalprintRate); + const GlobalAmount = useSelector(GlobalprintAmount); + const GlobalHsnCode = useSelector(GlobalprintHsnCode); + const GlobalQrcodet = useSelector(GlobalprintQrcodet); + const GlobaldummyData = useSelector(GlobalPritdummyData); + const GlobalSignature = useSelector(GlobalprintSignature); + const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); + const GlobalSignatureImages = useSelector(GlobalSignatureImage); + const GlobalIsnotes = useSelector(Globalnotes); + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); + const GlobalBilltext = useSelector(GlobalBillName); + let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions; + let SignatureImg = DCPrintTemplateDtl?.Signature; + let Notestext = DCPrintTemplateDtl?.Notes; + let BillName = DCPrintTemplateDtl?.PrintHdrName; + let FormatTheme = DCPrintTemplateDtl?.PrintType == 'S' ? true : false; + let PageSize = DCPrintTemplateDtl?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + console.log( + Signature, + TermsnAdCondition, + TermsAndConditions, + SignatureImg, + 'FormatTheme' + ); - const products = [ - { ProdName: 'ITEM 1', Rate: 88.00, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01' }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02' }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03' }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04' }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05' }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06' }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08' }, - ]; + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); + const keysLength = Object.keys(table2Data ?? {}).length; + if (keysLength > 0) { + dispatch(changeReprintDataFound(true)); + } + const currentDate = new Date(); + const day = currentDate.getDate().toString().padStart(2, '0'); + const monthNames = [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', + ]; + const monthIndex = currentDate.getMonth(); + const year = currentDate.getFullYear().toString().slice(-2); - const chunkSize = !isMobile ? 11 : PageSize == "A5" ? 11 : 16; + const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; - let dataSource = table2Data?.ProductDetails || []; + const products = [ + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + }, + ]; - // Paginate the data - const paginatedChunks = []; - 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); + const chunkSize = !isMobile ? 11 : PageSize == 'A5' ? 11 : 16; - return ( - <> + let dataSource = table2Data?.ProductDetails || []; + // Paginate the data + const paginatedChunks = []; + 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); + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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: 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, + }; + + return ( + <> +
+ {paginatedChunks.map((dataChunk, chunkIndex) => ( +
0 ? ' print-page-break' : ''}`} + style={{ + display: 'flex', + flexDirection: 'column', + height: PageSize == 'A5' ? '170mm' : '257mm', + }} + key={chunkIndex} + >
+ className="header" + style={{ + position: isMobile + ? GlobaldummyData + ? 'absolute' + : 'fixed' + : '', + top: 0, + width: '100%', + ...headerStyle, + }} + > +
+
+ {base64Image ? ( + image + ) : null} +
- {paginatedChunks.map((dataChunk, chunkIndex) => ( -
0 ? ' print-page-break' : ''}`} style={{ display: "flex", flexDirection: "column", height: PageSize == "A5" ? '170mm' : "257mm", }} key={chunkIndex}> +
+
+ {GlobaldummyData ? 'XYZ Shop' : BranchName} +
-
-
+
+ {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +
+ {BranchDetails?.BrGSTIN && ( +
+ GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : BranchDetails?.BrGSTIN} + , CIN :u00045hhsgbubufsdug +
+ )} -
- {(base64Image) ? image : null} -
+ {BranchDetails?.BrMobile && ( +
+ {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile} +
+ )} +
+
-
-
{GlobaldummyData ? 'XYZ Shop' : BranchName}
+
+ {GlobaldummyData + ? 'Cash Bill' + : BillName + ? BillName + : 'Delivery Challan'}{' '} +
-
{GlobaldummyData ? - 'BranchAddress, Town- 635XXX City - State' : - (BranchAddress || '') + (BranchCity ? (BranchAddress && BranchCity ? '-' : '') + BranchCity : '') + (BranchZip ? (BranchCity && BranchZip ? '-' : '') + BranchZip : '')} -
- {BranchDetails?.BrGSTIN &&
GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : BranchDetails?.BrGSTIN}, CIN :u00045hhsgbubufsdug
} - - {BranchDetails?.BrMobile &&
Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile}
} - -
- -
- -
{GlobaldummyData ? 'Cash Bill' : BillName ? BillName : "Delivery Challan"}
- - - {table2Data?.dispatchPrint !== true &&
-
-
Delivery Challan No :{GlobaldummyData ? 'A22' : table2Data?.DCNo}
-
-
{GlobaldummyData ? formattedDate : Date1}
-
} - {table2Data?.dispatchPrint === true &&
-
-
Ref No #:{table2Data?.RequestId}
-
-
Requested Date :{formatDate(table2Data?.RequestedDate)}
-
} -
- {table2Data?.dispatchPrint === true && <> -
-
-
Dispatch No #:{table2Data?.DispatchId}
-
-
Dispatch Date :{formatDate(table2Data?.CreatedDate)}
-
-
- } - {table2Data?.ToBranchDtl?.length > 0 && <> -
-
Delivery To :
-
-
{table2Data?.ToBranchDtl?.[0]?.BranchName}
- {table2Data?.ToBranchDtl?.[0]?.Address1 &&
{table2Data?.ToBranchDtl?.[0]?.Address1}
} - {(table2Data?.ToBranchDtl?.[0]?.City || table2Data?.ToBranchDtl?.[0]?.Dist || table2Data?.ToBranchDtl?.[0]?.Zip) &&
{`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
} - {table2Data?.ToBranchDtl?.[0]?.BrGSTIN &&
{table2Data?.ToBranchDtl?.[0]?.BrGSTIN}
} -
-
- } + {table2Data?.dispatchPrint !== true && ( +
+
+
+ Delivery Challan No : + {GlobaldummyData ? 'A22' : table2Data?.DCNo} +
+
+
+ {GlobaldummyData ? formattedDate : Date1} +
+
+ )} + {table2Data?.dispatchPrint === true && ( +
+
+
+ Ref No #:{table2Data?.RequestId} +
+
+
+ Requested Date :{formatDate(table2Data?.RequestedDate)} +
+
+ )} +
+ {table2Data?.dispatchPrint === true && ( + <> +
+
+
+ Dispatch No #:{table2Data?.DispatchId} +
+
+
+ Dispatch Date :{formatDate(table2Data?.CreatedDate)} +
+
+
+ + )} + {table2Data?.ToBranchDtl?.length > 0 && ( + <> +
+
+ Delivery To : +
+
+
+ {table2Data?.ToBranchDtl?.[0]?.BranchName} +
+ {table2Data?.ToBranchDtl?.[0]?.Address1 && ( +
+ {table2Data?.ToBranchDtl?.[0]?.Address1}
-
- {(table2Data?.CustMobile || table2Data?.CustName || table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && - <> -
-
- {(table2Data?.CustMobile || table2Data?.CustName) && -
-
Delivery Details
- {table2Data?.CustMobile &&
Mobile NO :{table2Data?.CustMobile}
} - {table2Data?.CustName &&
Name:{table2Data?.CustName}
} -
+ )} + {(table2Data?.ToBranchDtl?.[0]?.City || + table2Data?.ToBranchDtl?.[0]?.Dist || + table2Data?.ToBranchDtl?.[0]?.Zip) && ( +
{`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
+ )} + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN && ( +
+ {table2Data?.ToBranchDtl?.[0]?.BrGSTIN} +
+ )} +
+
+ + )} +
+
+ {(table2Data?.CustMobile || + table2Data?.CustName || + table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( + <> +
+
+ {(table2Data?.CustMobile || table2Data?.CustName) && ( +
+
+ Delivery Details +
+ {table2Data?.CustMobile && ( +
+ {' '} + Mobile NO :{table2Data?.CustMobile}{' '} +
+ )} + {table2Data?.CustName && ( +
+ {' '} + Name:{table2Data?.CustName} +
+ )} +
+ )} + {(table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( +
+
+ Vehicle Details +
+ {table2Data?.VehicleNo && ( +
+ {' '} + Vehicle No :{table2Data?.VehicleNo} +
+ )} + {table2Data?.TransporterId && ( +
+ {' '} + Transporter Id :{table2Data?.TransporterId} +
+ )} + {table2Data?.TransporterName && ( +
+ {' '} + Transporter Name :{table2Data?.TransporterName} +
+ )} +
+ )} +
+
+ + )} +
+
+ {(table2Data?.ProductDetails?.length > 0 || + GlobaldummyData) && ( +
+ + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + + + + {dataChunk?.map((item, index) => { + return ( + -
Vehicle Details
- {table2Data?.VehicleNo &&
Vehicle No :{table2Data?.VehicleNo}
} - {table2Data?.TransporterId &&
Transporter Id :{table2Data?.TransporterId}
} - {table2Data?.TransporterName &&
Transporter Name :{table2Data?.TransporterName}
} - - } - -
- - } -
-
- {(table2Data?.ProductDetails?.length > 0 || GlobaldummyData) && -
- -
+ S.No + + S.No + ItemItem + Qty + + Qty +
- - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } */} - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {/* {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalAmount && : Amount && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalRate && : Rate && } */} - - - - {dataChunk?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - - } - {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } */} - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {/* {GlobaldummyData ? GlobalMRP && : MRP && } + : {} + } + > + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && ( + + )} + {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } */} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {/* {GlobaldummyData ? GlobalMRP && : MRP && } {GlobaldummyData ? GlobalAmount && : Amount && } {GlobaldummyData ? GlobalDiscount && : Discount && } {GlobaldummyData ? GlobalRate && : Rate && } */} - - ) - })} - -
S.NoS.NoItemItemHSNHSNQtyQtyMRPMRPAmtAmtDis Dis RateRate
{index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName}({item?.Size + item?.UomName}) -
{item?.ProdName}
- {!(item?.ProdVariantName || item?.RequestVariantName)?.toLowerCase()?.includes('variant') && Variant:{item?.ProdVariantName || item?.RequestVariantName} } -
{item?.HSN}{item?.HSN}{item?.SalesQty}{item?.Qty || item?.DispatchedQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} + {index + 1} + + {chunkIndex * chunkSize + index + 1} + + {item?.ProdName}( + {item?.Size + item?.UomName}) + +
{item?.ProdName}
+ {!( + item?.ProdVariantName || + item?.RequestVariantName + ) + ?.toLowerCase() + ?.includes('variant') && ( + + Variant: + {item?.ProdVariantName || + item?.RequestVariantName}{' '} + + )} +
{item?.HSN}{item?.HSN} + {item?.SalesQty} + + {item?.Qty || item?.DispatchedQty} + {item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.TotalAmt} {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}{item?.discount} {item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.Rate}{item?.Rate}
-
- } - -
- -
-
- - {((chunkIndex === paginatedChunks.length - 1)) && - - <> - - - - -
- {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

- -
-
) : - 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) && (
-

- Terms & Conditions -

-
    - {TermsAndConditions?.map(item => (
  1. {item?.TermsandConditions}
  2. ))} - {/*
  3. Please check the product before leaving the counter.
  4. */} -
-
) - } - - {GlobaldummyData ? GlobalSignature && (
-

Signature

- -
) : Signature == true && (
-

Signature

- -
)} - -
-
- - {PrintGreeting?.SettingValue === "Y" && -
- Thank You Visit Again -
- } - - - - - } + + ); + })} + +
- ))} - - - - + )} +
+
+ {chunkIndex === paginatedChunks.length - 1 && ( + <> +
+ {GlobaldummyData + ? GlobalIsnotes && ( +
+

+ Notes : 10 days Return policy +

- - ) -} +
+
+ ) + : Notestext && ( +
+

{Notestext}

-export default DCPrintstyle2 +
+
+ )} + +
+ {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 && ( +
+

+ Terms & Conditions +

+
    + {TermsAndConditions?.map((item) => ( +
  1. + {item?.TermsandConditions} +
  2. + ))} + {/*
  3. Please check the product before leaving the counter.
  4. */} +
+
+ )} + + {GlobaldummyData + ? GlobalSignature && ( +
+

+ Signature +

+ +
+ ) + : Signature == true && ( +
+

+ Signature +

+ +
+ )} +
+
+ + {PrintGreeting?.SettingValue === 'Y' && ( +
+ Thank You Visit Again +
+ )} + + )} +
+ ))} +
+ + ); +}; + +export default DCPrintstyle2; diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle3.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle3.jsx index 2862325..bba185b 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle3.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle3.jsx @@ -23,6 +23,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableBodyColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedFooterFontColor, + GlobalSelectedFooterColor, + GlobalRowType, } from '../../../../Features/ThemeChange/ThemeChange'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.scss'; import QRCode from 'react-qr-code'; @@ -232,6 +241,70 @@ const DCPrintStyle3 = ({ lastChunkRows > (!isMobile ? 10 : PageSize == 'A5' ? 5 : 10); console.log(paginatedChunks, dataSource, 'dataSourcedataSource'); + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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 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, + }; + return ( <>
-
+
{GlobaldummyData ? 'XYZ Shop' : BranchName}
@@ -473,6 +546,7 @@ const DCPrintStyle3 = ({ width: '100%', fontweight: '600', gap: '0.2rem', + ...tableHeaderStyle, }} > {GlobaldummyData @@ -559,6 +633,11 @@ const DCPrintStyle3 = ({ justifyContent: 'space-between', width: '100%', gap: '0.2rem', + ...(index % 2 !== 1 && rowtypeStyle === 'even' + ? { ...tableBodyStyle } + : index % 2 === 1 && rowtypeStyle === 'odd' + ? { ...tableBodyStyle } + : {}), }} > {GlobaldummyData @@ -688,6 +767,7 @@ const DCPrintStyle3 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle4.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle4.jsx index 8731029..c585bde 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle4.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle4.jsx @@ -17,19 +17,25 @@ import { GlobalprintQrcodet, GlobalPritdummyData, changeReprintDataFound, - GloabalFieldDetails, GlobalprintSignature, GlobalprinttermsAndConditions, GlobalSignatureImage, Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.scss'; -import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import QRCode from 'react-qr-code'; import signature from '../../../../Images/signatureimage.jpg'; -import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; import { isMobile } from 'react-device-detect'; const DCPrintstyle4 = ({ @@ -219,6 +225,71 @@ const DCPrintstyle4 = ({ ? paginatedChunks[paginatedChunks.length - 1].length : 0; const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 11 : 20); + + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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 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, + }; + return ( <>
{GlobaldummyData ? GlobalSlNo && ( - S.No + + S.No + ) - : SLNO && S.No} + : SLNO && ( + + S.No + + )} {GlobaldummyData - ? GlobalItem && Item - : Item && Item} + ? GlobalItem && ( + Item + ) + : Item && ( + Item + )} {GlobaldummyData ? GlobalQuantity && ( Qty ) : Quantity && ( Qty )} - {/* {GlobaldummyData ? GlobalHsnCode && HSN : HsnCode && HSN} - {GlobaldummyData ? GlobalMRP && MRP : MRP && MRP} - {GlobaldummyData ? GlobalDiscount && Dis : Discount && Dis } - {GlobaldummyData ? GlobalRate && Rate : Rate && Rate} - {GlobaldummyData ? GlobalAmount && Amt : Amount && Amt} */} {dataChunk?.map((item, index) => { return ( - + {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( @@ -547,11 +649,6 @@ const DCPrintstyle4 = ({ {item?.Qty || item?.DispatchedQty} )} - {/* {GlobaldummyData ? GlobalHsnCode && {item?.HSN} : HsnCode && {item?.HSN}} - {GlobaldummyData ? GlobalMRP && {item?.MRP} : MRP && {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}} - {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount && {item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}} - {GlobaldummyData ? GlobalRate && {item?.Rate} : Rate && {item?.Rate}} - {GlobaldummyData ? GlobalAmount && {item?.TotalAmt} : Amount && {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}} */} ); })} @@ -604,6 +701,7 @@ const DCPrintstyle4 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle5.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle5.jsx index 7b955ef..d808a8f 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle5.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle5.jsx @@ -24,6 +24,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedFooterFontColor, + GlobalSelectedFooterColor, + GlobalRowType, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.scss'; @@ -203,6 +212,74 @@ const DCPrintStyle5 = ({ : 0; const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 15 : 15); + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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: 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, + }; + return ( <>
-
+
{GlobaldummyData @@ -502,10 +580,6 @@ const DCPrintStyle5 = ({ QTY
)} - {/* {GlobaldummyData ? GlobalMRP &&
MRP
: MRP &&
MRP
} - {GlobaldummyData ? GlobalRate &&
RATE
: Rate &&
RATE
} - {GlobaldummyData ? GlobalDiscount &&
DIS
: Discount &&
DIS
} - {GlobaldummyData ? GlobalAmount &&
Amt
: Amount &&
AMT
} */}

@@ -521,6 +595,15 @@ const DCPrintStyle5 = ({ fontWeight: '600', width: '95%', gap: '0.5rem', + ...(index % 2 !== 1 && rowtypeStyle === 'even' + ? { + ...tableBodyStyle, + } + : index % 2 === 1 && rowtypeStyle === 'odd' + ? { + ...tableBodyStyle, + } + : {}), }} > {GlobaldummyData @@ -576,31 +659,6 @@ const DCPrintStyle5 = ({ item?.RequestVariantName}{' '} )} - {/*
- { - (item?.Size || "1") + - (item?.SinglePc === "Y" ? "PCS" : item?.Type !== "C" ? item?.UomName : "COMBO") + - (item?.BrandName || "") + - ( - item?.ProductIdentifierDtls?.filter( - (items) => items.SerialNumber && items.SerialNumber !== "" - )?.map((a, index) =>
{a.SerialNumber}
) || "" - ) + - ( - item?.ProductIdentifierDtls?.filter( - (item1) => item1.IMEI1 || item1.IMEI2 - )?.map((item2, index) => { - const imei1 = item2.IMEI1 || ""; - const imei2 = item2.IMEI2 || ""; - return ( -
- {[imei1, imei2].filter(Boolean).join(",")} -
- ); - }) || "") + - "-" + (GlobaldummyData ? (GlobalQuantity && item?.SalesQty) : item?.SalesQty) - } -
*/} }
@@ -617,9 +675,6 @@ const DCPrintStyle5 = ({ {item?.Qty || item?.DispatchedQty}
)} - {/* {GlobaldummyData ? GlobalRate &&
{item?.Rate}
: Rate &&
{item?.Rate}
} - {GlobaldummyData ? GlobalDiscount &&
{item?.discount}
: Discount &&
{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}
} - {GlobaldummyData ? GlobalAmount &&
{item?.TotalAmt}
: Amount &&
{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
} */}
))} @@ -666,6 +721,7 @@ const DCPrintStyle5 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle6.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle6.jsx index 3be9a9c..1428629 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle6.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle6.jsx @@ -24,6 +24,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedFooterFontColor, + GlobalSelectedFooterColor, + GlobalRowType, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.scss'; @@ -219,6 +228,72 @@ const DCPrintstyle6 = ({ : 0; const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 20 : 24); + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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 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, + }; + return ( <>
-
+
- + {GlobaldummyData ? GlobalSlNo && ( - + ) : SLNO && ( )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( - ) ) : ( - ) : Quantity && ( @@ -557,7 +650,20 @@ const DCPrintstyle6 = ({ {dataChunk?.map((item, index) => { return ( - + {GlobaldummyData ? GlobalSlNo && : SLNO && ( @@ -749,6 +855,7 @@ const DCPrintstyle6 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle7.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle7.jsx index e3eec62..8442e79 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle7.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle7.jsx @@ -21,6 +21,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.scss'; @@ -246,6 +255,73 @@ const DCPrintStyle7 = ({ : 0; const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 10); console.log(BranchName, 'paginatedChunks'); + + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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 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, + }; + return ( <>

-
+
{' '} {GlobaldummyData ? 'XYZ Shop' : BranchName} @@ -524,31 +600,71 @@ const DCPrintStyle7 = ({
{GlobaldummyData ? GlobalSlNo && ( - + ) : SLNO == true && ( - + )} {GlobaldummyData - ? GlobalItem && - : Item == true && } - {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } */} + ? GlobalItem && ( + + ) + : Item == true && ( + + )} {GlobaldummyData ? GlobalQuantity && ( - + ) : Quantity == true && ( - + )} - {/* {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } */} {dataChunk?.map((item, index) => ( - + {GlobaldummyData ? GlobalSlNo && ( )} - {/* {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } */} ))} @@ -672,6 +784,7 @@ const DCPrintStyle7 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle8.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle8.jsx index 0157a6d..b2efa52 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle8.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle8.jsx @@ -1,358 +1,884 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import QrImage from '../../../../Images/QRcode.png'; -import { extractLastNumber, extractLastNumberOrderId } from '../../../../Services/Others'; import { - GlobalprintSlNo, - GlobalprintItem, - GlobalprintMRP, - GlobalprintDiscount, - GlobalprintQuantity, - GlobalprintRate, - GlobalprintAmount, - GlobalprintHsnCode, - GlobalprintQrcodet, - GlobalPritdummyData, - changeReprintDataFound, - GloabalFieldDetails, - GlobalprintSignature, - GlobalprinttermsAndConditions, - GlobalSignatureImage, - Globalnotes, - GlobalthemeFormat, - GlobalBillName, + extractLastNumber, + extractLastNumberOrderId, +} from '../../../../Services/Others'; +import { + GlobalprintSlNo, + GlobalprintItem, + GlobalprintMRP, + GlobalprintDiscount, + GlobalprintQuantity, + GlobalprintRate, + GlobalprintAmount, + GlobalprintHsnCode, + GlobalprintQrcodet, + GlobalPritdummyData, + changeReprintDataFound, + GloabalFieldDetails, + GlobalprintSignature, + GlobalprinttermsAndConditions, + GlobalSignatureImage, + Globalnotes, + GlobalthemeFormat, + GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.scss'; import QRCode from 'react-qr-code'; -import signature from "../../../../Images/signatureimage.jpg" +import signature from '../../../../Images/signatureimage.jpg'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; import { isMobile } from 'react-device-detect'; -const DCPrintstyle8 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, BranchZip, Date1, - table2Data, PaymentStatus, PrintGreeting, printDatas, DCPrintTemplateDtl }) => { - const formatDate = (dateString = '') => { - const date = new Date(dateString); - const day = date.getDate().toString().padStart(2, '0'); - const months = [ - 'Jan', - 'Feb', - 'Mar', - 'Apr', - 'May', - 'Jun', - 'Jul', - 'Aug', - 'Sep', - 'Oct', - 'Nov', - 'Dec', - ]; - const month = months[date.getMonth()]; - const year = date.getFullYear(); - return day && month && year ? `${day}-${month}-${year}` : '-'; - } - const dispatch = useDispatch(); - let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { - acc[item.ConfigName] = true; - return acc; - }, {}); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const Discount = FieldDetails?.["Discount"]; - const Quantity = FieldDetails?.["Quantity"]; - const GlobalSlNo = useSelector(GlobalprintSlNo); - const GlobalItem = useSelector(GlobalprintItem); - const GlobalDiscount = useSelector(GlobalprintDiscount); - const GlobalQuantity = useSelector(GlobalprintQuantity); - const GlobaldummyData = useSelector(GlobalPritdummyData); - const GlobalSignature = useSelector(GlobalprintSignature); - const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); - const GlobalSignatureImages = useSelector(GlobalSignatureImage); - const GlobalIsnotes = useSelector(Globalnotes); - - console.log(GlobalDiscount, Discount, "Discount"); - - let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions - let SignatureImg = DCPrintTemplateDtl?.Signature - let Notestext = DCPrintTemplateDtl?.Notes - let BillName = DCPrintTemplateDtl?.PrintHdrName - let FormatTheme = DCPrintTemplateDtl?.PrintType == "S" ? true : false - let PageSize = DCPrintTemplateDtl?.PageSize; - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - - - const keysLength = Object.keys(table2Data ?? {}).length; - if (keysLength > 0) { - dispatch(changeReprintDataFound(true)); - } - - - - - const productsData = table2Data?.productDetails || []; - const offers = table2Data?.OrderOfferDetails || []; - - let TotalOfferAmount = 0; - - // Calculate SalesWiseOffers total amount - offers.forEach(offer => { - if (offer.TableName === 'SalesWiseOffers') { - TotalOfferAmount += offer.OfferAmount; - } - }); - const hasMappedOffer = offers.some(offer => - ["ItemWiseOffers", "BundleOffers", "QuantityWiseOffers"].includes(offer.TableName) - ); - - if (hasMappedOffer) { - - const productTotal = productsData?.reduce((acc, item) => acc + (item?.Type != "C" ? item.OfferAmt : item.OfferValue || 0), 0); - TotalOfferAmount += productTotal; - } else { - const Combothere = productsData?.filter(item => item?.Type == "C") - const CombothereTotal = Combothere?.reduce((acc, item) => acc + (item.OfferValue || 0), 0); - TotalOfferAmount += CombothereTotal; - } - const products = [ - { ProdName: 'ITEM 1', Rate: 88.00, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g' }, +const DCPrintstyle8 = ({ + BranchName, + BranchDetails, + BranchAddress, + BranchCity, + BranchZip, + Date1, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + DCPrintTemplateDtl, +}) => { + const formatDate = (dateString = '') => { + const date = new Date(dateString); + const day = date.getDate().toString().padStart(2, '0'); + const months = [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', ]; + const month = months[date.getMonth()]; + const year = date.getFullYear(); + return day && month && year ? `${day}-${month}-${year}` : '-'; + }; + const dispatch = useDispatch(); + let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { + acc[item.ConfigName] = true; + return acc; + }, {}); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const Discount = FieldDetails?.['Discount']; + const Quantity = FieldDetails?.['Quantity']; + const GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalQuantity = useSelector(GlobalprintQuantity); + const GlobaldummyData = useSelector(GlobalPritdummyData); + const GlobalSignature = useSelector(GlobalprintSignature); + const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); + const GlobalSignatureImages = useSelector(GlobalSignatureImage); + const GlobalIsnotes = useSelector(Globalnotes); - console.log(printDatas, "printDatasjk") - const chunkSize = PageSize == "A5" ? 10 : 16; - let dataSource = table2Data?.ProductDetails || []; + console.log(GlobalDiscount, Discount, 'Discount'); + let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions; + let SignatureImg = DCPrintTemplateDtl?.Signature; + let Notestext = DCPrintTemplateDtl?.Notes; + let BillName = DCPrintTemplateDtl?.PrintHdrName; + let FormatTheme = DCPrintTemplateDtl?.PrintType == 'S' ? true : false; + let PageSize = DCPrintTemplateDtl?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + const keysLength = Object.keys(table2Data ?? {}).length; + if (keysLength > 0) { + dispatch(changeReprintDataFound(true)); + } - // Paginate the data - const paginatedChunks = []; - for (let i = 0; i < dataSource.length; i += chunkSize) { - paginatedChunks.push(dataSource.slice(i, i + chunkSize)); + const productsData = table2Data?.productDetails || []; + const offers = table2Data?.OrderOfferDetails || []; + + let TotalOfferAmount = 0; + + // Calculate SalesWiseOffers total amount + offers.forEach((offer) => { + if (offer.TableName === 'SalesWiseOffers') { + TotalOfferAmount += offer.OfferAmount; } - const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; - const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == "A5" ? 5 : 13); + }); + const hasMappedOffer = offers.some((offer) => + ['ItemWiseOffers', 'BundleOffers', 'QuantityWiseOffers'].includes( + offer.TableName + ) + ); - return ( - <> -
- {paginatedChunks.map((dataChunk, chunkIndex) => ( -
0 ? ' print-page-break' : ''}`} style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> + if (hasMappedOffer) { + const productTotal = productsData?.reduce( + (acc, item) => + acc + (item?.Type != 'C' ? item.OfferAmt : item.OfferValue || 0), + 0 + ); + TotalOfferAmount += productTotal; + } else { + const Combothere = productsData?.filter((item) => item?.Type == 'C'); + const CombothereTotal = Combothere?.reduce( + (acc, item) => acc + (item.OfferValue || 0), + 0 + ); + TotalOfferAmount += CombothereTotal; + } + const products = [ + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + }, + ]; -
{GlobaldummyData ? 'Cash Bill' : BillName ? BillName : "Delivery Challan"}
-
-
- {/*

{table2Data?.BrName}

*/} -
{GlobaldummyData ? "XYZ Shop" : BranchName}
-
- {GlobaldummyData - ? "BranchAddress, Town- 635XXX City - State" - : (BranchAddress || "") + - (BranchCity - ? (BranchAddress && BranchCity ? "-" : "") + BranchCity - : "") + - (BranchZip - ? (BranchCity && - BranchZip - ? "-" - : "") + BranchZip - : "")} -
- {BranchDetails?.BrMobile &&
Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile}
} -
- {BranchDetails?.BrGSTIN &&
GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : BranchDetails?.BrGSTIN}, CIN :u00045hhsgbubufsdug
} - {/* {BranchDetails?.BrMobile && + console.log(printDatas, 'printDatasjk'); + const chunkSize = PageSize == 'A5' ? 10 : 16; + let dataSource = table2Data?.ProductDetails || []; + + // Paginate the data + const paginatedChunks = []; + 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 : 13); + + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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 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, + }; + + return ( + <> +
+ {paginatedChunks.map((dataChunk, chunkIndex) => ( +
0 ? ' print-page-break' : ''}`} + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: FormatTheme ? (PageSize == 'A5' ? '170mm' : '257mm') : '', + }} + key={chunkIndex} + > +
+ {GlobaldummyData + ? 'Cash Bill' + : BillName + ? BillName + : 'Delivery Challan'}{' '} +
+
+
+ {/*

{table2Data?.BrName}

*/} +
+ {' '} + {GlobaldummyData ? 'XYZ Shop' : BranchName} +
+
+ {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +
+ {BranchDetails?.BrMobile && ( +
+ {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile} +
+ )} +
+ {BranchDetails?.BrGSTIN && ( +
+ GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : BranchDetails?.BrGSTIN} + , CIN :u00045hhsgbubufsdug +
+ )} + {/* {BranchDetails?.BrMobile &&
{" "} Mobile : +91 {GlobaldummyData ? "986XXXXXXX" : BranchDetails?.BrMobile}
} */} - {table2Data?.ToBranchDtl?.length > 0 && <> -
-
-
Delivery To :
-
-
{table2Data?.ToBranchDtl?.[0]?.BranchName}
- {table2Data?.ToBranchDtl?.[0]?.Address1 &&
{table2Data?.ToBranchDtl?.[0]?.Address1}
} - {(table2Data?.ToBranchDtl?.[0]?.City || table2Data?.ToBranchDtl?.[0]?.Dist || table2Data?.ToBranchDtl?.[0]?.Zip) &&
{`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
} - {table2Data?.ToBranchDtl?.[0]?.BrGSTIN &&
{table2Data?.ToBranchDtl?.[0]?.BrGSTIN}
} -
-
-
- } - - {table2Data?.dispatchPrint !== true &&
-
- Delivery ChallanNo: - {GlobaldummyData - ? "121" - : table2Data?.DCNo} -
-
} - {table2Data?.dispatchPrint === true &&
-
-
- Dispatch No #:{table2Data?.DispatchId} -
-
Dispatch Date:{formatDate(table2Data?.CreatedDate)}
-
-
-
- Ref No #:{table2Data?.RequestId} -
-
Requested Date:{formatDate(table2Data?.RequestedDate)}
-
-
} -
- {(table2Data?.CustMobile || table2Data?.CustName || table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && - <> -
- {(table2Data?.CustMobile || table2Data?.CustName) && -
-
Delivery Details
- {table2Data?.CustMobile &&
Mobile NO :{table2Data?.CustMobile}
} - {table2Data?.CustName &&
Name:{table2Data?.CustName}
} -
- } - {(table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && -
-
Vehicle Details
- {table2Data?.VehicleNo &&
Vehicle No :{table2Data?.VehicleNo}
} - {table2Data?.TransporterId &&
Transporter Id :{table2Data?.TransporterId}
} - {table2Data?.TransporterName &&
Transporter Name :{table2Data?.TransporterName}
} -
- } -
-
- - } + {table2Data?.ToBranchDtl?.length > 0 && ( + <> +
+
+
+ Delivery To : +
+
+
+ {table2Data?.ToBranchDtl?.[0]?.BranchName} +
+ {table2Data?.ToBranchDtl?.[0]?.Address1 && ( +
+ {table2Data?.ToBranchDtl?.[0]?.Address1}
+ )} + {(table2Data?.ToBranchDtl?.[0]?.City || + table2Data?.ToBranchDtl?.[0]?.Dist || + table2Data?.ToBranchDtl?.[0]?.Zip) && ( +
{`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
+ )} + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN && ( +
+ {table2Data?.ToBranchDtl?.[0]?.BrGSTIN} +
+ )} +
+
+
+ + )} + {table2Data?.dispatchPrint !== true && ( +
+
+ Delivery ChallanNo: + {GlobaldummyData ? '121' : table2Data?.DCNo} +
+
+ )} + {table2Data?.dispatchPrint === true && ( +
+
+
+ Dispatch No #:{table2Data?.DispatchId} +
+
+ Dispatch Date:{formatDate(table2Data?.CreatedDate)} +
+
+
+
+ Ref No #:{table2Data?.RequestId} +
+
+ Requested Date:{formatDate(table2Data?.RequestedDate)} +
+
+
+ )} +
+ {(table2Data?.CustMobile || + table2Data?.CustName || + table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( + <> +
+ {(table2Data?.CustMobile || table2Data?.CustName) && ( +
+
+ Delivery Details +
+ {table2Data?.CustMobile && ( +
+ {' '} + Mobile NO :{table2Data?.CustMobile}{' '} +
+ )} + {table2Data?.CustName && ( +
+ {' '} + Name:{table2Data?.CustName} +
+ )} +
+ )} + {(table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( +
+
+ Vehicle Details +
+ {table2Data?.VehicleNo && ( +
+ {' '} + Vehicle No :{table2Data?.VehicleNo} +
+ )} + {table2Data?.TransporterId && ( +
+ {' '} + Transporter Id :{table2Data?.TransporterId} +
+ )} + {table2Data?.TransporterName && ( +
+ {' '} + Transporter Name :{table2Data?.TransporterName} +
+ )} +
+ )} +
+
+ + )} +
-
- {(table2Data?.ProductDetails?.length > 0 || GlobaldummyData) && - <> -
-
S.No + S.No + S.No + {GlobaldummyData ? GlobalItem && 'ITEM /DES' : 'ITEM /DES'}{' '} + {GlobaldummyData ? GlobalItem && 'ITEM /DES' : Item && 'ITEM /DES'}{' '} @@ -500,14 +585,22 @@ const DCPrintstyle6 = ({ {GlobaldummyData ? GlobalQuantity && ( QTY QTY
{index + 1}
S.No + S.No + S.No + S.No + ItemItemHSNHSNItemItemQty + Qty + Qty + Qty + MRPMRPRateRateDis Dis AmtAmt
@@ -598,10 +714,6 @@ const DCPrintStyle7 = ({ {item?.Qty || item?.DispatchedQty} {item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
- - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } */} - {/* {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } */} - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {/* {GlobaldummyData ? GlobalAmount && : Amount && } */} - - - - {dataChunk?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } */} - {/* {GlobaldummyData ? GlobalMRP && : MRP && } +
+ {(table2Data?.ProductDetails?.length > 0 || GlobaldummyData) && ( + <> +
+
S.NoS.NoItemItemHSNHSNMRPMRPRateRt(%)(%)QtyQtyAmtAmt
{chunkIndex * chunkSize + index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} -
{item?.ProdName}
-
({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.RequestVariantName ? `${item?.RequestVariantName}` : ''}
-
{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}
+ + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + + + + {dataChunk?.map((item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } */} + {/* {GlobaldummyData ? GlobalMRP && : MRP && } {GlobaldummyData ? GlobalRate && : Rate && } {GlobaldummyData ? GlobalDiscount && : Discount && } */} - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {/* {GlobaldummyData ? GlobalAmount && : Amount && } */} - - ) - })} - -
+ S.No + + S.No + Item + Item + + Qty + + Qty +
+ {chunkIndex * chunkSize + index + 1} + + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} +
{item?.ProdName}
+
+ ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.RequestVariantName + ? `${item?.RequestVariantName}` + : ''} +
+
{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.SalesQty}{item?.Qty || item?.DispatchedQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
-
- - } - -
- - {(chunkIndex === paginatedChunks.length - 1) && - - <> -
- {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

- -
-
) : - 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) && (
-

- Terms & Conditions -

-
    - {TermsAndConditions?.map(item => (
  1. {item?.TermsandConditions}
  2. ))} - {/*
  3. Please check the product before leaving the counter.
  4. */} -
-
) - } - - {GlobaldummyData ? GlobalSignature && (
-

Signature

- -
) : Signature == true && (
-

Signature

- -
)} - -
-
- - - {PrintGreeting?.SettingValue === "Y" && -
- Thank You Visit Again -
- } - - } -
- ))} - - - + {GlobaldummyData + ? GlobalQuantity && ( + + {item?.SalesQty} + + ) + : Quantity && ( + + {item?.Qty || item?.DispatchedQty} + + )} + {/* {GlobaldummyData ? GlobalAmount && {item?.TotalAmt} : Amount && {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}} */} + + ); + })} + + +
+ + )}
- - ) -} -export default DCPrintstyle8 + {chunkIndex === paginatedChunks.length - 1 && ( + <> +
+ {GlobaldummyData + ? GlobalIsnotes && ( +
+

+ Notes : 10 days Return policy +

+ +
+
+ ) + : 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 && ( +
+

+ Terms & Conditions +

+
    + {TermsAndConditions?.map((item) => ( +
  1. + {item?.TermsandConditions} +
  2. + ))} + {/*
  3. Please check the product before leaving the counter.
  4. */} +
+
+ )} + + {GlobaldummyData + ? GlobalSignature && ( +
+

+ Signature +

+ +
+ ) + : Signature == true && ( +
+

+ Signature +

+ +
+ )} +
+
+ + {PrintGreeting?.SettingValue === 'Y' && ( +
+ Thank You Visit Again +
+ )} + + )} +
+ ))} +
+ + ); +}; + +export default DCPrintstyle8; diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle9.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle9.jsx index 0c4ef4f..e78ab8c 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle9.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle9.jsx @@ -1,7 +1,10 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import Qrcode from '../../../../Images/Qrcode.png' -import { extractLastNumber, extractLastNumberOrderId } from "../../../../Services/Others"; +import Qrcode from '../../../../Images/Qrcode.png'; +import { + extractLastNumber, + extractLastNumberOrderId, +} from '../../../../Services/Others'; import { GlobalprintSlNo, GlobalprintItem, @@ -21,16 +24,36 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.scss'; import QRCode from 'react-qr-code'; -import signature from "../../../../Images/signatureimage.jpg" +import signature from '../../../../Images/signatureimage.jpg'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; import { isMobile } from 'react-device-detect'; -const DCPrintStyle9 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, BranchZip, Date1, - table2Data, PaymentStatus, PrintGreeting, printDatas, DCPrintTemplateDtl }) => { +const DCPrintStyle9 = ({ + BranchName, + BranchDetails, + BranchAddress, + BranchCity, + BranchZip, + Date1, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + DCPrintTemplateDtl, +}) => { const formatDate = (dateString = '') => { const date = new Date(dateString); const day = date.getDate().toString().padStart(2, '0'); @@ -51,35 +74,37 @@ const DCPrintStyle9 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, B const month = months[date.getMonth()]; const year = date.getFullYear(); return day && month && year ? `${day}-${month}-${year}` : '-'; - } + }; const dispatch = useDispatch(); let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { acc[item.ConfigName] = true; return acc; }, {}); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const Quantity = FieldDetails?.["Quantity"]; - const GlobalSlNo = useSelector(GlobalprintSlNo) - const GlobalItem = useSelector(GlobalprintItem) - const GlobalQuantity = useSelector(GlobalprintQuantity) - const GlobaldummyData = useSelector(GlobalPritdummyData) + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const Quantity = FieldDetails?.['Quantity']; + const GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalQuantity = useSelector(GlobalprintQuantity); + const GlobaldummyData = useSelector(GlobalPritdummyData); const GlobalSignature = useSelector(GlobalprintSignature); const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); const GlobalSignatureImages = useSelector(GlobalSignatureImage); const GlobalIsnotes = useSelector(Globalnotes); - const GlobalthemeFormatr = useSelector(GlobalthemeFormat) + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); - let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions - let SignatureImg = DCPrintTemplateDtl?.Signature - let Notestext = DCPrintTemplateDtl?.Notes - let BillName = DCPrintTemplateDtl?.PrintHdrName - let FormatTheme = DCPrintTemplateDtl?.PrintType == "S" ? true : false - let PageSize = DCPrintTemplateDtl?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; + let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions; + let SignatureImg = DCPrintTemplateDtl?.Signature; + let Notestext = DCPrintTemplateDtl?.Notes; + let BillName = DCPrintTemplateDtl?.PrintHdrName; + let FormatTheme = DCPrintTemplateDtl?.PrintType == 'S' ? true : false; + let PageSize = DCPrintTemplateDtl?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); const keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); @@ -87,7 +112,20 @@ const DCPrintStyle9 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, B const currentDate = new Date(); const day = currentDate.getDate().toString().padStart(2, '0'); - const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; + const monthNames = [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', + ]; const monthIndex = currentDate.getMonth(); const year = currentDate.getFullYear().toString().slice(-2); @@ -99,179 +137,478 @@ const DCPrintStyle9 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, B let TotalOfferAmount = 0; // Calculate SalesWiseOffers total amount - offers.forEach(offer => { + offers.forEach((offer) => { if (offer.TableName === 'SalesWiseOffers') { TotalOfferAmount += offer.OfferAmount; } }); - const hasMappedOffer = offers.some(offer => - ["ItemWiseOffers", "BundleOffers", "QuantityWiseOffers"].includes(offer.TableName) + const hasMappedOffer = offers.some((offer) => + ['ItemWiseOffers', 'BundleOffers', 'QuantityWiseOffers'].includes( + offer.TableName + ) ); if (hasMappedOffer) { - - const productTotal = productsData?.reduce((acc, item) => acc + (item?.Type != "C" ? item.OfferAmt : item.OfferValue || 0), 0); + const productTotal = productsData?.reduce( + (acc, item) => + acc + (item?.Type != 'C' ? item.OfferAmt : item.OfferValue || 0), + 0 + ); TotalOfferAmount += productTotal; } else { - const Combothere = productsData?.filter(item => item?.Type == "C") - const CombothereTotal = Combothere?.reduce((acc, item) => acc + (item.OfferValue || 0), 0); + const Combothere = productsData?.filter((item) => item?.Type == 'C'); + const CombothereTotal = Combothere?.reduce( + (acc, item) => acc + (item.OfferValue || 0), + 0 + ); TotalOfferAmount += CombothereTotal; } const products = [ - { ProdName: 'ITEM 1', Rate: 88.00, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g' }, + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + }, ]; - const chunkSize = PageSize == "A5" ? 10 : 16; + const chunkSize = PageSize == 'A5' ? 10 : 16; let dataSource = table2Data?.ProductDetails || []; - // Paginate the data const paginatedChunks = []; 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); + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 10); + + // + 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 + ); + + // + let printColors = DCPrintTemplateDtl?.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 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, + }; return ( <> - -
+
{paginatedChunks.map((dataChunk, chunkIndex) => ( -
0 ? ' print-page-break' : ''}`} style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> - +
0 ? ' print-page-break' : ''}`} + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: FormatTheme ? (PageSize == 'A5' ? '170mm' : '257mm') : '', + }} + key={chunkIndex} + >
-
{GlobaldummyData ? 'Cash Bill' : BillName ? BillName : "Delivery Challan"}
- +
+ {GlobaldummyData + ? 'Cash Bill' + : BillName + ? BillName + : 'Delivery Challan'}{' '} +
-
-
-
{GlobaldummyData ? "XYZ Shop" : BranchName}
-
Low Prices... Love the Saving...
- -
- {GlobaldummyData - ? "BranchAddress, Town- 635XXX City - State" - : (BranchAddress || "") + - (BranchCity - ? (BranchAddress && BranchCity ? "-" : "") + BranchCity - : "") + - (BranchZip - ? (BranchCity && - BranchZip - ? "-" - : "") + BranchZip - : "")} -
- - {BranchDetails?.BrGSTIN &&
GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : BranchDetails?.BrGSTIN}, CIN :u00045hhsgbubufsdug
} - {BranchDetails?.BrMobile && -
- {" "} - Mobile : +91 {GlobaldummyData ? "986XXXXXXX" : BranchDetails?.BrMobile} +
+
+
+
+ {GlobaldummyData ? 'XYZ Shop' : BranchName}
- } +
+ Low Prices... Love the Saving... +
+ +
+ {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +
+ + {BranchDetails?.BrGSTIN && ( +
+ GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : BranchDetails?.BrGSTIN} + , CIN :u00045hhsgbubufsdug +
+ )} + {BranchDetails?.BrMobile && ( +
+ {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile} +
+ )} +

- {table2Data?.ToBranchDtl?.length > 0 && <> -
Delivery To :
-
-
{table2Data?.ToBranchDtl?.[0]?.BranchName}
- {table2Data?.ToBranchDtl?.[0]?.Address1 &&
{table2Data?.ToBranchDtl?.[0]?.Address1}
} - {(table2Data?.ToBranchDtl?.[0]?.City || table2Data?.ToBranchDtl?.[0]?.Dist || table2Data?.ToBranchDtl?.[0]?.Zip) &&
{`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
} - {table2Data?.ToBranchDtl?.[0]?.BrGSTIN &&
{table2Data?.ToBranchDtl?.[0]?.BrGSTIN}
} -
+ {table2Data?.ToBranchDtl?.length > 0 && ( + <> +
+ Delivery To : +
+
+
+ {table2Data?.ToBranchDtl?.[0]?.BranchName} +
+ {table2Data?.ToBranchDtl?.[0]?.Address1 && ( +
+ {table2Data?.ToBranchDtl?.[0]?.Address1} +
+ )} + {(table2Data?.ToBranchDtl?.[0]?.City || + table2Data?.ToBranchDtl?.[0]?.Dist || + table2Data?.ToBranchDtl?.[0]?.Zip) && ( +
{`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
+ )} + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN && ( +
+ {table2Data?.ToBranchDtl?.[0]?.BrGSTIN} +
+ )} +
-
- } +
+ + )} {/* orderdetails */} - {table2Data?.dispatchPrint !== true &&
-
-
- {" "} - Delivery ChallanNo: - {GlobaldummyData - ? "121" - : table2Data?.DCNo} -
-
- -
-
- {" "} - Date : {GlobaldummyData ? formattedDate : Date1}{" "} -
-
-
} - {table2Data?.dispatchPrint === true &&
+ {table2Data?.dispatchPrint !== true && (
-
- {" "} - Dispatch No #: - {table2Data?.DispatchId} +
+ {' '} + Delivery ChallanNo: + {GlobaldummyData ? '121' : table2Data?.DCNo}
-
- {" "} - Dispatched Date : {formatDate(table2Data?.CreatedDate)}{" "} +
+ {' '} + Date : {GlobaldummyData ? formattedDate : Date1}{' '}
-
-
-
- {" "} - Ref No #: - {table2Data?.RequestId} + )} + {table2Data?.dispatchPrint === true && ( +
+
+
+
+ {' '} + Dispatch No #: + {table2Data?.DispatchId} +
-
-
-
- {" "} - Requested Date : {formatDate(table2Data?.RequestedDate)}{" "} +
+
+ {' '} + Dispatched Date :{' '} + {formatDate(table2Data?.CreatedDate)}{' '} +
+
+
+
+
+
+ {' '} + Ref No #: + {table2Data?.RequestId} +
+
+ +
+
+ {' '} + Requested Date :{' '} + {formatDate(table2Data?.RequestedDate)}{' '} +
-
} + )} {/* orderdetails */}
- -
-
- {(table2Data?.ProductDetails?.length > 0) && +
+ {table2Data?.ProductDetails?.length > 0 && ( <> - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } {GlobaldummyData ? GlobalMRP && : MRP && } {GlobaldummyData ? GlobalDiscount && : Discount && } @@ -279,151 +616,283 @@ const DCPrintStyle9 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, B {GlobaldummyData ? GlobalAmount && : Amount && } */} - {console.log(FieldDetails, "paginatedChunks")} + {console.log(FieldDetails, 'paginatedChunks')} {dataChunk?.map((item, index) => { return ( - + {GlobaldummyData ? GlobalSlNo && ( - - ) + + ) : SLNO == true && ( - - )} + + )} {GlobaldummyData ? GlobalItem && : Item == true && ( - - )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - ) + + ) : Quantity == true && ( - - )} + + )} - ) + ); })}
S.NoS.NoItemItemQtyQty + S.No + + S.No + + Item + + Item + + Qty + + Qty + HSNHSNMRPMRPDis Dis AmtAmt
- {index + 1} - + {index + 1} + - {chunkIndex * chunkSize + index + 1} - + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} -
{item?.ProdName}
- {!(item?.ProdVariantName || item?.RequestVariantName)?.toLowerCase()?.includes( - 'variant' - ) && Variant:{item?.ProdVariantName || item?.RequestVariantName} } -  {" "} - -   - - -
+
{item?.ProdName}
+ {!( + item?.ProdVariantName || + item?.RequestVariantName + ) + ?.toLowerCase() + ?.includes('variant') && ( + + Variant: + {item?.ProdVariantName || + item?.RequestVariantName}{' '} + + )} +     +
- {item?.SalesQty} - + {item?.SalesQty} + - {item?.Qty || item?.DispatchedQty} - + {item?.Qty || item?.DispatchedQty} +
- } - + )}
- {(chunkIndex === paginatedChunks.length - 1) && + {chunkIndex === paginatedChunks.length - 1 && ( <>
- - -
- {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

+ {GlobaldummyData + ? GlobalIsnotes && ( +
+

+ Notes : 10 days Return policy +

-
-
) : - Notestext && (
-

{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 && ( +
+

+ Terms & Conditions +

+
    + {TermsAndConditions?.map((item) => ( +
  1. + {item?.TermsandConditions} +
  2. + ))} + {/*
  3. Please check the product before leaving the counter.
  4. */} +
+
+ )} -
- {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) && (
-

- Terms & Conditions -

-
    - {TermsAndConditions?.map(item => (
  1. {item?.TermsandConditions}
  2. ))} - {/*
  3. Please check the product before leaving the counter.
  4. */} -
-
) - } - - {GlobaldummyData ? GlobalSignature && (
-

Signature

- -
) : Signature == true && (
-

Signature

- -
)} - + {GlobaldummyData + ? GlobalSignature && ( +
+

+ Signature +

+ +
+ ) + : Signature == true && ( +
+

+ Signature +

+ +
+ )}
- {PrintGreeting?.SettingValue === "Y" && + {PrintGreeting?.SettingValue === 'Y' && ( <>
-
Thank You Visit Again
+
+ Thank You Visit Again +
- - } + )}
- - } + )}
))} - -
- - - ); -} +}; -export default DCPrintStyle9; \ No newline at end of file +export default DCPrintStyle9; diff --git a/src/Pages/DeliveryChallan/DeliveryPrint.jsx b/src/Pages/DeliveryChallan/DeliveryPrint.jsx index bbcd6f5..6eae3ac 100644 --- a/src/Pages/DeliveryChallan/DeliveryPrint.jsx +++ b/src/Pages/DeliveryChallan/DeliveryPrint.jsx @@ -7,6 +7,7 @@ import moment from 'moment'; import DCPrintA4Style11 from './DCPrintTemplates/DCA4/DCPrintA4Style11'; import { useSelector } from 'react-redux'; import { GlobalDCPrintTemplate } from '../../Features/ThemeChange/ThemeChange'; +import DCPrintStyle1 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle1'; import DCPrintstyle2 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle2'; import DCPrintStyle3 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle3'; import DCPrintstyle4 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle4'; @@ -20,32 +21,13 @@ import DCPrintStyle11 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle11'; import DCPrintstyle12 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle12'; import DCPrintStyleA5 from './DCPrintTemplates/DCA4/DCPrintStyleA5'; import DCA4Standard from './DCPrintTemplates/DCA4/DCA4Standard'; -import DCPrintStyle1 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle1'; import DCInvicePrint from './DCPrintTemplates/DCThermalPrinter/DCInvicePrint'; -// const PrintStyles = ` -// @media print { -// @page { -// size: A4; -// margin: 0; -// } -// body { -// margin: 1.6cm; -// } -// .Quo-Print-Body { -// padding: 20px; -// page-break-after: always; -// } -// .Quo-Print-Content { -// break-inside: avoid; -// } -// .no-print { -// display: none; -// } -// } -// `; - -const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateDtl }) => { +const DeliveryPrint = ({ + PrintingData1, + DCprinterTemplateStyle, + DCPrintTemplateDtl, +}) => { const PrintingData = PrintingData1?.[0]; console.log(PrintingData, 'PrintingData'); const dispatch = useDispatch(); @@ -159,20 +141,29 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD {/*
Gst No:33AAACH7409R1Z8
*/}
- {PrintingData?.[0]?.DCNo &&
- Delivery Challan No: {PrintingData?.[0]?.DCNo} -
} - {PrintingData?.[0]?.RequestId &&
- Ref No #: {PrintingData?.[0]?.RequestId} -
} - {PrintingData?.[0]?.DCDate &&
- Order Date:{' '} - {dateFormatChange1(PrintingData?.[0]?.DCDate)} -
} - {PrintingData?.[0]?.RequestedDate &&
- Requested Date:{' '} - {dateFormatChange1(PrintingData?.[0]?.RequestedDate)} -
} + {PrintingData?.[0]?.DCNo && ( +
+ Delivery Challan No: {PrintingData?.[0]?.DCNo} +
+ )} + {PrintingData?.[0]?.RequestId && ( +
+ Ref No #:{' '} + {PrintingData?.[0]?.RequestId} +
+ )} + {PrintingData?.[0]?.DCDate && ( +
+ Order Date:{' '} + {dateFormatChange1(PrintingData?.[0]?.DCDate)} +
+ )} + {PrintingData?.[0]?.RequestedDate && ( +
+ Requested Date: + {dateFormatChange1(PrintingData?.[0]?.RequestedDate)} +
+ )} {PrintingData?.[0]?.ModeOfTransport && (
Transport Mode: {PrintingData?.[0]?.ModeOfTransport} @@ -193,41 +184,66 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD Vehicle No: {PrintingData?.[0]?.VehicleNo}
)} -
- {PrintingData?.[0]?.ToBranchDtl?.length > 0 &&
-
-
Delivery To :
-
-
{PrintingData?.[0]?.ToBranchDtl?.[0]?.BranchName}
- {PrintingData?.[0]?.ToBranchDtl?.[0]?.Address1 &&
{PrintingData?.[0]?.ToBranchDtl?.[0]?.Address1}
} - {(PrintingData?.[0]?.ToBranchDtl?.[0]?.City || PrintingData?.[0]?.ToBranchDtl?.[0]?.Dist || PrintingData?.[0]?.ToBranchDtl?.[0]?.Zip) &&
{`${PrintingData?.[0]?.ToBranchDtl?.[0]?.City}, ${PrintingData?.[0]?.ToBranchDtl?.[0]?.Dist} - ${PrintingData?.[0]?.ToBranchDtl?.[0]?.Zip}`}
} - {PrintingData?.[0]?.ToBranchDtl?.[0]?.BrGSTIN &&
{PrintingData?.[0]?.ToBranchDtl?.[0]?.BrGSTIN}
} - {/*
Gst No:33AAACH7409R1Z8
*/} + {PrintingData?.[0]?.ToBranchDtl?.length > 0 && ( +
+
+
+ Delivery To : +
+
+
+ {PrintingData?.[0]?.ToBranchDtl?.[0]?.BranchName} +
+ {PrintingData?.[0]?.ToBranchDtl?.[0]?.Address1 && ( +
+ {PrintingData?.[0]?.ToBranchDtl?.[0]?.Address1} +
+ )} + {(PrintingData?.[0]?.ToBranchDtl?.[0]?.City || + PrintingData?.[0]?.ToBranchDtl?.[0]?.Dist || + PrintingData?.[0]?.ToBranchDtl?.[0]?.Zip) && ( +
{`${PrintingData?.[0]?.ToBranchDtl?.[0]?.City}, ${PrintingData?.[0]?.ToBranchDtl?.[0]?.Dist} - ${PrintingData?.[0]?.ToBranchDtl?.[0]?.Zip}`}
+ )} + {PrintingData?.[0]?.ToBranchDtl?.[0]?.BrGSTIN && ( +
+ {PrintingData?.[0]?.ToBranchDtl?.[0]?.BrGSTIN} +
+ )} + {/*
Gst No:33AAACH7409R1Z8
*/} +
+
+
+ {PrintingData?.[0]?.DispatchId && ( +
+ Dispatch No #:{' '} + {PrintingData?.[0]?.DispatchId} +
+ )} + {PrintingData?.[0]?.CreatedDate && ( +
+ Dispatch Date: + {dateFormatChange1(PrintingData?.[0]?.CreatedDate)} +
+ )}
-
- {PrintingData?.[0]?.DispatchId &&
- Dispatch No #: {PrintingData?.[0]?.DispatchId} -
} - {PrintingData?.[0]?.CreatedDate &&
- Dispatch Date:{' '} - {dateFormatChange1(PrintingData?.[0]?.CreatedDate)} -
} -
-
} + )}
-
Delivery Details
- {PrintingData?.[0]?.CustName &&
- Name: {PrintingData?.[0]?.CustName} -
} +
Delivery Details
+ {PrintingData?.[0]?.CustName && ( +
+ Name: {PrintingData?.[0]?.CustName} +
+ )} {/* {PrintingData?.[0]?.CustMobile && ( */} - {PrintingData?.[0]?.CustMobile &&
- Mobile: {PrintingData?.[0]?.CustMobile} -
} - + {PrintingData?.[0]?.CustMobile && ( +
+ Mobile: {PrintingData?.[0]?.CustMobile} +
+ )}
@@ -270,12 +286,18 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD Variant: {item?.ProdVariantName}
)} */} - {(item?.ProdVariantName || item?.RequestVariantName) && ( - (item?.RequestVariantName || item?.ProdVariantName) !== 'Variant 1' && -
- Variant: {item?.RequestVariantName || item?.ProdVariantName} -
- )} + {(item?.ProdVariantName || + item?.RequestVariantName) && + (item?.RequestVariantName || + item?.ProdVariantName) !== 'Variant 1' && ( +
+ Variant:{' '} + {item?.RequestVariantName || + item?.ProdVariantName} +
+ )}
-
))}
{DCprinterTemplateStyle === 'Style 1' && ( )} {DCprinterTemplateStyle === 'Style 2' && ( @@ -342,11 +362,11 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData?.[0]} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - // printDatas={printDatas} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + // printDatas={printDatas} /> )} {DCprinterTemplateStyle === 'Style 3' && ( @@ -366,16 +386,15 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData?.[0]} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - // printDatas={printDatas} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + // printDatas={printDatas} /> )} {DCprinterTemplateStyle === 'Style 4' && ( )} {DCprinterTemplateStyle === 'Style 5' && ( )} {DCprinterTemplateStyle === 'Style 6' && ( @@ -440,11 +458,11 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData?.[0]} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - // printDatas={printDatas} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + // printDatas={printDatas} /> )} {DCprinterTemplateStyle === 'Style 7' && ( @@ -458,18 +476,17 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD BranchName={BranchName} BranchZip={BranchZip} BranchDetails={BranchDetails} - // CashierName={CashierName} // totalQuantity={totalQuantity} // OrderDetailGST={OrderDetailGST} // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData?.[0]} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - // printDatas={printDatas} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + // printDatas={printDatas} /> )} {DCprinterTemplateStyle === 'Style 8' && ( @@ -489,16 +506,15 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData?.[0]} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - // printDatas={printDatas} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + // printDatas={printDatas} /> )} {DCprinterTemplateStyle === 'Style 9' && ( )} {DCprinterTemplateStyle === 'Style 10' && ( )} {DCprinterTemplateStyle === 'Style 11' && ( @@ -563,16 +578,15 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData?.[0]} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - // printDatas={printDatas} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + // printDatas={printDatas} /> )} {DCprinterTemplateStyle === 'Style 12' && ( )} {DCprinterTemplateStyle === 'A4' && ( )} {DCprinterTemplateStyle === 'A5' && ( )} {DCprinterTemplateStyle === 'A4Standard' && ( )} @@ -688,11 +699,11 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - printDatas={DCPrintTemplateDtl} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + printDatas={DCPrintTemplateDtl} /> )}