import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import QrImage from '../../../Images/qrcode.jpg';
import Logo from '../../../Images/Logo.jpg'
import { extractLastNumber, extractLastNumberOrderId, printDiv } from '../../../Services/Others';
import {


    changeReprintDataFound,
    GloabalFieldDetails,
    GlobalprintSignature,
    GlobalprinttermsAndConditions,
    GlobalSignatureImage,
    Globalnotes,
    GlobalthemeFormat,
    GlobalBillName,
} from '../../../Features/ThemeChange/ThemeChange'
import { GlobalUpiIDprint } from '../../../Features/BookingScreen/BookingData/BookingData';
import '../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.scss'
import signature from "../../../Images/signatureimage.jpg"
import { ApplicationPreferences } from '../../../Features/BrachLogin/BranchLogin';



const PurPrintStyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, totalQuantityFilter, BranchCity, BranchZip, CashierName, totalQuantity,
    OrderDetailGST, OrderDetailIGST, OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, printDatas }) => {

    const dispatch = useDispatch();
    const GlobalUpiID = useSelector(GlobalUpiIDprint)
    const FieldDetails = useSelector(GloabalFieldDetails);

    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 GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions);
    const appPreferences = useSelector(ApplicationPreferences);



    let TermsAndConditions = printDatas?.TermsandConditions
    let SignatureImg = printDatas?.Signature
    let Notestext = printDatas?.Notes
    let BillName = printDatas?.PrintHdrName
    let FormatTheme = printDatas?.PrintType == "S" ? true : false
    let PageSize = printDatas?.PageSize
    const Signature = FieldDetails?.["signature"];
    const TermsnAdCondition = FieldDetails?.["terms&conditions"];


    const keysLength = Object.keys(table2Data ?? {}).length;

    const printDocument = () => {
        window.print();
    }

    if (keysLength > 0) {
        dispatch(changeReprintDataFound(true));
    }

    const productsData = table2Data?.[0]?.productDetails || [];


    const TakeawayData = table2Data?.[0]?.ProductDetails
    console.log(table2Data, 'FormatTheme', productsData)

    let TotalOfferAmount = 0;

    const chunkSize = PageSize == "A5" ? 8 : 11;
    let dataSource = table2Data?.[0]?.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" ? 5 : 10);

    const style12 = `<style> 

  @media print {
    body {  
    font-family: 'Roboto Slab', serif;   
    font-size: clamp(1.2rem, 2.5vw, 2rem);  
    font-size:18px
    }
  }

  .PrintStyle12MasterDiv {
      color: #000;
      line-height: normal;
      padding: 1rem 1rem;
      font-size: clamp(0.81rem, 2.5vw, 1.2rem);
    }
   
    .PrintStyle12-firstDiv {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-direction: row;
    }
   
    .PrintStyle12-SecondDiv {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      padding: 5px 0;
    }
   
    .PrintStyle12-print-dottline {
      border-top: 0.5px dashed rgb(0, 0, 0);
      border-width: 0.7px;
      border-style: dashed;
      border-image: initial;
    }
   
    .PrintStyle12-print-solid {
      border-top: 0.5px solid rgb(0, 0, 0);
      border-width: 0.7px;
      border-style: solid;
      border-image: initial;
      width: 100%;
    }
   
    .PrintStyle12-ThirdDivMaster {
      display: flex;
      flex-direction: column;
    }
    
    .PrintStyle12-print-tableMaster {
      display: flex;
      width: 96%;    

    }
    
    .PrintStyle12-print-table {
      width: 100%;
      border-collapse: collapse;
    }
    
    .PrintStyle12-print-table th,
    .PrintStyle4-print-table td {
      padding: 2px 5px; 
      border-collapse: collapse;
      font-weight: 600;
    }
    
    .PrintStyle12-print-table th {
      background-color: #f2f2f2;
      padding: 5px 0px;
      font-weight: 600;
      font-size: clamp(0.68rem, 2.5vw, 0.9rem);
      border-bottom: 1px dashed;
    }
    
    
    .PrintStyle12-print-table td {
      font-size: clamp(0.68rem, 2.5vw, 0.9rem);
      padding: 0 2px;
    }
   
    .PrintStyle12-BrandImage {
      width: 87px;
      height: auto;
      mix-blend-mode: darken;
    }
   
    .PrintStyle12-FourthP {
   
      display: flex;
      flex-direction: column;
   
    }
   
    .PrintStyle12-FourthSpan {
      display: flex;
      justify-content: center;
   
    }
   
    .PrintStyle12-Qr-Order {
      display: flex;
      justify-content: space-between;
      flex-direction: row;
      padding: 0.5rem 0;
    }
   
    .PrintStyle12-OrderNo {
      display: flex;
      flex-direction: column;
   
    }
   
    .PrintStyle12-QrCode {
      display: flex;
      flex-direction: column;
    }
   
    .PrintStyle12-FourthDiv {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      padding: 0.3rem 0;
      align-items: center;
   
    }
   
    .PrintStyle12-Summary {
      display: flex;
      justify-content: flex-end;
      width: 100%;
      padding: 0rem 0;
    }
  </style>`;
    const PrintA4 = async () => {
        await printDiv("SQPrintStyle12", style12, 'FontApply');
    };
    console.log(table2Data, 'Address1');


    return (
        <>
            {
                FormatTheme ?
                    <div id="SQPrintStyle12" onClick={PrintA4} className='PrintStyle12MasterDiv' style={{ fontFamily: "'Courier New', Courier, monospace", position: "relative", width: "100%", minHeight: PageSize == "A5" ? '210mm' : '297mm' }}>

                        {paginatedChunks.map((dataChunk, chunkIndex) => (
                            <div className={`container print-chunk${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}>


                                <div className="header" style={{ position: "fixed", top: 0, width: "100%" }}>
                                    <div className='PrintStyle12-firstDiv'>

                                        <div style={{ display: "flex", flexDirection: "column" }}>
                                            <hr style={{ width: '100%', borderWidth: '0.7px', borderTop: '0.5px dashed rgb(0, 0, 0)' }} />

                                            <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1.8rem)", fontWeight: '600', }} > {table2Data?.[0]?.BranchName}</div>
                                            <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1rem)" }}>

                                                {table2Data?.[0]?.AddressDetails?.map((addr, index) => {
                                                    const { Address1, City, Zip } = addr;
                                                    const parts = [Address1, City, Zip].filter(Boolean).join(' - ');
                                                    return <div key={index}>{parts}</div>;
                                                })}
                                            </div>

                                            <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1rem)" }}> Mobile : +91 {table2Data?.customerMobile}</div>


                                            {
                                                <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1rem)" }}>Customer Name : {table2Data?.customerName}
                                                </div>
                                            }

                                            {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null &&
                                                <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1rem)" }}>Customer : {table2Data?.CustSuppName}
                                                </div>
                                            }



                                            {table2Data?.OrderType === "E" && <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1rem)", fontWeight: '600' }}>Estimate </div>}
                                        </div>
                                        <div style={{ display: "flex" }}>  <img style={{ width: "60px", height: "60px" }} src={base64Image} alt='image' /></div>
                                    </div>

                                    <div className='PrintStyle12-SecondDiv'>
                                        <div style={{ fontWeight: '600', fontSize: "clamp(0.9286rem, 2.5vw, 1rem)" }}>Bill No :  {table2Data?.[0]?.QuotationNo && extractLastNumber(table2Data?.[0]?.QuotationNo)}</div>
                                        <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1rem)", padding: '0 1rem' }}>{Date1}</div>
                                    </div>
                                </div>

                                <div style={{ marginTop: "0rem" }} className="print-body">
                                    {TakeawayData?.length > 0 &&
                                        <>
                                            {<div style={{ display: 'flex', width: '100%', justifyContent: 'center', alignItems: "center", fontSize: "12px", fontWeight: "600" }}>Purchase Quotation</div>}
                                            <div className="PrintStyle12-print-tableMaster">
                                                <table className="PrintStyle12-print-table">
                                                    <thead>
                                                        <tr>
                                                            {SLNO && <th>S.No</th>}
                                                            {Item && <th>Des</th>}
                                                            {Quantity && <th style={{ textAlign: "right" }}>Qty</th>}
                                                            {MRP && <th style={{ textAlign: 'right' }}>MRP</th>}
                                                            {Rate && <th style={{ textAlign: "right" }}>Rate</th>}
                                                            {HsnCode && <th style={{ textAlign: "right" }}>HSN</th>}
                                                            {Discount && <th style={{ textAlign: 'right' }}>(%)</th>}
                                                            {Amount && <th style={{ textAlign: "right" }}>Amt</th>}
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                        {dataChunk?.map((item, index) => (
                                                            <tr key={index}>
                                                                {SLNO && <td>{index + 1}</td>}
                                                                {Item && (
                                                                    <td style={{ display: 'flex', flexDirection: 'column' }}>
                                                                        <div>{item?.ProdName}</div>
                                                                        <div>
                                                                            ({item?.Size ? item?.Size : '1'} {item?.SinglePc === 'Y' ? 'PCS' : item?.Type !== 'C' ? item?.UomName : 'COMBO'})
                                                                            {item?.BrandName !== null ? item?.BrandName : ''}&nbsp;
                                                                            {item?.ProductIdentifierDtls?.length > 0 &&
                                                                                item?.ProductIdentifierDtls.filter(
                                                                                    (items) => !(items.SerialNumber === '' || items.SerialNumber == null)
                                                                                ).map((a, i) => <div key={i}>{a.SerialNumber}</div>)}
                                                                            {item?.ProductIdentifierDtls?.length > 0 &&
                                                                                item?.ProductIdentifierDtls.filter(
                                                                                    (item1) => item1.IMEI1 !== '' || item1.IMEI2 !== ''
                                                                                ).map((item2, j) => {
                                                                                    const imei1 = item2.IMEI1 || '';
                                                                                    const imei2 = item2.IMEI2 || '';
                                                                                    return <div key={j}>{[imei1, imei2].filter(Boolean).join(',')}</div>;
                                                                                })}
                                                                        </div>
                                                                    </td>
                                                                )}
                                                                {Quantity && <td style={{ textAlign: 'right' }}>{item?.Qty}</td>}
                                                                {MRP && <td style={{ textAlign: 'right' }}>{item?.MRP}</td>}
                                                                {Rate && <td style={{ textAlign: 'right' }}>{item?.Price}</td>}
                                                                {HsnCode && <td style={{ textAlign: 'right' }}>{item?.HSN}</td>}
                                                                {Discount && <td style={{ textAlign: 'right' }}>{item?.discount}</td>}
                                                                {Amount && <td style={{ textAlign: 'right' }}>{item?.NetAmt?.toFixed(2)}</td>}
                                                            </tr>
                                                        ))}
                                                    </tbody>
                                                </table>
                                            </div>
                                        </>
                                    }

                                </div>

                                {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme &&
                                    <>

                                        <hr className="PrintStyle12-print-dottline " />
                                        <div className='PrintStyle12-Summary'>
                                            <div style={{ display: "flex", justifyContent: "flex-end", width: '60%', flexDirection: "column", rowGap: "0.2rem", fontSize: "clamp(0.75rem, 2.5vw, 1rem)" }} >
                                                <div style={{ display: "flex", justifyContent: "space-between" }}>
                                                    <div style={{ width: '45%' }}>
                                                        Items
                                                    </div>
                                                    <div> : </div>
                                                    <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", width: '35%' }} >
                                                        {totalQuantityFilter?.length}
                                                    </div>
                                                </div>
                                                <div style={{ display: "flex", justifyContent: "space-between" }}>
                                                    <div style={{ width: '45%' }} >
                                                        Qty
                                                    </div>
                                                    <div> : </div>
                                                    <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", width: '35%' }}>
                                                        {totalQuantity}
                                                    </div>
                                                </div>
                                                {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
                                                    <div style={{ display: "flex", justifyContent: "space-between" }}>
                                                        <div style={{ width: '45%' }} >
                                                            Off
                                                        </div>
                                                        <div> : </div>
                                                        <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", width: '35%' }}>
                                                            {Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
                                                        </div>
                                                    </div>
                                                }


                                                <hr style={{ width: '100%', borderWidth: '0.7px', borderTop: '0.5px solid rgb(0, 0, 0)' }} />


                                                <div style={{ display: "flex", justifyContent: "space-between" }}>
                                                    <div style={{ width: '45%', fontWeight: "600" }}>
                                                        Amount
                                                    </div>
                                                    <div> : </div>
                                                    <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", fontWeight: "600", width: '35%' }}>
                                                        {Number(table2Data?.[0]?.NetAmount || 0).toFixed(2)}
                                                    </div>

                                                    {console.log(table2Data?.[0]?.NetAmount, 'table2Data?.NetAmount')
                                                    }
                                                </div>

                                                <div>
                                                    {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) ||
                                                        (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) ||
                                                        (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) &&
                                                        <>
                                                            <div>
                                                                <p style={{ margin: 0, padding: 0, fontSize: "12px", textAlign: "center" }}>
                                                                    --------- GST Breakup Details -----------</p>
                                                                {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) &&
                                                                    <table style={{ width: "90%" }}>

                                                                        <tr>
                                                                            <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                Taxable Amount
                                                                            </td>
                                                                            <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                CGST ({(OrderDetailGST?.[0]?.TaxPercentage) / 2}%)
                                                                            </td>
                                                                            <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                SGST ({(OrderDetailGST?.[0]?.TaxPercentage) / 2}%)
                                                                            </td>
                                                                            <td style={{ fontSize: "10px", textAlign: "center" }}>

                                                                                Total Amount
                                                                            </td>
                                                                        </tr>
                                                                        {OrderDetailGST?.map((item) =>
                                                                            <tr>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    {Number(item.WithOutTaxAmount).toFixed(2)}
                                                                                </td>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    {Number(item.CGST).toFixed(2)}
                                                                                </td>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    {Number(item.SGST).toFixed(2)}
                                                                                </td>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>{Number(item.TotalAmt).toFixed(2)}</td>
                                                                            </tr>
                                                                        )
                                                                        }
                                                                    </table>
                                                                }

                                                                {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) &&
                                                                    <>
                                                                        <div style={{ border: "0.01px dashed black", margin: "10px 0 5px 10px", width: '90%' }}></div>
                                                                        <table style={{ width: "90%" }}>

                                                                            <tr>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    Taxable Amount
                                                                                </td>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    IGST ({OrderDetailIGST?.[0]?.TaxPercentage}%)
                                                                                </td>

                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>

                                                                                    Total Amount
                                                                                </td>
                                                                            </tr>
                                                                            {OrderDetailIGST?.map((item) =>
                                                                                <tr>
                                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                        {Number(item.WithOutTaxAmount).toFixed(2)}
                                                                                    </td>
                                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                        {Number(item.TaxAmt).toFixed(2)}
                                                                                    </td>

                                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>{Number(item.TotalAmt).toFixed(2)}</td>
                                                                                </tr>
                                                                            )
                                                                            }
                                                                        </table>
                                                                    </>
                                                                }
                                                                {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) &&
                                                                    <>
                                                                        <div style={{ border: "0.01px dashed black", margin: "10px 0 5px 10px", width: '90%' }}></div>
                                                                        <table style={{ width: "90%" }}>

                                                                            <tr>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    Taxable Amount
                                                                                </td>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    VAT ({OrderDetailVAT?.[0]?.TaxPercentage}%)
                                                                                </td>

                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>

                                                                                    Total Amount
                                                                                </td>
                                                                            </tr>
                                                                            {OrderDetailVAT?.map((item) =>
                                                                                <tr>
                                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                        {Number(item.WithOutTaxAmount).toFixed(2)}
                                                                                    </td>
                                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                        {Number(item.TaxAmt).toFixed(2)}
                                                                                    </td>

                                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>{Number(item.TotalAmt).toFixed(2)}</td>
                                                                                </tr>
                                                                            )
                                                                            }
                                                                        </table>
                                                                    </>
                                                                }

                                                            </div>
                                                        </>
                                                    }
                                                </div>

                                                <hr style={{ width: '100%', borderWidth: '0.7px', borderTop: '0.5px solid rgb(0, 0, 0)' }} />

                                                <div style={{ display: "flex", justifyContent: "space-between" }}>

                                                </div>
                                                {/* <div style={{ display: "flex", justifyContent: "space-between" }}>
                            <div style={{ width: '45%' }}>
                                Recived Amt
                            </div>
                            <div> : </div>
                            <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", width: '35%' }}>
                                {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
                            </div>
                        </div>
                        <div style={{ display: "flex", justifyContent: "space-between" }}>
                            <div style={{ width: '45%' }}>
                                Balance Amt
                            </div>
                            <div> : </div>
                            <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", width: '35%' }}>
                                0.00
                            </div>
                        </div> */}

                                            </div>
                                        </div>


                                        <hr className="PrintStyle12-print-dottline" />

                                        <div className='PrintStyle12-Qr-Order'>

                                            <div className='PrintStyle12-OrderNo'>
                                                <div style={{ fontWeight: '600', fontSize: "clamp(0.8rem, 2.5vw, 1rem)" }}>Your Order No: {table2Data?.[0]?.QuotationNo && extractLastNumber(table2Data?.[0]?.QuotationNo)}</div>

                                            </div>



                                        </div>


                                        <div className="page-footerA4Style11"
                                            style={{
                                                marginTop: "auto",
                                                pageBreakBefore: "avoid",
                                                pageBreakInside: "avoid",
                                                minHeight: "auto",
                                            }}
                                        >
                                            {
                                                Notestext && (<div>
                                                    <p style={{ padding: "0rem 1rem" }}>{Notestext}</p>

                                                    <hr className="PrintA4Style11-print-dottline" />
                                                </div>)
                                            }

                                            <div style={{ display: "flex", width: "90%", padding: "0 1rem", justifyContent: GlobaltermsAndConditions ? "space-between" : "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" }}>
                                                        <p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>
                                                            Terms & Conditions
                                                        </p>
                                                        <ol style={{ fontSize: "12px", paddingLeft: "18px", margin: 0, lineHeight: "1" }}>
                                                            {TermsAndConditions?.map(item => (<li style={{ textAlign: "start" }}>{item?.TermsandConditions}</li>))}
                                                            {/* <li>Please check the product before leaving the counter.</li> */}
                                                        </ol>
                                                    </div>)
                                                }

                                                {Signature == true && (<div style={{ display: "flex", flexDirection: "column", alignItems: "center", marginTop: "1rem", paddingBottom: "1rem" }}>
                                                    <p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>Signature</p>
                                                    <img style={{ width: "100px", height: "60px" }} src={SignatureImg} alt="" />
                                                </div>)}

                                            </div>
                                        </div>

                                        {PrintGreeting?.SettingValue === "Y" &&
                                            <div className='PrintStyle12-FourthSpan'>
                                                Thank You Visit Again
                                            </div>
                                        }
                                    </>
                                }

                            </div>
                        ))}


                        {shouldFooterBeOnNewPage && FormatTheme &&
                            <div
                                className="print-page"
                                style={{
                                    display: "flex",
                                    flexDirection: "column",
                                    minHeight: PageSize == "A5" ? "200mm" : "297mm",
                                    justifyContent: "flex-end",
                                    pageBreakBefore: "always",
                                }}
                            >
                                <div className="page-footerA4Style11"
                                    style={{
                                        marginTop: "auto",
                                        pageBreakBefore: "avoid",
                                        pageBreakInside: "avoid",
                                        minHeight: "auto",
                                    }}
                                >
                                    <>

                                        <hr className="PrintStyle12-print-dottline " />
                                        <div className='PrintStyle12-Summary'>
                                            <div style={{ display: "flex", justifyContent: "flex-end", width: '60%', flexDirection: "column", rowGap: "0.2rem", fontSize: "clamp(0.75rem, 2.5vw, 1rem)" }} >
                                                <div style={{ display: "flex", justifyContent: "space-between" }}>
                                                    <div style={{ width: '45%' }}>
                                                        Items
                                                    </div>
                                                    <div> : </div>
                                                    <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", width: '35%' }} >
                                                        {totalQuantityFilter?.length}
                                                    </div>
                                                </div>
                                                <div style={{ display: "flex", justifyContent: "space-between" }}>
                                                    <div style={{ width: '45%' }} >
                                                        Qty
                                                    </div>
                                                    <div> : </div>
                                                    <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", width: '35%' }}>
                                                        {totalQuantity}
                                                    </div>
                                                </div>
                                                {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
                                                    <div style={{ display: "flex", justifyContent: "space-between" }}>
                                                        <div style={{ width: '45%' }} >
                                                            Off
                                                        </div>
                                                        <div> : </div>
                                                        <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", width: '35%' }}>
                                                            {Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
                                                        </div>
                                                    </div>
                                                }


                                                <hr style={{ width: '100%', borderWidth: '0.7px', borderTop: '0.5px solid rgb(0, 0, 0)' }} />


                                                <div style={{ display: "flex", justifyContent: "space-between" }}>
                                                    <div style={{ width: '45%', fontWeight: "600" }}>
                                                        Amount
                                                    </div>

                                                </div>

                                                <div>
                                                    {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) ||
                                                        (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) ||
                                                        (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) &&
                                                        <>
                                                            <div>
                                                                <p style={{ margin: 0, padding: 0, fontSize: "12px", textAlign: "center" }}>
                                                                    --------- GST Breakup Details -----------</p>
                                                                {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) &&
                                                                    <table style={{ width: "90%" }}>

                                                                        <tr>
                                                                            <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                Taxable Amount
                                                                            </td>
                                                                            <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                CGST ({(OrderDetailGST?.[0]?.TaxPercentage) / 2}%)
                                                                            </td>
                                                                            <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                SGST ({(OrderDetailGST?.[0]?.TaxPercentage) / 2}%)
                                                                            </td>
                                                                            <td style={{ fontSize: "10px", textAlign: "center" }}>

                                                                                Total Amount
                                                                            </td>
                                                                        </tr>
                                                                        {OrderDetailGST?.map((item) =>
                                                                            <tr>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    {Number(item.WithOutTaxAmount).toFixed(2)}
                                                                                </td>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    {Number(item.CGST).toFixed(2)}
                                                                                </td>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    {Number(item.SGST).toFixed(2)}
                                                                                </td>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>{Number(item.TotalAmt).toFixed(2)}</td>
                                                                            </tr>
                                                                        )
                                                                        }
                                                                    </table>
                                                                }

                                                                {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) &&
                                                                    <>
                                                                        <div style={{ border: "0.01px dashed black", margin: "10px 0 5px 10px", width: '90%' }}></div>
                                                                        <table style={{ width: "90%" }}>

                                                                            <tr>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    Taxable Amount
                                                                                </td>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    IGST ({OrderDetailIGST?.[0]?.TaxPercentage}%)
                                                                                </td>

                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>

                                                                                    Total Amount
                                                                                </td>
                                                                            </tr>
                                                                            {OrderDetailIGST?.map((item) =>
                                                                                <tr>
                                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                        {Number(item.WithOutTaxAmount).toFixed(2)}
                                                                                    </td>
                                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                        {Number(item.TaxAmt).toFixed(2)}
                                                                                    </td>

                                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>{Number(item.TotalAmt).toFixed(2)}</td>
                                                                                </tr>
                                                                            )
                                                                            }
                                                                        </table>
                                                                    </>
                                                                }
                                                                {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) &&
                                                                    <>
                                                                        <div style={{ border: "0.01px dashed black", margin: "10px 0 5px 10px", width: '90%' }}></div>
                                                                        <table style={{ width: "90%" }}>

                                                                            <tr>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    Taxable Amount
                                                                                </td>
                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                    VAT ({OrderDetailVAT?.[0]?.TaxPercentage}%)
                                                                                </td>

                                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>

                                                                                    Total Amount
                                                                                </td>
                                                                            </tr>
                                                                            {OrderDetailVAT?.map((item) =>
                                                                                <tr>
                                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                        {Number(item.WithOutTaxAmount).toFixed(2)}
                                                                                    </td>
                                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                                        {Number(item.TaxAmt).toFixed(2)}
                                                                                    </td>

                                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>{Number(item.TotalAmt).toFixed(2)}</td>
                                                                                </tr>
                                                                            )
                                                                            }
                                                                        </table>
                                                                    </>
                                                                }

                                                            </div>
                                                        </>
                                                    }
                                                </div>

                                                <hr style={{ width: '100%', borderWidth: '0.7px', borderTop: '0.5px solid rgb(0, 0, 0)' }} />

                                                <div style={{ display: "flex", justifyContent: "space-between" }}>


                                                </div>


                                            </div>
                                        </div>


                                        <hr className="PrintStyle12-print-dottline" />

                                        <div className='PrintStyle12-Qr-Order'>

                                            <div className='PrintStyle12-OrderNo'>
                                                <div style={{ fontWeight: '600', fontSize: "clamp(0.8rem, 2.5vw, 1rem)" }}>Your Order No: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}</div>

                                            </div>



                                        </div>


                                        <div className="page-footerA4Style11"
                                            style={{
                                                marginTop: "auto",
                                                pageBreakBefore: "avoid",
                                                pageBreakInside: "avoid",
                                                minHeight: "auto",
                                            }}
                                        >
                                            {
                                                Notestext && (<div>
                                                    <p style={{ padding: "0rem 1rem" }}>{Notestext}</p>

                                                    <hr className="PrintA4Style11-print-dottline" />
                                                </div>)
                                            }

                                            <div style={{ display: "flex", width: "90%", padding: "0 1rem", justifyContent: GlobaltermsAndConditions ? "space-between" : "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" }}>
                                                        <p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>
                                                            Terms & Conditions
                                                        </p>
                                                        <ol style={{ fontSize: "12px", paddingLeft: "18px", margin: 0, lineHeight: "1" }}>
                                                            {TermsAndConditions?.map(item => (<li style={{ textAlign: "start" }}>{item?.TermsandConditions}</li>))}
                                                            {/* <li>Please check the product before leaving the counter.</li> */}
                                                        </ol>
                                                    </div>)
                                                }

                                                {Signature == true && (<div style={{ display: "flex", flexDirection: "column", alignItems: "center", marginTop: "1rem", paddingBottom: "1rem" }}>
                                                    <p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>Signature</p>
                                                    <img style={{ width: "100px", height: "60px" }} src={SignatureImg} alt="" />
                                                </div>)}

                                            </div>
                                        </div>

                                        {PrintGreeting?.SettingValue === "Y" &&
                                            <div className='PrintStyle12-FourthSpan'>
                                                Thank You Visit Again
                                            </div>
                                        }
                                    </>
                                </div>
                            </div>
                        }

                    </div>


                    :
                    <div id={`SQPrintStyle12`} className='PrintStyle12MasterDiv' style={{ fontFamily: "'Courier New', Courier, monospace" }}>
                        <div className='PrintStyle12-firstDiv'>

                            {/* <h3>{table2Data?.BrName}</h3> */}
                            <div style={{ display: "flex", flexDirection: "column" }}>
                                <hr style={{ width: '100%', borderWidth: '0.7px', borderTop: '0.5px dashed rgb(0, 0, 0)' }} />

                                <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1.8rem)", fontWeight: '600', }} >{table2Data?.BrName}</div>
                                <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1rem)" }}>
                                    {(table2Data?.AddressDetails?.[0]?.Address1 || '') + (table2Data?.AddressDetails?.[0]?.City ? (table2Data?.AddressDetails?.[0]?.Address1 && table2Data?.AddressDetails?.[0]?.City ? '-' : '') + table2Data?.AddressDetails?.[0]?.City : '') + (table2Data?.AddressDetails?.[0]?.Zip ? (table2Data?.AddressDetails?.[0]?.City && table2Data?.AddressDetails?.[0]?.Zip ? '-' : '') + table2Data?.AddressDetails?.[0]?.Zip : '')}
                                </div>
                                <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1rem)" }}> Mobile : +91 {table2Data?.customerMobile}</div>
                                {CashierName && CashierName !== undefined && CashierName !== null &&
                                    <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1rem)" }}>Cashier : {CashierName}
                                    </div>
                                }

                                {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null &&
                                    <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1rem)" }}>Customer : {table2Data?.CustSuppName}
                                    </div>
                                }


                                {table2Data?.BookingTypeName == 'Dine In' &&
                                    <div>
                                        Waiter : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
                                    </div>}
                                {table2Data?.OrderType === "E" && <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1rem)", fontWeight: '600' }}>Estimate </div>}
                            </div>
                            <div style={{ display: "flex" }}>  <img style={{ width: "60px", height: "60px" }} src={base64Image} alt='image' /></div>
                        </div>
                        {/* <div style={{ display: "flex", justifyContent: "left", marginTop: '5px' }}>
          <p style={{ marginTop: '5px', padding: 0, fontSize: "17px", fontWeight: "600" }}>{table2Data?.PaymentTypeName} &nbsp;Payment : &nbsp;{Number(table2Data?.NetAmount).toFixed(2)}/- </p>
        </div> */}
                        <div className='PrintStyle12-SecondDiv'>
                            <div style={{ fontWeight: '600', fontSize: "clamp(0.9286rem, 2.5vw, 1rem)" }}>Bill No :  {table2Data?.[0]?.QuotationNo && extractLastNumber(table2Data?.[0]?.QuotationNo)}</div>
                            <div style={{ fontSize: "clamp(0.75rem, 2.5vw, 1rem)", padding: '0 1rem' }}>{Date1}</div>
                        </div>

                        {/* <hr className="PrintStyle8-print-dottline" /> */}
                        {TakeawayData?.length > 0 &&
                            <>
                                {<div style={{ display: 'flex', width: '100%', justifyContent: 'center', alignItems: "center", fontSize: "12px", fontWeight: "600" }}>Purchase Quotation</div>}
                                <div className="PrintStyle12-print-tableMaster">

                                    <table className="PrintStyle12-print-table">
                                        <thead>
                                            <tr>
                                                {SLNO && <th>S.No</th>}
                                                {Item && <th>Des</th>}
                                                {Quantity && <th style={{ textAlign: "right" }}>Qty</th>}
                                                {MRP && <th style={{ textAlign: 'right' }}>MRP</th>}
                                                {Rate && <th style={{ textAlign: "right" }}>Rate</th>}
                                                {HsnCode && <th style={{ textAlign: "right" }}>HSN</th>}
                                                {Discount && <th style={{ textAlign: 'right' }}>(%)</th>}
                                                {Amount && <th style={{ textAlign: "right" }}>Amt</th>}
                                            </tr>
                                        </thead>
                                        <tbody>
                                            {TakeawayData?.map((item, index) => {
                                                return (
                                                    <tr key={index}>
                                                        {SLNO && <td>{index + 1}</td>}
                                                        {Item && (
                                                            <td style={{ display: 'flex', flexDirection: 'column' }}>
                                                                <div>{item?.ProdName}</div>
                                                                <div>
                                                                    ({item?.Size ? item?.Size : '1'} {item?.SinglePc === 'Y' ? 'PCS' : item?.Type !== 'C' ? item?.UomName : 'COMBO'})
                                                                    {item?.BrandName !== null ? item?.BrandName : ''}&nbsp;
                                                                    {item?.ProductIdentifierDtls?.length > 0 &&
                                                                        item?.ProductIdentifierDtls.filter(
                                                                            (items) => !(items.SerialNumber === '' || items.SerialNumber == null)
                                                                        ).map((a, i) => <div key={i}>{a.SerialNumber}</div>)}
                                                                    {item?.ProductIdentifierDtls?.length > 0 &&
                                                                        item?.ProductIdentifierDtls.filter(
                                                                            (item1) => item1.IMEI1 !== '' || item1.IMEI2 !== ''
                                                                        ).map((item2, j) => {
                                                                            const imei1 = item2.IMEI1 || '';
                                                                            const imei2 = item2.IMEI2 || '';
                                                                            return <div key={j}>{[imei1, imei2].filter(Boolean).join(',')}</div>;
                                                                        })}
                                                                </div>
                                                            </td>
                                                        )}
                                                        {Quantity && <td style={{ textAlign: 'right' }}>{item?.Qty}</td>}
                                                        {MRP && <td style={{ textAlign: 'right' }}>{item?.MRP}</td>}
                                                        {Rate && <td style={{ textAlign: 'right' }}>{item?.Price}</td>}
                                                        {HsnCode && <td style={{ textAlign: 'right' }}>{item?.HSN}</td>}
                                                        {Discount && <td style={{ textAlign: 'right' }}>{item?.discount}</td>}
                                                        {Amount && <td style={{ textAlign: 'right' }}>{item?.NetAmt?.toFixed(2)}</td>}
                                                    </tr>
                                                )
                                            })}
                                        </tbody>
                                    </table>
                                </div>
                            </>
                        }

                        <hr className="PrintStyle12-print-dottline " />
                        <div className='PrintStyle12-Summary'>
                            <div style={{ display: "flex", justifyContent: "flex-end", width: '60%', flexDirection: "column", rowGap: "0.2rem", fontSize: "clamp(0.75rem, 2.5vw, 1rem)" }} >
                                <div style={{ display: "flex", justifyContent: "space-between" }}>
                                    <div style={{ width: '45%' }}>
                                        Items
                                    </div>
                                    <div> : </div>
                                    <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", width: '35%' }} >
                                        {totalQuantityFilter?.length}
                                    </div>
                                </div>
                                <div style={{ display: "flex", justifyContent: "space-between" }}>
                                    <div style={{ width: '45%' }} >
                                        Qty
                                    </div>
                                    <div> : </div>
                                    <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", width: '35%' }}>
                                        {totalQuantity}
                                    </div>
                                </div>

                                {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
                                    <div style={{ display: "flex", justifyContent: "space-between" }}>
                                        <div style={{ width: '45%' }} >
                                            Off
                                        </div>
                                        <div> : </div>
                                        <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", width: '35%' }}>
                                            {Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
                                        </div>
                                    </div>
                                }
                                {/* <div style={{ display: "flex", justifyContent: "space-between" }}>
                            <div style={{ width: '45%' }}>
                                Extra Charges
                            </div>
                            <div> : </div>
                            <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", width: '35%' }}>
                                0
                            </div>
                        </div> */}

                                <hr style={{ width: '100%', borderWidth: '0.7px', borderTop: '0.5px solid rgb(0, 0, 0)' }} />


                                <div style={{ display: "flex", justifyContent: "space-between" }}>
                                    <div style={{ width: '45%', fontWeight: "600" }}>
                                        Amount
                                    </div>
                                    <div> : </div>
                                    <div style={{ padding: '0rem 1rem', display: "flex", justifyContent: "flex-end", fontWeight: "600", width: '35%' }}>
                                        {Number(table2Data?.[0]?.NetAmount || 0).toFixed(2)}
                                    </div>

                                    {console.log(table2Data?.[0]?.NetAmount, 'table2Data?.NetAmount')
                                    }
                                </div>

                                <div>
                                    {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) ||
                                        (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) ||
                                        (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) &&
                                        <>
                                            <div>
                                                <p style={{ margin: 0, padding: 0, fontSize: "12px", textAlign: "center" }}>
                                                    --------- GST Breakup Details -----------</p>
                                                {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) &&
                                                    <table style={{ width: "90%" }}>

                                                        <tr>
                                                            <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                Taxable Amount
                                                            </td>
                                                            <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                CGST ({(OrderDetailGST?.[0]?.TaxPercentage) / 2}%)
                                                            </td>
                                                            <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                SGST ({(OrderDetailGST?.[0]?.TaxPercentage) / 2}%)
                                                            </td>
                                                            <td style={{ fontSize: "10px", textAlign: "center" }}>

                                                                Total Amount
                                                            </td>
                                                        </tr>
                                                        {OrderDetailGST?.map((item) =>
                                                            <tr>
                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                    {Number(item.WithOutTaxAmount).toFixed(2)}
                                                                </td>
                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                    {Number(item.CGST).toFixed(2)}
                                                                </td>
                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                    {Number(item.SGST).toFixed(2)}
                                                                </td>
                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>{Number(item.TotalAmt).toFixed(2)}</td>
                                                            </tr>
                                                        )
                                                        }
                                                    </table>
                                                }

                                                {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) &&
                                                    <>
                                                        <div style={{ border: "0.01px dashed black", margin: "10px 0 5px 10px", width: '90%' }}></div>
                                                        <table style={{ width: "90%" }}>

                                                            <tr>
                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                    Taxable Amount
                                                                </td>
                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                    IGST ({OrderDetailIGST?.[0]?.TaxPercentage}%)
                                                                </td>

                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>

                                                                    Total Amount
                                                                </td>
                                                            </tr>
                                                            {OrderDetailIGST?.map((item) =>
                                                                <tr>
                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                        {Number(item.WithOutTaxAmount).toFixed(2)}
                                                                    </td>
                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                        {Number(item.TaxAmt).toFixed(2)}
                                                                    </td>

                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>{Number(item.TotalAmt).toFixed(2)}</td>
                                                                </tr>
                                                            )
                                                            }
                                                        </table>
                                                    </>
                                                }
                                                {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) &&
                                                    <>
                                                        <div style={{ border: "0.01px dashed black", margin: "10px 0 5px 10px", width: '90%' }}></div>
                                                        <table style={{ width: "90%" }}>

                                                            <tr>
                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                    Taxable Amount
                                                                </td>
                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                    VAT ({OrderDetailVAT?.[0]?.TaxPercentage}%)
                                                                </td>

                                                                <td style={{ fontSize: "10px", textAlign: "center" }}>

                                                                    Total Amount
                                                                </td>
                                                            </tr>
                                                            {OrderDetailVAT?.map((item) =>
                                                                <tr>
                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                        {Number(item.WithOutTaxAmount).toFixed(2)}
                                                                    </td>
                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>
                                                                        {Number(item.TaxAmt).toFixed(2)}
                                                                    </td>

                                                                    <td style={{ fontSize: "10px", textAlign: "center" }}>{Number(item.TotalAmt).toFixed(2)}</td>
                                                                </tr>
                                                            )
                                                            }
                                                        </table>
                                                    </>
                                                }

                                            </div>
                                        </>
                                    }
                                </div>

                                <hr style={{ width: '100%', borderWidth: '0.7px', borderTop: '0.5px solid rgb(0, 0, 0)' }} />

                                <div style={{ display: "flex", justifyContent: "space-between" }}>


                                </div>


                            </div>
                        </div>


                        <hr className="PrintStyle12-print-dottline" />

                        <div className='PrintStyle12-Qr-Order'>

                            <div className='PrintStyle12-OrderNo'>
                                <div style={{ fontWeight: '600', fontSize: "clamp(0.8rem, 2.5vw, 1rem)" }}>Your Order No:{table2Data?.[0]?.QuotationNo && extractLastNumber(table2Data?.[0]?.QuotationNo)}</div>

                            </div>



                        </div>


                        <div className="page-footerA4Style11"
                            style={{
                                marginTop: "auto",
                                pageBreakBefore: "avoid",
                                pageBreakInside: "avoid",
                                minHeight: "auto",
                            }}
                        >
                            {
                                Notestext && (<div>
                                    <p style={{ padding: "0rem 1rem" }}>{Notestext}</p>

                                    <hr className="PrintA4Style11-print-dottline" />
                                </div>)
                            }

                            <div style={{ display: "flex", width: "90%", padding: "0 1rem", justifyContent: GlobaltermsAndConditions ? "space-between" : "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" }}>
                                        <p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>
                                            Terms & Conditions
                                        </p>
                                        <ol style={{ fontSize: "12px", paddingLeft: "18px", margin: 0, lineHeight: "1" }}>
                                            {TermsAndConditions?.map(item => (<li style={{ textAlign: "start" }}>{item?.TermsandConditions}</li>))}
                                            {/* <li>Please check the product before leaving the counter.</li> */}
                                        </ol>
                                    </div>)
                                }

                                {Signature == true && (<div style={{ display: "flex", flexDirection: "column", alignItems: "center", marginTop: "1rem", paddingBottom: "1rem" }}>
                                    <p style={{ fontSize: "13px", fontWeight: "bold", marginBottom: "6px" }}>Signature</p>
                                    <img style={{ width: "100px", height: "60px" }} src={SignatureImg} alt="" />
                                </div>)}

                            </div>
                        </div>

                        {PrintGreeting?.SettingValue === "Y" &&
                            <div className='PrintStyle12-FourthSpan'>
                                Thank You Visit Again
                            </div>
                        }
                        {/* <div onClick={Print}> print</div> */}
                    </div>
            }

        </>
    )
}

export default PurPrintStyle12
