import React from "react"; import { useDispatch, useSelector } from "react-redux"; import { extractLastNumber, extractLastNumberOrderId, } from "../../../../Services/Others"; import Logo from '../../../../Images/Logo.jpg' import { GlobalprintSlNo, GlobalprintItem, GlobalprintMRP, GlobalprintDiscount, GlobalprintQuantity, GlobalprintRate, GlobalprintAmount, GlobalprintHsnCode, GlobalprintQrcodet, GlobalPritdummyData, changeReprintDataFound, GloabalFieldDetails, GlobalprintSignature, GlobalprinttermsAndConditions, GlobalSignatureImage, Globalnotes, GlobalthemeFormat, GlobalBillName, GlobalprintCashierName, GlobalprintLogo, GlobalprintTax, } from "../../../../Features/ThemeChange/ThemeChange"; import "../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.scss"; import QRCode from "react-qr-code"; import { GlobalUpiIDprint, PreferenceData } from "../../../../Features/BookingScreen/BookingData/BookingData"; import signature from "../../../../Images/signatureimage.jpg" import { isMobile } from 'react-device-detect'; const InvoiceTemplate = ({ index, totalQuantityFilter, Date1, CashierName, totalQuantity, OrderDetailGST, OrderDetailIGST, OrderDetailVAT, table2Data, UpiId, PaymentStatus, PrintLogo, PrintGreeting, base64Image, printDatas, isPdf, sportsAppPreference, MembershipApplied = null }) => { const dispatch = useDispatch(); const GlobalUpiID = useSelector(GlobalUpiIDprint); const FieldDetails = useSelector(GloabalFieldDetails); console.log(table2Data, "FieldDetails") const SLNO = FieldDetails?.["Sl.No"]; const Item = FieldDetails?.["Item"]; console.log(Item, "Item") const MRP = FieldDetails?.["MRP"]; const Discount = FieldDetails?.["Discount"]; const Quantity = FieldDetails?.["Quantity"]; const Tax = FieldDetails?.["Tax"]; const Rate = FieldDetails?.["Rate"]; const Amount = FieldDetails?.["Amount"]; const HsnCode = FieldDetails?.["HsnCode"]; const Qrcodet = FieldDetails?.["Qrcode"]; const LogoField = FieldDetails?.["Logo"]; 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 GlobalSignature = useSelector(GlobalprintSignature); const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); const GlobalSignatureImages = useSelector(GlobalSignatureImage); const GlobalIsnotes = useSelector(Globalnotes); const GlobalthemeFormatr = useSelector(GlobalthemeFormat) const GlobalBilltext = useSelector(GlobalBillName) const GlobalLogo = useSelector(GlobalprintLogo); const SettingData = useSelector(PreferenceData); const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' const keysLength = Object.keys(table2Data ?? {}).length; console.log(GlobalDiscount, Discount, "Discount"); let BankDetails = table2Data?.BankDetails 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"]; console.log(BankDetails, "GlobalthemeFormatr"); console.log(table2Data, "FormatThemekjhjk", PaymentStatus) if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } const currentDate = new Date(); const day = currentDate.getDate().toString().padStart(2, "0"); const monthNames = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ]; const monthIndex = currentDate.getMonth(); const year = currentDate.getFullYear().toString().slice(-2); const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; const TakeawayData = table2Data?.productDetails?.filter( (item) => item.BookingTypeName?.toLowerCase() === "takeaway" ); const DineInData = table2Data?.productDetails?.filter( (item) => item.BookingTypeName?.toLowerCase() === "dine in" ); let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === "S" ); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, 0 ); const PackageDetails = table2Data?.PackageDtl 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; console.log(table2Data, "productsDatakl") // 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 invoiceData = { company: { name: "Prematix Software Solution Pvt Ltd.", address: "#589, 2nd floor, VP Chambers, 1st cross, 3rd block, Koramangala, Bengaluru- 560034.", phone: "9344270900", email: "info@prematix.com", gstin: "29AAICP0469K1ZX" }, invoice: { state: "Karnataka", stateCode: "29", date: "13/04/2024", number: "BLR/01/2024-25", reverseCharge: "", placeOfSupply: "", dateOfSupply: "", vehicleNumber: "", transportationMode: "" }, billTo: { name: "Ooty Boat House", address: "No:2, North Lake Road,", state: "Tamil Nadu", stateCode: "33", gstin: "", poNumber: "BLR/14/2024", poDate: "11/04/2024" }, items: [ { sr: 1, name: "Acrylic Scanner Box", hsn: "39204900", uom: "INR", qty: 1, rate: 6501, amount: 6501, discount: 0, taxableValue: 6501, cgstRate: 0, cgstAmount: 0, sgstRate: 0, sgstAmount: 0, igstRate: 18.00, igstAmount: 1170, totalAmount: 7671 }, { sr: 2, name: '32" Wide Angle view display FHD', hsn: "84716030", uom: "INR", qty: 1, rate: 48317, amount: 48317, discount: 0, taxableValue: 48317, cgstRate: 0, cgstAmount: 0, sgstRate: 0, sgstAmount: 0, igstRate: 18.00, igstAmount: 8697, totalAmount: 57014 }, { sr: 3, name: "Service charges", hsn: "999630", uom: "INR", qty: 1, rate: 25000, amount: 25000, discount: 0, taxableValue: 25000, cgstRate: 0, cgstAmount: 0, sgstRate: 0, sgstAmount: 0, igstRate: 18.00, igstAmount: 4500, totalAmount: 29500 }, ], totals: { beforeTax: 83660, igst: 15059, sgst: 0, cgst: 0, totalGst: 15059, afterTax: 98719, amountInWords: "Ninety Eight Thousand Seven Hundred and Nineteen Rupees Only" }, bankDetails: { bankName: "State Bank of India", accountNo: "34850253701", ifscCode: "SBIN0006242", branchName: "Mookandapalli" } }; const chunkSize = isMobile ? 11 : PageSize == "A5" ? 8 : 9; let dataSource = []; if (GlobaldummyData || TakeawayData?.length > 0) { dataSource = GlobaldummyData ? "" : TakeawayData; } else if (DineInData?.length > 0) { dataSource = DineInData; } const paginatedChunks = []; for (let i = 0; i < dataSource.length; i += chunkSize) { paginatedChunks.push(dataSource.slice(i, i + chunkSize)); } const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; const shouldFooterBeOnNewPage = lastChunkRows > (isMobile ? 11 : PageSize == "A5" ? 4 : 6); console.log(table2Data, "table2Datah") const companyName = table2Data?.CompName; const companyAddress = table2Data?.AddressDetails?.[0]?.Address1 + table2Data?.AddressDetails?.[0]?.Address2 || "#589, 2nd floor, VP Chambers, 1st cross, 3rd block, Koramangala, Bengaluru- 560034."; const companyPhone = table2Data?.BrMobile + "," + table2Data?.BrMobile2 !== null ? table2Data?.BrMobile2 : ""; const companyEmail = table2Data?.CompanyEmail || "info@prematix.com"; const companyGSTIN = table2Data?.CompGSTIN; // Billing Address (replace static values) const billToName = table2Data?.CustomerName || "Ooty Boat House"; const billToAddress = table2Data?.CustomerAddress || "No:2, North Lake Road,"; const billToState = table2Data?.CustomerState || "Tamil Nadu"; const billToStateCode = table2Data?.CustomerStateCode || "33"; const billToGSTIN = table2Data?.CustomerGSTIN || ""; const InvoiceAmountWords = ({ amount }) => { const numberToWords = (num) => { const a = [ "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen" ]; const b = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"]; if (num === 0) return "Zero"; if (num < 20) return a[num]; if (num < 100) return b[Math.floor(num / 10)] + (num % 10 ? " " + a[num % 10] : ""); if (num < 1000) return a[Math.floor(num / 100)] + " Hundred" + (num % 100 ? " and " + numberToWords(num % 100) : ""); if (num < 100000) return numberToWords(Math.floor(num / 1000)) + " Thousand" + (num % 1000 ? " " + numberToWords(num % 1000) : ""); return "Number too large"; }; return (

Total Invoice Amount in Words:

{numberToWords(amount)}

); }; 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", }, ]; 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: FormatTheme ? isMobile ? "293mm" : PageSize == "A5" ? '170mm' : "275mm" : "", marginBottom: "0" }} key={chunkIndex}> {/*
*/} {/* Header */} {/*
*/}
{((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
{(GlobalLogo && GlobaldummyData) &&
Brand Logo
} {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? Brand Logo : null}

{GlobaldummyData ? "Company Name" : companyName}

{companyAddress}

Phone: {GlobaldummyData ? "999999XXXX" : companyPhone}
Email: {companyEmail}
{companyGSTIN || GlobaldummyData &&
GSTIN: {GlobaldummyData ? "XXTTHJJF7679" : companyGSTIN}
}
{" "} BillNo: {GlobaldummyData ? "121" : table2Data?.OrderId && extractLastNumberOrderId( table2Data?.OrderId, table2Data?.FYStatus )}
)} {/* Invoice Title */}
{table2Data?.OrderType === "E" && (
Estimate{" "}
)} {table2Data?.OrderType === "E" ? ( "" ) : (
{GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""}
)}
{GlobaldummyData ?

Details of Receiver | Billed to

Name : {GlobaldummyData ? ( {"XXXYYY"} ) : table2Data?.CustomerDetails?.[0]?.CustSuppName}
Address: XYZ City
State: XYZ State
: table2Data?.CustomerDetails?.length > 0 &&

Details of Receiver | Billed to

Name : {GlobaldummyData ? ( {"XXXYYY"} ) : table2Data?.CustomerDetails?.[0]?.CustSuppName}
Address: {table2Data?.CustomerDetails?.length > 0 && !GlobaldummyData && ( {table2Data?.CustomerDetails?.[0]?.Address1} {table2Data?.CustomerDetails?.[0]?.Address2} )}
State: {table2Data?.CustomerDetails?.[0]?.State}
{table2Data?.CustomerDetails?.[0]?.CustGSTNo &&
GST: {table2Data?.CustomerDetails?.[0]?.CustGSTNo}
}
}
{/* Items Table */}
{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 && } {((GlobaldummyData ? products : dataChunk) || []).map((item, idx) => ( {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 && ( )} ))}
S.NoS.NoItemItemHSN HSN Qty { WeightasKg ?'Qty/Kg' :'Qty'}UOM UOMMRPMRPRateRateDisDisTax %Tax %AmountAmount
{chunkIndex * chunkSize + idx + 1} {chunkIndex * chunkSize + idx + 1} {item?.ProdName}
{item?.ProdName}
{(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ?
{PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) ))}
:
({item?.Size ? item?.Size : "1"}{" "} {item?.SinglePc == "Y" ? "PCS" : item?.Type != "C" ? item?.UomName : "COMBO"} )
)}  {" "} {item?.BrandName !== null ? item?.BrandName : ""}   {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls?.filter( (items) => !( items.SerialNumber == "" || items.SerialNumber == null ) )?.map((a) => { return
{a.SerialNumber}
; }) : ""}{" "} {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(",")}
); }) : ""}
{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}
{Array.isArray(dataChunk) && dataChunk.length === 1 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 1 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 1 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 1 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 1 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 1 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 2 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 2 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 2 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 2 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 2 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 3 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 3 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 3 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 3 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 4 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 4 && (
)} {Array.isArray(dataChunk) && dataChunk.length === 5 && (
)} {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && <> {(sportsAppPreference && MembershipApplied) &&
{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
}
Items :
{GlobaldummyData ? "7" : totalQuantityFilter?.length}
Qty :
{GlobaldummyData ? "9" : totalQuantity}
Off :
{(Number(TotalOfferAmount || 0) + Number(table2Data?.OverallDisc || 0)).toFixed(2)}
Amount :₹
{GlobaldummyData ? "1066" : (table2Data?.NetAmount)}
{/* Summary */}
{GlobaldummyData ?
:
} {table2Data?.OrderType !== 'E' &&
Total Taxable Amount :
{GlobaldummyData ? 736 : table2Data?.BillAmount}
{OrderDetailGST?.map((item, index) => (
Taxable Amount :
{Number(item.WithOutTaxAmount).toFixed(2)}
CGST ({item.TaxPercentage / 2}%) :
{Number(item.CGST).toFixed(2)}
SGST ({item.TaxPercentage / 2}%) :
{Number(item.SGST).toFixed(2)}
Total (incl GST) :
{Number(item.TotalAmt).toFixed(2)}
))}
{/*
GST Payable on Reverse Charge
*/}
Total Amount Payable :
{Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)}
{/*
Total Amount Payable {Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)}
*/} {/*
{Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)}
*/}
}
{/* Footer */}
{(BankDetails?.length > 0) && (<>

Bank Details:

Bank Name: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.BankName}
Account No.: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.AccountNo}
IFSC Code: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.IFSCCode}
Branch Name: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.BankBranch}

)}
{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. */}
) }

Certified that the particulars given above are true and correct.

{GlobaldummyData ?

Company Name

: (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :

"For" {companyName}

}

Authorised Signatory

{GlobaldummyData ? GlobalSignature && (
) : Signature == true && (
{(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : }
)}

(Common Seal)

{/*
*/} {/* Copy Labels */}
{GlobaldummyData ? GlobalIsnotes && (

Notes : 10 days Return policy


) : Notestext && (

{Notestext}

{/*
*/}
) }
}
//
))}
{/*
*/} {shouldFooterBeOnNewPage && FormatTheme &&
<> {(sportsAppPreference && MembershipApplied) &&
{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
}
Items :
{GlobaldummyData ? "7" : totalQuantityFilter?.length}
Qty :
{GlobaldummyData ? "9" : totalQuantity}
Off :
{(Number(TotalOfferAmount || 0) + Number(table2Data?.OverallDisc || 0)).toFixed(2)}
Amount :₹
{GlobaldummyData ? "1066" : (table2Data?.NetAmount)}
{/*
*/} {/* Summary */}
{GlobaldummyData ?
:
} {table2Data?.OrderType !== 'E' &&
Total Taxable Amount :
{GlobaldummyData ? 736 : table2Data?.BillAmount}
{OrderDetailGST?.map((item, index) => (
Taxable Amount :
{Number(item.WithOutTaxAmount).toFixed(2)}
CGST ({item.TaxPercentage / 2}%) :
{Number(item.CGST).toFixed(2)}
SGST ({item.TaxPercentage / 2}%) :
{Number(item.SGST).toFixed(2)}
Total Amount Tax :
{Number(item.TotalAmt).toFixed(2)}
))}
{/*
GST Payable on Reverse Charge
*/}
Total Amount Payable {Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)}
{Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)}
}
{/* Footer */}
{BankDetails?.length > 0 && (<>

Bank Details:

Bank Name: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.BankName}
Account No.: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.AccountNo}
IFSC Code: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.IFSCCode}
Branch Name: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.BankBranch}

)}
{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. */}
) }

Certified that the particulars given above are true and correct.

{GlobaldummyData ?

Company Name

:

"For" {companyName}

}

Authorised Signatory

{GlobaldummyData ? GlobalSignature && (
) : Signature == true && (
)}

(Common Seal)

{/*
*/} {/* Copy Labels */}
{GlobaldummyData ? GlobalIsnotes && (

Notes : 10 days Return policy


) : Notestext && (

{Notestext}

{/*
*/}
) }
} :
{/* Header */} {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
{(GlobalLogo && GlobaldummyData) &&
Brand Logo
} {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? Brand Logo : null}

{GlobaldummyData ? "Company Name" : companyName}

{companyAddress}

Phone: {GlobaldummyData ? "999999XXXX" : companyPhone}
Email: {companyEmail}
{companyGSTIN || GlobaldummyData &&
GSTIN: {GlobaldummyData ? "XXTTHJJF7679" : companyGSTIN}
}
} {/* Invoice Title */}
{table2Data?.OrderType === "E" && (
Estimate{" "}
)} {table2Data?.OrderType === "E" ? ( "" ) : (
{GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""}
)}
{GlobaldummyData ?

Details of Receiver | Billed to

Name : {GlobaldummyData ? ( {"XXXYYY"} ) : table2Data?.CustomerDetails?.[0]?.CustSuppName}
Address: XYZ City
State: XYZ State
: table2Data?.CustomerDetails?.length > 0 &&

Details of Receiver | Billed to

Name : {GlobaldummyData ? ( {"XXXYYY"} ) : table2Data?.CustomerDetails?.[0]?.CustSuppName}
Address: {table2Data?.CustomerDetails?.length > 0 && !GlobaldummyData && ( {table2Data?.CustomerDetails?.[0]?.Address1} {table2Data?.CustomerDetails?.[0]?.Address2} )}
State: {table2Data?.CustomerDetails?.[0]?.State}
} {/* Items Table */}
{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 && } {/* */} {/* */} {((GlobaldummyData ? products : productsData) || []).map((item, idx) => ( {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 && ( )} ))}
S.NoS.NoItemItemHSN HSN Qty { WeightasKg ?'Qty/Kg' :'Qty'}UOM UOMMRPMRPRateRateDisDisTax %Tax %AmountAmountTaxable IGST Total
Rate Amount
{idx + 1} {idx + 1} {item?.ProdName}
{item?.ProdName}
({item?.Size ? item?.Size : "1"}{" "} {item?.SinglePc == "Y" ? "PCS" : item?.Type != "C" ? item?.UomName : "COMBO"} )
 {" "} {item?.BrandName !== null ? item?.BrandName : ""}   {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls?.filter( (items) => !( items.SerialNumber == "" || items.SerialNumber == null ) )?.map((a) => { return
{a.SerialNumber}
; }) : ""}{" "} {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(",")}
); }) : ""}
{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}
{" "} Items:{GlobaldummyData ? "7" : totalQuantityFilter?.length}
{" "} Qty:{GlobaldummyData ? "9" : totalQuantity}
{/* {ExtraChargeTotal > 0 &&

Extra Charges:{ExtraChargeTotal}

} */} {(TotalOfferAmount > 0 || table2Data?.OverallDisc > 0) && (

Off :{(Number(TotalOfferAmount || 0) + Number(table2Data?.OverallDisc || 0)).toFixed(2)}

)}
Amount :₹ {GlobaldummyData ? "1066" : Number(table2Data?.NetAmount).toFixed(2)}
{/* Summary */}
{GlobaldummyData ?
:
} {table2Data?.OrderType !== 'E' &&
Total Taxable Amount :
{GlobaldummyData ? 736 : table2Data?.BillAmount}
{OrderDetailGST?.map((item, index) => (
Taxable Amount :
{Number(item.WithOutTaxAmount).toFixed(2)}
CGST ({item.TaxPercentage / 2}%) :
{Number(item.CGST).toFixed(2)}
SGST ({item.TaxPercentage / 2}%) :
{Number(item.SGST).toFixed(2)}
Total (incl GST) :
{Number(item.TotalAmt).toFixed(2)}
))}
{/*
GST Payable on Reverse Charge
*/}
Total Amount Payable {Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)}
{Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)}
}
{/* Footer */}
{(BankDetails?.length > 0 || GlobaldummyData) && (<>

Bank Details:

Bank Name: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.BankName}
Account No.: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.AccountNo}
IFSC Code: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.IFSCCode}
Branch Name: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.BankBranch}

)}
{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. */}
) }

Certified that the particulars given above are true and correct.

{GlobaldummyData ?

Company Name

:

"For" {companyName}

}

Authorised Signatory

{GlobaldummyData ? GlobalSignature && (
) : Signature == true && (
)}

(Common Seal)

{/* Copy Labels */}
{GlobaldummyData ? GlobalIsnotes && (

Notes : 10 days Return policy


) : Notestext && (

{Notestext}

{/*
*/}
) }
} ); }; export default InvoiceTemplate;