import { useDispatch } from 'react-redux';
import '../../Styles/PurchaseQuotation/PurchaseQuotationPrint.scss';
import { getBranchDetail } from '../../Features/BrachLogin/BranchLogin';
import { dateFormatChange1, getSession } from '../../Services/Others';
import { useEffect, useState } from 'react';
import moment from 'moment';
import DCPrintA4Style11 from './DCPrintTemplates/DCA4/DCPrintA4Style11';
import { useSelector } from 'react-redux';
import { GlobalDCPrintTemplate } from '../../Features/ThemeChange/ThemeChange';
import DCPrintStyle1 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle1';
import DCPrintstyle2 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle2';
import DCPrintStyle3 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle3';
import DCPrintstyle4 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle4';
import DCPrintStyle5 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle5';
import DCPrintstyle6 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle6';
import DCPrintStyle7 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle7';
import DCPrintstyle8 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle8';
import DCPrintStyle9 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle9';
import DCPrintStyle10 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle10';
import DCPrintStyle11 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle11';
import DCPrintstyle12 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle12';
import DCPrintStyleA5 from './DCPrintTemplates/DCA4/DCPrintStyleA5';
import DCA4Standard from './DCPrintTemplates/DCA4/DCA4Standard';
import DCInvicePrint from './DCPrintTemplates/DCThermalPrinter/DCInvicePrint';

const DeliveryPrint = ({
  PrintingData1,
  DCprinterTemplateStyle,
  DCPrintTemplateDtl,
}) => {
  const PrintingData = PrintingData1?.[0];
  console.log(PrintingData, 'PrintingData');
  const dispatch = useDispatch();
  const BranchId = getSession('BranchId');
  console.log(DCprinterTemplateStyle, 'DCprinterTemplateStyle');
  const Date1 = dateFormatChange1(PrintingData?.[0]?.DCDate);
  const [BranchDetails, setBranchDetails] = useState({});
  const [BranchLogo, setBranchLogo] = useState(null);
  const [BranchAddress, setBranchAddress] = useState();
  const [BranchCity, setBranchCity] = useState();
  const [BranchZip, setBranchZip] = useState();
  const [BranchName, setBranchName] = useState();
  const [base64Image, setBase64Image] = useState(null);
  const [conversionError, setConversionError] = useState(null);
  useEffect(() => {
    fetchBranchData();
  }, []);
  const imageUrlToBase64 = async (url) => {
    try {
      const response = await fetch(url);
      const blob = await response.blob();
      return new Promise((resolve, reject) => {
        const reader = new FileReader();
        reader.onloadend = () => resolve(reader.result);
        reader.onerror = reject;
        reader.readAsDataURL(blob);
      });
    } catch (error) {
      console.error('Error fetching or converting image:', error);
      throw error;
    }
  };

  // Call the function to convert the image URL to base64
  useEffect(() => {
    async function fetchImage() {
      try {
        const base64 = await imageUrlToBase64(BranchLogo);
        setBase64Image(base64);
      } catch (error) {
        setConversionError(error.message || 'Error converting image');
      }
    }
    if (BranchLogo) {
      fetchImage();
    }
  }, [BranchLogo]);

  const fetchBranchData = async () => {
    const response = await dispatch(
      getBranchDetail({ BrId: BranchId })
    ).unwrap();
    if (response?.data?.statusCode === 1) {
      console.log(response?.data?.data, 'branchdata');
      setBranchDetails(response?.data?.data?.[0]);
      setBranchName(response?.data?.data?.[0]?.BrName);
      setBranchAddress(response?.data?.data?.[0]?.Address1);
      setBranchCity(response?.data?.data?.[0]?.City);
      setBranchLogo(response?.data?.data?.[0]?.CompLogo);
    } else {
      setBranchAddress();
      setBranchCity();
      setBranchZip();
      setBranchLogo();
    }
  };
  const chunkSize = 17;
  let dataChunks = [];

  // Check if PrintingData exists and has ProductDetails
  if (PrintingData?.[0]?.ProductDetails) {
    // Only split into chunks if there are more items than chunkSize
    if (PrintingData[0].ProductDetails.length > chunkSize) {
      // Split table data into chunks
      for (
        let i = 0;
        i < PrintingData[0].ProductDetails.length;
        i += chunkSize
      ) {
        dataChunks.push(PrintingData[0].ProductDetails.slice(i, i + chunkSize));
      }
    } else {
      // If less items than chunkSize, just use one chunk
      dataChunks = [PrintingData[0].ProductDetails];
    }
  }

  console.log(dataChunks, 'dataChunksdataChunks');

  return (
    <>
      {/* <style>{PrintStyles}</style> */}{' '}
      <div className="Quo-Print-Body" id="DC-Default-Print">
        {dataChunks.length > 0 &&
          dataChunks.map((dataChunk, chunkIndex) => (
            <div className="Quo-Print-Content" key={chunkIndex}>
              <div className="Quo-Print-ComCus">
                <div className="Quo-Print-Header">
                  {base64Image ? (
                    <img
                      src={base64Image}
                      alt="Base64 Image"
                      className="Quo-print-Logo"
                      onError={(e) => console.error('Image error:', e)}
                    />
                  ) : null}
                  <div className="Quo-Print-Company">
                    <div className="Quo-Print-Cname">{BranchName}</div>
                    <div className="Quo-Print-address">{BranchAddress}</div>
                    <div className="Quo-Print-address">{BranchCity}</div>
                    {/* <div className="Quo-Print-address">Gst No:33AAACH7409R1Z8</div> */}
                  </div>
                  <div className="Quo-Print-Qno">
                    {PrintingData?.[0]?.DCNo && (
                      <div className="Quo-Print-address">
                        Delivery Challan No: {PrintingData?.[0]?.DCNo}
                      </div>
                    )}
                    {PrintingData?.[0]?.RequestId && (
                      <div className="Quo-Print-address">
                        <strong>Ref No #:</strong>{' '}
                        {PrintingData?.[0]?.RequestId}
                      </div>
                    )}
                    {PrintingData?.[0]?.DCDate && (
                      <div className="Quo-Print-address">
                        Order Date:{' '}
                        {dateFormatChange1(PrintingData?.[0]?.DCDate)}
                      </div>
                    )}
                    {PrintingData?.[0]?.RequestedDate && (
                      <div className="Quo-Print-address">
                        <strong>Requested Date: </strong>
                        {dateFormatChange1(PrintingData?.[0]?.RequestedDate)}
                      </div>
                    )}
                    {PrintingData?.[0]?.ModeOfTransport && (
                      <div className="Quo-Print-address">
                        Transport Mode: {PrintingData?.[0]?.ModeOfTransport}
                      </div>
                    )}
                    {PrintingData?.[0]?.TransporterName && (
                      <div className="Quo-Print-address">
                        Transporter Name: {PrintingData?.[0]?.TransporterName}
                      </div>
                    )}
                    {PrintingData?.[0]?.TransporterId && (
                      <div className="Quo-Print-address">
                        Transporter ID: {PrintingData?.[0]?.TransporterId}
                      </div>
                    )}
                    {PrintingData?.[0]?.VehicleNo && (
                      <div className="Quo-Print-address">
                        Vehicle No: {PrintingData?.[0]?.VehicleNo}
                      </div>
                    )}
                  </div>
                </div>
                {PrintingData?.[0]?.ToBranchDtl?.length > 0 && (
                  <div className="Quo-Print-Header">
                    <div>
                      <div style={{ marginBottom: '10px' }}>
                        <strong>Delivery To :</strong>
                      </div>
                      <div className="Quo-Print-Company">
                        <div className="Quo-Print-Cname">
                          {PrintingData?.[0]?.ToBranchDtl?.[0]?.BranchName}
                        </div>
                        {PrintingData?.[0]?.ToBranchDtl?.[0]?.Address1 && (
                          <div className="Quo-Print-address">
                            {PrintingData?.[0]?.ToBranchDtl?.[0]?.Address1}
                          </div>
                        )}
                        {(PrintingData?.[0]?.ToBranchDtl?.[0]?.City ||
                          PrintingData?.[0]?.ToBranchDtl?.[0]?.Dist ||
                          PrintingData?.[0]?.ToBranchDtl?.[0]?.Zip) && (
                          <div className="Quo-Print-address">{`${PrintingData?.[0]?.ToBranchDtl?.[0]?.City}, ${PrintingData?.[0]?.ToBranchDtl?.[0]?.Dist} - ${PrintingData?.[0]?.ToBranchDtl?.[0]?.Zip}`}</div>
                        )}
                        {PrintingData?.[0]?.ToBranchDtl?.[0]?.BrGSTIN && (
                          <div className="Quo-Print-address">
                            {PrintingData?.[0]?.ToBranchDtl?.[0]?.BrGSTIN}
                          </div>
                        )}
                        {/* <div className="Quo-Print-address">Gst No:33AAACH7409R1Z8</div> */}
                      </div>
                    </div>
                    <div className="Quo-Print-Qno">
                      {PrintingData?.[0]?.DispatchId && (
                        <div className="Quo-Print-address">
                          <strong>Dispatch No #:</strong>{' '}
                          {PrintingData?.[0]?.DispatchId}
                        </div>
                      )}
                      {PrintingData?.[0]?.CreatedDate && (
                        <div className="Quo-Print-address">
                          <strong>Dispatch Date: </strong>
                          {dateFormatChange1(PrintingData?.[0]?.CreatedDate)}
                        </div>
                      )}
                    </div>
                  </div>
                )}
                <div className="Horizondal-line"></div>
                <div className="Quo-Print-Customer">
                  <div className="Quo-Print-Cname">Delivery Details</div>
                  {PrintingData?.[0]?.CustName && (
                    <div className="Quo-Print-address">
                      Name: {PrintingData?.[0]?.CustName}
                    </div>
                  )}
                  {/* {PrintingData?.[0]?.CustMobile && ( */}
                  {PrintingData?.[0]?.CustMobile && (
                    <div className="Quo-Print-address">
                      Mobile: {PrintingData?.[0]?.CustMobile}
                    </div>
                  )}
                </div>
              </div>

              <div className="Quo-Print-Tabsum" style={{ height: '50vh' }}>
                <div className="Quo-Print-Table">
                  <table className="Quo-Print-ProTable">
                    <thead>
                      <tr className="Quo-Print-tableheader">
                        <td className="Quo-Print-headingData">Sl.No.</td>
                        <td
                          className="Quo-Print-headingData"
                          style={{ textAlign: 'left' }}
                        >
                          Item & Description
                        </td>
                        <td
                          className="Quo-Print-headingData"
                          style={{ textAlign: 'center' }}
                        >
                          Qty
                        </td>
                        {/* <td
                          className="Quo-Print-headingData"
                          style={{ textAlign: 'center' }}
                        >
                          UOM
                        </td> */}
                      </tr>
                    </thead>
                    <tbody>
                      {dataChunk?.map((item, index) => (
                        <tr key={index} className="Quo-Print-DataRow">
                          <td className="Quo-Print-TableDataSno">
                            {chunkIndex * chunkSize + index + 1}
                          </td>
                          <td className="Quo-Print-TableDataName">
                            {item?.ProdName}
                            {/* {item?.ProdVariantName && (
                              <div style={{ fontSize: '0.9em', color: '#666' }}>
                                Variant: {item?.ProdVariantName}
                              </div>
                            )} */}
                            {(item?.ProdVariantName ||
                              item?.RequestVariantName) &&
                              (item?.RequestVariantName ||
                                item?.ProdVariantName) !== 'Variant 1' && (
                                <div
                                  style={{ fontSize: '0.9em', color: '#666' }}
                                >
                                  Variant:{' '}
                                  {item?.RequestVariantName ||
                                    item?.ProdVariantName}
                                </div>
                              )}
                          </td>
                          <td
                            className="Quo-Print-TableData"
                            style={{ textAlign: 'center' }}
                          >
                            {item?.Qty || item?.DispatchedQty}
                          </td>
                          {/* <td
                            className="Quo-Print-TableData"
                            style={{ textAlign: 'center' }}
                          >
                            {item?.UOM}
                          </td> */}
                        </tr>
                      ))}
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
          ))}
      </div>
      <div style={{ display: 'none' }}>
        {DCprinterTemplateStyle === 'Style 1' && (
          <DCPrintStyle1
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'Style 2' && (
          <DCPrintstyle2
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'Style 3' && (
          <DCPrintStyle3
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'Style 4' && (
          <DCPrintstyle4
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'Style 5' && (
          <DCPrintStyle5
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'Style 6' && (
          <DCPrintstyle6
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'Style 7' && (
          <DCPrintStyle7
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchName={BranchName}
            BranchZip={BranchZip}
            BranchDetails={BranchDetails}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'Style 8' && (
          <DCPrintstyle8
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'Style 9' && (
          <DCPrintStyle9
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'Style 10' && (
          <DCPrintStyle10
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'Style 11' && (
          <DCPrintStyle11
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'Style 12' && (
          <DCPrintstyle12
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'A4' && (
          <DCPrintA4Style11
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'A5' && (
          <DCPrintStyleA5
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}
        {DCprinterTemplateStyle === 'A4Standard' && (
          <DCA4Standard
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData?.[0]}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            // printDatas={printDatas}
          />
        )}

        {DCprinterTemplateStyle === 'TaxInvoice' && (
          <DCInvicePrint
            DCprinterTemplateStyle={DCprinterTemplateStyle}
            DCPrintTemplateDtl={DCPrintTemplateDtl}
            Date1={Date1}
            base64Image={base64Image}
            BranchDetails={BranchDetails}
            BranchName={BranchName}
            BranchAddress={BranchAddress}
            BranchCity={BranchCity}
            BranchZip={BranchZip}
            // CashierName={CashierName}
            // totalQuantity={totalQuantity}
            // OrderDetailGST={OrderDetailGST}
            // OrderDetailIGST={OrderDetailIGST}
            // OrderDetailVAT={OrderDetailVAT}
            table2Data={PrintingData}
            // totalQuantityFilter={totalQuantityFilter}
            // PaymentStatus={PaymentStatus}
            // PrintLogo={PrintLogo}
            // PrintGreeting={PrintGreeting}
            printDatas={DCPrintTemplateDtl}
          />
        )}
      </div>
    </>
  );
};
export default DeliveryPrint;
