import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { isMobile } from 'react-device-detect';

import {
  dateFormatChange,
  extractLastNumber,
  extractLastNumberOrderId,
} from '../../../../Services/Others';
import {
  GlobalprintSlNo,
  GlobalprintItem,
  GlobalprintMRP,
  GlobalprintDiscount,
  GlobalprintQuantity,
  GlobalprintRate,
  GlobalprintAmount,
  GlobalprintHsnCode,
  GlobalprintQrcodet,
  GlobalPritdummyData,
  changeReprintDataFound,
  GloabalFieldDetails,
  GlobalprintSignature,
  GlobalprinttermsAndConditions,
  GlobalSignatureImage,
  Globalnotes,
  GlobalthemeFormat,
  GlobalBillName,
  GlobalprintCashierName,
  GlobalprintLogo,
  GlobalprintCredit,
  GlobalprintTax,
  GlobalSelectedPrintHeaderColor,
  GlobalSelectedPrintHeaderFontColor,
  GlobalSelectedTableHeaderColor,
  GlobalSelectedTableHeaderFontColor,
  GlobalSelectedTableBodyColor,
  GlobalSelectedTableBodyFontColor,
  GlobalSelectedFooterColor,
  GlobalSelectedFooterFontColor,
  GlobalRowType,
  GlobalSelectedNetAmountColor,
  GlobalSelectedNetAmountFontColor,
} from '../../../../Features/ThemeChange/ThemeChange';
import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.scss';
import QRCode from 'react-qr-code';
import {
  GlobalUpiIDprint,
  PreferenceData,
} from '../../../../Features/BookingScreen/BookingData/BookingData';
import signature from '../../../../Images/signatureimage.jpg';
import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin';
import Logo from '../../../../Images/Logo.jpg';
const PrintStyle1 = ({
  index,
  totalQuantityFilter,
  Date1,
  CashierName,
  totalQuantity,
  OrderDetailGST,
  OrderDetailIGST,
  OrderDetailVAT,
  table2Data,
  UpiId,
  PaymentStatus,
  PrintLogo,
  PrintGreeting,
  base64Image,
  printDatas,
  SalesModePref,
  isPdf,
  sportsAppPreference,
  MembershipApplied = null,
}) => {
  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 Tax = FieldDetails?.['Tax'];
  const Quantity = FieldDetails?.['Quantity'];
  const Rate = FieldDetails?.['Rate'];
  const Amount = FieldDetails?.['Amount'];
  const HsnCode = FieldDetails?.['HsnCode'];
  const Qrcodet = FieldDetails?.['Qrcode'];
  const CashierNameField = FieldDetails?.['CashierName'];
  const LogoField = FieldDetails?.['Logo'];
  const CreditDetails = FieldDetails?.['Credit details'];
  const WeightasKg = FieldDetails?.['Weight'];
  const HeaderColor = FieldDetails?.['Header Colour'];
  const NetAmountColor = FieldDetails?.['Net Amount'];
  const TableHeaderColour = FieldDetails?.['Table Header Colour'];
  const TableBodyColour = FieldDetails?.['Table Body Colour'];
  const FooterColor = FieldDetails?.['Footer Colour'];
  console.log(FieldDetails, 'FieldDetailsFieldDetails', printDatas);
  const GlobalSlNo = useSelector(GlobalprintSlNo);
  const GlobalItem = useSelector(GlobalprintItem);
  const GlobalMRP = useSelector(GlobalprintMRP);
  const GlobalDiscount = useSelector(GlobalprintDiscount);
  const GlobalTax = useSelector(GlobalprintTax);
  const GlobalQuantity = useSelector(GlobalprintQuantity);
  const GlobalRate = useSelector(GlobalprintRate);
  const GlobalAmount = useSelector(GlobalprintAmount);
  const GlobalHsnCode = useSelector(GlobalprintHsnCode);
  const GlobalQrcodet = useSelector(GlobalprintQrcodet);
  const GlobaldummyData = useSelector(GlobalPritdummyData);
  const GlobalSignature = useSelector(GlobalprintSignature);
  const GlobalCashierName = useSelector(GlobalprintCashierName);
  const GlobalLogo = useSelector(GlobalprintLogo);
  const GlobalCredit = useSelector(GlobalprintCredit);
  const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor);
  const SelectedHeaderFontColor = useSelector(GlobalSelectedPrintHeaderFontColor);
  const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor);
  const SelectedTableHeaderFontColor = useSelector(GlobalSelectedTableHeaderFontColor);
  const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor);
  const SelectedTableBodyFontColor = useSelector(GlobalSelectedTableBodyFontColor);
  const SelectedRowType = useSelector(GlobalRowType);
  const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor);
  const SelectedTableFooterFontColor = useSelector(GlobalSelectedFooterFontColor);
  const SelectedNetAmountColor = useSelector(GlobalSelectedNetAmountColor);
  const SelectedNetAmountFontColor = useSelector(GlobalSelectedNetAmountFontColor);
  const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions);
  const GlobalSignatureImages = useSelector(GlobalSignatureImage);
  const GlobalIsnotes = useSelector(Globalnotes);
  const GlobalthemeFormatr = useSelector(GlobalthemeFormat);
  const GlobalBilltext = useSelector(GlobalBillName);
  const appPreferences = useSelector(ApplicationPreferences);
  const SettingData = useSelector(PreferenceData);
  const bookingTypePreference = appPreferences?.find(
    (preference) => preference?.PreferredCatName === 'Booking Type'
  )?.PreferenceCatDetails;
  const dinePreference = bookingTypePreference?.find(
    (type) =>
      type?.PreferredSubCatName?.toLowerCase() === 'dine in' &&
      type?.PreferredStatus === 'Y'
  );
  const takeAwayPreference = bookingTypePreference?.find(
    (type) =>
      type?.PreferredSubCatName?.toLowerCase() === 'take away' &&
      type?.PreferredStatus === 'Y'
  );
  const estimatePrintHeader =
    SettingData?.[0]?.SettingDtlDetails?.find(
      (setting) =>
        setting?.SettingIdName?.toLowerCase() === 'estimateprintheader'
    )?.SettingValue === 'Y';

  const estimateTitle =
    SettingData?.[0]?.SettingDtlDetails?.find(
      (setting) =>
        setting?.SettingIdName?.toLowerCase() === 'estimatetitle'
    )?.SettingValue === 'Y';
  const UomPrint = SettingData?.[0]?.SettingDtlDetails?.filter(
    (i) => i.SettingIdName === 'PrintUom'
  )?.[0];


  const keysLength = Object.keys(table2Data ?? {}).length;
  const paymentTypeUPI = PaymentStatus?.find(
    (ps) => ps.PaymentTypeName === 'UPI'
  );
  console.log(GlobalDiscount, Discount, 'Discount');
  console.log(printDatas, 'GlobalthemeFormatr');
  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;
  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 Signature = FieldDetails?.['signature'];
  const TermsnAdCondition = FieldDetails?.['terms&conditions'];
  const isEditedBill = PaymentStatus?.some(payment => {
    const type = payment?.AdjustmentType?.toLowerCase();
    return (
      (type === 'extra' || type === 'refund') &&
      payment?.BeforeAdjustment != null &&
      payment?.AfterAdjustment != null
    );
  });
  const lastTransaction = PaymentStatus?.find(
    (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y'
  )

  if (keysLength > 0) {
    dispatch(changeReprintDataFound(true));
  }
  const currentDate = new Date();
  const day = currentDate.getDate().toString().padStart(2, '0');
  const monthNames = [
    'Jan',
    'Feb',
    'Mar',
    'Apr',
    'May',
    'Jun',
    'Jul',
    'Aug',
    'Sep',
    'Oct',
    'Nov',
    'Dec',
  ];
  const monthIndex = currentDate.getMonth();
  const year = currentDate.getFullYear().toString().slice(-2);

  const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`;

  const TakeawayData = table2Data?.productDetails?.filter(
    (item) => item.BookingTypeName?.toLowerCase() === 'takeaway'
  );

  const PackageDetails = table2Data?.PackageDtl;

  console.log('dataSourcedataSourcedataSource', TakeawayData);

  const DineInData = table2Data?.productDetails?.filter(
    (item) => item.BookingTypeName?.toLowerCase() === 'dine in'
  );
  let PaymentStatusSuccess = PaymentStatus?.filter(
    (ps) => ps.PaymentStatus === 'S'
  );
  const TakeawayTotal = TakeawayData?.reduce(
    (accumulator, currentValue) => accumulator + currentValue.TotalAmt,
    0
  );
  const DineInTotal = DineInData?.reduce(
    (accumulator, currentValue) => accumulator + currentValue.TotalAmt,
    0
  );
  const aggregatedPayments = PaymentStatusSuccess?.reduce(
    (acc, paymentdata) => {
      const paymentType = paymentdata?.PaymentTypeName;
      const amount = Number(paymentdata?.Amount);

      if (acc[paymentType]) {
        acc[paymentType] += amount;
      } else {
        acc[paymentType] = amount;
      }

      return acc;
    },
    {}
  );

  console.log(
    table2Data,
    GlobaldummyData
      ? GlobalBilltext
        ? GlobalBilltext
        : 'Cash' + ' Bill'
      : BillName
        ? BillName
        : PaymentStatusSuccess?.length === 1
          ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill'
          : '',
    'FormatThemekjhjk'
  );

  const productsData = table2Data?.productDetails || [];
  const offers = table2Data?.OrderOfferDetails || [];

  let TotalOfferAmount = 0;

  // Calculate SalesWiseOffers total amount
  offers.forEach((offer) => {
    if (offer.TableName === 'SalesWiseOffers') {
      TotalOfferAmount += offer.OfferAmount;
    }
  });
  const hasMappedOffer = offers.some((offer) =>
    [
      'ItemWiseOffers',
      'BundleOffers',
      'QuantityWiseOffers',
      'MemberShip',
    ].includes(offer.TableName)
  );

  if (hasMappedOffer) {
    const productTotal = productsData?.reduce(
      (acc, item) =>
        acc + (item?.Type != 'C' ? item.OfferAmt : item.OfferValue || 0),
      0
    );
    TotalOfferAmount += productTotal;
  } else {
    const Combothere = productsData?.filter((item) => item?.Type == 'C');
    const CombothereTotal = Combothere?.reduce(
      (acc, item) => acc + (item.OfferValue || 0),
      0
    );
    TotalOfferAmount += CombothereTotal;
  }

  const to12Hour = (timeStr) => {
    if (!timeStr) return '';
    let [h, m] = timeStr.split(':');
    h = parseInt(h, 10);
    const suffix = h >= 12 ? 'PM' : 'AM';
    h = h % 12 || 12;
    return `${h}:${m}${suffix}`;
  };
  const products = [
    {
      ProdName: 'ITEM 1',
      Rate: 88.0,
      SalesQty: 2,
      MRP: 100,
      TotalAmt: 176,
      discount: 0,
      HSN: '01',
      ProdTaxPercentage: 5,
    },
    {
      ProdName: 'ITEM 2',
      Rate: 300.0,
      SalesQty: 1,
      MRP: 350,
      TotalAmt: 300,
      discount: 0,
      HSN: '02',
      ProdTaxPercentage: 5,
    },
    {
      ProdName: 'ITEM 3',
      Rate: 200.0,
      SalesQty: 1,
      MRP: 250,
      TotalAmt: 200,
      discount: 0,
      HSN: '03',
      ProdTaxPercentage: 0,
    },
    {
      ProdName: 'ITEM 4',
      Rate: 30.0,
      SalesQty: 1,
      MRP: 50,
      TotalAmt: 30,
      discount: 0,
      HSN: '04',
      ProdTaxPercentage: 18,
    },
    {
      ProdName: 'ITEM 5',
      Rate: 30.0,
      SalesQty: 1,
      MRP: 50,
      TotalAmt: 30,
      discount: 0,
      HSN: '05',
      ProdTaxPercentage: 40,
    },
    {
      ProdName: 'ITEM 6',
      Rate: 130.0,
      SalesQty: 1,
      MRP: 150,
      TotalAmt: 130,
      discount: 0,
      ProdTaxPercentage: 3,
      HSN: '06',
    },
    {
      ProdName: 'ITEM 7',
      Rate: 230.0,
      SalesQty: 1,
      MRP: 250,
      TotalAmt: 230,
      discount: 0,
      ProdTaxPercentage: 0,
      HSN: '08',
    },
  ];

  const chunkSize = isMobile ? 11 : PageSize == 'A5' ? 8 : 11;
  let dataSource = [];

  if (GlobaldummyData || TakeawayData?.length > 0) {
    dataSource = GlobaldummyData ? products : TakeawayData;
  } else if (DineInData?.length > 0) {
    dataSource = DineInData;
  }

  // Paginate the data
  const paginatedChunks = [];
  for (let i = 0; i < dataSource.length; i += chunkSize) {
    paginatedChunks.push(dataSource.slice(i, i + chunkSize));
  }
  const lastChunkRows =
    paginatedChunks.length > 0
      ? paginatedChunks[paginatedChunks.length - 1].length
      : 0;
  const shouldFooterBeOnNewPage =
    lastChunkRows > (isMobile ? 11 : PageSize == 'A5' ? 5 : 10);
  const headerStyle = {
    backgroundColor: GlobaldummyData
      ? SelectedTableHeaderColor
      : tableHeaderColor?.background,

    color: GlobaldummyData
      ? SelectedTableHeaderFontColor
      : tableHeaderColor?.font,
  }
  const tableBodyStyle = {
    backgroundColor: GlobaldummyData
      ? SelectedTableBodyColor
      : tableBodyColor?.background,
    color: GlobaldummyData
      ? SelectedTableBodyFontColor
      : tableBodyColor?.font,
  }
  const rowtypeStyle = GlobaldummyData ? SelectedRowType : tableBodyColor?.rowType;
  const footerColorStyle = {
    backgroundColor: GlobaldummyData
      ? SelectedTableFooterColor
      : footerColor?.background,

    color: GlobaldummyData
      ? SelectedTableFooterFontColor
      : footerColor?.font,
  }
  const netAmountStyle = {
    backgroundColor: GlobaldummyData
      ? SelectedNetAmountColor
      : netAmtColor?.background,

    color: GlobaldummyData
      ? SelectedNetAmountFontColor
      : netAmtColor?.font,
  }
  return (
    <>
      {FormatTheme ? (
        <div
          className="PrintStyle1MasterDiv"
          id={`PrintStyle1-${index}`}
          style={{
            fontFamily: "'Courier New', Courier, monospace",
            position: 'relative',

            margin: 0,
            padding: 0,
            background: 'white',
          }}
        >
          {paginatedChunks.map((dataChunk, chunkIndex) => (
            <div
              className={
                isMobile
                  ? `invoice-wrapper container pdf-page`
                  : `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'
                    : isMobile
                      ? '295mm'
                      : '257mm'
                  : '',
              }}
              key={chunkIndex}
            >
              {/* <div className="header" style={{ position: !isMobile ? GlobaldummyData ? "absolute" : "fixed" : "", top: 0, width: "100%" }}> */}
              <div
                className="header"
                style={{
                  position: isMobile
                    ? ''
                    : GlobaldummyData
                      ? 'absolute'
                      : isPdf
                        ? 'static'
                        : 'fixed',
                  top: 0,
                  width: '100%',
                }}
              >
                <div style={{ display: 'flex', justifyContent: 'center', ...(GlobaldummyData
                ? {
                  color: SelectedHeaderFontColor,
                  backgroundColor: SelectedHeaderColor,
                }
                : {
                  color: headerColor?.font,
                  backgroundColor: headerColor?.background,
                }), }}>
                  {GlobaldummyData ? (
                    GlobalLogo && (
                      <img
                        className="PrintStyle2-BrandImage"
                        src={Logo}
                        alt="image"
                      />
                    )
                  ) : !estimatePrintHeader && table2Data?.OrderType === 'E' ? (
                    ''
                  ) : base64Image &&
                    (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
                    <img
                      className="PrintStyle2-BrandImage"
                      src={base64Image}
                      alt="image"
                      width={'100px'}
                    />
                  ) : null}
                </div>
                {!estimatePrintHeader && table2Data?.OrderType === 'E' ? (
                  ''
                ) : (
                  <div className="PrintStyle1-print" 
                      style={{
                        fontSize: 'clamp(2rem, 2.5vw, 2rem)',
                        fontWeight: '600',
                        color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font,
                        backgroundColor: GlobaldummyData ? SelectedHeaderColor : headerColor?.background,
                      }}>
                    <div>
                      {' '}
                      {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
                    </div>
                    <div style={{ fontWeight: '600' }}>
                      {GlobaldummyData
                        ? 'BranchAddress, Town- 635XXX City - State'
                        : (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>
                    {(GlobaldummyData || table2Data?.BrMobile) && <div style={{ fontWeight: '600' }}>
                      {' '}
                      Mobile : +91{' '}
                      {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
                    </div>}
                    {table2Data?.OrderType === 'E' && estimateTitle && (
                      <div
                        style={{
                          fontSize: '14px',
                          margin: '2px 0 0 0',
                          padding: 0,
                          fontWeight: 600,
                        }}
                      >
                        Estimate{' '}
                        {/* {SalesModePref?.SettingValue == 'Y' &&
                          `(${table2Data?.SalesMode})`} */}
                      </div>
                    )}
                    {table2Data?.OrderType === 'E' ? (
                      ''
                    ) : (
                      <div
                        style={{
                          fontSize: '14px',
                          margin: '2px 0 0 0',
                          padding: 0,
                          fontWeight: 600,
                        }}
                      >
                        {GlobaldummyData
                          ? GlobalBilltext
                            ? GlobalBilltext
                            : 'Cash' + ' Bill'
                          : BillName
                            ? BillName
                            : PaymentStatusSuccess?.length === 1
                              ? PaymentStatusSuccess?.[0]?.PaymentTypeName +
                              ' Bill'
                              : ''}
                        {/* {SalesModePref?.SettingValue == 'Y' &&
                          `(${table2Data?.SalesMode})`} */}
                      </div>
                    )}
                  </div>
                )}

                {!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && (
                  <div
                    style={{
                      fontSize: '14px',
                      margin: '2px 0 0 0',
                      padding: 0,
                      fontWeight: 600,
                      textAlign: 'center',
                    }}
                  >
                    Estimate{' '}
                    {/* {SalesModePref?.SettingValue == 'Y' &&
                      `(${table2Data?.SalesMode})`} */}
                  </div>
                )}
                <hr className="PrintStyle1-print-dottline" />

                {/* orderdetails  */}

                <div className="PrintStyle1-print-ordr-dtls">
                  <div>
                    {table2Data?.BookingTypeName === 'Dine In' &&
                      dinePreference && (
                        <div style={{ fontWeight: '600', fontSize: '14px' }}>
                          {' '}
                          Table :{' '}
                          {
                            table2Data?.SalesTableLinkDetails?.[0]?.TableName
                          }{' '}
                        </div>
                      )}
                    {GlobaldummyData && GlobalCashierName && (
                      <div style={{ fontWeight: '600', fontSize: '12px' }}>
                        {' '}
                        Cashier : Cashier Name
                      </div>
                    )}
                    {CashierName &&
                      CashierName !== undefined &&
                      CashierName !== null &&
                      !GlobaldummyData &&
                      CashierNameField && (
                        <div style={{ fontWeight: '600', fontSize: '12px' }}>
                          Cashier : {CashierName}
                        </div>
                      )}
                    {GlobaldummyData && (
                      <div style={{ fontWeight: '600', fontSize: '12px' }}>
                        {' '}
                        Customer : Customer Name
                      </div>
                    )}
                    {table2Data?.CustSuppName &&
                      table2Data?.CustSuppName !== undefined &&
                      table2Data?.CustSuppName !== null &&
                      !GlobaldummyData && (
                        <div style={{ fontWeight: '600', fontSize: '12px' }}>
                          Customer : {table2Data?.CustSuppName}
                        </div>
                      )}
                    <div style={{ fontWeight: '600', fontSize: '14px' }}>
                      {' '}
                      BillNo:
                      {GlobaldummyData
                        ? '121'
                        : table2Data?.OrderId &&
                        extractLastNumberOrderId(
                          table2Data?.OrderId,
                          table2Data?.FYStatus
                        )}
                    </div>
                  </div>

                  <div>
                    <div style={{ fontWeight: '600' }}>
                      {' '}
                      Date : {GlobaldummyData ? formattedDate : Date1}{' '}
                    </div>
                    {SalesModePref?.SettingValue == 'Y' && <div style={{ fontWeight: '600' }}>
                      {' '}
                      Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '}

                    </div>}

                  </div>
                </div>

                {/* orderdetails  */}

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

                {/* itemdata  (loop) */}
              </div>
              <div
                style={{ marginTop: GlobaldummyData ? '9rem' : '0rem' }}
                className="print-body"
              >
                {(TakeawayData?.length > 0 || GlobaldummyData) && (
                  <>
                    {takeAwayPreference ? (
                      <div
                        style={{
                          display: 'flex',
                          width: '100%',
                          justifyContent: 'center',
                          alignItems: 'center',
                          fontSize: '12px',
                          fontWeight: '600',
                        }}
                      >
                        <p>TakeAway </p>
                      </div>
                    ) : (
                      <div
                        style={{
                          display: 'flex',
                          width: '100%',
                          justifyContent: 'center',
                          alignItems: 'center',
                          fontSize: '12px',
                          fontWeight: '600',
                        }}
                      >
                        <p> </p>
                      </div>
                    )}

                    <div className="PrintStyle1-print-tableMaster">
                      <table className="PrintStyle1-print-table">
                        <thead>
                          <tr>
                            {GlobaldummyData
                              ? GlobalSlNo && (
                                <th style={{ ...headerStyle, width: '10px' }}>S.No</th>
                              )
                              : SLNO == true && (
                                <th style={{ ...headerStyle, width: '10px' }}>S.No</th>
                              )}
                            {GlobaldummyData
                              ? GlobalItem && <th style={{ ...headerStyle }}>Item</th>
                              : Item == true && <th style={{ ...headerStyle }}>Item</th>}
                            {GlobaldummyData
                              ? GlobalHsnCode && (
                                <th style={{ ...headerStyle, width: '10px' }}>HSN</th>
                              )
                              : HsnCode == true && (
                                <th style={{ ...headerStyle, width: '10px' }}>HSN</th>
                              )}
                            {GlobaldummyData
                              ? GlobalQuantity && (
                                <th style={{ ...headerStyle, width: '10px' }}>Qty</th>
                              )
                              : Quantity == true && (
                                <th style={{ ...headerStyle, width: '10px' }}>
                                  {WeightasKg ? 'Qty/Kg' : 'Qty'}
                                </th>
                              )}
                            {GlobaldummyData
                              ? GlobalMRP && (
                                <th style={{ ...headerStyle, width: '10px' }}>MRP</th>
                              )
                              : MRP == true && (
                                <th style={{ ...headerStyle, width: '10px' }}>MRP</th>
                              )}
                            {GlobaldummyData
                              ? GlobalRate && (
                                <th style={{ ...headerStyle, width: '10px' }}>Rate</th>
                              )
                              : Rate == true && (
                                <th style={{ ...headerStyle, width: '10px' }}>Rate</th>
                              )}
                            {GlobaldummyData
                              ? GlobalDiscount && (
                                <th style={{ ...headerStyle, width: '10px' }}>Dis </th>
                              )
                              : Discount == true && (
                                <th style={{ ...headerStyle, width: '10px' }}>Dis </th>
                              )}
                            {GlobaldummyData
                              ? GlobalTax && (
                                <th style={{ ...headerStyle, width: '10px' }}>Tax %</th>
                              )
                              : Tax == true &&
                              table2Data?.OrderType !== 'E' && (
                                <th style={{ ...headerStyle, width: '10px' }}>Tax %</th>
                              )}
                            {GlobaldummyData
                              ? GlobalAmount && (
                                <th
                                  style={{
                                    width: '10px',
                                    textAlign: 'right',
                                    ...headerStyle,
                                  }}
                                >
                                  Amt
                                </th>
                              )
                              : Amount == true && (
                                <th
                                  style={{
                                    width: '10px',
                                    textAlign: 'right',
                                    ...headerStyle,
                                  }}
                                >
                                  Amt
                                </th>
                              )}
                          </tr>
                        </thead>
                        <tbody>
                          {dataChunk?.map((item, index) => (
                            <tr key={index}
                              style={
                                index % 2 !== 1 && rowtypeStyle === "even"
                                  ? {
                                    ...tableBodyStyle
                                  }
                                  : index % 2 === 1 && rowtypeStyle === "odd"
                                    ? {
                                      ...tableBodyStyle
                                    }
                                    : {}
                              }>
                              {GlobaldummyData
                                ? GlobalSlNo && (
                                  <td style={{ textAlign: 'center' }}>
                                    {index + 1}
                                  </td>
                                )
                                : SLNO == true && (
                                  <td style={{ textAlign: 'center' }}>
                                    {chunkIndex * chunkSize + index + 1}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalItem && <td>{item?.ProdName}</td>
                                : Item == true && (
                                  <td

                                  >
                                    <div>{item?.ProdName}</div>
                                    {PackageDetails?.filter(
                                      (pkg) => pkg.ProdId === item.ProdId
                                    ).length > 0 ? (
                                      <div>
                                        {PackageDetails?.filter(
                                          (pkg) => pkg.ProdId === item.ProdId
                                        )?.map((item, index) => (
                                          <span
                                            key={index}
                                            style={{ display: 'block' }}
                                          >
                                            {item.ParcelCount} PCS{' '}
                                            {item.ParcelQty} PACK (
                                            {item.ParcelType})
                                          </span>
                                        ))}
                                      </div>
                                    ) : (
                                      UomPrint?.SettingValue === 'Y' &&
                                      <div>
                                        ({item?.Size ? item?.Size : '1'}{' '}
                                        {item?.SinglePc == 'Y'
                                          ? 'PCS'
                                          : item?.Type != 'C'
                                            ? item?.UomName
                                            : 'COMBO'}
                                        )
                                      </div>
                                    )}
                                    {sportsAppPreference &&
                                      `${item?.BookingDate?.trim()
                                        ? `(${dateFormatChange(item.BookingDate)})`
                                        : ''
                                      } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`}
                                    &nbsp;{' '}
                                    {item?.BrandName !== null
                                      ? <div>{item?.BrandName}</div>
                                      : ''}
                                    &nbsp;
                                    <div style={{ display: "flex", gap: "2px", flexDirection: "column" }}>
                                      {item?.ProductIdentifierDtls?.length > 0
                                        ? item?.ProductIdentifierDtls?.filter(
                                          (items) =>
                                            !(
                                              items.SerialNumber == '' ||
                                              items.SerialNumber == null
                                            )
                                        )?.map((a) => {
                                          return <div>{a.SerialNumber}</div>;
                                        })
                                        : ''}{' '}
                                      {item?.ProductIdentifierDtls?.length > 0
                                        ? item?.ProductIdentifierDtls.filter(
                                          (item1) =>
                                            item1.IMEI1 !== '' ||
                                            item1.IMEI2 !== ''
                                        )?.map((item2) => {
                                          const imei1 = item2.IMEI1 || '';
                                          const imei2 = item2.IMEI2 || '';
                                          return (
                                            <div>
                                              {[imei1, imei2]
                                                .filter(Boolean)
                                                .join(',')}
                                            </div>
                                          );
                                        })
                                        : ''}
                                      {item?.ProductIdentifierDtls?.length > 0 &&
                                        item?.ProductIdentifierDtls.find(
                                          (items) =>
                                            items.SerialNumber || items.IMEI1 || items.IMEI2
                                        )?.Description && (
                                          <div>{item.ProductIdentifierDtls.find(
                                            (items) =>
                                              items.SerialNumber || items.IMEI1 || items.IMEI2
                                          ).Description}</div>
                                        )}
                                    </div>

                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalHsnCode && (
                                  <td style={{ textAlign: 'center' }}>
                                    {item?.HSN}
                                  </td>
                                )
                                : HsnCode == true && (
                                  <td style={{ textAlign: 'center' }}>
                                    {item?.HSN}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalQuantity && (
                                  <td style={{ textAlign: 'center' }}>
                                    {item?.SalesQty}
                                  </td>
                                )
                                : Quantity == true && (
                                  <td style={{ textAlign: 'center' }}>
                                    {item?.SalesQty}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalMRP && (
                                  <td style={{ textAlign: 'right' }}>
                                    {item?.MRP}
                                  </td>
                                )
                                : MRP == true && (
                                  <td style={{ textAlign: 'right' }}>
                                    {item?.SinglePc === 'Y'
                                      ? item?.Rate
                                      : item?.MRP}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalRate && (
                                  <td style={{ textAlign: 'right' }}>
                                    {item?.Rate}
                                  </td>
                                )
                                : Rate == true && (
                                  <td style={{ textAlign: 'right' }}>
                                    {' '}
                                    {item?.Rate}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalDiscount && <td>{item.discount}</td>
                                : Discount == true && (
                                  <td style={{ textAlign: 'right' }}>
                                    {item?.Type != 'C'
                                      ? item?.OfferAmt || 0
                                      : item?.OfferValue || 0}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalTax && (
                                  <td style={{ textAlign: 'center' }}>
                                    {item?.ProdTaxPercentage || 0}
                                  </td>
                                )
                                : Tax == true &&
                                table2Data?.OrderType !== 'E' && (
                                  <td style={{ textAlign: 'center' }}>
                                    {item?.ProdTaxPercentage}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalAmount && (
                                  <td style={{ textAlign: 'right' }}>
                                    {item?.TotalAmt}
                                  </td>
                                )
                                : Amount == true && (
                                  <td style={{ textAlign: 'right' }}>
                                    {item?.Type != 'C'
                                      ? item?.TotalAmt - item?.OfferAmt || 0
                                      : item?.TotalAmt - item?.OfferValue ||
                                      0}
                                  </td>
                                )}
                            </tr>
                          ))}
                        </tbody>
                      </table>
                    </div>
                  </>
                )}
                {DineInData?.length > 0 && dinePreference && (
                  <>
                    <div
                      style={{
                        display: 'flex',
                        width: '100%',
                        justifyContent: 'center',
                        alignItems: 'center',
                        fontSize: '12px',
                        fontWeight: '600',
                      }}
                    >
                      Dine In
                    </div>

                    <div className="PrintStyle1-print-tableMaster">
                      <table className="PrintStyle1-print-table">
                        <thead>
                          <tr>
                            {GlobaldummyData
                              ? GlobalSlNo && (
                                <th style={{ ...headerStyle, width: '10px' }}>S.No</th>
                              )
                              : SLNO == true && (
                                <th style={{ ...headerStyle, width: '10px' }}>S.No</th>
                              )}
                            {GlobaldummyData
                              ? GlobalItem && <th style={{ ...headerStyle, }}>Item</th>
                              : Item == true && <th style={{ ...headerStyle, }}>Item</th>}
                            {GlobaldummyData
                              ? GlobalHsnCode && (
                                <th style={{ ...headerStyle, width: '10px' }}>HSN</th>
                              )
                              : HsnCode == true && (
                                <th style={{ ...headerStyle, width: '10px' }}>HSN</th>
                              )}
                            {GlobaldummyData
                              ? GlobalQuantity && (
                                <th style={{ ...headerStyle, width: '10px' }}>Qty</th>
                              )
                              : Quantity == true && (
                                <th style={{ ...headerStyle, width: '10px' }}>
                                  {WeightasKg ? 'Qty/Kg' : 'Qty'}
                                </th>
                              )}
                            {GlobaldummyData
                              ? GlobalMRP && (
                                <th style={{ ...headerStyle, width: '10px' }}>MRP</th>
                              )
                              : MRP == true && (
                                <th style={{ ...headerStyle, width: '10px' }}>MRP</th>
                              )}
                            {GlobaldummyData
                              ? GlobalRate && (
                                <th style={{ ...headerStyle, width: '10px' }}>Rate</th>
                              )
                              : Rate == true && (
                                <th style={{ ...headerStyle, width: '10px' }}>Rate</th>
                              )}
                            {GlobaldummyData
                              ? GlobalDiscount && (
                                <th style={{ ...headerStyle, width: '10px' }}>Dis </th>
                              )
                              : Discount == true && (
                                <th style={{ ...headerStyle, width: '10px' }}>Dis </th>
                              )}
                            {GlobaldummyData
                              ? GlobalTax && (
                                <th style={{ ...headerStyle, width: '10px' }}>Tax %</th>
                              )
                              : Tax == true &&
                              table2Data?.OrderType !== 'E' && (
                                <th style={{ ...headerStyle, width: '10px' }}>Tax %</th>
                              )}
                            {GlobaldummyData
                              ? GlobalAmount && (
                                <th
                                  style={{
                                    width: '10px',
                                    textAlign: 'right',
                                    ...headerStyle,
                                  }}
                                >
                                  Amt
                                </th>
                              )
                              : Amount == true && (
                                <th
                                  style={{
                                    width: '10px',
                                    textAlign: 'right',
                                    ...headerStyle,
                                  }}
                                >
                                  Amt
                                </th>
                              )}
                          </tr>
                        </thead>
                        <tbody>
                          {dataChunk?.map((item, index) => (
                            <tr key={index}
                              style={
                                index % 2 !== 1 && rowtypeStyle === "even"
                                  ? {
                                    ...tableBodyStyle
                                  }
                                  : index % 2 === 1 && rowtypeStyle === "odd"
                                    ? {
                                      ...tableBodyStyle
                                    }
                                    : {}
                              }>
                              {GlobaldummyData
                                ? GlobalSlNo && (
                                  <td style={{ textAlign: 'center' }}>
                                    {index + 1}
                                  </td>
                                )
                                : SLNO == true && (
                                  <td style={{ textAlign: 'center' }}>
                                    {chunkIndex * chunkSize + index + 1}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalItem && <td>{item?.ProdName}</td>
                                : Item == true && (
                                  <td

                                  >
                                    <div>{item?.ProdName}</div>
                                    {UomPrint?.SettingValue === 'Y' &&
                                      <div>
                                        ({item?.Size ? item?.Size : '1'}{' '}
                                        {item?.SinglePc == 'Y'
                                          ? 'PCS'
                                          : item?.Type != 'C'
                                            ? item?.UomName
                                            : 'COMBO'}
                                        )
                                      </div>
                                    }
                                    {sportsAppPreference &&
                                      `${item?.BookingDate?.trim()
                                        ? `(${dateFormatChange(item.BookingDate)})`
                                        : ''
                                      } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalHsnCode && (
                                  <td style={{ textAlign: 'center' }}>
                                    {item?.HSN}
                                  </td>
                                )
                                : HsnCode == true && (
                                  <td style={{ textAlign: 'center' }}>
                                    {item?.HSN}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalQuantity && (
                                  <td style={{ textAlign: 'center' }}>
                                    {item?.SalesQty}
                                  </td>
                                )
                                : Quantity == true && (
                                  <td style={{ textAlign: 'center' }}>
                                    {item?.SalesQty}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalMRP && (
                                  <td style={{ textAlign: 'right' }}>
                                    {item?.MRP}
                                  </td>
                                )
                                : MRP == true && (
                                  <td style={{ textAlign: 'right' }}>
                                    {item?.SinglePc === 'Y'
                                      ? item?.Rate
                                      : item?.MRP}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalRate && (
                                  <td style={{ textAlign: 'right' }}>
                                    {item?.Rate}
                                  </td>
                                )
                                : Rate == true && (
                                  <td style={{ textAlign: 'right' }}>
                                    {' '}
                                    {item?.Rate}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalDiscount && <td>{item.discount}</td>
                                : Discount == true && (
                                  <td>
                                    {' '}
                                    {item?.Type != 'C'
                                      ? item?.OfferAmt || 0
                                      : item?.OfferValue || 0}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalTax && (
                                  <td style={{ textAlign: 'center' }}>
                                    {item.ProdTaxPercentage}
                                  </td>
                                )
                                : Tax == true &&
                                table2Data?.OrderType !== 'E' && (
                                  <td style={{ textAlign: 'center' }}>
                                    {item?.ProdTaxPercentage || 0}
                                  </td>
                                )}
                              {GlobaldummyData
                                ? GlobalAmount && (
                                  <td style={{ textAlign: 'right' }}>
                                    {item?.TotalAmt}
                                  </td>
                                )
                                : Amount == true && (
                                  <td style={{ textAlign: 'right' }}>
                                    {item?.Type != 'C'
                                      ? item?.TotalAmt - item?.OfferAmt || 0
                                      : item?.TotalAmt - item?.OfferValue ||
                                      0}
                                  </td>
                                )}
                            </tr>
                          ))}
                        </tbody>
                      </table>
                    </div>
                  </>
                )}
                {/* itemdata  */}
              </div>

              {chunkIndex === paginatedChunks.length - 1 &&
                !shouldFooterBeOnNewPage &&
                FormatTheme && (
                  <>
                    <hr className="PrintStyle1-print-dottline" />
                    <div
                      style={{
                        display: 'flex',
                        justifyContent: 'space-around',
                        width: '95%',
                        whiteSpace: 'nowrap',
                        fontSize: '10px',
                        flexWrap: 'wrap',
                        gap: '2px',
                      }}
                    >
                      <div
                        style={{
                          margin: 0,
                          padding: 0,
                          fontSize: '10px',
                          fontWeight: '600',
                        }}
                      >
                        {' '}
                        Items:
                        {GlobaldummyData ? '7' : totalQuantityFilter?.length}
                      </div>
                      <div
                        style={{
                          margin: 0,
                          padding: 0,
                          fontSize: '10px',
                          fontWeight: '600',
                        }}
                      >
                        {' '}
                        Qty:{GlobaldummyData ? '9' : totalQuantity}
                      </div>
                      {/* {ExtraChargeTotal > 0 && <p style={{ margin: 0, padding: 0, fontSize: "12px" }}> Extra Charges:{ExtraChargeTotal}</p>} */}

                      {(TotalOfferAmount > 0 ||
                        table2Data?.OverallDisc > 0) && (
                          <p
                            style={{
                              margin: 0,
                              padding: 0,
                              fontSize: '10px',
                              fontWeight: '600',
                            }}
                          >
                            Off :
                            {(
                              Number(TotalOfferAmount || 0) +
                              Number(table2Data?.OverallDisc || 0)
                            ).toFixed(2)}
                          </p>
                        )}
                      <div
                        style={{
                          margin: 0,
                          padding: 0,
                          fontSize: '10px',
                          fontWeight: '600',
                          ...netAmountStyle
                        }}
                      >
                        Amount :₹
                        {GlobaldummyData
                          ? '1066'
                          : Number(table2Data?.NetAmount).toFixed(2)}
                      </div>
                    </div>

                    {DineInData?.length > 0 && TakeawayData?.length > 0 && (
                      <>
                        {takeAwayPreference && (
                          <div>
                            Takeaway:&nbsp;{Number(TakeawayTotal).toFixed(2)}
                          </div>
                        )}
                        {dinePreference && (
                          <div>
                            Dine In:&nbsp;{Number(DineInTotal).toFixed(2)}{' '}
                          </div>
                        )}
                      </>
                    )}
                    {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && (
                      <>
                        {/* <p>Split Payment:</p> */}
                        {Object.keys(aggregatedPayments).map((paymentType) => (
                          <div
                            key={paymentType}
                            style={{ margin: 0, padding: 0, fontSize: '12px' }}
                          >
                            {paymentType}:{' '}
                            {aggregatedPayments[paymentType].toFixed(2)}
                          </div>
                        ))}
                      </>
                    )}
                    {isEditedBill && lastTransaction && (
                      <div style={{
                        width: '100%', marginTop: '2px',
                        paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'center',
                        flexDirection: 'column', borderTop: '1px dashed #000'
                      }}>
                        <div
                          style={{
                            fontSize: '10px',
                            width: '90%'
                          }}
                        >
                          <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                            <span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
                            <strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
                          </div>
                          <div
                            style={{
                              display: 'flex',
                              justifyContent: 'space-between',
                              fontWeight: 600,
                              color:
                                lastTransaction?.AdjustmentType === 'REFUND'
                                  ? '#000'
                                  : '#000',
                            }}
                          >
                            <span>{'Adjustment Amount'}</span>
                            <span>
                              {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
                              {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
                                (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
                            </span>
                          </div>
                          <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
                            <span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
                            <strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
                          </div>
                        </div>
                      </div>
                    )}
                    {table2Data?.OrderType === 'E' ? (
                      ''
                    ) : (
                      <div>
                        {((OrderDetailGST?.length > 0 &&
                          OrderDetailGST?.[0]?.TaxAmt > 0) ||
                          (OrderDetailIGST?.length > 0 &&
                            OrderDetailIGST?.[0]?.TaxAmt > 0) ||
                          (OrderDetailVAT?.length > 0 &&
                            OrderDetailVAT?.[0]?.TaxAmt > 0)) &&
                          table2Data?.NetAmount !== 0 && (
                            <>
                              <hr className="PrintStyle1-print-dottline" />

                              <div>
                                <div
                                  style={{
                                    margin: 0,
                                    padding: 0,
                                    fontSize: '14px',
                                    textAlign: 'center',
                                    fontWeight: '600',
                                  }}
                                >
                                  --------- GST Breakup Details -----------
                                </div>
                                {OrderDetailGST?.length > 0 &&
                                  OrderDetailGST?.[0]?.TaxAmt > 0 && (
                                    <table style={{ width: '90%' }}>
                                      <tr>
                                        <td
                                          style={{
                                            fontSize: '12px',
                                            textAlign: 'center',
                                          }}
                                        ></td>
                                        <td
                                          style={{
                                            fontSize: '12px',
                                            textAlign: 'center',
                                          }}
                                        >
                                          Taxable Amount
                                        </td>
                                        <td
                                          style={{
                                            fontSize: '12px',
                                            textAlign: 'center',
                                          }}
                                        >
                                          CGST
                                        </td>
                                        <td
                                          style={{
                                            fontSize: '12px',
                                            textAlign: 'center',
                                          }}
                                        >
                                          SGST
                                        </td>
                                        <td
                                          style={{
                                            fontSize: '12px',
                                            textAlign: 'center',
                                          }}
                                        >
                                          Total Amount
                                        </td>
                                      </tr>
                                      {OrderDetailGST?.map((item) => (
                                        <tr>
                                          <td
                                            style={{
                                              fontSize: '12px',
                                              textAlign: 'right',
                                            }}
                                          >
                                            {item?.TaxPercentage || 0}%
                                          </td>
                                          <td
                                            style={{
                                              fontSize: '12px',
                                              textAlign: 'center',
                                            }}
                                          >
                                            {Number(
                                              item.WithOutTaxAmount
                                            ).toFixed(2)}
                                          </td>
                                          <td
                                            style={{
                                              fontSize: '12px',
                                              textAlign: 'center',
                                            }}
                                          >
                                            {Number(item.CGST).toFixed(2)}
                                          </td>
                                          <td
                                            style={{
                                              fontSize: '12px',
                                              textAlign: 'center',
                                            }}
                                          >
                                            {Number(item.SGST).toFixed(2)}
                                          </td>
                                          <td
                                            style={{
                                              fontSize: '12px',
                                              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: '12px',
                                              textAlign: 'center',
                                            }}
                                          ></td>
                                          <td
                                            style={{
                                              fontSize: '12px',
                                              textAlign: 'center',
                                            }}
                                          >
                                            Taxable Amount
                                          </td>
                                          <td
                                            style={{
                                              fontSize: '12px',
                                              textAlign: 'center',
                                            }}
                                          >
                                            IGST (
                                            {
                                              OrderDetailIGST?.[0]
                                                ?.TaxPercentage
                                            }
                                            %)
                                          </td>

                                          <td
                                            style={{
                                              fontSize: '12px',
                                              textAlign: 'center',
                                            }}
                                          >
                                            Total Amount
                                          </td>
                                        </tr>
                                        {OrderDetailIGST?.map((item) => (
                                          <tr>
                                            <td
                                              style={{
                                                fontSize: '12px',
                                                textAlign: 'right',
                                              }}
                                            >
                                              {item?.TaxPercentage || 0}%
                                            </td>
                                            <td
                                              style={{
                                                fontSize: '12px',
                                                textAlign: 'center',
                                              }}
                                            >
                                              {Number(
                                                item.WithOutTaxAmount
                                              ).toFixed(2)}
                                            </td>
                                            <td
                                              style={{
                                                fontSize: '12px',
                                                textAlign: 'center',
                                              }}
                                            >
                                              {Number(item.TaxAmt).toFixed(2)}
                                            </td>

                                            <td
                                              style={{
                                                fontSize: '12px',
                                                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: '12px',
                                              textAlign: 'center',
                                            }}
                                          ></td>
                                          <td
                                            style={{
                                              fontSize: '12px',
                                              textAlign: 'center',
                                            }}
                                          >
                                            Taxable Amount
                                          </td>
                                          <td
                                            style={{
                                              fontSize: '12px',
                                              textAlign: 'center',
                                            }}
                                          >
                                            VAT (
                                            {OrderDetailVAT?.[0]?.TaxPercentage}
                                            %)
                                          </td>

                                          <td
                                            style={{
                                              fontSize: '12px',
                                              textAlign: 'center',
                                            }}
                                          >
                                            Total Amount
                                          </td>
                                        </tr>
                                        {OrderDetailVAT?.map((item) => (
                                          <tr>
                                            <td
                                              style={{
                                                fontSize: '12px',
                                                textAlign: 'right',
                                              }}
                                            >
                                              {item?.TaxPercentage || 0}%
                                            </td>
                                            <td
                                              style={{
                                                fontSize: '12px',
                                                textAlign: 'center',
                                              }}
                                            >
                                              {Number(
                                                item.WithOutTaxAmount
                                              ).toFixed(2)}
                                            </td>
                                            <td
                                              style={{
                                                fontSize: '12px',
                                                textAlign: 'center',
                                              }}
                                            >
                                              {Number(item.TaxAmt).toFixed(2)}
                                            </td>
                                            <td
                                              style={{
                                                fontSize: '12px',
                                                textAlign: 'center',
                                              }}
                                            >
                                              {Number(item.TotalAmt).toFixed(2)}
                                            </td>
                                          </tr>
                                        ))}
                                      </table>
                                    </>
                                  )}
                              </div>
                              <hr className="PrintStyle1-print-dottline" />
                            </>
                          )}
                      </div>
                    )}
                    {table2Data?.BookingTypeName === 'Dine In' &&
                      dinePreference && (
                        <div>
                          {table2Data?.SalesTableLinkDetails?.[0]
                            ?.WaiterName && (
                              <div
                                style={{
                                  marginLeft: '10px',
                                  padding: 0,
                                  fontSize: '12px',
                                  fontWeight: '600',
                                }}
                              >
                                Captain:{' '}
                                {
                                  table2Data?.SalesTableLinkDetails?.[0]
                                    ?.WaiterName
                                }
                              </div>
                            )}
                        </div>
                      )}

                    {GlobaldummyData
                      ? GlobalCredit && (
                        <div
                          style={{
                            textAlign: 'left',
                            fontSize: '12px',
                            padding: 0,
                            margin: 0,
                            fontWeight: '600',
                            lineHeight: '14px',
                          }}
                        >
                          <h6>Advance Amount:</h6>
                          <h6>Opening Balance:</h6>
                        </div>
                      )
                      : CreditDetails &&
                      table2Data?.CustomerDetails?.length > 0 && (
                        <div
                          style={{
                            fontSize: '12px',
                            fontWeight: '600',
                            lineHeight: '14px',
                          }}
                        >
                          {(() => {
                            const c = table2Data.CustomerDetails[0];
                            const items = [];

                            if (
                              PaymentStatusSuccess?.[0]?.PaymentTypeName ===
                              'Credit'
                            ) {
                              if (c.OldCreditBal !== 0) {
                                items.push({
                                  label:
                                    c.OldCreditBal > 0
                                      ? 'Advance Amount'
                                      : 'Opening Balance',
                                  value: Math.abs(c.OldCreditBal).toFixed(2),
                                });
                              }
                            }

                            if (c.CurrentCreditBal !== 0) {
                              items.push({
                                label:
                                  c.CurrentCreditBal > 0
                                    ? 'Current Advance Amount'
                                    : 'Current Balance Amount',
                                value: Math.abs(c.CurrentCreditBal).toFixed(
                                  2
                                ),
                              });
                            }

                            return items.map((i, idx) => (
                              <p
                                key={idx}
                                style={{
                                  display: 'grid',
                                  gridTemplateColumns: '4fr  1fr 1fr',
                                  // gridTemplateColumns: "auto auto auto",
                                  margin: 0,
                                  padding: 0,
                                }}
                              >
                                <span style={{ textAlign: 'left' }}>
                                  {i.label}
                                </span>
                                <span style={{ textAlign: 'center' }}>:</span>
                                <span style={{ textAlign: 'right' }}>
                                  {i.value}
                                </span>
                              </p>
                            ));
                          })()}
                        </div>
                      )}
                    <div
                      style={{
                        display: 'flex',
                        justifyContent: 'space-evenly',
                        marginTop: '2px',
                      }}
                    >
                      <div
                        style={{
                          marginTop: '2px',
                          padding: 0,
                          fontSize: '15px',
                          fontWeight: '600',
                        }}
                      >
                        {PaymentStatusSuccess?.length === 1
                          ? PaymentStatusSuccess?.[0]?.PaymentTypeName
                          : 'Split'}{' '}
                        &nbsp; Payment : ₹
                        {GlobaldummyData
                          ? '1066'
                          : Number(table2Data?.NetAmount).toFixed(2)}
                        /-{' '}
                      </div>
                    </div>

                    <h6
                      style={{
                        textAlign: 'center',
                        marginTop: '5px',
                        fontSize: '12px',
                      }}
                    >
                      YOUR ORDER NO:{' '}
                      {table2Data?.SalesId &&
                        extractLastNumber(table2Data?.SalesId)}
                    </h6>
                    {sportsAppPreference && MembershipApplied && (
                      <div
                        style={{
                          fontWeight: 'bold',
                          width: '100%',
                          textAlign: 'center',
                        }}
                      >{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}</div>
                    )}

                    {GlobaldummyData
                      ? GlobalQrcodet && (
                        <div
                          style={{
                            display: 'flex',
                            flexDirection: 'column',
                            justifyContent: 'center',
                            alignItems: 'center',
                          }}
                        >
                          {/* <img style={{ width: '75px', height: '75px' }} src={QRcode} alt='QRcode' /> */}
                          <QRCode
                            value={`upi://pay?pa=${UpiId}&pn=Merchant&am=${table2Data?.NetAmount}&cu=INR`}
                            size={80}
                          />
                          <div style={{ fontSize: '12px' }}>Scan to Pay </div>
                          <div style={{ fontSize: '12px' }}>
                            ₹
                            {GlobaldummyData
                              ? '1,066'
                              : Number(table2Data?.NetAmount).toFixed(2)}
                          </div>
                        </div>
                      )
                      : !estimatePrintHeader && table2Data?.OrderType === 'E'
                        ? ''
                        : Qrcodet &&
                        paymentTypeUPI && (
                          <div
                            style={{
                              display: 'flex',
                              flexDirection: 'column',
                              justifyContent: 'center',
                              alignItems: 'center',
                            }}
                          >
                            <QRCode
                              value={`upi://pay?pa=${GlobalUpiID}&pn=Merchant&am=${table2Data?.NetAmount}&cu=INR`}
                              size={80}
                            />
                            <div style={{ fontSize: '10px' }}>
                              Scan to Pay{' '}
                            </div>
                            <div style={{ fontSize: '10px' }}>
                              ₹
                              {GlobaldummyData
                                ? '1,066'
                                : Number(table2Data?.NetAmount).toFixed(2)}
                            </div>
                          </div>
                        )}

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

                    <div
                      className="page-footerA4Style11"
                      style={{
                        marginTop: 'auto',
                        pageBreakBefore: 'avoid',
                        pageBreakInside: 'avoid',
                        minHeight: 'auto',
                        ...footerColorStyle
                      }}
                    >
                      {GlobaldummyData
                        ? GlobalIsnotes && (
                          <div>
                            <p style={{ padding: '0rem 1rem' }}>
                              Notes : 10 days Return policy
                            </p>

                            <hr className="PrintA4Style11-print-dottline" />
                          </div>
                        )
                        : !estimatePrintHeader && table2Data?.OrderType === 'E'
                          ? ''
                          : Notestext && (
                            <div>
                              <p
                                style={{
                                  padding: '0rem 1rem',
                                  textAlign: 'center',
                                }}
                              >
                                {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',
                        }}
                      >
                        {GlobaldummyData
                          ? GlobaltermsAndConditions && (
                            <div
                              style={{
                                margin: '8px 0',
                                padding: '8px',
                                fontFamily: 'sans-serif',
                                width: '100%',
                              }}
                            >
                              <p
                                style={{
                                  fontSize: '13px',
                                  fontWeight: 'bold',
                                  marginBottom: '6px',
                                }}
                              >
                                Terms & Conditions
                              </p>
                              <ol
                                style={{
                                  fontSize: '12px',
                                  paddingLeft: '18px',
                                  margin: 0,
                                  lineHeight: '1',
                                }}
                              >
                                <li>
                                  Once goods are sold, they are not
                                  exchangeable or refundable.
                                </li>
                                <li>
                                  Please check the product before leaving the
                                  counter.
                                </li>
                              </ol>
                            </div>
                          )
                          : !estimatePrintHeader &&
                            table2Data?.OrderType === 'E'
                            ? ''
                            : 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>
                            )}

                        {GlobaldummyData
                          ? GlobalSignature && (
                            <div
                              style={{
                                display: 'flex',
                                flexDirection: 'column',
                                alignItems: 'flex-end',
                                paddingBottom: '1rem',
                              }}
                            >
                              <p
                                style={{
                                  fontSize: '13px',
                                  fontWeight: 'bold',
                                  marginBottom: '6px',
                                }}
                              >
                                Signature
                              </p>
                              <img
                                style={{ width: '70px', height: '40px' }}
                                src={
                                  GlobalSignatureImages
                                    ? GlobalSignatureImages
                                    : signature
                                }
                                alt=""
                              />
                            </div>
                          )
                          : !estimatePrintHeader &&
                            table2Data?.OrderType === 'E'
                            ? ''
                            : 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>
                      {PrintGreeting?.SettingValue === 'Y' && (
                        <div
                          style={{
                            display: 'flex',
                            justifyContent: 'center',
                            alignItems: 'center',
                            fontWeight: '600',
                          }}
                        >
                          Thank You Visit Again
                        </div>
                      )}
                    </div>
                  </>
                )}
            </div>
          ))}

          {shouldFooterBeOnNewPage && FormatTheme && (
            <div
              className="print-page"
              style={{
                display: 'flex',
                flexDirection: 'column',
                minHeight: PageSize == 'A5' ? '200mm' : '260mm',
                justifyContent: 'flex-end',
                pageBreakBefore: 'always',
                position: !isMobile && 'relative',
              }}
            >
              <div
                style={{
                  position: !isMobile && 'absolute',
                  bottom: '0',
                  width: '100%',
                  left: '0',
                }}
              >
                <hr className="PrintStyle1-print-dottline" />
                <div
                  style={{
                    display: 'flex',
                    justifyContent: 'space-around',
                    width: '95%',
                    whiteSpace: 'nowrap',
                    fontSize: '10px',
                    flexWrap: 'wrap',
                    gap: '2px',
                  }}
                >
                  <div
                    style={{
                      margin: 0,
                      padding: 0,
                      fontSize: '10px',
                      fontWeight: '600',
                    }}
                  >
                    {' '}
                    Items:{GlobaldummyData ? '7' : totalQuantityFilter?.length}
                  </div>
                  <div
                    style={{
                      margin: 0,
                      padding: 0,
                      fontSize: '10px',
                      fontWeight: '600',
                    }}
                  >
                    {' '}
                    Qty:{GlobaldummyData ? '9' : totalQuantity}
                  </div>
                  {/* {ExtraChargeTotal > 0 && <p style={{ margin: 0, padding: 0, fontSize: "12px" }}> Extra Charges:{ExtraChargeTotal}</p>} */}

                  {(TotalOfferAmount > 0 || table2Data?.OverallDisc > 0) && (
                    <p
                      style={{
                        margin: 0,
                        padding: 0,
                        fontSize: '10px',
                        fontWeight: '600',
                      }}
                    >
                      Off :
                      {(
                        Number(TotalOfferAmount || 0) +
                        Number(table2Data?.OverallDisc || 0)
                      ).toFixed(2)}
                    </p>
                  )}
                  <div
                    style={{
                      margin: 0,
                      padding: 0,
                      fontSize: '10px',
                      fontWeight: '600',
                      ...netAmountStyle
                    }}
                  >
                    Amount :₹
                    {GlobaldummyData
                      ? '1066'
                      : Number(table2Data?.NetAmount).toFixed(2)}
                  </div>
                </div>

                {DineInData?.length > 0 && TakeawayData?.length > 0 && (
                  <>
                    {takeAwayPreference && (
                      <div>
                        Takeaway:&nbsp;{Number(TakeawayTotal).toFixed(2)}
                      </div>
                    )}
                    {dinePreference && (
                      <div>Dine In:&nbsp;{Number(DineInTotal).toFixed(2)} </div>
                    )}
                  </>
                )}
                {(PaymentStatusSuccess?.length > 1 && !isEditedBill)(
                  <>
                    {/* <p>Split Payment:</p> */}
                    {Object.keys(aggregatedPayments).map((paymentType) => (
                      <div
                        key={paymentType}
                        style={{ margin: 0, padding: 0, fontSize: '12px' }}
                      >
                        {paymentType}:{' '}
                        {aggregatedPayments[paymentType].toFixed(2)}
                      </div>
                    ))}
                  </>
                )}
                {isEditedBill && lastTransaction && (
                  <div style={{
                    width: '100%', marginTop: '2px',
                    paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'center',
                    flexDirection: 'column', borderTop: '1px dashed #000'
                  }}>
                    <div
                      style={{
                        fontSize: '10px',
                        width: '90%'
                      }}
                    >
                      <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                        <span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
                        <strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
                      </div>
                      <div
                        style={{
                          display: 'flex',
                          justifyContent: 'space-between',
                          fontWeight: 600,
                          color:
                            lastTransaction?.AdjustmentType === 'REFUND'
                              ? '#000'
                              : '#000',
                        }}
                      >
                        <span>{'Adjustment Amount'}</span>
                        <span>
                          {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
                          {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
                            (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
                        </span>
                      </div>
                      <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px', }}>
                        <span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
                        <strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
                      </div>
                    </div>
                  </div>
                )}
                {table2Data?.OrderType === 'E' ? (
                  ''
                ) : (
                  <div>
                    {((OrderDetailGST?.length > 0 &&
                      OrderDetailGST?.[0]?.TaxAmt > 0) ||
                      (OrderDetailIGST?.length > 0 &&
                        OrderDetailIGST?.[0]?.TaxAmt > 0) ||
                      (OrderDetailVAT?.length > 0 &&
                        OrderDetailVAT?.[0]?.TaxAmt > 0)) &&
                      table2Data?.NetAmount !== 0 && (
                        <>
                          <hr className="PrintStyle1-print-dottline" />

                          <div>
                            <div
                              style={{
                                margin: 0,
                                padding: 0,
                                fontSize: '14px',
                                textAlign: 'center',
                                fontWeight: '600',
                              }}
                            >
                              --------- GST Breakup Details -----------
                            </div>
                            {OrderDetailGST?.length > 0 &&
                              OrderDetailGST?.[0]?.TaxAmt > 0 && (
                                <table style={{ width: '90%' }}>
                                  <tr>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'center',
                                      }}
                                    ></td>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'center',
                                      }}
                                    >
                                      Taxable Amount
                                    </td>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'center',
                                      }}
                                    >
                                      CGST
                                    </td>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'center',
                                      }}
                                    >
                                      SGST
                                    </td>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'center',
                                      }}
                                    >
                                      Total Amount
                                    </td>
                                  </tr>
                                  {OrderDetailGST?.map((item) => (
                                    <tr>
                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'right',
                                        }}
                                      >
                                        {item?.TaxPercentage || 0}%
                                      </td>
                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'center',
                                        }}
                                      >
                                        {Number(item.WithOutTaxAmount).toFixed(
                                          2
                                        )}
                                      </td>
                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'center',
                                        }}
                                      >
                                        {Number(item.CGST).toFixed(2)}
                                      </td>
                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'center',
                                        }}
                                      >
                                        {Number(item.SGST).toFixed(2)}
                                      </td>
                                      <td
                                        style={{
                                          fontSize: '12px',
                                          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: '12px',
                                          textAlign: 'center',
                                        }}
                                      ></td>
                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'center',
                                        }}
                                      >
                                        Taxable Amount
                                      </td>
                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'center',
                                        }}
                                      >
                                        IGST (
                                        {OrderDetailIGST?.[0]?.TaxPercentage}%)
                                      </td>

                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'center',
                                        }}
                                      >
                                        Total Amount
                                      </td>
                                    </tr>
                                    {OrderDetailIGST?.map((item) => (
                                      <tr>
                                        <td
                                          style={{
                                            fontSize: '12px',
                                            textAlign: 'right',
                                          }}
                                        >
                                          {item?.TaxPercentage || 0}%
                                        </td>
                                        <td
                                          style={{
                                            fontSize: '12px',
                                            textAlign: 'center',
                                          }}
                                        >
                                          {Number(
                                            item.WithOutTaxAmount
                                          ).toFixed(2)}
                                        </td>
                                        <td
                                          style={{
                                            fontSize: '12px',
                                            textAlign: 'center',
                                          }}
                                        >
                                          {Number(item.TaxAmt).toFixed(2)}
                                        </td>

                                        <td
                                          style={{
                                            fontSize: '12px',
                                            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: '12px',
                                          textAlign: 'center',
                                        }}
                                      ></td>
                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'center',
                                        }}
                                      >
                                        Taxable Amount
                                      </td>
                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'center',
                                        }}
                                      >
                                        VAT (
                                        {OrderDetailVAT?.[0]?.TaxPercentage}
                                        %)
                                      </td>

                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'center',
                                        }}
                                      >
                                        Total Amount
                                      </td>
                                    </tr>
                                    {OrderDetailVAT?.map((item) => (
                                      <tr>
                                        <td
                                          style={{
                                            fontSize: '12px',
                                            textAlign: 'right',
                                          }}
                                        >
                                          {item?.TaxPercentage || 0}%
                                        </td>
                                        <td
                                          style={{
                                            fontSize: '12px',
                                            textAlign: 'center',
                                          }}
                                        >
                                          {Number(
                                            item.WithOutTaxAmount
                                          ).toFixed(2)}
                                        </td>
                                        <td
                                          style={{
                                            fontSize: '12px',
                                            textAlign: 'center',
                                          }}
                                        >
                                          {Number(item.TaxAmt).toFixed(2)}
                                        </td>
                                        <td
                                          style={{
                                            fontSize: '12px',
                                            textAlign: 'center',
                                          }}
                                        >
                                          {Number(item.TotalAmt).toFixed(2)}
                                        </td>
                                      </tr>
                                    ))}
                                  </table>
                                </>
                              )}
                          </div>
                          <hr className="PrintStyle1-print-dottline" />
                        </>
                      )}
                  </div>
                )}
                {table2Data?.BookingTypeName === 'Dine In' &&
                  dinePreference && (
                    <div>
                      {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && (
                        <div
                          style={{
                            marginLeft: '10px',
                            padding: 0,
                            fontSize: '12px',
                            fontWeight: '600',
                          }}
                        >
                          Captain:{' '}
                          {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
                        </div>
                      )}
                    </div>
                  )}
                {GlobaldummyData
                  ? GlobalCredit && (
                    <div
                      style={{
                        textAlign: 'left',
                        fontSize: '12px',
                        padding: 0,
                        margin: 0,
                        fontWeight: '600',
                        lineHeight: '14px',
                      }}
                    >
                      <h6>Advance Amount:</h6>
                      <h6>Opening Balance:</h6>
                    </div>
                  )
                  : CreditDetails &&
                  table2Data?.CustomerDetails?.length > 0 && (
                    <div
                      style={{
                        fontSize: '12px',
                        fontWeight: '600',
                        lineHeight: '14px',
                      }}
                    >
                      {(() => {
                        const c = table2Data.CustomerDetails[0];
                        const items = [];

                        if (
                          PaymentStatusSuccess?.[0]?.PaymentTypeName ===
                          'Credit'
                        ) {
                          if (c.OldCreditBal !== 0) {
                            items.push({
                              label:
                                c.OldCreditBal > 0
                                  ? 'Advance Amount'
                                  : 'Opening Balance',
                              value: Math.abs(c.OldCreditBal).toFixed(2),
                            });
                          }
                        }

                        if (c.CurrentCreditBal !== 0) {
                          items.push({
                            label:
                              c.CurrentCreditBal > 0
                                ? 'Current Advance Amount'
                                : 'Current Balance Amount',
                            value: Math.abs(c.CurrentCreditBal).toFixed(2),
                          });
                        }

                        return items.map((i, idx) => (
                          <p
                            key={idx}
                            style={{
                              display: 'grid',
                              gridTemplateColumns: '4fr  1fr 1fr',
                              // gridTemplateColumns: "auto auto auto",
                              margin: 0,
                              padding: 0,
                            }}
                          >
                            <span style={{ textAlign: 'left' }}>
                              {i.label}
                            </span>
                            <span style={{ textAlign: 'center' }}>:</span>
                            <span style={{ textAlign: 'right' }}>
                              {i.value}
                            </span>
                          </p>
                        ));
                      })()}
                    </div>
                  )}

                <div
                  style={{
                    display: 'flex',
                    justifyContent: 'space-evenly',
                    marginTop: '5px',
                  }}
                  className="PrintStyle1-payment-line"
                >
                  <div
                    style={{
                      marginTop: '5px',
                      padding: 0,
                      fontSize: '17px',
                      fontWeight: '600',
                    }}
                  >
                    {PaymentStatusSuccess?.length === 1
                      ? PaymentStatusSuccess?.[0]?.PaymentTypeName
                      : 'Split'}{' '}
                    &nbsp; Payment : ₹
                    {GlobaldummyData
                      ? '1066'
                      : Number(table2Data?.NetAmount).toFixed(2)}
                    /-{' '}
                  </div>
                </div>

                <h6
                  style={{
                    textAlign: 'center',
                    marginTop: '5px',
                    fontSize: '12px',
                  }}
                >
                  YOUR ORDER NO:{' '}
                  {table2Data?.SalesId &&
                    extractLastNumber(table2Data?.SalesId)}
                </h6>
                {sportsAppPreference && MembershipApplied && (
                  <div
                    style={{
                      fontWeight: 'bold',
                      width: '100%',
                      textAlign: 'center',
                    }}
                  >{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}</div>
                )}
                {GlobaldummyData
                  ? GlobalQrcodet && (
                    <div
                      style={{
                        display: 'flex',
                        flexDirection: 'column',
                        justifyContent: 'center',
                        alignItems: 'center',
                      }}
                    >
                      {/* <img style={{ width: '75px', height: '75px' }} src={QRcode} alt='QRcode' /> */}
                      <QRCode
                        value={`upi://pay?pa=${UpiId}&pn=Merchant&am=${table2Data?.NetAmount}&cu=INR`}
                        size={80}
                      />
                      <div style={{ fontSize: '12px' }}>Scan to Pay </div>
                      <div style={{ fontSize: '12px' }}>
                        ₹
                        {GlobaldummyData
                          ? '1,066'
                          : Number(table2Data?.NetAmount).toFixed(2)}
                      </div>
                    </div>
                  )
                  : !estimatePrintHeader && table2Data?.OrderType === 'E'
                    ? ''
                    : Qrcodet &&
                    paymentTypeUPI && (
                      <div
                        style={{
                          display: 'flex',
                          flexDirection: 'column',
                          justifyContent: 'center',
                          alignItems: 'center',
                        }}
                      >
                        <QRCode
                          value={`upi://pay?pa=${GlobalUpiID}&pn=Merchant&am=${table2Data?.NetAmount}&cu=INR`}
                          size={80}
                        />
                        <div style={{ fontSize: '10px' }}>Scan to Pay </div>
                        <div style={{ fontSize: '10px' }}>
                          ₹
                          {GlobaldummyData
                            ? '1,066'
                            : Number(table2Data?.NetAmount).toFixed(2)}
                        </div>
                      </div>
                    )}

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

                <div
                  className="page-footerA4Style11"
                  style={{
                    marginTop: 'auto',
                    pageBreakBefore: 'avoid',
                    pageBreakInside: 'avoid',
                    minHeight: 'auto',
                    ...footerColorStyle
                  }}
                >
                  {GlobaldummyData
                    ? GlobalIsnotes && (
                      <div>
                        <p style={{ padding: '0rem 1rem' }}>
                          Notes : 10 days Return policy
                        </p>

                        <hr className="PrintA4Style11-print-dottline" />
                      </div>
                    )
                    : !estimatePrintHeader && table2Data?.OrderType === 'E'
                      ? ''
                      : Notestext && (
                        <div>
                          <p
                            style={{
                              padding: '0rem 1rem',
                              textAlign: 'center',
                            }}
                          >
                            {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',
                    }}
                  >
                    {GlobaldummyData
                      ? GlobaltermsAndConditions && (
                        <div
                          style={{
                            margin: '8px 0',
                            padding: '8px',
                            fontFamily: 'sans-serif',
                            width: '100%',
                          }}
                        >
                          <p
                            style={{
                              fontSize: '13px',
                              fontWeight: 'bold',
                              marginBottom: '6px',
                            }}
                          >
                            Terms & Conditions
                          </p>
                          <ol
                            style={{
                              fontSize: '12px',
                              paddingLeft: '18px',
                              margin: 0,
                              lineHeight: '1',
                            }}
                          >
                            <li>
                              Once goods are sold, they are not exchangeable
                              or refundable.
                            </li>
                            <li>
                              Please check the product before leaving the
                              counter.
                            </li>
                          </ol>
                        </div>
                      )
                      : !estimatePrintHeader && table2Data?.OrderType === 'E'
                        ? ''
                        : 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>
                        )}

                    {GlobaldummyData
                      ? GlobalSignature && (
                        <div
                          style={{
                            display: 'flex',
                            flexDirection: 'column',
                            alignItems: 'flex-end',
                            paddingBottom: '1rem',
                          }}
                        >
                          <p
                            style={{
                              fontSize: '13px',
                              fontWeight: 'bold',
                              marginBottom: '6px',
                            }}
                          >
                            Signature
                          </p>
                          <img
                            style={{ width: '70px', height: '40px' }}
                            src={
                              GlobalSignatureImages
                                ? GlobalSignatureImages
                                : signature
                            }
                            alt=""
                          />
                        </div>
                      )
                      : !estimatePrintHeader && table2Data?.OrderType === 'E'
                        ? ''
                        : 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>
                  {PrintGreeting?.SettingValue === 'Y' && (
                    <div
                      style={{
                        display: 'flex',
                        justifyContent: 'center',
                        alignItems: 'center',
                        fontWeight: '600',
                      }}
                    >
                      Thank You Visit Again
                    </div>
                  )}
                </div>
              </div>
            </div>
          )}

          {GlobaldummyData && (
            <>
              <hr className="PrintStyle1-print-dottline" />
              <div
                style={{
                  display: 'flex',
                  justifyContent: 'space-around',
                  width: '95%',
                  whiteSpace: 'nowrap',
                  fontSize: '10px',
                  flexWrap: 'wrap',
                  gap: '2px',
                }}
              >
                <div
                  style={{
                    margin: 0,
                    padding: 0,
                    fontSize: '10px',
                    fontWeight: '600',
                  }}
                >
                  {' '}
                  Items:{GlobaldummyData ? '7' : totalQuantityFilter?.length}
                </div>
                <div
                  style={{
                    margin: 0,
                    padding: 0,
                    fontSize: '10px',
                    fontWeight: '600',
                  }}
                >
                  {' '}
                  Qty:{GlobaldummyData ? '9' : totalQuantity}
                </div>
                {/* {ExtraChargeTotal > 0 && <p style={{ margin: 0, padding: 0, fontSize: "12px" }}> Extra Charges:{ExtraChargeTotal}</p>} */}

                {(TotalOfferAmount > 0 || table2Data?.OverallDisc > 0) && (
                  <p
                    style={{
                      margin: 0,
                      padding: 0,
                      fontSize: '10px',
                      fontWeight: '600',
                    }}
                  >
                    Off :
                    {(
                      Number(TotalOfferAmount || 0) +
                      Number(table2Data?.OverallDisc || 0)
                    ).toFixed(2)}
                  </p>
                )}
                <div
                  style={{
                    margin: 0,
                    padding: 0,
                    fontSize: '10px',
                    fontWeight: '600',
                    ...netAmountStyle
                  }}
                >
                  Amount :₹
                  {GlobaldummyData
                    ? '1066'
                    : Number(table2Data?.NetAmount).toFixed(2)}
                </div>
              </div>

              {DineInData?.length > 0 && TakeawayData?.length > 0 && (
                <>
                  {takeAwayPreference && (
                    <div>Takeaway:&nbsp;{Number(TakeawayTotal).toFixed(2)}</div>
                  )}
                  {dinePreference && (
                    <div>Dine In:&nbsp;{Number(DineInTotal).toFixed(2)} </div>
                  )}
                </>
              )}
              {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && (
                <>
                  {/* <p>Split Payment:</p> */}
                  {Object.keys(aggregatedPayments).map((paymentType) => (
                    <div
                      key={paymentType}
                      style={{ margin: 0, padding: 0, fontSize: '12px' }}
                    >
                      {paymentType}:{' '}
                      {aggregatedPayments[paymentType].toFixed(2)}
                    </div>
                  ))}
                </>
              )}
              {isEditedBill && lastTransaction && (
                <div style={{
                  width: '100%', marginTop: '2px',
                  paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'center',
                  flexDirection: 'column', borderTop: '1px dashed #000'
                }}>
                  <div
                    style={{
                      fontSize: '10px',
                      width: '90%'
                    }}
                  >
                    <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                      <span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
                      <strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
                    </div>
                    <div
                      style={{
                        display: 'flex',
                        justifyContent: 'space-between',
                        fontWeight: 600,
                        color:
                          lastTransaction?.AdjustmentType === 'REFUND'
                            ? '#000'
                            : '#000',
                      }}
                    >
                      <span>{'Adjustment Amount'}</span>
                      <span>
                        {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
                        {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
                          (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
                      </span>
                    </div>
                    <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px', }}>
                      <span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
                      <strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
                    </div>
                  </div>
                </div>
              )}
              {table2Data?.OrderType === 'E' ? (
                ''
              ) : (
                <div>
                  {((OrderDetailGST?.length > 0 &&
                    OrderDetailGST?.[0]?.TaxAmt > 0) ||
                    (OrderDetailIGST?.length > 0 &&
                      OrderDetailIGST?.[0]?.TaxAmt > 0) ||
                    (OrderDetailVAT?.length > 0 &&
                      OrderDetailVAT?.[0]?.TaxAmt > 0)) &&
                    table2Data?.NetAmount !== 0 && (
                      <>
                        <hr className="PrintStyle1-print-dottline" />

                        <div>
                          <div
                            style={{
                              margin: 0,
                              padding: 0,
                              fontSize: '14px',
                              textAlign: 'center',
                              fontWeight: '600',
                            }}
                          >
                            --------- GST Breakup Details -----------
                          </div>
                          {OrderDetailGST?.length > 0 &&
                            OrderDetailGST?.[0]?.TaxAmt > 0 && (
                              <table style={{ width: '90%' }}>
                                <tr>
                                  <td
                                    style={{
                                      fontSize: '12px',
                                      textAlign: 'center',
                                    }}
                                  ></td>
                                  <td
                                    style={{
                                      fontSize: '12px',
                                      textAlign: 'center',
                                    }}
                                  >
                                    Taxable Amount
                                  </td>
                                  <td
                                    style={{
                                      fontSize: '12px',
                                      textAlign: 'center',
                                    }}
                                  >
                                    CGST
                                  </td>
                                  <td
                                    style={{
                                      fontSize: '12px',
                                      textAlign: 'center',
                                    }}
                                  >
                                    SGST
                                  </td>
                                  <td
                                    style={{
                                      fontSize: '12px',
                                      textAlign: 'center',
                                    }}
                                  >
                                    Total Amount
                                  </td>
                                </tr>
                                {OrderDetailGST?.map((item) => (
                                  <tr>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'right',
                                      }}
                                    >
                                      {item?.TaxPercentage || 0}%
                                    </td>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'center',
                                      }}
                                    >
                                      {Number(item.WithOutTaxAmount).toFixed(2)}
                                    </td>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'center',
                                      }}
                                    >
                                      {Number(item.CGST).toFixed(2)}
                                    </td>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'center',
                                      }}
                                    >
                                      {Number(item.SGST).toFixed(2)}
                                    </td>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        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: '12px',
                                        textAlign: 'center',
                                      }}
                                    ></td>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'center',
                                      }}
                                    >
                                      Taxable Amount
                                    </td>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'center',
                                      }}
                                    >
                                      IGST (
                                      {OrderDetailIGST?.[0]?.TaxPercentage}
                                      %)
                                    </td>

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

                                      <td
                                        style={{
                                          fontSize: '12px',
                                          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: '12px',
                                        textAlign: 'center',
                                      }}
                                    ></td>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'center',
                                      }}
                                    >
                                      Taxable Amount
                                    </td>
                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'center',
                                      }}
                                    >
                                      VAT ({OrderDetailVAT?.[0]?.TaxPercentage}
                                      %)
                                    </td>

                                    <td
                                      style={{
                                        fontSize: '12px',
                                        textAlign: 'center',
                                      }}
                                    >
                                      Total Amount
                                    </td>
                                  </tr>
                                  {OrderDetailVAT?.map((item) => (
                                    <tr>
                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'right',
                                        }}
                                      >
                                        {item?.TaxPercentage || 0}%
                                      </td>
                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'center',
                                        }}
                                      >
                                        {Number(item.WithOutTaxAmount).toFixed(
                                          2
                                        )}
                                      </td>
                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'center',
                                        }}
                                      >
                                        {Number(item.TaxAmt).toFixed(2)}
                                      </td>
                                      <td
                                        style={{
                                          fontSize: '12px',
                                          textAlign: 'center',
                                        }}
                                      >
                                        {Number(item.TotalAmt).toFixed(2)}
                                      </td>
                                    </tr>
                                  ))}
                                </table>
                              </>
                            )}
                        </div>
                        <hr className="PrintStyle1-print-dottline" />
                      </>
                    )}
                </div>
              )}
              {table2Data?.BookingTypeName === 'Dine In' && dinePreference && (
                <div>
                  {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && (
                    <div
                      style={{
                        marginLeft: '10px',
                        padding: 0,
                        fontSize: '12px',
                        fontWeight: '600',
                      }}
                    >
                      Captain:{' '}
                      {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
                    </div>
                  )}
                </div>
              )}

              {GlobaldummyData
                ? GlobalCredit && (
                  <div
                    style={{
                      textAlign: 'left',
                      fontSize: '12px',
                      padding: 0,
                      margin: 0,
                      fontWeight: '600',
                      lineHeight: '14px',
                    }}
                  >
                    <h6>Advance Amount:</h6>
                    <h6>Opening Balance:</h6>
                  </div>
                )
                : CreditDetails &&
                table2Data?.CustomerDetails?.length > 0 && (
                  <div
                    style={{
                      fontSize: '12px',
                      fontWeight: '600',
                      lineHeight: '14px',
                    }}
                  >
                    {(() => {
                      const c = table2Data.CustomerDetails[0];
                      const items = [];

                      if (
                        PaymentStatusSuccess?.[0]?.PaymentTypeName ===
                        'Credit'
                      ) {
                        if (c.OldCreditBal !== 0) {
                          items.push({
                            label:
                              c.OldCreditBal > 0
                                ? 'Advance Amount'
                                : 'Opening Balance',
                            value: Math.abs(c.OldCreditBal).toFixed(2),
                          });
                        }
                      }

                      if (c.CurrentCreditBal !== 0) {
                        items.push({
                          label:
                            c.CurrentCreditBal > 0
                              ? 'Current Advance Amount'
                              : 'Current Balance Amount',
                          value: Math.abs(c.CurrentCreditBal).toFixed(2),
                        });
                      }

                      return items.map((i, idx) => (
                        <p
                          key={idx}
                          style={{
                            display: 'grid',
                            gridTemplateColumns: '4fr  1fr 1fr',
                            // gridTemplateColumns: "auto auto auto",
                            margin: 0,
                            padding: 0,
                          }}
                        >
                          <span style={{ textAlign: 'left' }}>{i.label}</span>
                          <span style={{ textAlign: 'center' }}>:</span>
                          <span style={{ textAlign: 'right' }}>
                            {i.value}
                          </span>
                        </p>
                      ));
                    })()}
                  </div>
                )}

              <div
                style={{
                  display: 'flex',
                  justifyContent: 'space-evenly',
                  marginTop: '5px',
                }}
                className="PrintStyle1-payment-line"
              >
                <div
                  style={{
                    marginTop: '5px',
                    padding: 0,
                    fontSize: '17px',
                    fontWeight: '600',
                  }}
                >
                  {PaymentStatusSuccess?.length === 1
                    ? PaymentStatusSuccess?.[0]?.PaymentTypeName
                    : 'Split'}{' '}
                  &nbsp; Payment : ₹
                  {GlobaldummyData
                    ? '1066'
                    : Number(table2Data?.NetAmount).toFixed(2)}
                  /-{' '}
                </div>
              </div>

              <h6
                style={{
                  textAlign: 'center',
                  marginTop: '5px',
                  fontSize: '12px',
                }}
              >
                YOUR ORDER NO:{' '}
                {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
              </h6>
              {sportsAppPreference && MembershipApplied && (
                <div
                  style={{
                    fontWeight: 'bold',
                    width: '100%',
                    textAlign: 'center',
                  }}
                >{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}</div>
              )}
              {GlobaldummyData
                ? GlobalQrcodet && (
                  <div
                    style={{
                      display: 'flex',
                      flexDirection: 'column',
                      justifyContent: 'center',
                      alignItems: 'center',
                    }}
                  >
                    {/* <img style={{ width: '75px', height: '75px' }} src={QRcode} alt='QRcode' /> */}
                    <QRCode
                      value={`upi://pay?pa=${UpiId}&pn=Merchant&am=${table2Data?.NetAmount}&cu=INR`}
                      size={80}
                    />
                    <div style={{ fontSize: '12px' }}>Scan to Pay </div>
                    <div style={{ fontSize: '12px' }}>
                      ₹
                      {GlobaldummyData
                        ? '1,066'
                        : Number(table2Data?.NetAmount).toFixed(2)}
                    </div>
                  </div>
                )
                : !estimatePrintHeader && table2Data?.OrderType === 'E'
                  ? ''
                  : Qrcodet &&
                  paymentTypeUPI && (
                    <div
                      style={{
                        display: 'flex',
                        flexDirection: 'column',
                        justifyContent: 'center',
                        alignItems: 'center',
                      }}
                    >
                      <QRCode
                        value={`upi://pay?pa=${GlobalUpiID}&pn=Merchant&am=${table2Data?.NetAmount}&cu=INR`}
                        size={80}
                      />
                      <div style={{ fontSize: '10px' }}>Scan to Pay </div>
                      <div style={{ fontSize: '10px' }}>
                        ₹
                        {GlobaldummyData
                          ? '1,066'
                          : Number(table2Data?.NetAmount).toFixed(2)}
                      </div>
                    </div>
                  )}

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

              <div
                className="page-footerA4Style11"
                style={{
                  marginTop: 'auto',
                  pageBreakBefore: 'avoid',
                  pageBreakInside: 'avoid',
                  minHeight: 'auto',
                  ...footerColorStyle
                }}
              >
                {GlobaldummyData
                  ? GlobalIsnotes && (
                    <div>
                      <p
                        style={{
                          padding: '0rem 1rem',
                          marginTop: GlobalthemeFormatr ? '5vh' : '',
                        }}
                      >
                        Notes : 10 days Return policy
                      </p>

                      <hr className="PrintA4Style11-print-dottline" />
                    </div>
                  )
                  : !estimatePrintHeader && table2Data?.OrderType === 'E'
                    ? ''
                    : Notestext && (
                      <div>
                        <p
                          style={{
                            padding: '0rem 1rem',
                            textAlign: 'center',
                          }}
                        >
                          {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',
                  }}
                >
                  {GlobaldummyData
                    ? GlobaltermsAndConditions && (
                      <div
                        style={{
                          margin: '8px 0',
                          padding: '8px',
                          fontFamily: 'sans-serif',
                          width: '100%',
                        }}
                      >
                        <p
                          style={{
                            fontSize: '13px',
                            fontWeight: 'bold',
                            marginBottom: '6px',
                          }}
                        >
                          Terms & Conditions
                        </p>
                        <ol
                          style={{
                            fontSize: '12px',
                            paddingLeft: '18px',
                            margin: 0,
                            lineHeight: '1',
                          }}
                        >
                          <li>
                            Once goods are sold, they are not exchangeable or
                            refundable.
                          </li>
                          <li>
                            Please check the product before leaving the
                            counter.
                          </li>
                        </ol>
                      </div>
                    )
                    : !estimatePrintHeader && table2Data?.OrderType === 'E'
                      ? ''
                      : 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>
                      )}

                  {GlobaldummyData
                    ? GlobalSignature && (
                      <div
                        style={{
                          display: 'flex',
                          flexDirection: 'column',
                          alignItems: 'flex-end',
                          paddingBottom: '1rem',
                        }}
                      >
                        <p
                          style={{
                            fontSize: '13px',
                            fontWeight: 'bold',
                            marginBottom: '6px',
                          }}
                        >
                          Signature
                        </p>
                        <img
                          style={{ width: '70px', height: '40px' }}
                          src={
                            GlobalSignatureImages
                              ? GlobalSignatureImages
                              : signature
                          }
                          alt=""
                        />
                      </div>
                    )
                    : !estimatePrintHeader && table2Data?.OrderType === 'E'
                      ? ''
                      : 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>
                {PrintGreeting?.SettingValue === 'Y' && (
                  <div
                    style={{
                      display: 'flex',
                      justifyContent: 'center',
                      alignItems: 'center',
                      fontWeight: '600',
                    }}
                  >
                    Thank You Visit Again
                  </div>
                )}
              </div>
            </>
          )}
        </div >
      ) : (
        <div
          className="PrintStyle1MasterDiv"
          id={`PrintStyle1-${index}`}
          style={{ fontFamily: "'Courier New', Courier, monospace" }}
        >
          <div
            style={{
              display: "flex",
              justifyContent: "center",
              ...(GlobaldummyData
                ? {
                  color: SelectedHeaderFontColor,
                  backgroundColor: SelectedHeaderColor,
                }
                : {
                  color: headerColor?.font,
                  backgroundColor: headerColor?.background,
                }),
            }}
          >
            {GlobaldummyData ? (
              GlobalLogo && (
                <img
                  className="PrintStyle2-BrandImage"
                  src={Logo}
                  alt="image"
                />
              )
            ) : !estimatePrintHeader && table2Data?.OrderType === 'E' ? (
              ''
            ) : base64Image &&
              (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
              <img
                className="PrintStyle2-BrandImage"
                src={base64Image}
                alt="image"
                width={'100px'}
              />
            ) : null}
          </div>
          {!estimatePrintHeader && table2Data?.OrderType === 'E' ? (
            ''
          ) : (
            <div className="PrintStyle1-print"
              style={
                GlobaldummyData
                  ? { color: SelectedHeaderFontColor, backgroundColor: SelectedHeaderColor }
                  : { color: headerColor?.font, backgroundColor: headerColor?.background }
              }>
              <div
                style={{
                  fontSize: 'clamp(2rem, 2.5vw, 2rem)',
                  fontWeight: '600',
                  // color: SelectedHeaderColor,
                }}
              >
                {' '}
                {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
              </div>
              <div style={{ fontWeight: '600' }}>
                {GlobaldummyData
                  ? 'BranchAddress, Town- 635XXX City - State'
                  : (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>
              {(GlobaldummyData || table2Data?.BrMobile) && <div style={{ fontWeight: '600' }}>
                {' '}
                Mobile : +91{' '}
                {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
              </div>}
              {table2Data?.OrderType === 'E' && estimateTitle && (
                <div
                  style={{
                    fontSize: '14px',
                    margin: '2px 0 0 0',
                    padding: 0,
                    fontWeight: 600,
                  }}
                >
                  Estimate{' '}
                  {/* {SalesModePref?.SettingValue == 'Y' &&
                    `(${table2Data?.SalesMode})`} */}
                </div>
              )}
              {table2Data?.OrderType === 'E' ? (
                ''
              ) : (
                <div
                  style={{
                    fontSize: '14px',
                    margin: '2px 0 0 0',
                    padding: 0,
                    fontWeight: 600,
                  }}
                >
                  {GlobaldummyData
                    ? GlobalBilltext
                      ? GlobalBilltext
                      : 'Cash' + ' Bill'
                    : BillName
                      ? BillName
                      : PaymentStatusSuccess?.length === 1
                        ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill'
                        : ''}
                  {SalesModePref?.SettingValue == 'Y' &&
                    `(${table2Data?.SalesMode})`}
                </div>
              )}
            </div>
          )}

          {!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && (
            <div
              style={{
                fontSize: '14px',
                margin: '2px 0 0 0',
                padding: 0,
                fontWeight: 600,
                textAlign: 'center',
              }}
            >
              Estimate{' '}
              {/* {SalesModePref?.SettingValue == 'Y' &&
                `(${table2Data?.SalesMode})`} */}
            </div>
          )}
          <hr className="PrintStyle1-print-dottline" />

          {/* orderdetails  */}

          <div className="PrintStyle1-print-ordr-dtls">
            <div>
              {table2Data?.BookingTypeName === 'Dine In' && dinePreference && (
                <div style={{ fontWeight: '600', fontSize: '14px' }}>
                  {' '}
                  Table :{' '}
                  {table2Data?.SalesTableLinkDetails?.[0]?.TableName}{' '}
                </div>
              )}
              {GlobaldummyData && GlobalCashierName && (
                <div style={{ fontWeight: '600', fontSize: '12px' }}>
                  {' '}
                  Cashier : Cashier Name
                </div>
              )}
              {CashierName &&
                CashierName !== undefined &&
                CashierName !== null &&
                !GlobaldummyData &&
                CashierNameField && (
                  <div style={{ fontWeight: '600', fontSize: '12px' }}>
                    Cashier : {CashierName}
                  </div>
                )}
              {GlobaldummyData && (
                <div style={{ fontWeight: '600', fontSize: '12px' }}>
                  {' '}
                  Customer : Customer Name
                </div>
              )}
              {table2Data?.CustSuppName &&
                table2Data?.CustSuppName !== undefined &&
                table2Data?.CustSuppName !== null &&
                !GlobaldummyData && (
                  <div style={{ fontWeight: '600', fontSize: '12px' }}>
                    Customer : {table2Data?.CustSuppName}
                  </div>
                )}
              <div style={{ fontWeight: '600', fontSize: '14px' }}>
                {' '}
                BillNo:
                {GlobaldummyData
                  ? '121'
                  : table2Data?.OrderId &&
                  extractLastNumberOrderId(
                    table2Data?.OrderId,
                    table2Data?.FYStatus
                  )}
              </div>
            </div>

            <div>
              <div style={{ fontWeight: '600' }}>
                {' '}
                Date : {GlobaldummyData ? formattedDate : Date1}{' '}
              </div>
            </div>
          </div>

          {/* orderdetails  */}

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

          {/* itemdata  (loop) */}

          {(TakeawayData?.length > 0 || GlobaldummyData) && (
            <>
              {takeAwayPreference && (
                <div
                  style={{
                    display: 'flex',
                    width: '100%',
                    justifyContent: 'center',
                    alignItems: 'center',
                    fontSize: '12px',
                    fontWeight: '600',
                  }}
                >
                  Take Away
                </div>
              )}

              <div className="PrintStyle1-print-tableMaster">
                <table className="PrintStyle1-print-table">
                  <thead>
                    <tr>
                      {GlobaldummyData
                        ? GlobalSlNo && <th style={{ ...headerStyle, width: '10px' }}>S.No</th>
                        : SLNO == true && (
                          <th style={{ ...headerStyle, width: '10px' }}>S.No</th>
                        )}
                      {GlobaldummyData
                        ? GlobalItem && (
                          <th style={{ ...headerStyle, textAlign: 'left' }}>Item</th>
                        )
                        : Item == true && <th style={{ ...headerStyle }}>Item</th>}
                      {GlobaldummyData
                        ? GlobalHsnCode && (
                          <th style={{ ...headerStyle, width: '10px' }}>HSN</th>
                        )
                        : HsnCode == true && (
                          <th style={{ ...headerStyle, width: '10px' }}>HSN</th>
                        )}
                      {GlobaldummyData
                        ? GlobalQuantity && (
                          <th style={{ ...headerStyle, width: '10px' }}>Qty</th>
                        )
                        : Quantity == true && (
                          <th style={{ ...headerStyle, width: '10px' }}>
                            {WeightasKg ? 'Qty/Kg' : 'Qty'}
                          </th>
                        )}
                      {GlobaldummyData
                        ? GlobalMRP && <th style={{ ...headerStyle, width: '10px' }}>MRP</th>
                        : MRP == true && <th style={{ ...headerStyle, width: '10px' }}>MRP</th>}
                      {GlobaldummyData
                        ? GlobalRate && <th style={{ ...headerStyle, width: '10px' }}>Rate</th>
                        : Rate == true && (
                          <th style={{ ...headerStyle, width: '10px' }}>Rate</th>
                        )}
                      {GlobaldummyData
                        ? GlobalDiscount && (
                          <th style={{ ...headerStyle, width: '10px' }}>Dis </th>
                        )
                        : Discount == true && (
                          <th style={{ ...headerStyle, width: '10px' }}>Dis </th>
                        )}
                      {GlobaldummyData
                        ? GlobalTax && <th style={{ ...headerStyle, width: '10px' }}>Tax %</th>
                        : Tax == true &&
                        table2Data?.OrderType !== 'E' && (
                          <th style={{ ...headerStyle, width: '10px' }}>Tax %</th>
                        )}
                      {GlobaldummyData
                        ? GlobalAmount && (
                          <th style={{ ...headerStyle, width: '10px', textAlign: 'right' }}>
                            Amt
                          </th>
                        )
                        : Amount == true && (
                          <th style={{ ...headerStyle, width: '10px', textAlign: 'right' }}>
                            Amt
                          </th>
                        )}
                    </tr>
                  </thead>
                  <tbody>
                    {(GlobaldummyData ? products : TakeawayData)?.map(
                      (item, index) => (
                        <tr key={index}
                          style={
                            index % 2 !== 1 && rowtypeStyle === "even"
                              ? {
                                ...tableBodyStyle
                              }
                              : index % 2 === 1 && rowtypeStyle === "odd"
                                ? {
                                  ...tableBodyStyle
                                }
                                : {}
                          }>
                          {GlobaldummyData
                            ? GlobalSlNo && (
                              <td style={{ textAlign: 'center' }}>
                                {index + 1}
                              </td>
                            )
                            : SLNO == true && (
                              <td style={{ textAlign: 'center' }}>
                                {index + 1}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalItem && <td>{item?.ProdName}</td>
                            : Item == true && (
                              <td

                              >
                                <div>{item?.ProdName}</div>
                                {PackageDetails?.filter(
                                  (pkg) => pkg.ProdId === item.ProdId
                                ).length > 0 ? (
                                  <div>
                                    {PackageDetails?.filter(
                                      (pkg) => pkg.ProdId === item.ProdId
                                    )?.map((item, index) => (
                                      <span
                                        key={index}
                                        style={{ display: 'block' }}
                                      >
                                        {item.ParcelCount} PCS{' '}
                                        {item.ParcelQty} PACK (
                                        {item.ParcelType})
                                      </span>
                                    ))}
                                  </div>
                                ) : (
                                  UomPrint?.SettingValue === 'Y' &&
                                  <div>
                                    ({item?.Size ? item?.Size : '1'}{' '}
                                    {item?.SinglePc == 'Y'
                                      ? 'PCS'
                                      : item?.Type != 'C'
                                        ? item?.UomName
                                        : 'COMBO'}
                                    )
                                  </div>
                                )}
                                {sportsAppPreference &&
                                  `${item?.BookingDate?.trim()
                                    ? `(${dateFormatChange(item.BookingDate)})`
                                    : ''
                                  } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`}
                                &nbsp;{' '}
                                {item?.BrandName !== null
                                  ? item?.BrandName
                                  : ''}
                                &nbsp;
                                <div style={{ display: 'flex', gap: "3px", flexDirection: "column" }}>
                                  {item?.ProductIdentifierDtls?.length > 0
                                    ? item?.ProductIdentifierDtls.filter(
                                      (items) =>
                                        items.SerialNumber &&
                                        items.SerialNumber !== ''
                                    ).map((a, i) => (
                                      <div key={i}>{a.SerialNumber}</div>
                                    ))
                                    : ''}
                                  {item?.ProductIdentifierDtls?.length > 0
                                    ? item?.ProductIdentifierDtls.filter(
                                      (id) => id.IMEI1 !== '' || id.IMEI2 !== ''
                                    ).map((id, i) => {
                                      const imei1 = id.IMEI1 || '';
                                      const imei2 = id.IMEI2 || '';
                                      return (
                                        <div key={i}>
                                          {[imei1, imei2]
                                            .filter(Boolean)
                                            .join(',')}
                                        </div>
                                      );
                                    })
                                    : ''}
                                  {item?.ProductIdentifierDtls?.length > 0 &&
                                    item?.ProductIdentifierDtls.find(
                                      (items) =>
                                        items.SerialNumber || items.IMEI1 || items.IMEI2
                                    )?.Description && (
                                      <div>{item.ProductIdentifierDtls.find(
                                        (items) =>
                                          items.SerialNumber || items.IMEI1 || items.IMEI2
                                      ).Description}</div>
                                    )}
                                </div>
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalHsnCode && (
                              <td style={{ textAlign: 'center' }}>
                                {item?.HSN}
                              </td>
                            )
                            : HsnCode == true && (
                              <td style={{ textAlign: 'center' }}>
                                {item?.HSN}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalQuantity && (
                              <td style={{ textAlign: 'center' }}>
                                {item?.SalesQty}
                              </td>
                            )
                            : Quantity == true && (
                              <td style={{ textAlign: 'center' }}>
                                {item?.SalesQty}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalMRP && (
                              <td style={{ textAlign: 'right' }}>
                                {item?.MRP}
                              </td>
                            )
                            : MRP == true && (
                              <td style={{ textAlign: 'right' }}>
                                {item?.SinglePc === 'Y'
                                  ? item?.Rate
                                  : item?.MRP}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalRate && (
                              <td style={{ textAlign: 'right' }}>
                                {item?.Rate}
                              </td>
                            )
                            : Rate == true && (
                              <td style={{ textAlign: 'right' }}>
                                {' '}
                                {item?.Rate}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalDiscount && <td>{item.discount}</td>
                            : Discount == true && (
                              <td style={{ textAlign: 'right' }}>
                                {item?.Type != 'C'
                                  ? item?.OfferAmt || 0
                                  : item?.OfferValue || 0}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalTax && (
                              <td style={{ textAlign: 'center' }}>
                                {item.ProdTaxPercentage || 0}
                              </td>
                            )
                            : Tax == true &&
                            table2Data?.OrderType !== 'E' && (
                              <td style={{ textAlign: 'center' }}>
                                {item?.ProdTaxPercentage}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalAmount && (
                              <td style={{ textAlign: 'right' }}>
                                {item?.TotalAmt}
                              </td>
                            )
                            : Amount == true && (
                              <td style={{ textAlign: 'right' }}>
                                {item?.Type != 'C'
                                  ? item?.TotalAmt - item?.OfferAmt || 0
                                  : item?.TotalAmt - item?.OfferValue || 0}
                              </td>
                            )}
                        </tr>
                      )
                    )}
                  </tbody>
                </table>
              </div>
            </>
          )}
          {DineInData?.length > 0 && dinePreference && (
            <>
              <div
                style={{
                  display: 'flex',
                  width: '100%',
                  justifyContent: 'center',
                  alignItems: 'center',
                  fontSize: '12px',
                  fontWeight: '600',
                }}
              >
                Dine In
              </div>

              <div className="PrintStyle1-print-tableMaster">
                <table className="PrintStyle1-print-table">
                  <thead>
                    <tr>
                      {GlobaldummyData
                        ? GlobalSlNo && <th style={{ ...headerStyle, width: '10px' }}>S.No</th>
                        : SLNO == true && (
                          <th style={{ ...headerStyle, width: '10px' }}>S.No</th>
                        )}
                      {GlobaldummyData
                        ? GlobalItem && <th style={{ ...headerStyle, }}>Item</th>
                        : Item == true && <th style={{ ...headerStyle, }}>Item</th>}
                      {GlobaldummyData
                        ? GlobalHsnCode && (
                          <th style={{ ...headerStyle, width: '10px' }}>HSN</th>
                        )
                        : HsnCode == true && (
                          <th style={{ ...headerStyle, width: '10px' }}>HSN</th>
                        )}
                      {GlobaldummyData
                        ? GlobalQuantity && (
                          <th style={{ ...headerStyle, width: '10px' }}>Qty</th>
                        )
                        : Quantity == true && (
                          <th style={{ ...headerStyle, width: '10px' }}>
                            {WeightasKg ? 'Qty/Kg' : 'Qty'}
                          </th>
                        )}
                      {GlobaldummyData
                        ? GlobalMRP && <th style={{ ...headerStyle, width: '10px' }}>MRP</th>
                        : MRP == true && <th style={{ ...headerStyle, width: '10px' }}>MRP</th>}
                      {GlobaldummyData
                        ? GlobalRate && <th style={{ ...headerStyle, width: '10px' }}>Rate</th>
                        : Rate == true && (
                          <th style={{ ...headerStyle, width: '10px' }}>Rate</th>
                        )}
                      {GlobaldummyData
                        ? GlobalDiscount && (
                          <th style={{ ...headerStyle, width: '10px' }}>Dis </th>
                        )
                        : Discount == true && (
                          <th style={{ ...headerStyle, width: '10px' }}>Dis </th>
                        )}
                      {GlobaldummyData
                        ? GlobalTax && <th style={{ ...headerStyle, width: '10px' }}>Tax %</th>
                        : Tax == true &&
                        table2Data?.OrderType !== 'E' && (
                          <th style={{ ...headerStyle, width: '10px' }}>Tax %</th>
                        )}
                      {GlobaldummyData
                        ? GlobalAmount && (
                          <th style={{ ...headerStyle, width: '10px', textAlign: 'right' }}>
                            Amt
                          </th>
                        )
                        : Amount == true && (
                          <th style={{ ...headerStyle, width: '10px', textAlign: 'right' }}>
                            Amt
                          </th>
                        )}
                    </tr>
                  </thead>
                  <tbody>
                    {(GlobaldummyData ? products : DineInData)?.map(
                      (item, index) => (
                        <tr key={index}
                          style={
                            index % 2 !== 1 && rowtypeStyle === "even"
                              ? {
                                ...tableBodyStyle
                              }
                              : index % 2 === 1 && rowtypeStyle === "odd"
                                ? {
                                  ...tableBodyStyle
                                }
                                : {}
                          }>
                          {GlobaldummyData
                            ? GlobalSlNo && (
                              <td style={{ textAlign: 'center' }}>
                                {index + 1}
                              </td>
                            )
                            : SLNO == true && (
                              <td style={{ textAlign: 'center' }}>
                                {index + 1}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalItem && <td>{item?.ProdName}</td>
                            : Item == true && (
                              <td

                              >
                                <div>{item?.ProdName}</div>
                                {UomPrint?.SettingValue === 'Y' &&
                                  <div>
                                    ({item?.Size ? item?.Size : '1'}{' '}
                                    {item?.SinglePc == 'Y'
                                      ? 'PCS'
                                      : item?.Type != 'C'
                                        ? item?.UomName
                                        : 'COMBO'}
                                    )
                                  </div>
                                }
                                {sportsAppPreference &&
                                  `${item?.BookingDate?.trim()
                                    ? `(${dateFormatChange(item.BookingDate)})`
                                    : ''
                                  } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalHsnCode && (
                              <td style={{ textAlign: 'center' }}>
                                {item?.HSN}
                              </td>
                            )
                            : HsnCode == true && (
                              <td style={{ textAlign: 'center' }}>
                                {item?.HSN}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalQuantity && (
                              <td style={{ textAlign: 'center' }}>
                                {item?.SalesQty}
                              </td>
                            )
                            : Quantity == true && (
                              <td style={{ textAlign: 'center' }}>
                                {item?.SalesQty}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalMRP && (
                              <td style={{ textAlign: 'right' }}>
                                {item?.MRP}
                              </td>
                            )
                            : MRP == true && (
                              <td style={{ textAlign: 'right' }}>
                                {item?.SinglePc === 'Y'
                                  ? item?.Rate
                                  : item?.MRP}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalRate && (
                              <td style={{ textAlign: 'right' }}>
                                {item?.Rate}
                              </td>
                            )
                            : Rate == true && (
                              <td style={{ textAlign: 'right' }}>
                                {' '}
                                {item?.Rate}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalDiscount && <td>{item.discount}</td>
                            : Discount == true && (
                              <td>
                                {' '}
                                {item?.Type != 'C'
                                  ? item?.OfferAmt || 0
                                  : item?.OfferValue || 0}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalTax && (
                              <td style={{ textAlign: 'center' }}>
                                {item.ProdTaxPercentage || 0}
                              </td>
                            )
                            : Tax == true &&
                            table2Data?.OrderType !== 'E' && (
                              <td style={{ textAlign: 'center' }}>
                                {item?.ProdTaxPercentage || 0}
                              </td>
                            )}
                          {GlobaldummyData
                            ? GlobalAmount && (
                              <td style={{ textAlign: 'right' }}>
                                {item?.TotalAmt}
                              </td>
                            )
                            : Amount == true && (
                              <td style={{ textAlign: 'right' }}>
                                {item?.Type != 'C'
                                  ? item?.TotalAmt - item?.OfferAmt || 0
                                  : item?.TotalAmt - item?.OfferValue || 0}
                              </td>
                            )}
                        </tr>
                      )
                    )}
                  </tbody>
                </table>
              </div>
            </>
          )}
          {/* itemdata  */}

          <hr className="PrintStyle1-print-dottline" />
          <div
            style={{
              display: 'flex',
              justifyContent: 'space-around',
              width: '95%',
              whiteSpace: 'nowrap',
              fontSize: '10px',
              flexWrap: 'wrap',
              gap: '2px',
            }}
          >
            <div
              style={{
                margin: 0,
                padding: 0,
                fontSize: '10px',
                fontWeight: '600',
              }}
            >
              {' '}
              Items:{GlobaldummyData ? '7' : totalQuantityFilter?.length}
            </div>
            <div
              style={{
                margin: 0,
                padding: 0,
                fontSize: '10px',
                fontWeight: '600',
              }}
            >
              {' '}
              Qty:{GlobaldummyData ? '9' : totalQuantity}
            </div>
            {/* {ExtraChargeTotal > 0 && <p style={{ margin: 0, padding: 0, fontSize: "12px" }}> Extra Charges:{ExtraChargeTotal}</p>} */}

            {(TotalOfferAmount > 0 || table2Data?.OverallDisc > 0) && (
              <p
                style={{
                  margin: 0,
                  padding: 0,
                  fontSize: '10px',
                  fontWeight: '600',
                }}
              >
                Off :
                {(
                  Number(TotalOfferAmount || 0) +
                  Number(table2Data?.OverallDisc || 0)
                ).toFixed(2)}
              </p>
            )}
            <div
              style={{
                margin: 0,
                padding: 0,
                fontSize: '10px',
                fontWeight: '600',
                ...netAmountStyle
              }}
            >
              Amount :₹
              {GlobaldummyData
                ? '1066'
                : Number(table2Data?.NetAmount).toFixed(2)}
            </div>
          </div>

          {DineInData?.length > 0 && TakeawayData?.length > 0 && (
            <>
              {takeAwayPreference && (
                <div>Takeaway:&nbsp;{Number(TakeawayTotal).toFixed(2)}</div>
              )}
              {dinePreference && (
                <div>Dine In:&nbsp;{Number(DineInTotal).toFixed(2)} </div>
              )}
            </>
          )}
          {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && (
            <>
              {/* <p>Split Payment:</p> */}
              {Object.keys(aggregatedPayments).map((paymentType) => (
                <div
                  key={paymentType}
                  style={{ margin: 0, padding: 0, fontSize: '12px' }}
                >
                  {paymentType}: {aggregatedPayments[paymentType].toFixed(2)}
                </div>
              ))}
            </>
          )}
          {isEditedBill && lastTransaction && (
            <div style={{
              width: '100%', marginTop: '2px',
              paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'center',
              flexDirection: 'column', borderTop: '1px dashed #000'
            }}>
              <div
                style={{
                  fontSize: '10px',
                  width: '90%'
                }}
              >
                <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                  <span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
                  <strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
                </div>
                <div
                  style={{
                    display: 'flex',
                    justifyContent: 'space-between',
                    fontWeight: 600,
                    color:
                      lastTransaction?.AdjustmentType === 'REFUND'
                        ? '#000'
                        : '#000',
                  }}
                >
                  <span>{'Adjustment Amount'}</span>
                  <span>
                    {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
                    {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
                      (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
                  </span>
                </div>
                <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px', }}>
                  <span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
                  <strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
                </div>
              </div>
            </div>
          )}
          {table2Data?.OrderType === 'E' ? (
            ''
          ) : (
            <div>
              {((OrderDetailGST?.length > 0 &&
                OrderDetailGST?.[0]?.TaxAmt > 0) ||
                (OrderDetailIGST?.length > 0 &&
                  OrderDetailIGST?.[0]?.TaxAmt > 0) ||
                (OrderDetailVAT?.length > 0 &&
                  OrderDetailVAT?.[0]?.TaxAmt > 0)) &&
                table2Data?.NetAmount !== 0 && (
                  <>
                    <hr className="PrintStyle1-print-dottline" />

                    <div>
                      <div
                        style={{
                          margin: 0,
                          padding: 0,
                          fontSize: '14px',
                          textAlign: 'center',
                          fontWeight: '600',
                        }}
                      >
                        --------- GST Breakup Details -----------
                      </div>
                      {OrderDetailGST?.length > 0 &&
                        OrderDetailGST?.[0]?.TaxAmt > 0 && (
                          <table style={{ width: '90%' }}>
                            <tr>
                              <td
                                style={{
                                  fontSize: '12px',
                                  textAlign: 'center',
                                }}
                              ></td>
                              <td
                                style={{
                                  fontSize: '12px',
                                  textAlign: 'center',
                                }}
                              >
                                Taxable Amount
                              </td>
                              <td
                                style={{
                                  fontSize: '12px',
                                  textAlign: 'center',
                                }}
                              >
                                CGST
                              </td>
                              <td
                                style={{
                                  fontSize: '12px',
                                  textAlign: 'center',
                                }}
                              >
                                SGST
                              </td>
                              <td
                                style={{
                                  fontSize: '12px',
                                  textAlign: 'center',
                                }}
                              >
                                Total Amount
                              </td>
                            </tr>
                            {OrderDetailGST?.map((item) => (
                              <tr>
                                <td
                                  style={{
                                    fontSize: '12px',
                                    textAlign: 'right',
                                  }}
                                >
                                  {item?.TaxPercentage || 0}%
                                </td>
                                <td
                                  style={{
                                    fontSize: '12px',
                                    textAlign: 'center',
                                  }}
                                >
                                  {Number(item.WithOutTaxAmount).toFixed(2)}
                                </td>
                                <td
                                  style={{
                                    fontSize: '12px',
                                    textAlign: 'center',
                                  }}
                                >
                                  {Number(item.CGST).toFixed(2)}
                                </td>
                                <td
                                  style={{
                                    fontSize: '12px',
                                    textAlign: 'center',
                                  }}
                                >
                                  {Number(item.SGST).toFixed(2)}
                                </td>
                                <td
                                  style={{
                                    fontSize: '12px',
                                    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: '12px',
                                    textAlign: 'center',
                                  }}
                                ></td>
                                <td
                                  style={{
                                    fontSize: '12px',
                                    textAlign: 'center',
                                  }}
                                >
                                  Taxable Amount
                                </td>
                                <td
                                  style={{
                                    fontSize: '12px',
                                    textAlign: 'center',
                                  }}
                                >
                                  IGST ({OrderDetailIGST?.[0]?.TaxPercentage}%)
                                </td>

                                <td
                                  style={{
                                    fontSize: '12px',
                                    textAlign: 'center',
                                  }}
                                >
                                  Total Amount
                                </td>
                              </tr>
                              {OrderDetailIGST?.map((item) => (
                                <tr>
                                  <td
                                    style={{
                                      fontSize: '12px',
                                      textAlign: 'right',
                                    }}
                                  >
                                    {item?.TaxPercentage || 0}%
                                  </td>
                                  <td
                                    style={{
                                      fontSize: '12px',
                                      textAlign: 'center',
                                    }}
                                  >
                                    {Number(item.WithOutTaxAmount).toFixed(2)}
                                  </td>
                                  <td
                                    style={{
                                      fontSize: '12px',
                                      textAlign: 'center',
                                    }}
                                  >
                                    {Number(item.TaxAmt).toFixed(2)}
                                  </td>

                                  <td
                                    style={{
                                      fontSize: '12px',
                                      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: '12px',
                                    textAlign: 'center',
                                  }}
                                ></td>
                                <td
                                  style={{
                                    fontSize: '12px',
                                    textAlign: 'center',
                                  }}
                                >
                                  Taxable Amount
                                </td>
                                <td
                                  style={{
                                    fontSize: '12px',
                                    textAlign: 'center',
                                  }}
                                >
                                  VAT ({OrderDetailVAT?.[0]?.TaxPercentage}%)
                                </td>

                                <td
                                  style={{
                                    fontSize: '12px',
                                    textAlign: 'center',
                                  }}
                                >
                                  Total Amount
                                </td>
                              </tr>
                              {OrderDetailVAT?.map((item) => (
                                <tr>
                                  <td
                                    style={{
                                      fontSize: '12px',
                                      textAlign: 'right',
                                    }}
                                  >
                                    {item?.TaxPercentage || 0}%
                                  </td>
                                  <td
                                    style={{
                                      fontSize: '12px',
                                      textAlign: 'center',
                                    }}
                                  >
                                    {Number(item.WithOutTaxAmount).toFixed(2)}
                                  </td>
                                  <td
                                    style={{
                                      fontSize: '12px',
                                      textAlign: 'center',
                                    }}
                                  >
                                    {Number(item.TaxAmt).toFixed(2)}
                                  </td>
                                  <td
                                    style={{
                                      fontSize: '12px',
                                      textAlign: 'center',
                                    }}
                                  >
                                    {Number(item.TotalAmt).toFixed(2)}
                                  </td>
                                </tr>
                              ))}
                            </table>
                          </>
                        )}
                    </div>
                    <hr className="PrintStyle1-print-dottline" />
                  </>
                )}
            </div>
          )}
          {table2Data?.BookingTypeName === 'Dine In' && (
            <div>
              {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && (
                <div
                  style={{
                    marginLeft: '10px',
                    padding: 0,
                    fontSize: '12px',
                    fontWeight: '600',
                  }}
                >
                  Captain: {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
                </div>
              )}
            </div>
          )}
          {GlobaldummyData
            ? GlobalCredit && (
              <div
                style={{
                  textAlign: 'left',
                  fontSize: '12px',
                  padding: 0,
                  margin: 0,
                  fontWeight: '600',
                  lineHeight: '14px',
                }}
              >
                <h6>Advance Amount:</h6>
                <h6>Opening Balance:</h6>
              </div>
            )
            : CreditDetails &&
            table2Data?.CustomerDetails?.length > 0 && (
              <div
                style={{
                  fontSize: '12px',
                  fontWeight: '600',
                  lineHeight: '14px',
                }}
              >
                {(() => {
                  const c = table2Data.CustomerDetails[0];
                  const items = [];

                  if (
                    PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit'
                  ) {
                    if (c.OldCreditBal !== 0) {
                      items.push({
                        label:
                          c.OldCreditBal > 0
                            ? 'Advance Amount'
                            : 'Opening Balance',
                        value: Math.abs(c.OldCreditBal).toFixed(2),
                      });
                    }
                  }

                  if (c.CurrentCreditBal !== 0) {
                    items.push({
                      label:
                        c.CurrentCreditBal > 0
                          ? 'Current Advance Amount'
                          : 'Current Balance Amount',
                      value: Math.abs(c.CurrentCreditBal).toFixed(2),
                    });
                  }

                  return items.map((i, idx) => (
                    <p
                      key={idx}
                      style={{
                        display: 'grid',
                        gridTemplateColumns: '4fr  1fr 1fr',
                        // gridTemplateColumns: "auto auto auto",
                        margin: 0,
                        padding: 0,
                      }}
                    >
                      <span style={{ textAlign: 'left' }}>{i.label}</span>
                      <span style={{ textAlign: 'center' }}>:</span>
                      <span style={{ textAlign: 'right' }}>{i.value}</span>
                    </p>
                  ));
                })()}
              </div>
            )}

          <div
            style={{
              display: 'flex',
              justifyContent: 'space-evenly',
              marginTop: '5px',
            }}
            className="PrintStyle1-payment-line"
          >
            <div
              style={{
                marginTop: '5px',
                padding: 0,
                fontSize: '15px',
                fontWeight: '600',
              }}
            >
              {PaymentStatusSuccess?.length === 1
                ? PaymentStatusSuccess?.[0]?.PaymentTypeName
                : 'Split'}{' '}
              &nbsp; Payment : ₹
              {GlobaldummyData
                ? '1066'
                : Number(table2Data?.NetAmount).toFixed(2)}
              /-{' '}
            </div>
          </div>

          <h6
            style={{ textAlign: 'center', marginTop: '5px', fontSize: '12px' }}
          >
            YOUR ORDER NO:{' '}
            {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
          </h6>
          {sportsAppPreference && MembershipApplied && (
            <div
              style={{ fontWeight: 'bold', width: '100%', textAlign: 'center' }}
            >{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}</div>
          )}
          {GlobaldummyData
            ? GlobalQrcodet && (
              <div
                style={{
                  display: 'flex',
                  flexDirection: 'column',
                  justifyContent: 'center',
                  alignItems: 'center',
                }}
              >
                {/* <img style={{ width: '75px', height: '75px' }} src={QRcode} alt='QRcode' /> */}
                <QRCode
                  value={`upi://pay?pa=${UpiId}&pn=Merchant&am=${table2Data?.NetAmount}&cu=INR`}
                  size={80}
                />
                <div style={{ fontSize: '12px' }}>Scan to Pay </div>
                <div style={{ fontSize: '12px' }}>
                  ₹
                  {GlobaldummyData
                    ? '1,066'
                    : Number(table2Data?.NetAmount).toFixed(2)}
                </div>
              </div>
            )
            : !estimatePrintHeader && table2Data?.OrderType === 'E'
              ? ''
              : Qrcodet &&
              paymentTypeUPI && (
                <div
                  style={{
                    display: 'flex',
                    flexDirection: 'column',
                    justifyContent: 'center',
                    alignItems: 'center',
                  }}
                >
                  <QRCode
                    value={`upi://pay?pa=${GlobalUpiID}&pn=Merchant&am=${table2Data?.NetAmount}&cu=INR`}
                    size={80}
                  />
                  <div style={{ fontSize: '10px' }}>Scan to Pay </div>
                  <div style={{ fontSize: '10px' }}>
                    ₹
                    {GlobaldummyData
                      ? '1,066'
                      : Number(table2Data?.NetAmount).toFixed(2)}
                  </div>
                </div>
              )}

          <hr className="PrintStyle1-print-dottline" />
          <div
            className="page-footerA4Style11"
            style={{
              marginTop: 'auto',
              pageBreakBefore: 'avoid',
              pageBreakInside: 'avoid',
              minHeight: 'auto',
              ...footerColorStyle
            }}
          >
            {GlobaldummyData
              ? GlobalIsnotes && (
                <div>
                  <p
                    style={{
                      padding: '0rem 1rem',
                      marginTop: GlobalthemeFormatr ? '5vh' : '',
                    }}
                  >
                    Notes : 10 days Return policy
                  </p>

                  <hr className="PrintA4Style11-print-dottline" />
                </div>
              )
              : !estimatePrintHeader && table2Data?.OrderType === 'E'
                ? ''
                : 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',
              }}
            >
              {GlobaldummyData
                ? GlobaltermsAndConditions && (
                  <div
                    style={{
                      margin: '8px 0',
                      padding: '8px',
                      fontFamily: 'sans-serif',
                      width: '100%',
                    }}
                  >
                    <p
                      style={{
                        fontSize: '13px',
                        fontWeight: 'bold',
                        marginBottom: '6px',
                      }}
                    >
                      Terms & Conditions
                    </p>
                    <ol
                      style={{
                        fontSize: '12px',
                        paddingLeft: '18px',
                        margin: 0,
                        lineHeight: '1',
                      }}
                    >
                      <li>
                        Once goods are sold, they are not exchangeable or
                        refundable.
                      </li>
                      <li>
                        Please check the product before leaving the counter.
                      </li>
                    </ol>
                  </div>
                )
                : !estimatePrintHeader && table2Data?.OrderType === 'E'
                  ? ''
                  : 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>
                  )}

              {GlobaldummyData
                ? GlobalSignature && (
                  <div
                    style={{
                      display: 'flex',
                      flexDirection: 'column',
                      alignItems: 'flex-end',
                      paddingBottom: '1rem',
                    }}
                  >
                    <p
                      style={{
                        fontSize: '13px',
                        fontWeight: 'bold',
                        marginBottom: '6px',
                      }}
                    >
                      Signature
                    </p>
                    <img
                      style={{ width: '70px', height: '40px' }}
                      src={
                        GlobalSignatureImages
                          ? GlobalSignatureImages
                          : signature
                      }
                      alt=""
                    />
                  </div>
                )
                : !estimatePrintHeader && table2Data?.OrderType === 'E'
                  ? ''
                  : 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
              style={{
                display: 'flex',
                justifyContent: 'center',
                alignItems: 'center',
                fontWeight: '600',
              }}
            >
              Thank You Visit Again
            </div>
          )}
        </div>
      )}
    </>
  );
};

export default PrintStyle1;
