Implement dynamic header and table color functionality

This commit is contained in:
Srinath 2026-03-03 19:55:25 +05:30
parent 6540340559
commit dffd5e6209
1 changed files with 315 additions and 153 deletions

View File

@ -8,6 +8,17 @@ import {
Globalnotes, Globalnotes,
GlobalthemeFormat, GlobalthemeFormat,
GlobalBillName, GlobalBillName,
GlobalSelectedPrintHeaderColor,
GlobalSelectedPrintHeaderFontColor,
GlobalSelectedTableHeaderColor,
GlobalSelectedTableHeaderFontColor,
GlobalSelectedTableBodyColor,
GlobalSelectedTableBodyFontColor,
GlobalRowType,
GlobalSelectedFooterColor,
GlobalSelectedFooterFontColor,
GlobalSelectedNetAmountColor,
GlobalSelectedNetAmountFontColor,
} from "../../../Features/ThemeChange/ThemeChange"; } from "../../../Features/ThemeChange/ThemeChange";
import "../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.scss" import "../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.scss"
import { extractLastNumber } from "../../../Services/Others"; import { extractLastNumber } from "../../../Services/Others";
@ -37,6 +48,17 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
const GlobaldummyData = useSelector(GlobalPritdummyData); const GlobaldummyData = useSelector(GlobalPritdummyData);
const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions);
const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor);
const SelectedHeaderFontColor = useSelector(GlobalSelectedPrintHeaderFontColor);
const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor);
const SelectedTableHeaderFontColor = useSelector(GlobalSelectedTableHeaderFontColor);
const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor);
const SelectedTableBodyFontColor = useSelector(GlobalSelectedTableBodyFontColor);
const SelectedRowType = useSelector(GlobalRowType);
const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor);
const SelectedTableFooterFontColor = useSelector(GlobalSelectedFooterFontColor);
const SelectedNetAmountColor = useSelector(GlobalSelectedNetAmountColor);
const SelectedNetAmountFontColor = useSelector(GlobalSelectedNetAmountFontColor);
let TermsAndConditions = printDatas?.TermsandConditions let TermsAndConditions = printDatas?.TermsandConditions
@ -47,7 +69,12 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
let PageSize = printDatas?.PageSize let PageSize = printDatas?.PageSize
const Signature = FieldDetails?.["signature"]; const Signature = FieldDetails?.["signature"];
const TermsnAdCondition = FieldDetails?.["terms&conditions"]; const TermsnAdCondition = FieldDetails?.["terms&conditions"];
let printColors = printDatas?.PrintColors;
const headerColor = printColors?.find(obj => obj.headerColor)?.headerColor;
const tableHeaderColor = printColors?.find(obj => obj.tableHeaderColor)?.tableHeaderColor;
const tableBodyColor = printColors?.find(obj => obj.tableBodyColor)?.tableBodyColor;
const footerColor = printColors?.find(obj => obj.footerColor)?.footerColor;
const netAmtColor = printColors?.find(obj => obj.netAmtColor)?.netAmtColor;
const keysLength = Object.keys(table2Data ?? {}).length; const keysLength = Object.keys(table2Data ?? {}).length;
if (keysLength > 0) { if (keysLength > 0) {
@ -60,28 +87,10 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
const year = currentDate.getFullYear().toString().slice(-2); const year = currentDate.getFullYear().toString().slice(-2);
const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`;
const TakeawayData = table2Data?.[0]?.ProductDetails const TakeawayData = table2Data?.[0]?.ProductDetails
console.log(TakeawayData, "TakeawayData", table2Data)
let TotalOfferAmount = 0; let TotalOfferAmount = 0;
// Calculate SalesWiseOffers total amount
const chunkSize = PageSize == "A5" ? 11 : 16; const chunkSize = PageSize == "A5" ? 11 : 16;
let dataSource = table2Data?.[0]?.ProductDetails; let dataSource = table2Data?.[0]?.ProductDetails;
console.log(table2Data,"FieldDetailsFieldDetails")
// Paginate the data // Paginate the data
const paginatedChunks = []; const paginatedChunks = [];
for (let i = 0; i < dataSource?.length; i += chunkSize) { for (let i = 0; i < dataSource?.length; i += chunkSize) {
@ -89,9 +98,52 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
} }
const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0;
const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == "A5" ? 5 : 10); const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == "A5" ? 5 : 10);
{console.log(TakeawayData,"TakeawayDataTakeawayData")}
const headerStyle = {
backgroundColor: GlobaldummyData
? SelectedHeaderColor
: headerColor?.background,
color: GlobaldummyData
? SelectedHeaderFontColor
: headerColor?.font,
}
const tableHeaderStyle = {
backgroundColor: GlobaldummyData
? SelectedTableHeaderColor
: tableHeaderColor?.background,
color: GlobaldummyData
? SelectedTableHeaderFontColor
: tableHeaderColor?.font,
}
const tableBodyStyle = {
backgroundColor: GlobaldummyData
? SelectedTableBodyColor
: tableBodyColor?.background,
color: GlobaldummyData
? SelectedTableBodyFontColor
: tableBodyColor?.font,
}
const rowtypeStyle = GlobaldummyData ? SelectedRowType : tableBodyColor?.rowType;
const footerColorStyle = {
backgroundColor: GlobaldummyData
? SelectedTableFooterColor
: footerColor?.background,
color: GlobaldummyData
? SelectedTableFooterFontColor
: footerColor?.font,
}
const netAmountStyle = {
backgroundColor: GlobaldummyData
? SelectedNetAmountColor
: netAmtColor?.background,
color: GlobaldummyData
? SelectedNetAmountFontColor
: netAmtColor?.font,
}
return ( return (
<> <>
{FormatTheme ? {FormatTheme ?
@ -101,91 +153,149 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
{/* <div className="header" style={{ position: "fixed", top: 0, width: "100%" }}> */} {/* <div className="header" style={{ position: "fixed", top: 0, width: "100%" }}> */}
<div className="header" style={{ position: isMobile ? GlobaldummyData ? "absolute" : "fixed" : "", top: 0, width: "100%" }}> <div className="header" style={{ position: isMobile ? GlobaldummyData ? "absolute" : "fixed" : "", top: 0, width: "100%" }}>
<div className="PrintStyle3-print" > <div className="PrintStyle3-print" style={{ ...headerStyle }} >
<div style={{ fontSize: '30px', fontweight: '900' }}> <div style={{ fontSize: '30px', fontweight: '900' }}>
{ table2Data?.[0]?.BrName} {table2Data?.[0]?.BrName}
</div> </div>
<div style={{ fontweight: '600' }}> {GlobaldummyData ? <div style={{ fontweight: '600' }}> {GlobaldummyData ?
'BranchAddress, Town- 635XXX City - State' : 'BranchAddress, Town- 635XXX City - State' :
(table2Data?.[0]?.AddressDetails?.[0]?.Address1 || '') + (table2Data?.[0]?.AddressDetails?.[0]?.City ? (table2Data?.[0]?.AddressDetails?.[0]?.Address1 && table2Data?.[0]?.AddressDetails?.[0]?.City ? '-' : '') + table2Data?.[0]?.AddressDetails?.[0]?.City : '') + (table2Data?.[0]?.AddressDetails?.[0]?.Zip ? (table2Data?.[0]?.AddressDetails?.[0]?.City && table2Data?.[0]?.AddressDetails?.[0]?.Zip ? '-' : '') + table2Data?.[0]?.AddressDetails?.[0]?.Zip : '')} (table2Data?.[0]?.AddressDetails?.[0]?.Address1 || '') + (table2Data?.[0]?.AddressDetails?.[0]?.City ? (table2Data?.[0]?.AddressDetails?.[0]?.Address1 && table2Data?.[0]?.AddressDetails?.[0]?.City ? '-' : '') + table2Data?.[0]?.AddressDetails?.[0]?.City : '') + (table2Data?.[0]?.AddressDetails?.[0]?.Zip ? (table2Data?.[0]?.AddressDetails?.[0]?.City && table2Data?.[0]?.AddressDetails?.[0]?.Zip ? '-' : '') + table2Data?.[0]?.AddressDetails?.[0]?.Zip : '')}
{table2Data?.[0]?.BrGSTIN && <div>GST NO :{ table2Data?.[0]?.BrGSTIN}, CIN :u00045hhsgbubufsdug</div>} {table2Data?.[0]?.BrGSTIN && <div>GST NO :{table2Data?.[0]?.BrGSTIN}, CIN :u00045hhsgbubufsdug</div>}
<div style={{ fontWeight: '600' }}> Mobile : +91 { table2Data?.[0]?.BrMobile}</div> <div style={{ fontWeight: '600' }}> Mobile : +91 {table2Data?.[0]?.BrMobile}</div>
{ <div style={{ fontSize: "14px", margin: "2px 0 0 0", padding: 0, fontWeight: 600 }}>{BillName} </div>} {<div style={{ fontSize: "14px", margin: "2px 0 0 0", padding: 0, fontWeight: 600 }}>{BillName} </div>}
</div> </div>
</div> </div>
<hr className="PrintStyle3-print-dottline" /> <hr className="PrintStyle3-print-dottline" />
<div className="PrintStyle3-print-ordr-dtls"> <div className="PrintStyle3-print-ordr-dtls">
<div style={{ lineheight: '50px' }}> <div style={{ lineheight: '50px' }}>
<div style={{ fontSize: '14px', fontWeight: 600 }} > BILL NO : <div style={{ fontSize: '14px', fontWeight: 600 }} > BILL NO :
{ {
table2Data?.[0]?.QuotationNo && extractLastNumber(table2Data?.[0]?.QuotationNo) table2Data?.[0]?.QuotationNo && extractLastNumber(table2Data?.[0]?.QuotationNo)
} </div> } </div>
<div style={{ fontSize: '14px', fontWeight: 600 }} > { Date1}</div> <div style={{ fontSize: '14px', fontWeight: 600 }} > {Date1}</div>
</div> </div>
</div> </div>
<hr className="PrintStyle3-print-dottline" /> <hr className="PrintStyle3-print-dottline" />
</div> </div>
<div className="print-body" style={{ marginTop: "0rem" }}> <div className="print-body" style={{ marginTop: "0rem" }}>
<div className="PrintStyle3-print-tableMaster"> <div className="PrintStyle3-print-tableMaster">
{(TakeawayData?.length > 0 ) && {(TakeawayData?.length > 0) &&
<div style={{ width: '95%' }} className="PrintStyle3-print-table"> <div style={{ width: '95%' }} className="PrintStyle3-print-table">
<div style={{ display: 'flex', justifyContent: 'space-between', width: '100%', fontweight: '600', gap: '0.2rem' }}> <div style={{ ...tableHeaderStyle, display: 'flex', justifyContent: 'space-between', width: '100%', fontweight: '600', gap: '0.2rem' }}>
{ SLNO && <div style={{ width: '100%', textAlign: 'center', fontWeight: 600 }}>S.No</div>} {SLNO && <div style={{ width: '100%', textAlign: 'center', fontWeight: 600 }}>S.No</div>}
{ Item && <div style={{ width: '300%', textAlign: 'left', fontWeight: 600 }}>ITEM</div>} {Item && <div style={{ width: '300%', textAlign: 'left', fontWeight: 600 }}>ITEM</div>}
{ HsnCode && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>HSN</div>} {HsnCode && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>HSN</div>}
{ MRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>MRP</div>} {MRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>MRP</div>}
{ Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>QTY</div>} {Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>QTY</div>}
{ Rate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>RATE</div>} {Rate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>RATE</div>}
{ Discount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>DIS </div>} {Discount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>DIS </div>}
{ Amount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>AMT</div>} {Amount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>AMT</div>}
</div> </div>
<div style={{ marginTop: '5px' }}> <div style={{ marginTop: '5px' }}>
{dataChunk?.map((item, index) => ( {dataChunk?.map((item, index) => {
<div style={{ display: 'flex', justifyContent: 'space-between', width: '100%', gap: '0.2rem' }}> const isMatch =
{ SLNO && <div style={{ width: '100%', textAlign: 'center', fontWeight: 600 }}>{chunkIndex * chunkSize + index + 1}</div>} (index % 2 === 0 && rowtypeStyle === "even") ||
{ Item && (index % 2 === 1 && rowtypeStyle === "odd");
<div style={{ display: 'flex', flexDirection: 'column', width: '300%', textAlign: 'left', fontWeight: 600 }}>
<div>{item?.ProdName}</div> return (
<div>({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}) <div
&nbsp; {item?.BrandName !== null ? item?.BrandName : ""}&nbsp; style={{
{item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) display: "flex",
?.map(a => { return (<div>{a.SerialNumber}</div>) })) : ""} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter((item1) => item1.IMEI1 !== "" || item1.IMEI2 !== "") justifyContent: "space-between",
?.map(item2 => { width: "100%",
const imei1 = item2.IMEI1 || ""; gap: "0.2rem",
const imei2 = item2.IMEI2 || ""; ...(isMatch ? tableBodyStyle : {}),
return (<div>{[imei1, imei2].filter(Boolean).join(",")}</div>); }}
} >
) : ""} {SLNO && (
<div style={{ width: "100%", textAlign: "center", fontWeight: 600 }}>
{chunkIndex * chunkSize + index + 1}
</div> </div>
</div>} )}
{ HsnCode && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>{item?.HSN}</div>}
{ MRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>{item?.SinglePc === 'Y' ? item?.Price : item?.MRP}</div>} {Item && (
{ Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>{item?.Qty}</div>} <div
{ Rate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>{item?.Price}</div>} style={{
{ Discount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}</div>} display: "flex",
{ Amount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }} > {item?.NetAmt?.toFixed(2)}</div>} flexDirection: "column",
</div> width: "300%",
))} textAlign: "left",
fontWeight: 600,
}}
>
<div>{item?.ProdName}</div>
<div>
({item?.Size ? item?.Size : "1"}{" "}
{item?.SinglePc === "Y"
? "PCS"
: item?.Type !== "C"
? item?.UomName
: "COMBO"})
&nbsp;{item?.BrandName ?? ""}
</div>
</div>
)}
{HsnCode && (
<div style={{ width: "100%", textAlign: "right", fontWeight: 600 }}>
{item?.HSN}
</div>
)}
{MRP && (
<div style={{ width: "100%", textAlign: "right", fontWeight: 600 }}>
{item?.SinglePc === "Y" ? item?.Price : item?.MRP}
</div>
)}
{Quantity && (
<div style={{ width: "100%", textAlign: "right", fontWeight: 600 }}>
{item?.Qty}
</div>
)}
{Rate && (
<div style={{ width: "100%", textAlign: "right", fontWeight: 600 }}>
{item?.Price}
</div>
)}
{Discount && (
<div style={{ width: "100%", textAlign: "right", fontWeight: 600 }}>
{item?.Type !== "C"
? item?.OfferAmt || 0
: item?.OfferValue || 0}
</div>
)}
{Amount && (
<div style={{ width: "100%", textAlign: "right", fontWeight: 600 }}>
{item?.NetAmt?.toFixed(2)}
</div>
)}
</div>
);
})}
</div> </div>
</div> </div>
} }
</div> </div>
</div> </div>
{((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme &&
<> <>
<div className="PrintStyle3-print-ttlovrl"> <div className="PrintStyle3-print-ttlovrl" style={{...netAmountStyle}}>
<div> <div>
<div style={{ fontWeight: '600' }}> Items : </div> <div style={{ fontWeight: '600' }}> Items : </div>
<div style={{ fontWeight: '600' }}> Qty : </div> <div style={{ fontWeight: '600' }}> Qty : </div>
@ -319,24 +429,15 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
</div> </div>
<hr className="PrintStyle3-print-dottline" /> <hr className="PrintStyle3-print-dottline" />
<div className="PrintStyle3-print-stradrs" style={{ display: 'flex', justifyContent: 'space-between' }}> <div className="PrintStyle3-print-stradrs" style={{ display: 'flex', justifyContent: 'space-between' }}>
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', width: "100%" }}> <div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', width: "100%" }}>
{table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData &&
<div style={{ fontSize: "14px", fontWeight: 600 }}>Customer : {table2Data?.CustSuppName} <div style={{ fontSize: "14px", fontWeight: 600 }}>Customer : {table2Data?.CustSuppName}
</div> </div>
} }
</div> </div>
</div> </div>
{/* <br/> */} {/* <br/> */}
<hr className="PrintStyle3-print-dottline" /> <hr className="PrintStyle3-print-dottline" />
<div className="page-footerA4Style11" <div className="page-footerA4Style11"
@ -345,6 +446,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
pageBreakBefore: "avoid", pageBreakBefore: "avoid",
pageBreakInside: "avoid", pageBreakInside: "avoid",
minHeight: "auto", minHeight: "auto",
...footerColorStyle
}} }}
> >
{ {
@ -356,7 +458,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
} }
<div style={{ display: "flex", width: "90%", padding: "0 1rem", justifyContent: "flex-end", alignItems: "center" }}> <div style={{ display: "flex", width: "90%", padding: "0 1rem", justifyContent: "flex-end", alignItems: "center" }}>
{ {
(TermsnAdCondition == true && TermsAndConditions?.length > 0) && (<div style={{ margin: "8px 0", fontFamily: "sans-serif", width: "100%", display: "flex", flexDirection: "column", alignItems: "flex-start" }}> (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (<div style={{ margin: "8px 0", fontFamily: "sans-serif", width: "100%", display: "flex", flexDirection: "column", alignItems: "flex-start" }}>
<p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}> <p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>
@ -369,7 +471,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
</div>) </div>)
} }
{ Signature == true && (<div style={{ display: "flex", flexDirection: "column", alignItems: "center", marginTop: "1rem", paddingBottom: "1rem" }}> {Signature == true && (<div style={{ display: "flex", flexDirection: "column", alignItems: "center", marginTop: "1rem", paddingBottom: "1rem" }}>
<p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>Signature</p> <p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>Signature</p>
<img style={{ width: "100px", height: "60px" }} src={SignatureImg} alt="" /> <img style={{ width: "100px", height: "60px" }} src={SignatureImg} alt="" />
</div>)} </div>)}
@ -378,7 +480,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
</div> </div>
</> </>
} }
@ -405,7 +507,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
}} }}
> >
<> <>
<div className="PrintStyle3-print-ttlovrl"> <div className="PrintStyle3-print-ttlovrl" style={{...netAmountStyle}}>
<div> <div>
<div style={{ fontWeight: '600' }}> Items : </div> <div style={{ fontWeight: '600' }}> Items : </div>
<div style={{ fontWeight: '600' }}> Qty : </div> <div style={{ fontWeight: '600' }}> Qty : </div>
@ -413,10 +515,10 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
<div style={{ fontWeight: '600' }}> Amount : </div> <div style={{ fontWeight: '600' }}> Amount : </div>
</div> </div>
<div className="PrintStyle3-print-prdttl-amt"> <div className="PrintStyle3-print-prdttl-amt">
<div style={{ marginRight: '0.5rem', fontWeight: '600' }}>{ totalQuantityFilter?.length} </div> <div style={{ marginRight: '0.5rem', fontWeight: '600' }}>{totalQuantityFilter?.length} </div>
<div style={{ marginRight: '0.5rem', fontWeight: '600' }}>{ totalQuantity} </div> <div style={{ marginRight: '0.5rem', fontWeight: '600' }}>{totalQuantity} </div>
{(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && <div style={{ marginRight: '0.5rem', fontWeight: '600' }}>{ Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)} </div>} {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && <div style={{ marginRight: '0.5rem', fontWeight: '600' }}>{Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)} </div>}
<div style={{ fontWeight: '600', marginRight: '0.5rem' }}> { Number(table2Data?.[0]?.NetAmount).toFixed(2)} </div> <div style={{ fontWeight: '600', marginRight: '0.5rem' }}> {Number(table2Data?.[0]?.NetAmount).toFixed(2)} </div>
</div> </div>
</div> </div>
@ -543,27 +645,27 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
{/* <br/> */} {/* <br/> */}
<div className="PrintStyle3-print-stradrs" style={{ display: 'flex', justifyContent: 'space-between' }}> <div className="PrintStyle3-print-stradrs" style={{ display: 'flex', justifyContent: 'space-between' }}>
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', width: "100%" }}> <div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', width: "100%" }}>
{table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData &&
<div style={{ fontSize: "14px", fontWeight: 600 }}>Customer : {table2Data?.CustSuppName} <div style={{ fontSize: "14px", fontWeight: 600 }}>Customer : {table2Data?.CustSuppName}
</div> </div>
} }
</div>
</div>
</div> </div>
{/* <br/> */} {/* <br/> */}
<div className="page-footerA4Style11" <div className="page-footerA4Style11"
style={{ style={{
@ -571,6 +673,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
pageBreakBefore: "avoid", pageBreakBefore: "avoid",
pageBreakInside: "avoid", pageBreakInside: "avoid",
minHeight: "auto", minHeight: "auto",
...footerColorStyle
}} }}
> >
{ {
@ -595,7 +698,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
</div>) </div>)
} }
{ Signature == true && (<div style={{ display: "flex", flexDirection: "column", alignItems: "center", marginTop: "1rem", paddingBottom: "1rem" }}> {Signature == true && (<div style={{ display: "flex", flexDirection: "column", alignItems: "center", marginTop: "1rem", paddingBottom: "1rem" }}>
<p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>Signature</p> <p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>Signature</p>
<img style={{ width: "100px", height: "60px" }} src={SignatureImg} alt="" /> <img style={{ width: "100px", height: "60px" }} src={SignatureImg} alt="" />
</div>)} </div>)}
@ -604,7 +707,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
</div> </div>
</> </>
</div> </div>
</div> </div>
@ -614,79 +717,137 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
: :
<div className="PrintStyle3MasterDiv" id={`SQPrintStyle3`} style={{ fontFamily: "'Courier New', Courier, monospace" }}> <div className="PrintStyle3MasterDiv" id={`SQPrintStyle3`} style={{ fontFamily: "'Courier New', Courier, monospace" }}>
<div className="PrintStyle3-print" > <div className="PrintStyle3-print" style={{ ...headerStyle }}>
<div style={{ fontSize: '30px', fontweight: '900' }}>{table2Data?.[0]?.BrName}</div> <div style={{ fontSize: '30px', fontweight: '900' }}>{table2Data?.[0]?.BrName}</div>
<div style={{ fontweight: '600' }}> { <div style={{ fontweight: '600' }}> {
(table2Data?.[0]?.AddressDetails?.[0]?.Address1 || '') + (table2Data?.[0]?.AddressDetails?.[0]?.City ? (table2Data?.[0]?.AddressDetails?.[0]?.Address1 && table2Data?.[0]?.AddressDetails?.[0]?.City ? '-' : '') + table2Data?.[0]?.AddressDetails?.[0]?.City : '') + (table2Data?.[0]?.AddressDetails?.[0]?.Zip ? (table2Data?.[0]?.AddressDetails?.[0]?.City && table2Data?.[0]?.AddressDetails?.[0]?.Zip ? '-' : '') + table2Data?.[0]?.AddressDetails?.[0]?.Zip : '')} (table2Data?.[0]?.AddressDetails?.[0]?.Address1 || '') + (table2Data?.[0]?.AddressDetails?.[0]?.City ? (table2Data?.[0]?.AddressDetails?.[0]?.Address1 && table2Data?.[0]?.AddressDetails?.[0]?.City ? '-' : '') + table2Data?.[0]?.AddressDetails?.[0]?.City : '') + (table2Data?.[0]?.AddressDetails?.[0]?.Zip ? (table2Data?.[0]?.AddressDetails?.[0]?.City && table2Data?.[0]?.AddressDetails?.[0]?.Zip ? '-' : '') + table2Data?.[0]?.AddressDetails?.[0]?.Zip : '')}
{table2Data?.[0]?.BrGSTIN && <div>GST NO :{ table2Data?.[0]?.BrGSTIN}, CIN :u00045hhsgbubufsdug</div>} {table2Data?.[0]?.BrGSTIN && <div>GST NO :{table2Data?.[0]?.BrGSTIN}, CIN :u00045hhsgbubufsdug</div>}
<div style={{ fontWeight: '600' }}> Mobile : +91 { table2Data?.[0]?.BrMobile}</div> <div style={{ fontWeight: '600' }}> Mobile : +91 {table2Data?.[0]?.BrMobile}</div>
{ <div style={{ fontSize: "14px", margin: "2px 0 0 0", padding: 0, fontWeight: 600 }}>{BillName}</div>} {<div style={{ fontSize: "14px", margin: "2px 0 0 0", padding: 0, fontWeight: 600 }}>{BillName}</div>}
</div> </div>
</div> </div>
<hr className="PrintStyle3-print-dottline" /> <hr className="PrintStyle3-print-dottline" />
<div className="PrintStyle3-print-ordr-dtls"> <div className="PrintStyle3-print-ordr-dtls">
<div style={{ lineheight: '50px' }}> <div style={{ lineheight: '50px' }}>
<div style={{ fontSize: '14px', fontWeight: 600 }} > BILL NO : <div style={{ fontSize: '14px', fontWeight: 600 }} > BILL NO :
{ {
table2Data?.[0]?.QuotationNo && extractLastNumber(table2Data?.[0]?.QuotationNo) table2Data?.[0]?.QuotationNo && extractLastNumber(table2Data?.[0]?.QuotationNo)
} }
</div> </div>
<div style={{ fontSize: '14px', fontWeight: 600 }} > { Date1}</div> <div style={{ fontSize: '14px', fontWeight: 600 }} > {Date1}</div>
</div> </div>
</div> </div>
<hr className="PrintStyle3-print-dottline" /> <hr className="PrintStyle3-print-dottline" />
<div className="PrintStyle3-print-tableMaster"> <div className="PrintStyle3-print-tableMaster">
{(TakeawayData?.length > 0) && {(TakeawayData?.length > 0) &&
<div style={{ width: '95%' }} className="PrintStyle3-print-table"> <div style={{ width: '95%' }} className="PrintStyle3-print-table">
<div style={{ display: 'flex', justifyContent: 'space-between', width: '100%', fontweight: '600', gap: '0.2rem' }}> <div style={{ ...tableHeaderStyle, display: 'flex', justifyContent: 'space-between', width: '100%', fontweight: '600', gap: '0.2rem' }}>
{ SLNO && <div style={{ width: '100%', textAlign: 'center', fontWeight: 600 }}>S.No</div>} {SLNO && <div style={{ width: '100%', textAlign: 'center', fontWeight: 600 }}>S.No</div>}
{ Item && <div style={{ width: '300%', textAlign: 'left', fontWeight: 600 }}>ITEM</div>} {Item && <div style={{ width: '300%', textAlign: 'left', fontWeight: 600 }}>ITEM</div>}
{ HsnCode && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>HSN</div>} {HsnCode && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>HSN</div>}
{ MRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>MRP</div>} {MRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>MRP</div>}
{ Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>QTY</div>} {Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>QTY</div>}
{ Rate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>RATE</div>} {Rate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>RATE</div>}
{ Discount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>DIS </div>} {Discount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>DIS </div>}
{ Amount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>AMT</div>} {Amount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>AMT</div>}
</div> </div>
<div style={{ marginTop: '5px' }}> <div style={{ marginTop: '5px' }}>
{( TakeawayData)?.map((item, index) => ( {dataChunk?.map((item, index) => {
<div style={{ display: 'flex', justifyContent: 'space-between', width: '100%', gap: '0.2rem' }}> const isMatch =
{ SLNO && <div style={{ width: '100%', textAlign: 'center', fontWeight: 600 }}>{index + 1}</div>} (index % 2 === 0 && rowtypeStyle === "even") ||
{ Item && (index % 2 === 1 && rowtypeStyle === "odd");
<div style={{ display: 'flex', flexDirection: 'column', width: '300%', textAlign: 'left', fontWeight: 600 }}>
<div>{item?.ProdName}</div> return (
<div>({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}) <div
&nbsp; {item?.BrandName !== null ? item?.BrandName : ""}&nbsp; style={{
{item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) display: "flex",
?.map(a => { return (<div>{a.SerialNumber}</div>) })) : ""} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter((item1) => item1.IMEI1 !== "" || item1.IMEI2 !== "") justifyContent: "space-between",
?.map(item2 => { width: "100%",
const imei1 = item2.IMEI1 || ""; gap: "0.2rem",
const imei2 = item2.IMEI2 || ""; ...(isMatch ? tableBodyStyle : {}),
return (<div>{[imei1, imei2].filter(Boolean).join(",")}</div>); }}
} >
) : ""} {SLNO && (
<div style={{ width: "100%", textAlign: "center", fontWeight: 600 }}>
{chunkIndex * chunkSize + index + 1}
</div> </div>
</div>} )}
{ HsnCode && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>{item?.HSN}</div>}
{ MRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>{item?.SinglePc === 'Y' ? item?.Price : item?.MRP}</div>} {Item && (
{ Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>{item?.Qty}</div>} <div
{ Rate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>{item?.Price}</div>} style={{
{ Discount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}</div>} display: "flex",
{ Amount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }} > {item?.NetAmt?.toFixed(2)}</div>} flexDirection: "column",
</div> width: "300%",
))} textAlign: "left",
fontWeight: 600,
}}
>
<div>{item?.ProdName}</div>
<div>
({item?.Size ? item?.Size : "1"}{" "}
{item?.SinglePc === "Y"
? "PCS"
: item?.Type !== "C"
? item?.UomName
: "COMBO"})
&nbsp;{item?.BrandName ?? ""}
</div>
</div>
)}
{HsnCode && (
<div style={{ width: "100%", textAlign: "right", fontWeight: 600 }}>
{item?.HSN}
</div>
)}
{MRP && (
<div style={{ width: "100%", textAlign: "right", fontWeight: 600 }}>
{item?.SinglePc === "Y" ? item?.Price : item?.MRP}
</div>
)}
{Quantity && (
<div style={{ width: "100%", textAlign: "right", fontWeight: 600 }}>
{item?.Qty}
</div>
)}
{Rate && (
<div style={{ width: "100%", textAlign: "right", fontWeight: 600 }}>
{item?.Price}
</div>
)}
{Discount && (
<div style={{ width: "100%", textAlign: "right", fontWeight: 600 }}>
{item?.Type !== "C"
? item?.OfferAmt || 0
: item?.OfferValue || 0}
</div>
)}
{Amount && (
<div style={{ width: "100%", textAlign: "right", fontWeight: 600 }}>
{item?.NetAmt?.toFixed(2)}
</div>
)}
</div>
);
})}
</div> </div>
</div> </div>
} }
</div> </div>
{/* <br/> */} {/* <br/> */}
<div className="PrintStyle3-print-ttlovrl"> <div className="PrintStyle3-print-ttlovrl" style={{...netAmountStyle}}>
<div> <div>
<div style={{ fontWeight: '600' }}> Items : </div> <div style={{ fontWeight: '600' }}> Items : </div>
<div style={{ fontWeight: '600' }}> Qty : </div> <div style={{ fontWeight: '600' }}> Qty : </div>
@ -819,7 +980,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
} }
</div> </div>
{/* <br/> */} {/* <br/> */}
@ -827,27 +988,28 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
<div className="PrintStyle3-print-stradrs" style={{ display: 'flex', justifyContent: 'space-between' }}> <div className="PrintStyle3-print-stradrs" style={{ display: 'flex', justifyContent: 'space-between' }}>
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', width: "100%" }}> <div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', width: "100%" }}>
{table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData &&
<div style={{ fontSize: "14px", fontWeight: 600 }}>Customer : {table2Data?.CustSuppName} <div style={{ fontSize: "14px", fontWeight: 600 }}>Customer : {table2Data?.CustSuppName}
</div> </div>
} }
</div> </div>
</div> </div>
{/* <br/> */} {/* <br/> */}
<div className="page-footerA4Style11" <div className="page-footerA4Style11"
style={{ style={{
marginTop: "auto", marginTop: "auto",
pageBreakBefore: "avoid", pageBreakBefore: "avoid",
pageBreakInside: "avoid", pageBreakInside: "avoid",
minHeight: "auto", minHeight: "auto",
...footerColorStyle
}} }}
> >
{ {
@ -859,7 +1021,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
} }
<div style={{ display: "flex", width: "90%", padding: "0 1rem", justifyContent: "flex-end", alignItems: "center" }}> <div style={{ display: "flex", width: "90%", padding: "0 1rem", justifyContent: "flex-end", alignItems: "center" }}>
{ {
(TermsnAdCondition == true && TermsAndConditions?.length > 0) && (<div style={{ margin: "8px 0", fontFamily: "sans-serif", width: "100%", display: "flex", flexDirection: "column", alignItems: "flex-start" }}> (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (<div style={{ margin: "8px 0", fontFamily: "sans-serif", width: "100%", display: "flex", flexDirection: "column", alignItems: "flex-start" }}>
<p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}> <p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>
@ -872,7 +1034,7 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
</div>) </div>)
} }
{ Signature == true && (<div style={{ display: "flex", flexDirection: "column", alignItems: "center", marginTop: "1rem", paddingBottom: "1rem" }}> {Signature == true && (<div style={{ display: "flex", flexDirection: "column", alignItems: "center", marginTop: "1rem", paddingBottom: "1rem" }}>
<p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>Signature</p> <p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>Signature</p>
<img style={{ width: "100px", height: "60px" }} src={SignatureImg} alt="" /> <img style={{ width: "100px", height: "60px" }} src={SignatureImg} alt="" />
</div>)} </div>)}
@ -880,8 +1042,8 @@ const PurPrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQ
</div> </div>
</div> </div>
{/* <div onClick={Print}> print</div> */} {/* <div onClick={Print}> print</div> */}
</div>} </div>}
</> </>