import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import Qrcode from '../../../../Images/Qrcode.png'; import { 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, GlobalSelectedTableBodyFontColor, GlobalSelectedTableBodyColor, GlobalRowType, GlobalSelectedFooterColor, GlobalSelectedFooterFontColor, GlobalSelectedNetAmountColor, GlobalSelectedNetAmountFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.scss'; import { GlobalUpiIDprint, PreferenceData, } from '../../../../Features/BookingScreen/BookingData/BookingData'; import QRCode from 'react-qr-code'; import signature from '../../../../Images/signatureimage.jpg'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; import { isMobile } from 'react-device-detect'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; import Logo from '../../../../Images/Logo.jpg'; const Printstyle4 = ({ index, Date1, base64Image, totalQuantityFilter, CashierName, totalQuantity, OrderDetailGST, OrderDetailIGST, OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, PrintLogo, printDatas, isPdf, sportsAppPreference, SalesModePref, MembershipApplied = null, }) => { console.log(printDatas, 'printDatas') const dispatch = useDispatch(); const GlobalUpiID = useSelector(GlobalUpiIDprint); const FieldDetails = useSelector(GloabalFieldDetails); const SLNO = FieldDetails?.['Sl.No']; const Item = FieldDetails?.['Item']; const MRP = FieldDetails?.['MRP']; const Discount = FieldDetails?.['Discount']; const 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 orderNo = FieldDetails?.['Order No']; const paymentTypelabel = FieldDetails?.['Payment Type Label']; const WeightasKg = FieldDetails?.['Weight']; const BillLabel = FieldDetails?.['BillNoLabel'] const Total_Label = FieldDetails?.['Total Label'] const BillNoLabel = (printDatas?.PrintDocLabel && BillLabel) ? printDatas?.PrintDocLabel : "Bill No"; const TotalLabel = (printDatas?.PrintTotalLabel && Total_Label) ? printDatas?.PrintTotalLabel : "SUB TOTAL"; 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); console.log(GlobaldummyData, 'GlobaldummyData'); const GlobalSignature = useSelector(GlobalprintSignature); 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 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 SettingData = useSelector(PreferenceData); const Retailshortname = SettingData?.[0]?.SettingDtlDetails?.find( (setting) => setting?.SettingIdName?.toLowerCase() === 'retailshortname' ); const Wholesaleshortname = SettingData?.[0]?.SettingDtlDetails?.find( (setting) => setting?.SettingIdName?.toLowerCase() === 'wholesaleshortname' ); const totalGSTData = [ (OrderDetailGST || []).reduce( (acc, item) => ({ WithOutTaxAmount: (acc.WithOutTaxAmount || 0) + item.WithOutTaxAmount, TaxAmt: (acc.TaxAmt || 0) + item.TaxAmt, TotalAmt: (acc.TotalAmt || 0) + item.TotalAmt, CGST: (acc.CGST || 0) + item.CGST, SGST: (acc.SGST || 0) + item.SGST, }), {} ), ]; console.log(table2Data, 'table2Data'); const UomPrint = SettingData?.[0]?.SettingDtlDetails?.filter( (i) => i.SettingIdName === 'PrintUom' )?.[0]; 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 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 paymentTypeUPI = PaymentStatus?.find( (ps) => ps.PaymentTypeName === 'UPI' ); 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; let TermsAndConditions = printDatas?.TermsandConditions; let SignatureImg = printDatas?.Signature; let Notestext = printDatas?.Notes; let BillName = printDatas?.PrintHdrName; let FormatTheme = printDatas?.PrintType == 'S' ? true : false; let PageSize = printDatas?.PageSize; const Signature = FieldDetails?.['signature']; const TermsnAdCondition = FieldDetails?.['terms&conditions']; 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 keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } const PackageDetails = table2Data?.PackageDtl; 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' ); console.log(TakeawayData, 'TakeawayData'); const DineInData = table2Data?.productDetails?.filter( (item) => item.BookingTypeName?.toLowerCase() === 'dine in' ); 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; }, {} ); 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'].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 products = [ { ProdName: 'ITEM 1', Rate: 88.0, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01', }, { ProdName: 'ITEM 2', Rate: 300.0, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', }, { ProdName: 'ITEM 3', Rate: 200.0, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', }, { ProdName: 'ITEM 4', Rate: 30.0, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', }, { ProdName: 'ITEM 5', Rate: 30.0, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', }, { ProdName: 'ITEM 6', Rate: 130.0, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', }, { ProdName: 'ITEM 7', Rate: 230.0, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', }, ]; const chunkSize = PageSize == 'A5' ? 10 : 16; let dataSource = []; if (GlobaldummyData || TakeawayData?.length > 0) { dataSource = GlobaldummyData ? products : TakeawayData; } else if (DineInData?.length > 0) { dataSource = DineInData; } console.log(dataSource, 'dataSource'); // 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 > (PageSize == 'A5' ? 5 : 10); console.log(paginatedChunks, 'paginatedChunks'); const headerStyle = { backgroundColor: GlobaldummyData ? SelectedHeaderColor : headerColor?.background, color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, }; const tableHeaderStyle = { backgroundColor: GlobaldummyData ? SelectedTableHeaderColor : tableHeaderColor?.background, color: GlobaldummyData ? SelectedTableHeaderFontColor : tableHeaderColor?.font, }; const tableBodyStyle = { backgroundColor: GlobaldummyData ? SelectedTableBodyColor : tableBodyColor?.background, color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, }; const rowtypeStyle = GlobaldummyData ? SelectedRowType : tableBodyColor?.rowType; const footerColorStyle = { backgroundColor: GlobaldummyData ? SelectedTableFooterColor : footerColor?.background, color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, }; const netAmountStyle = { backgroundColor: GlobaldummyData ? SelectedNetAmountColor : netAmtColor?.background, color: GlobaldummyData ? SelectedNetAmountFontColor : netAmtColor?.font, }; return ( <> {FormatTheme ? (
{paginatedChunks.map((dataChunk, chunkIndex) => (
0 ? ' print-page-break' : ''}` } style={{ display: 'flex', flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && !shouldFooterBeOnNewPage && FormatTheme ? 'space-between' : '', height: isMobile ? '295mm' : FormatTheme ? PageSize == 'A5' ? '170mm' : '257mm' : '', }} key={chunkIndex} > {/*
*/}
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{GlobaldummyData && GlobalLogo ? ( image ) : null} {base64Image && (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( image ) : null}
{GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}{' '}
{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 : '')}
{' '} Mobile : +91{' '} {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
)}
Dt: {GlobaldummyData ? formattedDate : Date1} {SalesModePref?.SettingValue == 'Y' && (
{' '} Name :{' '} {table2Data?.SalesMode == 'R' ? Retailshortname?.Comments : Wholesaleshortname?.Comments}{' '}
)}
{BillNoLabel}: {GlobaldummyData ? '51' : table2Data?.OrderId && extractLastNumberOrderId( table2Data?.OrderId, table2Data?.FYStatus )}
{/*
{GlobaldummyData ? formattedDate : Date1}
*/}
{table2Data?.OrderType === 'E' && estimateTitle && (
Estimate{' '} {/* {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
)} {table2Data?.OrderType === 'E' ? ( '' ) : (
{GlobaldummyData ? 'Cash Bill' : BillName || (PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ' Bill')}{' '} {/* {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
)} {/*
*/}
{(TakeawayData?.length > 0 || GlobaldummyData) && ( <> {takeAwayPreference && (
TakeAway
)}
{GlobaldummyData ? GlobalSlNo && ( ) : SLNO && ( )} {GlobaldummyData ? GlobalItem && ( ) : Item && ( )} {GlobaldummyData ? GlobalQuantity && ( ) : Quantity && ( )} {GlobaldummyData ? GlobalHsnCode && ( ) : HsnCode && ( )} {GlobaldummyData ? GlobalMRP && ( ) : MRP && ( )} {GlobaldummyData ? GlobalDiscount && ( ) : Discount && ( )} {GlobaldummyData ? GlobalRate && ( ) : Rate && ( )} {GlobaldummyData ? GlobalAmount && ( ) : Amount && ( )} {dataChunk?.map((item, index) => { const identifiers = item?.ProductIdentifierDtls ?? []; const serials = identifiers .filter((d) => d.SerialNumber) .map((d) => d.SerialNumber); const imeis = identifiers .filter((d) => d.IMEI1 || d.IMEI2) .map((d) => [d.IMEI1, d.IMEI2].filter(Boolean).join(', ') ); const descriptions = identifiers .filter((d) => d.Description) .map((d) => d.Description); console.log( descriptions, identifiers, 'descriptions' ); const packageList = PackageDetails?.filter( (pkg) => pkg.ProdId === item.ProdId ) ?? []; return ( {/* SL NO */} {GlobaldummyData ? GlobalSlNo && : SLNO && ( )} {/* ITEM COLUMN */} {GlobaldummyData ? GlobalItem && : Item && ( )} {/* Quantity */} {(GlobaldummyData ? GlobalQuantity : Quantity) && ( )} {/* HSN */} {(GlobaldummyData ? GlobalHsnCode : HsnCode) && ( )} {/* MRP */} {(GlobaldummyData ? GlobalMRP : MRP) && ( )} {/* Discount */} {(GlobaldummyData ? GlobalDiscount : Discount) && ( )} {/* Rate */} {(GlobaldummyData ? GlobalRate : Rate) && ( )} {/* Amount */} {(GlobaldummyData ? GlobalAmount : Amount) && ( )} ); })}
# # ItemItem Qty {WeightasKg ? 'Qty/Kg' : 'Qty'} HSN HSN MRP MRP Dis{' '} Dis{' '} Rate Rate Amt Amt
{index + 1} {chunkIndex * chunkSize + index + 1} {item?.ProdName} {/* Product Name */}
{item?.ProdName}
{/* Package OR Size */} {packageList.length > 0 ? (
{packageList.map((pkg, i) => (
{pkg.ParcelCount} PCS{' '} {pkg.ParcelQty} PACK ( {pkg.ParcelType})
))}
) : (
{UomPrint?.SettingValue === 'Y' ? (item?.Size || '1') + (item?.SinglePc === 'Y' ? ' PCS' : item?.Type !== 'C' ? ` ${item?.UomName}` : ' COMBO') : ''} {item?.BrandName || ''}
)} {/* Serials */} {serials.map((s, i) => (
{s}
))} {/* IMEIs */} {imeis.map((iVal, i) => (
{iVal}
))} {/* Description from first identifier */} {descriptions[0] && (
{descriptions[0]}
)}
{item?.SalesQty} {item?.HSN} {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} {item?.Type !== 'C' ? item?.OfferAmt || (item?.DiscountAmt / item?.SalesQty) || 0 : item?.OfferValue || (item?.DiscountAmt / item?.SalesQty) || 0} {item?.Rate} {item?.Type !== 'C' ? (item?.TotalAmt || 0) - (item?.OfferAmt || 0) : (item?.TotalAmt || 0) - (item?.OfferValue || 0)}
)} {DineInData?.length > 0 && ( <>
Dine In
{GlobaldummyData ? GlobalSlNo && ( ) : SLNO && ( )} {GlobaldummyData ? GlobalItem && ( ) : Item && ( )} {GlobaldummyData ? GlobalQuantity && ( ) : Quantity && ( )} {GlobaldummyData ? GlobalHsnCode && ( ) : HsnCode && ( )} {GlobaldummyData ? GlobalMRP && ( ) : MRP && ( )} {GlobaldummyData ? GlobalDiscount && ( ) : Discount && ( )} {GlobaldummyData ? GlobalRate && ( ) : Rate && ( )} {GlobaldummyData ? GlobalAmount && ( ) : Amount && ( )} {dataChunk?.map((item, index) => { return ( {GlobaldummyData ? GlobalSlNo && : SLNO && ( )} {GlobaldummyData ? GlobalItem && : Item && ( )} {GlobaldummyData ? GlobalQuantity && ( ) : Quantity && ( )} {GlobaldummyData ? GlobalHsnCode && ( ) : HsnCode && ( )} {GlobaldummyData ? GlobalMRP && ( ) : MRP && ( )} {GlobaldummyData ? GlobalDiscount && ( ) : Discount && ( )} {GlobaldummyData ? GlobalTax && ( ) : Tax && table2Data?.OrderType !== 'E' && ( )} {GlobaldummyData ? GlobalRate && ( ) : Rate && ( )} {GlobaldummyData ? GlobalAmount && ( ) : Amount && ( )} ); })}
# # ItemItem Qty Qty HSN HSN MRP MRP Dis{' '} Dis{' '} Rate Rate Amt Amt
{index + 1} {chunkIndex * chunkSize + index + 1} {item?.ProdName}
{item?.ProdName}
{UomPrint?.SettingValue === 'Y' && (
({item?.Size ? item?.Size : '1'}{' '} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'} )
)}
{item?.SalesQty} {item?.SalesQty} {item?.HSN} {item?.HSN} {item?.MRP} {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} {item.discount} {item?.Type !== 'C' ? item?.OfferAmt || (item?.DiscountAmt / item?.SalesQty) || 0 : item?.OfferValue || (item?.DiscountAmt / item?.SalesQty) || 0} {item?.ProdTaxPercentage || 0} {item?.ProdTaxPercentage || 0} {item?.Rate} {item?.Rate} {item?.TotalAmt} {' '} {item?.Type !== 'C' ? item?.TotalAmt - (item?.OfferAmt || 0) : item?.TotalAmt - (item?.OfferValue || 0)}
)} {/*
*/}
{chunkIndex === paginatedChunks.length - 1 && !shouldFooterBeOnNewPage && FormatTheme && ( <> {DineInData?.length > 0 && TakeawayData?.length > 0 && (
Takeaway: {Number(TakeawayTotal).toFixed(2)}
Dine In: {Number(DineInTotal).toFixed(2)}{' '}

)}
ITEM :
{GlobaldummyData ? '1,066' : productsData?.length}
QTY :
{GlobaldummyData ? '1,066' : Number( productsData?.reduce( (a, b) => a + b.SalesQty, 0 ) )}
{' '}
{TotalLabel}
{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{((totalGSTData?.length > 0 && totalGSTData?.[0]?.TaxAmt > 0) || (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && table2Data?.NetAmount !== 0 && ( <>
--------- GST Breakup Details -----------
{totalGSTData?.length > 0 && totalGSTData?.[0]?.TaxAmt > 0 && (
{totalGSTData?.map((item) => (
Taxable Amount
{( Number( table2Data?.NetAmount ).toFixed(2) - Number(item.CGST).toFixed(2) - Number(item.SGST).toFixed(2) )?.toFixed(2)}
CGST
{Number(item.CGST).toFixed(2)}
SGST
{Number(item.SGST).toFixed(2)}
Total Amount
{Number( table2Data?.NetAmount ).toFixed(2)}
Rupees in words:{' '} {(() => { const num = Number( table2Data?.NetAmount ); const ones = [ '', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', ]; const tens = [ '', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety', ]; if (num < 20) return ones[num]; if (num < 100) return ( tens[Math.floor(num / 10)] + (num % 10 ? ' ' + ones[num % 10] : '') ); if (num < 1000) return ( ones[Math.floor(num / 100)] + ' hundred' + (num % 100 ? ' ' + (num % 100 < 20 ? ones[num % 100] : tens[ Math.floor( (num % 100) / 10 ) ] + (num % 10 ? ' ' + ones[num % 10] : '')) : '') ); return num.toString(); })()}
))}
)} {OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0 && ( <>
{OrderDetailIGST?.map((item) => ( ))}
Taxable Amount IGST Total Amount
{item?.TaxPercentage || 0}% {Number( item.WithOutTaxAmount ).toFixed(2)} {Number(item.TaxAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
)} {OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0 && ( <>
{OrderDetailVAT?.map((item) => ( ))}
Taxable Amount VAT Total Amount
{item?.TaxPercentage || 0}% {Number( item.WithOutTaxAmount ).toFixed(2)} {Number(item.TaxAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
)}
)}
)} {paymentTypelabel &&
{GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ''}{' '}  Payment :  {GlobaldummyData ? '1,066' : 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 && (
{(() => { 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) => (

{i.label} : {i.value}

)); })()}
)}
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{GlobaldummyData ? GlobalQrcodet && (
image
Scan to Pay{' '}
₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed( 2 )}
) : Qrcodet && paymentTypeUPI && (
Scan to Pay{' '}
₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed( 2 )}
)}
)}
{/*
Scan to Pay
*/} {orderNo &&
YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
}
{PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

Split Payment:

*/} {Object.keys(aggregatedPayments).map( (paymentType) => (
{paymentType}:{' '} {aggregatedPayments[paymentType].toFixed( 2 )}
) )} )} {GlobaldummyData && GlobalCashierName && (
{' '} Cashier : Cashier Name
)} {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && (
Cashier : {CashierName}
)} {GlobaldummyData && (
{' '} Customer : Customer Name
)} {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && (
Customer : {table2Data?.CustSuppName}
)} {table2Data?.BookingTypeName == 'Dine In' && table2Data?.SalesTableLinkDetails?.[0] ?.WaiterName && (
Captain :{' '} { table2Data?.SalesTableLinkDetails?.[0] ?.WaiterName }
)} {sportsAppPreference && MembershipApplied && (
{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
)}
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{GlobaldummyData ? GlobalIsnotes && (

Notes : 10 days Return policy


) : Notestext && (

{Notestext}


)}
)} {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{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

)}
)}
{PrintGreeting?.SettingValue === 'Y' && (
Thank You Visit Again
)} )}
))} {shouldFooterBeOnNewPage && FormatTheme && (
<> {DineInData?.length > 0 && TakeawayData?.length > 0 && (
Takeaway: {Number(TakeawayTotal).toFixed(2)}
Dine In: {Number(DineInTotal).toFixed(2)}

)}
ITEM :
{GlobaldummyData ? '1,066' : productsData?.length}
QTY :
{GlobaldummyData ? '1,066' : Number( productsData?.reduce( (a, b) => a + b.SalesQty, 0 ) )}
{TotalLabel}
{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{((totalGSTData?.length > 0 && totalGSTData?.[0]?.TaxAmt > 0) || (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && table2Data?.NetAmount !== 0 && ( <>
--------- GST Breakup Details -----------
{totalGSTData?.length > 0 && totalGSTData?.[0]?.TaxAmt > 0 && (
{totalGSTData?.map((item) => (
Taxable Amount
{( Number( table2Data?.NetAmount ).toFixed(2) - Number(item.CGST).toFixed(2) - Number(item.SGST).toFixed(2) )?.toFixed(2)}
CGST
{Number(item.CGST).toFixed(2)}
SGST
{Number(item.SGST).toFixed(2)}
Total Amount
{Number( table2Data?.NetAmount ).toFixed(2)}
Rupees in words:{' '} {(() => { const num = Number( table2Data?.NetAmount ); const ones = [ '', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', ]; const tens = [ '', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety', ]; if (num < 20) return ones[num]; if (num < 100) return ( tens[Math.floor(num / 10)] + (num % 10 ? ' ' + ones[num % 10] : '') ); if (num < 1000) return ( ones[Math.floor(num / 100)] + ' hundred' + (num % 100 ? ' ' + (num % 100 < 20 ? ones[num % 100] : tens[ Math.floor( (num % 100) / 10 ) ] + (num % 10 ? ' ' + ones[num % 10] : '')) : '') ); return num.toString(); })()}
))}
)} {OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0 && ( <>
{OrderDetailIGST?.map((item) => ( ))}
Taxable Amount IGST Total Amount
{item?.TaxPercentage || 0}% {Number( item.WithOutTaxAmount ).toFixed(2)} {Number(item.TaxAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
)} {OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0 && ( <>
{OrderDetailVAT?.map((item) => ( ))}
Taxable Amount VAT Total Amount
{item?.TaxPercentage || 0}% {Number( item.WithOutTaxAmount ).toFixed(2)} {Number(item.TaxAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
)}
)}
)} {paymentTypelabel &&
{GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ''}{' '}  Payment :  {GlobaldummyData ? '1,066' : 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 && (
{(() => { 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) => (

{i.label} : {i.value}

)); })()}
)} {/*
*/}
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{GlobaldummyData ? GlobalQrcodet && (
image
Scan to Pay{' '}
₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
) : Qrcodet && paymentTypeUPI && (
Scan to Pay{' '}
₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
)}
)}
{/*
Scan to Pay
*/} {orderNo &&
YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
}
{PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

Split Payment:

*/} {Object.keys(aggregatedPayments).map( (paymentType) => (
{paymentType}:{' '} {aggregatedPayments[paymentType].toFixed(2)}
) )} )} {GlobaldummyData && GlobalCashierName && (
{' '} Cashier : Cashier Name
)} {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && (
Cashier : {CashierName}
)} {GlobaldummyData && (
{' '} Customer : Customer Name
)} {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && (
Customer : {table2Data?.CustSuppName}
)} {table2Data?.BookingTypeName == 'Dine In' && table2Data?.SalesTableLinkDetails?.[0] ?.WaiterName && (
Captain :{' '} { table2Data?.SalesTableLinkDetails?.[0] ?.WaiterName }
)} {sportsAppPreference && MembershipApplied && (
{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
)}
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{GlobaldummyData ? GlobalIsnotes && (

Notes : 10 days Return policy


) : Notestext && (

{Notestext}


)}
)} {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{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

)}
)}
{PrintGreeting?.SettingValue === 'Y' && (
Thank You Visit Again
)}
)}
) : (
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{GlobaldummyData && GlobalLogo ? ( image ) : null} {base64Image && (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( image ) : null}
{GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
{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 : '')}
{' '} Mobile : +91{' '} {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
)} {/*
{GlobaldummyData ? 'XYZ Shop' : table2Data?.BrMobile}
*/}
Dt: {GlobaldummyData ? formattedDate : Date1} {SalesModePref?.SettingValue == 'Y' && (
{' '} Name :{' '} {table2Data?.SalesMode == 'R' ? Retailshortname?.Comments : Wholesaleshortname?.Comments}{' '}
)}
{BillNoLabel}: {GlobaldummyData ? '51' : table2Data?.OrderId && extractLastNumberOrderId( table2Data?.OrderId, table2Data?.FYStatus )}
{table2Data?.OrderType === 'E' && estimateTitle && (
Estimate{' '} {/* {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
)} {table2Data?.OrderType === 'E' ? ( '' ) : (
{GlobaldummyData ? GlobalBilltext ? GlobalBilltext : 'Cash' + ' Bill' : BillName || (PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ' Bill')}{' '} {/* {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
)} {/*
*/} {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> {takeAwayPreference && (
Take Away
)}
{GlobaldummyData ? GlobalSlNo && ( ) : SLNO && ( )} {GlobaldummyData ? GlobalItem && ( ) : Item && } {GlobaldummyData ? GlobalQuantity && ( ) : Quantity && ( )} {GlobaldummyData ? GlobalHsnCode && ( ) : HsnCode && ( )} {GlobaldummyData ? GlobalMRP && ( ) : MRP && ( )} {GlobaldummyData ? GlobalDiscount && ( ) : Discount && ( )} {/* {GlobaldummyData ? GlobalTax && ( ) : Tax == true && table2Data?.OrderType !== 'E' && ( )} */} {GlobaldummyData ? GlobalRate && ( ) : Rate && ( )} {GlobaldummyData ? GlobalAmount && ( ) : Amount && ( )} {(GlobaldummyData ? products : TakeawayData)?.map( (item, index) => { return ( {GlobaldummyData ? GlobalSlNo && : SLNO && } {GlobaldummyData ? GlobalItem && : Item && ( )} {GlobaldummyData ? GlobalQuantity && ( ) : Quantity && ( )} {GlobaldummyData ? GlobalHsnCode && ( ) : HsnCode && ( )} {GlobaldummyData ? GlobalMRP && ( ) : MRP && ( ) : Tax == true && table2Data?.OrderType !== 'E' && ( )} )} {GlobaldummyData ? GlobalDiscount && ( ) : Discount && ( )} {GlobaldummyData ? GlobalRate && ( ) : Rate && ( )} {GlobaldummyData ? GlobalAmount && ( ) : Amount && ( )} ); } )}
# # ItemItem Qty Qty HSN HSN MRP MRP Dis{' '} Dis{' '} GST GST Rate Rate Amt Amt
{index + 1}{index + 1}{item?.ProdName}
{item?.ProdName}
{/* Serial Numbers */} {item?.ProductIdentifierDtls?.filter( (d) => d.SerialNumber )?.map((d, i) => (
{d.SerialNumber}
))} {/* IMEI Numbers */} {item?.ProductIdentifierDtls?.filter( (d) => d.IMEI1 || d.IMEI2 )?.map((d, i) => (
{[d.IMEI1, d.IMEI2] .filter(Boolean) .join(', ')}
))} {/* Description from first identifier */} {item?.ProductIdentifierDtls?.length > 0 && item.ProductIdentifierDtls?.[0] ?.Description && (
{ item.ProductIdentifierDtls?.[0] ?.Description }
)}
{item?.SalesQty}
{/* Package Details */} {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})
))} {/* Serial */} {item?.ProductIdentifierDtls?.filter( (d) => d.SerialNumber )?.map((d, i) => (
{d.SerialNumber}
))} {/* IMEI */} {item?.ProductIdentifierDtls?.filter( (d) => d.IMEI1 || d.IMEI2 )?.map((d, i) => (
{[d.IMEI1, d.IMEI2] .filter(Boolean) .join(', ')}
))} {/* Description from first identifier */} {item?.ProductIdentifierDtls?.length > 0 && item.ProductIdentifierDtls?.[0] ?.Description && (
{ item .ProductIdentifierDtls?.[0] ?.Description }
)}
) : (
{UomPrint?.SettingValue === 'Y' && ( <> ({item?.Size || '1'}){' '} {item?.SinglePc === 'Y' ? 'PCS' : item?.Type !== 'C' ? item?.UomName : 'COMBO'}{' '} )} {item?.BrandName || ''}
)}
{item?.SalesQty} {item?.HSN} {item?.HSN} {item?.MRP} {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} {GlobaldummyData ? GlobalTax && ( GST:{' '} {' '} {item?.ProdTaxPercentage || 0} {/* */} GST:{' '} {' '} {item?.ProdTaxPercentage || 0} {item.discount} {item?.Type !== 'C' ? item?.OfferAmt || (item?.DiscountAmt / item?.SalesQty) || 0 : item?.OfferValue || (item?.DiscountAmt / item?.SalesQty) || 0} {item?.Rate} {item?.Rate} {item?.TotalAmt} {' '} {item?.Type !== 'C' ? item?.TotalAmt - (item?.OfferAmt || 0) : item?.TotalAmt - (item?.OfferValue || 0)}
)} {DineInData?.length > 0 && ( <>
Dine In
{GlobaldummyData ? GlobalSlNo && : SLNO && } {GlobaldummyData ? GlobalItem && : Item && } {GlobaldummyData ? GlobalQuantity && ( ) : Quantity && ( )} {GlobaldummyData ? GlobalHsnCode && ( ) : HsnCode && ( )} {GlobaldummyData ? GlobalMRP && ( ) : MRP && ( )} {GlobaldummyData ? GlobalDiscount && ( ) : Discount && ( )} {/* {GlobaldummyData ? GlobalTax && ( ) : Tax == true && table2Data?.OrderType !== 'E' && ( )} */} {GlobaldummyData ? GlobalRate && ( ) : Rate && ( )} {GlobaldummyData ? GlobalAmount && ( ) : Amount && ( )} {(GlobaldummyData ? products : DineInData)?.map( (item, index) => { return ( {GlobaldummyData ? GlobalSlNo && : SLNO && } {GlobaldummyData ? GlobalItem && : Item && ( )} {GlobaldummyData ? GlobalQuantity && ( ) : Quantity && ( )} {GlobaldummyData ? GlobalHsnCode && ( ) : HsnCode && ( )} {GlobaldummyData ? GlobalMRP && ( ) : MRP && ( )} {GlobaldummyData ? GlobalDiscount && ( ) : Discount && ( )} {GlobaldummyData ? GlobalTax && ( ) : Tax == true && table2Data?.OrderType !== 'E' && ( )} {GlobaldummyData ? GlobalRate && ( ) : Rate && ( )} {GlobaldummyData ? GlobalAmount && ( ) : Amount && ( )} ); } )}
##ItemItem Qty Qty HSN HSN MRP MRP Dis{' '} Dis{' '} GST GST Rate Rate Amt Amt
{index + 1}{index + 1}{item?.ProdName}
{item?.ProdName}
{( (item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( (items) => items.SerialNumber ) .map( (a, index) => ` ${a.SerialNumber}` ) .join('') : '') + (item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( (item1) => item1.IMEI1 || item1.IMEI2 ) .map((item2) => { const imei1 = item2.IMEI1 || ''; const imei2 = item2.IMEI2 || ''; return ` ${[imei1, imei2].filter(Boolean).join(',')}`; }) .join('') : '') + (item?.ProductIdentifierDtls?.length > 0 && item.ProductIdentifierDtls?.[0] ?.Description) && (
{ item.ProductIdentifierDtls?.[0] ?.Description }
) )?.trim()}
{item?.SalesQty}
({item?.Size ? item?.Size : '1'}{' '} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'} )
{item?.SalesQty} {UomPrint?.SettingValue === 'Y' && (
({item?.Size ? item?.Size : '1'}{' '} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'} )
)}
{item?.HSN} {item?.HSN} {item?.MRP} {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} {item.discount} {item?.Type !== 'C' ? item?.OfferAmt || (item?.DiscountAmt / item?.SalesQty) || 0 : item?.OfferValue || (item?.DiscountAmt / item?.SalesQty) || 0} {item?.ProdTaxPercentage || 0} {item?.ProdTaxPercentage || 0} {item?.Rate} {item?.Rate} {item?.TotalAmt} {' '} {item?.Type !== 'C' ? item?.TotalAmt - (item?.OfferAmt || 0) : item?.TotalAmt - (item?.OfferValue || 0)}
)} {DineInData?.length > 0 && TakeawayData?.length > 0 && ( <>
Takeaway: {Number(TakeawayTotal).toFixed(2)}
Dine In: {Number(DineInTotal).toFixed(2)}

)}
ITEM :
{GlobaldummyData ? '1,066' : productsData?.length}
QTY :
{GlobaldummyData ? '1,066' : Number(productsData?.reduce((a, b) => a + b.SalesQty, 0))}
{TotalLabel}
{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{((totalGSTData?.length > 0 && totalGSTData?.[0]?.TaxAmt > 0) || (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && table2Data?.NetAmount !== 0 && ( <>
{/* --------- GST Breakup Details ----------- */}
{totalGSTData?.length > 0 && totalGSTData?.[0]?.TaxAmt > 0 && (
{totalGSTData?.map((item) => (
Taxable Amount
{( Number(table2Data?.NetAmount).toFixed(2) - Number(item.CGST).toFixed(2) - Number(item.SGST).toFixed(2) )?.toFixed(2)}
CGST
{Number(item.CGST).toFixed(2)}
SGST
{Number(item.SGST).toFixed(2)}
Total Amount
{Number(table2Data?.NetAmount).toFixed(2)}
Rupees in words:{' '} {(() => { const num = Number(table2Data?.NetAmount); const ones = [ '', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', ]; const tens = [ '', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety', ]; if (num < 20) return ones[num]; if (num < 100) return ( tens[Math.floor(num / 10)] + (num % 10 ? ' ' + ones[num % 10] : '') ); if (num < 1000) return ( ones[Math.floor(num / 100)] + ' hundred' + (num % 100 ? ' ' + (num % 100 < 20 ? ones[num % 100] : tens[ Math.floor((num % 100) / 10) ] + (num % 10 ? ' ' + ones[num % 10] : '')) : '') ); return num.toString(); })()}
))}
)} {OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0 && ( <>
{OrderDetailIGST?.map((item) => ( ))}
Taxable Amount IGST Total Amount
{item?.TaxPercentage || 0}% {Number(item.WithOutTaxAmount).toFixed(2)} {Number(item.TaxAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
)} {OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0 && ( <>
{OrderDetailVAT?.map((item) => ( ))}
Taxable Amount VAT Total Amount
{item?.TaxPercentage || 0}% {Number(item.WithOutTaxAmount).toFixed(2)} {Number(item.TaxAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
)}
)}
)} {paymentTypelabel &&
{GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ''}{' '}  Payment :  {GlobaldummyData ? '1,066' : 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 && (
{(() => { 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) => (

{i.label} : {i.value}

)); })()}
)}
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{GlobaldummyData ? GlobalQrcodet && (
image
Scan to Pay
₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
) : Qrcodet && paymentTypeUPI && (
Scan to Pay
₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
)}
)}
{/*
Scan to Pay
*/} {orderNo &&
YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
}
{PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

Split Payment:

*/} {Object.keys(aggregatedPayments).map((paymentType) => (
{paymentType}:{' '} {aggregatedPayments[paymentType].toFixed(2)}
))} )} {GlobaldummyData && GlobalCashierName && (
{' '} Cashier : Cashier Name
)} {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && (
Cashier : {CashierName}
)} {GlobaldummyData && (
{' '} Customer : Customer Name
)} {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && (
Customer : {table2Data?.CustSuppName}
)} {table2Data?.BookingTypeName == 'Dine In' && table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && (
Captain :{' '} {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
)} {sportsAppPreference && MembershipApplied && (
{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
)}
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{GlobaldummyData ? GlobalIsnotes && (

Notes : 10 days Return policy


) : Notestext && (

{Notestext}


)}
)} {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
{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

)}
)}
{PrintGreeting?.SettingValue === 'Y' && (
Thank You Visit Again
)}
)} ); }; export default Printstyle4;