import React, { useEffect, useState } from 'react'; import { useDispatch } from 'react-redux'; import moment from 'moment'; import { extractLastNumberOrderId, getSession, } from '../../../../Services/Others'; import QRcode from '../../../../Images/QRcode.png'; import { printDiv } from '../../../../Services/Others'; // import HpyImg from "../../../../Images/happyemoji.png" import '../../../../Styles/BookingScreen/PrintTemplates/A4/PrintA4Style11.scss'; import { useSelector } from 'react-redux'; import { GloabalFieldDetails, GlobalBillName, Globalnotes, GlobalprintAmount, GlobalprintCashierName, GlobalprintCredit, GlobalprintDiscount, GlobalprintHsnCode, GlobalprintItem, GlobalprintLogo, GlobalprintMRP, GlobalprintQrcodet, GlobalprintQuantity, GlobalprintRate, GlobalprintSignature, GlobalprintSlNo, GlobalprintTax, GlobalprinttermsAndConditions, GlobalPritdummyData, GlobalSignatureImage, GlobalthemeFormat, } from '../../../../Features/ThemeChange/ThemeChange'; import signature from '../../../../Images/signatureimage.jpg'; import Logo from '../../../../Images/Logo.jpg'; import QRCode from 'react-qr-code'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; import { PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; const PrintA5Style11 = ({ index, ExtraChargeTotal, UpiId, Date1, base64Image, totalQuantityFilter = 6, BranchCity, BranchZip, CashierName, totalQuantity, OrderDetailGST, OrderDetailIGST, OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, PrintLogo, printDatas, sportsAppPreference, MembershipApplied = null, SalesModePref, }) => { const GlobalthemeFormatr = useSelector(GlobalthemeFormat); const GlobalSignature = useSelector(GlobalprintSignature); const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); const FieldDetails = useSelector(GloabalFieldDetails); const GlobalIsnotes = useSelector(Globalnotes); const GlobalSignatureImages = useSelector(GlobalSignatureImage); console.log(FieldDetails, 'FieldDetails'); const SLNO = FieldDetails?.['Sl.No']; const Item = FieldDetails?.['Item']; const MRP = FieldDetails?.['MRP']; const Discount = FieldDetails?.['Discount']; const Tax = FieldDetails?.['Tax']; const Quantity = FieldDetails?.['Quantity']; const Rate = FieldDetails?.['Rate']; const Amount = FieldDetails?.['Amount']; const HsnCode = FieldDetails?.['HsnCode']; const Qrcodet = FieldDetails?.['Qrcode']; const Signature = FieldDetails?.['signature']; const TermsnAdCondition = FieldDetails?.['terms&conditions']; const isNotes = FieldDetails?.['Notes']; const CashierNameField = FieldDetails?.['CashierName']; const LogoField = FieldDetails?.['Logo']; const CreditDetails = FieldDetails?.['Credit details']; const WeightasKg = FieldDetails?.['Weight']; 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 GlobalBilltext = useSelector(GlobalBillName); const GlobalCashierName = useSelector(GlobalprintCashierName); const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); const SettingData = useSelector(PreferenceData); 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 currentDate = new Date(); console.log(FieldDetails, 'FieldDetails'); const day = currentDate.getDate().toString().padStart(2, '0'); const monthNames = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', ]; 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 DineInData = table2Data?.productDetails?.filter( (item) => item.BookingTypeName?.toLowerCase() === 'dine in' ); let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); 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' ) const PackageDetails = table2Data?.PackageDtl; 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; }, {} ); let TermsAndConditions = printDatas?.TermsandConditions; let SignatureImg = printDatas?.Signature; let Notestext = printDatas?.Notes; let BillName = printDatas?.PrintHdrName; let FormatTheme = printDatas?.PrintType == 'S' ? true : false; console.log(FormatTheme, 'TermsAndConditions'); const productsData = table2Data?.productDetails || []; const offers = table2Data?.OrderOfferDetails || []; const paymentTypeUPI = PaymentStatus?.find( (ps) => ps.PaymentTypeName === 'UPI' ); let TotalOfferAmount = 0; const products = [ { id: 1, name: 'Butter Naan', price: 88.0, quantity: 2, mrp: 50, amt: 60, discount: 12, ProdTaxPercentage: 5, }, { id: 2, name: 'Grill Chicken (f)', price: 300.0, quantity: 1, mrp: 50, amt: 60, discount: 12, ProdTaxPercentage: 5, }, { id: 3, name: 'Tandoori Chicken (H) ', price: 200.0, quantity: 1, mrp: 50, amt: 60, discount: 12, ProdTaxPercentage: 0, }, { id: 4, name: 'Kulfi', price: 30.0, quantity: 1, mrp: 50, amt: 60, discount: 12, ProdTaxPercentage: 18, }, { id: 1, name: 'Butter Naan', price: 88.0, quantity: 2, mrp: 50, amt: 60, discount: 12, ProdTaxPercentage: 40, }, { id: 2, name: 'Grill Chicken (f)', price: 300.0, quantity: 1, mrp: 50, amt: 60, discount: 12, ProdTaxPercentage: 5, }, ]; const chunkSize = 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 > 6; return (
{paginatedChunks.map((dataChunk, chunkIndex) => (
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{/* Logo Image */}
{GlobalLogo && GlobaldummyData && (
{' '} Brand Logo
)} {base64Image && (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( Brand Logo ) : null}
{/* Store Info */}
{GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
{/* Address */}
{GlobaldummyData ? 'BranchAddress, Town- 635XXX City - State' : [ table2Data?.AddressDetails?.[0]?.Address1, table2Data?.AddressDetails?.[0]?.City, table2Data?.AddressDetails?.[0]?.Zip, ] .filter(Boolean) .join(' - ')}
Mobile: +91{' '} {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
{/* Order Type */}
{/*
{table2Data?.OrderType === "E" ? "Estimate" : (GlobaldummyData ? "Cash" : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "") + table2Data?.OrderId && "Cash: " + extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)} {GlobaldummyData && "685"}
*/}
)}
Bill No : {table2Data?.OrderId && extractLastNumberOrderId( table2Data?.OrderId, table2Data?.FYStatus )} {GlobaldummyData && '685'}
{GlobaldummyData ? GlobalBilltext ? GlobalBilltext : 'Cash' + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ''}
{' '}
{Date1}
{' '} {SalesModePref?.SettingValue == 'Y' &&
{' '} Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '}
}


{(TakeawayData?.length > 0 || GlobaldummyData) && ( <>
Take Away
{/* Placeholder for the fixed-position header */}
{GlobaldummyData ? GlobalSlNo && ( ) : SLNO == true && ( )} {GlobaldummyData ? GlobalItem && : Item == true && } {GlobaldummyData ? GlobalHsnCode && ( ) : HsnCode == true && ( )} {GlobaldummyData ? GlobalQuantity && ( ) : Quantity == true && ( )} {GlobaldummyData ? GlobalMRP && ( ) : MRP == true && ( )} {GlobaldummyData ? GlobalRate && ( ) : Rate == true && ( )} {GlobaldummyData ? GlobalDiscount && ( ) : Discount == true && ( )} {GlobaldummyData ? GlobalTax && ( ) : (Tax && table2Data?.OrderType !== 'E') && ( )} {GlobaldummyData ? GlobalAmount && ( ) : Amount == true && ( )} {dataChunk?.map((item, index) => ( {GlobaldummyData ? GlobalSlNo && ( ) : SLNO == true && ( )} {GlobaldummyData ? ( GlobalItem && ) : ( Item && ( ) )} {GlobaldummyData ? GlobalHsnCode && ( ) : HsnCode == true && ( )} {GlobaldummyData ? GlobalQuantity && ( ) : Quantity == true && ( )} {GlobaldummyData ? GlobalMRP && ( ) : MRP == true && ( )} {GlobaldummyData ? GlobalRate && ( ) : Rate == true && ( )} {GlobaldummyData ? GlobalDiscount && ( ) : Discount == true && ( )} {GlobaldummyData ? GlobalTax && ( ) : (Tax && table2Data?.OrderType !== 'E') && ( )} {GlobaldummyData ? GlobalAmount && ( ) : Amount == true && ( )} ))}
S.No S.No ItemItem HSN HSN Qty {WeightasKg ? 'Qty/Kg' : 'Qty'} MRP MRP Rate Rate Dis{' '} Dis{' '} Tax % Tax % Amt Amt
{index + 1} {chunkIndex * chunkSize + index + 1} {item?.name}
{item?.ProdName}
{PackageDetails?.filter( (pkg) => pkg.ProdId === item.ProdId ).length > 0 ? (
{PackageDetails ?.filter((pkg) => pkg.ProdId === item.ProdId) ?.map((pkg, index) => ( {pkg.ParcelCount} PCS {pkg.ParcelQty} PACK ({pkg.ParcelType}) ))}
) : (
({item?.Size || "1"}{" "} {item?.SinglePc === "Y" ? "PCS" : item?.Type !== "C" ? item?.UomName : "COMBO"} )
)} {item?.BrandName &&
{item.BrandName}
} {/* Identifiers */} {item?.ProductIdentifierDtls?.length > 0 ? item.ProductIdentifierDtls.map((id, index) => (
{/* Serial */} {id?.SerialNumber &&
{id.SerialNumber}
} {/* IMEI */} {(id?.IMEI1 || id?.IMEI2) && (
{[id.IMEI1, id.IMEI2].filter(Boolean).join(",")}
)} {/* Description */} {(id?.SerialNumber || id?.IMEI1 || id?.IMEI2) && id?.Description && (
{id.Description}
)}
)) : null}
{item?.discount} {item?.HSN} {item?.quantity} {item?.SalesQty} {item?.mrp} {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} {item?.Rate} {' '} {item?.MRP} {item.discount} {item?.Type != 'C' ? item?.OfferAmt || 0 : item?.OfferValue || 0} {item.ProdTaxPercentage} {item?.ProdTaxPercentage || 0} {item?.price} {item?.Type != 'C' ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
{!FormatTheme && chunkIndex === paginatedChunks.length - 1 && (
<>
ITEMS
Qty
{TotalOfferAmount > 0 || table2Data?.OverallDisc ? (
OFFER
) : ( '' )} {/*
Amount
*/}
{GlobaldummyData ? '7' : totalQuantityFilter?.length}
{GlobaldummyData ? '9' : totalQuantity}
{TotalOfferAmount > 0 || table2Data?.OverallDisc ? (
{Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)}
) : ( '' )} {/*
{GlobaldummyData ? "1066" : Number(table2Data?.NetAmount).toFixed(2)}
*/}
Amount : {GlobaldummyData ? '1066' : Number( table2Data?.NetAmount ).toFixed(2)}
{isEditedBill && lastTransaction && (
Bill Gross Amount {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}
{'Adjustment Amount'} {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
Net Bill Amount {(lastTransaction?.AfterAdjustment || 0).toFixed(2)}
)} {GlobaldummyData ? GlobalCredit && (
Advance Amount:
Opening Balance:
) : CreditDetails && table2Data?.CustomerDetails?.length > 0 && (
{/* OLD CREDIT BAL */} {PaymentStatusSuccess?.[0] ?.PaymentTypeName === 'Credit' && ( <> {table2Data.CustomerDetails[0] .OldCreditBal > 0 ? (

Advance Amount: { table2Data .CustomerDetails[0] .OldCreditBal }

) : table2Data .CustomerDetails[0] .OldCreditBal < 0 ? (

{' '} Opening Balance:{' '} {Math.abs( table2Data .CustomerDetails[0] .OldCreditBal )}

) : null} )} {/* CURRENT CREDIT BAL */} {table2Data.CustomerDetails[0] .CurrentCreditBal > 0 ? (

{' '} Current Advance Amount:{' '} { table2Data.CustomerDetails[0] .CurrentCreditBal }

) : table2Data.CustomerDetails[0] .CurrentCreditBal < 0 ? (

{' '} Current Balance Amount:{' '} {Math.abs( table2Data.CustomerDetails[0] .CurrentCreditBal )}

) : null}
)}
{(table2Data?.OrderType !== "E") && OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0 && ( <>

--------- GST Breakup Details -----------

{OrderDetailGST?.map((item) => ( ))}
GST Rate Taxable Amount CGST SGST Total
{item?.TaxPercentage}%{' '} {' '} {Number(item.WithOutTaxAmount).toFixed(2)}{' '} {' '} {Number(item.CGST).toFixed(2)} {' '} {Number(item.SGST).toFixed(2)} {' '} {Number(item.TotalAmt).toFixed(2)}
)}
{GlobaldummyData ? GlobalQrcodet && (
Scan to Pay{' '}
₹ {GlobaldummyData ? '1,066' : Number( table2Data?.NetAmount ).toFixed(2)}
) : Qrcodet && paymentTypeUPI && (
Scan to Pay{' '}
₹ {GlobaldummyData ? '1,066' : Number( table2Data?.NetAmount ).toFixed(2)}
)}
{GlobaldummyData && GlobalCashierName && (
CASHIER : {CashierName}
)} {CashierName && CashierNameField && (
CASHIER : {CashierName}
)}
{Date1}
{sportsAppPreference && MembershipApplied && (
{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
)} {GlobaldummyData ? GlobalIsnotes && (

Notes : 10 days Return policy


) : Notestext && (

{Notestext}


)}
{GlobaldummyData ? GlobaltermsAndConditions && (

Terms & Conditions

  1. Once goods are sold, they are not exchangeable or refundable.
  2. Please check the product before leaving the counter.
) : TermsnAdCondition == true && TermsAndConditions?.length > 0 && (

Terms & Conditions

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

Signature

) : Signature == true && (

Signature

)}
)}
{/* {(chunkIndex === paginatedChunks.length - 1) && ( )} */}
)} {DineInData?.length > 0 && ( <>
Dine In
{/* Placeholder for the fixed-position header */}
{GlobaldummyData ? GlobalSlNo && ( ) : SLNO == true && ( )} {GlobaldummyData ? GlobalItem && : Item == true && } {GlobaldummyData ? GlobalHsnCode && ( ) : HsnCode == true && ( )} {GlobaldummyData ? GlobalQuantity && ( ) : Quantity == true && ( )} {GlobaldummyData ? GlobalMRP && ( ) : MRP == true && ( )} {GlobaldummyData ? GlobalRate && ( ) : Rate == true && ( )} {GlobaldummyData ? GlobalDiscount && ( ) : Discount == true && ( )} {GlobaldummyData ? GlobalTax && ( ) : (Tax && table2Data?.OrderType !== 'E') && ( )} {GlobaldummyData ? GlobalAmount && ( ) : Amount == true && ( )} {dataChunk?.map((item, index) => ( {GlobaldummyData ? GlobalSlNo && ( ) : SLNO == true && ( )} {GlobaldummyData ? ( GlobalItem && ) : ( Item && ( ) )} {GlobaldummyData ? GlobalHsnCode && ( ) : HsnCode == true && ( )} {GlobaldummyData ? GlobalQuantity && ( ) : Quantity == true && ( )} {GlobaldummyData ? GlobalMRP && ( ) : MRP == true && ( )} {GlobaldummyData ? GlobalRate && ( ) : Rate == true && ( )} {GlobaldummyData ? GlobalDiscount && ( ) : Discount == true && ( )} {GlobaldummyData ? GlobalTax && ( ) : (Tax && table2Data?.OrderType !== 'E') && ( )} {GlobaldummyData ? GlobalAmount && ( ) : Amount == true && ( )} ))}
S.No S.No ItemItem HSN HSN Qty {WeightasKg ? 'Qty/Kg' : 'Qty'} MRP MRP Rate Rate Dis{' '} Dis{' '} Tax % Tax % Amt Amt
{index + 1} {chunkIndex * chunkSize + index + 1} {item?.ProdName}
{item?.ProdName}
({item?.Size || "1"}{" "} {item?.SinglePc === "Y" ? "PCS" : item?.Type !== "C" ? item?.UomName : "COMBO"} )
{item?.BrandName &&
{item.BrandName}
} {item?.ProductIdentifierDtls?.map((id, index) => (
{/* Serial Number */} {id?.SerialNumber &&
{id.SerialNumber}
} {/* IMEI */} {(id?.IMEI1 || id?.IMEI2) && (
{[id.IMEI1, id.IMEI2].filter(Boolean).join(",")}
)} {/* Description */} {(id?.SerialNumber || id?.IMEI1 || id?.IMEI2) && id?.Description && (
{id.Description}
)}
))}
{item?.HSN} {item?.HSN} {item?.SalesQty} {item?.SalesQty} {item?.MRP} {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} {item?.Rate} {' '} {item?.Rate} {item.discount} {item?.Type != 'C' ? item?.OfferAmt || 0 : item?.OfferValue || 0} {item.ProdTaxPercentage} {item?.ProdTaxPercentage || 0} {item?.TotalAmt} {item?.Type != 'C' ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
{!FormatTheme && chunkIndex === paginatedChunks.length - 1 && (
<>
ITEMS
Qty
{TotalOfferAmount > 0 || table2Data?.OverallDisc ? (
OFFER
) : ( '' )} {/*
Amount
*/}
{GlobaldummyData ? '7' : totalQuantityFilter?.length}
{GlobaldummyData ? '9' : totalQuantity}
{TotalOfferAmount > 0 || table2Data?.OverallDisc ? (
{Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)}
) : ( '' )} {/*
{GlobaldummyData ? "1066" : Number(table2Data?.NetAmount).toFixed(2)}
*/}
Amount : {GlobaldummyData ? '1066' : Number( table2Data?.NetAmount ).toFixed(2)}
{isEditedBill && lastTransaction && (
Bill Gross Amount {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}
{'Adjustment Amount'} {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
Net Bill Amount {(lastTransaction?.AfterAdjustment || 0).toFixed(2)}
)} {GlobaldummyData ? GlobalCredit && (
Advance Amount:
Opening Balance:
) : CreditDetails && table2Data?.CustomerDetails?.length > 0 && (
{/* OLD CREDIT BAL */} {PaymentStatusSuccess?.[0] ?.PaymentTypeName === 'Credit' && ( <> {table2Data.CustomerDetails[0] .OldCreditBal > 0 ? (

Advance Amount: { table2Data .CustomerDetails[0] .OldCreditBal }

) : table2Data .CustomerDetails[0] .OldCreditBal < 0 ? (

{' '} Opening Balance:{' '} {Math.abs( table2Data .CustomerDetails[0] .OldCreditBal )}

) : null} )} {/* CURRENT CREDIT BAL */} {table2Data.CustomerDetails[0] .CurrentCreditBal > 0 ? (

{' '} Current Advance Amount:{' '} { table2Data.CustomerDetails[0] .CurrentCreditBal }

) : table2Data.CustomerDetails[0] .CurrentCreditBal < 0 ? (

{' '} Current Balance Amount:{' '} {Math.abs( table2Data.CustomerDetails[0] .CurrentCreditBal )}

) : null}
)}
{(table2Data?.OrderType !== "E") && OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0 && ( <>

--------- GST Breakup Details -----------

{OrderDetailGST?.map((item) => ( ))}
GST Rate Taxable Amount CGST SGST Total
{item?.TaxPercentage}%{' '} {' '} {Number(item.WithOutTaxAmount).toFixed(2)}{' '} {' '} {Number(item.CGST).toFixed(2)} {' '} {Number(item.SGST).toFixed(2)} {' '} {Number(item.TotalAmt).toFixed(2)}
)}

{GlobaldummyData ? GlobalQrcodet && (
Scan to Pay{' '}
₹ {GlobaldummyData ? '1,066' : Number( table2Data?.NetAmount ).toFixed(2)}
) : Qrcodet && paymentTypeUPI && (
Scan to Pay{' '}
₹ {GlobaldummyData ? '1,066' : Number( table2Data?.NetAmount ).toFixed(2)}
)}
{GlobaldummyData && GlobalCashierName && (
CASHIER : {CashierName}
)} {CashierName && CashierNameField && (
CASHIER : {CashierName}
)}
{Date1}
{sportsAppPreference && MembershipApplied && (
{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
)} {GlobaldummyData ? GlobalIsnotes && (

Notes : 10 days Return policy


) : Notestext && (

{Notestext}


)}
{GlobaldummyData ? GlobaltermsAndConditions && (

Terms & Conditions

  1. Once goods are sold, they are not exchangeable or refundable.
  2. Please check the product before leaving the counter.
) : TermsnAdCondition == true && TermsAndConditions?.length > 0 && (

Terms & Conditions

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

Signature

) : Signature == true && (

Signature

)}
)}
)}
{(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

Split Payment:

*/} {Object.keys(aggregatedPayments).map((paymentType) => (
{paymentType}: {aggregatedPayments[paymentType].toFixed(2)}
))} )} {chunkIndex === paginatedChunks.length - 1 && !shouldFooterBeOnNewPage && FormatTheme && (
<>
ITEMS
Qty
{TotalOfferAmount > 0 || table2Data?.OverallDisc ? (
OFFER
) : ( '' )} {/*
Amount
*/}
{GlobaldummyData ? '7' : totalQuantityFilter?.length}
{GlobaldummyData ? '9' : totalQuantity}
{TotalOfferAmount > 0 || table2Data?.OverallDisc ? (
{Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)}
) : ( '' )} {/*
{GlobaldummyData ? "1066" : Number(table2Data?.NetAmount).toFixed(2)}
*/}
Amount : {GlobaldummyData ? '1066' : Number(table2Data?.NetAmount).toFixed(2)}
{isEditedBill && lastTransaction && (
Bill Gross Amount {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}
{'Adjustment Amount'} {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
Net Bill Amount {(lastTransaction?.AfterAdjustment || 0).toFixed(2)}
)} {isEditedBill && lastTransaction && (
Bill Gross Amount {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}
{'Adjustment Amount'} {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
Net Bill Amount {(lastTransaction?.AfterAdjustment || 0).toFixed(2)}
)} {GlobaldummyData ? GlobalCredit && (
Advance Amount:
Opening Balance:
) : CreditDetails && table2Data?.CustomerDetails?.length > 0 && (
{/* OLD CREDIT BAL */} {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > 0 ? (

Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal}

) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? (

{' '} Opening Balance:{' '} {Math.abs( table2Data.CustomerDetails[0].OldCreditBal )}

) : null} )} {/* CURRENT CREDIT BAL */} {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? (

{' '} Current Advance Amount:{' '} {table2Data.CustomerDetails[0].CurrentCreditBal}

) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? (

{' '} Current Balance Amount:{' '} {Math.abs( table2Data.CustomerDetails[0].CurrentCreditBal )}

) : null}
)}
{(table2Data?.OrderType !== "E") && OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0 && ( <>

--------- GST Breakup Details -----------

{OrderDetailGST?.map((item) => ( ))}
GST Rate Taxable Amount CGST SGST Total
{item?.TaxPercentage}%{' '} {' '} {Number(item.WithOutTaxAmount).toFixed(2)}{' '} {' '} {Number(item.CGST).toFixed(2)} {' '} {Number(item.SGST).toFixed(2)} {' '} {Number(item.TotalAmt).toFixed(2)}
)}

{GlobaldummyData ? GlobalQrcodet && (
Scan to Pay{' '}
₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
) : Qrcodet && paymentTypeUPI && (
Scan to Pay{' '}
₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
)}
{GlobaldummyData && GlobalCashierName && (
CASHIER : {CashierName}
)} {CashierName && CashierNameField && (
CASHIER : {CashierName}
)}
{Date1}
{sportsAppPreference && MembershipApplied && (
{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
)} {GlobaldummyData ? GlobalIsnotes && (

Notes : 10 days Return policy


) : Notestext && (

{Notestext}


)}
{GlobaldummyData ? GlobaltermsAndConditions && (

Terms & Conditions

  1. Once goods are sold, they are not exchangeable or refundable.
  2. Please check the product before leaving the counter.
) : TermsnAdCondition == true && TermsAndConditions?.length > 0 && (

Terms & Conditions

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

Signature

) : Signature == true && (

Signature

)}
)}
))} {shouldFooterBeOnNewPage && FormatTheme && (
<>
ITEMS
Qty
{TotalOfferAmount > 0 || table2Data?.OverallDisc ? (
OFFER
) : ( '' )} {/*
Amount
*/}
{GlobaldummyData ? '7' : totalQuantityFilter?.length}
{GlobaldummyData ? '9' : totalQuantity}
{TotalOfferAmount > 0 || table2Data?.OverallDisc ? (
{Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)}
) : ( '' )} {/*
{GlobaldummyData ? "1066" : Number(table2Data?.NetAmount).toFixed(2)}
*/}
Amount : {GlobaldummyData ? '1066' : Number(table2Data?.NetAmount).toFixed(2)}
{isEditedBill && lastTransaction && (
Bill Gross Amount {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}
{'Adjustment Amount'} {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
Net Bill Amount {(lastTransaction?.AfterAdjustment || 0).toFixed(2)}
)} {isEditedBill && lastTransaction && (
Bill Gross Amount {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}
{'Adjustment Amount'} {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
Net Bill Amount {(lastTransaction?.AfterAdjustment || 0).toFixed(2)}
)} {GlobaldummyData ? GlobalCredit && (
Advance Amount:
Opening Balance:
) : CreditDetails && table2Data?.CustomerDetails?.length > 0 && (
{/* OLD CREDIT BAL */} {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > 0 ? (

Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal}

) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? (

{' '} Opening Balance:{' '} {Math.abs( table2Data.CustomerDetails[0].OldCreditBal )}

) : null} )} {/* CURRENT CREDIT BAL */} {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? (

{' '} Current Advance Amount:{' '} {table2Data.CustomerDetails[0].CurrentCreditBal}

) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? (

{' '} Current Balance Amount:{' '} {Math.abs( table2Data.CustomerDetails[0].CurrentCreditBal )}

) : null}
)}
{(table2Data?.OrderType !== "E") && OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0 && ( <>

--------- GST Breakup Details -----------

{OrderDetailGST?.map((item) => ( ))}
GST Rate Taxable Amount CGST SGST Total
{item?.TaxPercentage}%{' '} {' '} {Number(item.WithOutTaxAmount).toFixed(2)}{' '} {' '} {Number(item.CGST).toFixed(2)} {' '} {Number(item.SGST).toFixed(2)} {' '} {Number(item.TotalAmt).toFixed(2)}
)}

{GlobaldummyData ? GlobalQrcodet && (
Scan to Pay
₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
) : Qrcodet && paymentTypeUPI && (
Scan to Pay
₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
)}
{GlobaldummyData && GlobalCashierName && (
CASHIER : {CashierName}
)} {CashierName && CashierNameField && (
CASHIER : {CashierName}
)}
{Date1}
{sportsAppPreference && MembershipApplied && (
{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
)} {GlobaldummyData ? GlobalIsnotes && (

Notes : 10 days Return policy


) : Notestext && (

{Notestext}


)}
{GlobaldummyData ? GlobaltermsAndConditions && (

Terms & Conditions

  1. Once goods are sold, they are not exchangeable or refundable.
  2. Please check the product before leaving the counter.
) : TermsnAdCondition == true && TermsAndConditions?.length > 0 && (

Terms & Conditions

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

Signature

) : Signature == true && (

Signature

)}
)}
); }; export default PrintA5Style11;