From 2cb2199390fd5492e71b369f726c98c28b838f48 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 30 Jan 2026 16:11:37 +0530 Subject: [PATCH 01/20] TaxInvoice Printer Design Issue' --- .../UtillComponents/MultipleSearch.jsx | 213 +- .../PrintTemplates/A4/TaxInvoice.jsx | 1745 +++++++++-------- src/Pages/Preference/PreferenceList.jsx | 14 +- src/Pages/Preference/PreferenceList.scss | 23 +- .../BSCategories/BSCategoryHorizontal.scss | 2 +- .../Components/BSNavbar/BSNavbar3.scss | 2 +- src/Styles/Reports/KOT/kot.scss | 23 +- 7 files changed, 1021 insertions(+), 1001 deletions(-) diff --git a/src/Pages/BookingScreen/Components/UtillComponents/MultipleSearch.jsx b/src/Pages/BookingScreen/Components/UtillComponents/MultipleSearch.jsx index ace6660..a7cfc90 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/MultipleSearch.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/MultipleSearch.jsx @@ -1,126 +1,125 @@ import React, { useEffect, useState } from "react"; import { getSession } from "../../../../Services/Others"; import { useDispatch } from "react-redux"; -import { getmultipleSearch, PostProductSearch } from "../../../../Features/BookingScreen/BookingData/BookingData"; +import { + getmultipleSearch, + PostProductSearch, +} from "../../../../Features/BookingScreen/BookingData/BookingData"; import Buttons from "../../../../Components/Forms/Buttons"; - const MultipleSearch = ({ close }) => { - const CompId = getSession("CompId"); - const BranchId = getSession("BranchId"); - const AppId = getSession("AppId"); - const dispatch = useDispatch(); + const CompId = getSession("CompId"); + const BranchId = getSession("BranchId"); + const AppId = getSession("AppId"); + const dispatch = useDispatch(); + const options = [ + { label: "Product Name", value: "ProdName" }, + { label: "Product Variant Name", value: "ProdVariantName" }, + // { label: "Product ID", value: "ProdId" }, + { label: "One Piece QR", value: "OnePcQR" }, + { label: "QR Code", value: "QrCode" }, + { label: "Product Name Code", value: "ProdNameCode" }, + { label: "Category Name", value: "CategoryName" }, + { label: "Sub Category Name", value: "SubCategoryName" }, + { label: "Brand Name", value: "BrandName" }, + ]; - const options = [ - { label: "Product Name", value: "ProdName" }, - { label: "Product Variant Name", value: "ProdVariantName" }, - // { label: "Product ID", value: "ProdId" }, - { label: "One Piece QR", value: "OnePcQR" }, - { label: "QR Code", value: "QrCode" }, - { label: "Product Name Code", value: "ProdNameCode" }, - { label: "Category Name", value: "CategoryName" }, - { label: "Sub Category Name", value: "SubCategoryName" }, - { label: "Brand Name", value: "BrandName" }, - ]; + const [selectedValues, setSelectedValues] = useState([]); + console.log(selectedValues, "selectedValuesselectedValues"); + useEffect(() => { + GetmultipleSearchData(); + }, []); - const [selectedValues, setSelectedValues] = useState([]); - console.log(selectedValues, 'selectedValuesselectedValues'); + const postMultipleSearch = async () => { + if (selectedValues.length === 0) { + alert("Please select at least one option!"); + return; + } + const data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + SearchTerms: selectedValues, + }; + try { + const response = await dispatch(PostProductSearch(data)).unwrap(); + console.log("Search Response:", response); + if (response?.data?.statusCode == 1) { + setSelectedValues(""); + close(false); + } + } catch (error) { + console.error("Search Error:", error); + } + }; - useEffect(() => { - GetmultipleSearchData(); - }, []); - - - const postMultipleSearch = async () => { - if (selectedValues.length === 0) { - alert("Please select at least one option!"); - return; - } - const data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - SearchTerms: selectedValues, - }; - try { - const response = await dispatch(PostProductSearch(data)).unwrap(); - console.log("Search Response:", response); - if (response?.data?.statusCode == 1) { - setSelectedValues('') - close(false); - } - } catch (error) { - console.error("Search Error:", error); - } + const GetmultipleSearchData = async () => { + const data = { + AppId, + CompId, + BranchId, }; + try { + const response = await dispatch(getmultipleSearch(data)).unwrap(); - const GetmultipleSearchData = async () => { - const data = { - AppId, - CompId, - BranchId, - }; + if (response?.data?.statusCode === 1) { + const selected = + response?.data?.data?.[0]?.SearchTermDtl?.map( + (item) => item?.SearchTerm, + ) || []; - try { - const response = await dispatch(getmultipleSearch(data)).unwrap(); + setSelectedValues(selected); + } + } catch (error) { + console.error("Get Search Terms Error:", error); + } + }; - if (response?.data?.statusCode === 1) { - const selected = response?.data?.data?.[0]?.SearchTermDtl?.map( - (item) => item?.SearchTerm - ) || []; - - setSelectedValues(selected); - } - } catch (error) { - console.error("Get Search Terms Error:", error); - } - }; - - return ( - <> -
- {options.map((item) => ( - - ))} - -
-
- } - /> -
- - - ); + return ( + <> +
+ {options.map((item) => ( + + ))} +
+
+ +
+ + ); }; export default MultipleSearch; diff --git a/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx b/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx index fc9e823..2ddd7f9 100644 --- a/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx @@ -1,11 +1,11 @@ -import React from 'react'; -import { useSelector } from 'react-redux'; -import { GlobalPritdummyData } from '../../../../Features/ThemeChange/ThemeChange'; -import { isMobile } from 'react-device-detect'; -import { extractLastNumberOrderId } from '../../../../Services/Others'; -import moment from 'moment'; -import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; -import { PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import React from "react"; +import { useSelector } from "react-redux"; +import { GlobalPritdummyData } from "../../../../Features/ThemeChange/ThemeChange"; +import { isMobile } from "react-device-detect"; +import { extractLastNumberOrderId } from "../../../../Services/Others"; +import moment from "moment"; +import { settingDataSelector } from "../../../../Features/PreferenceMaster/PreferenceMaster"; +import { PreferenceData } from "../../../../Features/BookingScreen/BookingData/BookingData"; const TaxInvoice = ({ index, @@ -25,138 +25,138 @@ const TaxInvoice = ({ const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find( (setting) => - setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' - )?.SettingValue === 'Y'; + setting?.SettingIdName?.toLowerCase() === "estimateprintheader", + )?.SettingValue === "Y"; let BillName = printDatas?.PrintHdrName; - let companyColour = printDatas?.PrintHdrColor ?? '#00000'; + let companyColour = printDatas?.PrintHdrColor ?? "#00000"; // Function to convert number to words const numberToWords = (num) => { const a = [ - '', - 'One', - 'Two', - 'Three', - 'Four', - 'Five', - 'Six', - 'Seven', - 'Eight', - 'Nine', - 'Ten', - 'Eleven', - 'Twelve', - 'Thirteen', - 'Fourteen', - 'Fifteen', - 'Sixteen', - 'Seventeen', - 'Eighteen', - 'Nineteen', + "", + "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', + "", + "", + "Twenty", + "Thirty", + "Forty", + "Fifty", + "Sixty", + "Seventy", + "Eighty", + "Ninety", ]; - if (num === 0) return 'Zero'; + 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] : ''); + 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) : '') + " Hundred" + + (num % 100 ? " and " + numberToWords(num % 100) : "") ); if (num < 100000) return ( numberToWords(Math.floor(num / 1000)) + - ' Thousand' + - (num % 1000 ? ' ' + numberToWords(num % 1000) : '') + " Thousand" + + (num % 1000 ? " " + numberToWords(num % 1000) : "") ); if (num < 10000000) return ( numberToWords(Math.floor(num / 100000)) + - ' Lakh' + - (num % 100000 ? ' ' + numberToWords(num % 100000) : '') + " Lakh" + + (num % 100000 ? " " + numberToWords(num % 100000) : "") ); if (num < 1000000000) return ( numberToWords(Math.floor(num / 10000000)) + - ' Crore' + - (num % 10000000 ? ' ' + numberToWords(num % 10000000) : '') + " Crore" + + (num % 10000000 ? " " + numberToWords(num % 10000000) : "") ); - return 'Number too large'; + return "Number too large"; }; // Helper to format date as 7-Aug-2025 function formatDateToDDMMMYYYY(dateStr) { - console.log(dateStr, 'dateStrdateStr'); - if (!dateStr) return ''; + console.log(dateStr, "dateStrdateStr"); + if (!dateStr) return ""; const date = new Date(dateStr); if (isNaN(date)) return dateStr; // fallback if invalid date const day = date.getDate(); - const month = date.toLocaleString('en-US', { month: 'short' }); + const month = date.toLocaleString("en-US", { month: "short" }); const year = date.getFullYear(); return `${day}-${month}-${year}`; } function removeTimeFromDate(dateStr) { - if (!dateStr) return ''; + if (!dateStr) return ""; // Split on ":" — first part will be "DD-MM-YYYY" - const parts = dateStr.split(':'); + const parts = dateStr.split(":"); return parts[0] || dateStr; } console.log( Date1, - moment(Date1).format('DD-MMM-YYYY'), - 'datadatadatadatadatadata' + moment(Date1).format("DD-MMM-YYYY"), + "datadatadatadatadatadata", ); // Extract data from table2Data - mapping from A4Standard structure const invoiceData = { // Company Details - mapped from A4Standard - companyName: table2Data?.CompName || table2Data?.BrName || '', - companyspecname: table2Data?.AppSpecificName || '', + companyName: table2Data?.CompName || table2Data?.BrName || "", + companyspecname: table2Data?.AppSpecificName || "", companyAddress: { - address1: table2Data?.AddressDetails?.[0]?.Address1 || '', - address2: table2Data?.AddressDetails?.[0]?.Address2 || '', - city: table2Data?.AddressDetails?.[0]?.City || '', - state: table2Data?.AddressDetails?.[0]?.State || '', - zip: table2Data?.AddressDetails?.[0]?.Zip || '', + address1: table2Data?.AddressDetails?.[0]?.Address1 || "", + address2: table2Data?.AddressDetails?.[0]?.Address2 || "", + city: table2Data?.AddressDetails?.[0]?.City || "", + state: table2Data?.AddressDetails?.[0]?.State || "", + zip: table2Data?.AddressDetails?.[0]?.Zip || "", }, - companyGSTIN: table2Data?.CompGSTIN || table2Data?.BrGSTIN || '', - companyEmail: table2Data?.CompanyEmail || table2Data?.BrEmail || '', - companyMobile: table2Data?.BrMobile || '', - companyMobile2: table2Data?.BrMobile2 || '', + companyGSTIN: table2Data?.CompGSTIN || table2Data?.BrGSTIN || "", + companyEmail: table2Data?.CompanyEmail || table2Data?.BrEmail || "", + companyMobile: table2Data?.BrMobile || "", + companyMobile2: table2Data?.BrMobile2 || "", // Invoice Details - mapped from A4Standard invoiceNo: table2Data?.OrderId ? extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus) - : '', - invoiceDate: moment(Date1).format('DD-MMM-YYYY'), + : "", + invoiceDate: moment(Date1).format("DD-MMM-YYYY"), // Customer Details - mapped from A4Standard CustomerDetails array customerName: table2Data?.CustomerDetails?.[0]?.CustSuppName || table2Data?.CustSuppName || - '', + "", customerMobile: - table2Data?.CustomerDetails?.[0]?.MobileNo || table2Data?.MobileNo || '', + table2Data?.CustomerDetails?.[0]?.MobileNo || table2Data?.MobileNo || "", customerGSTIN: table2Data?.CustomerDetails?.[0]?.CustGSTNo || table2Data?.CustGSTIN || - '', + "", customerAddress: { - address1: table2Data?.CustomerDetails?.[0]?.Address1 || '', - address2: table2Data?.CustomerDetails?.[0]?.Address2 || '', - state: table2Data?.CustomerDetails?.[0]?.State || '', + address1: table2Data?.CustomerDetails?.[0]?.Address1 || "", + address2: table2Data?.CustomerDetails?.[0]?.Address2 || "", + state: table2Data?.CustomerDetails?.[0]?.State || "", }, // Product Details - mapped from A4Standard productDetails @@ -167,7 +167,7 @@ const TaxInvoice = ({ taxAmount: Number(OrderDetailGST), grandTotal: Number(table2Data?.NetAmount || table2Data?.GrandTotal), totalBillAmount: Number( - table2Data?.BillAmount || table2Data?.NetAmount || 0 + table2Data?.BillAmount || table2Data?.NetAmount || 0, ), // Bank Details - mapped from A4Standard bankDetails: table2Data?.BankDetails?.[0] || null, @@ -176,31 +176,31 @@ const TaxInvoice = ({ let PageSize = printDatas?.PageSize; const TakeawayData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' + (item) => item.BookingTypeName?.toLowerCase() === "takeaway", ); const DineInData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === 'dine in' + (item) => item.BookingTypeName?.toLowerCase() === "dine in", ); let PaymentStatusSuccess = PaymentStatus?.filter( - (ps) => ps.PaymentStatus === 'S' + (ps) => ps.PaymentStatus === "S", ); // Calculate GST/IGST totals const cgstTotal = OrderDetailGST && OrderDetailGST.length > 0 ? Number( - OrderDetailGST?.reduce((sum, item) => sum + (item.CGST || 0), 0) + OrderDetailGST?.reduce((sum, item) => sum + (item.CGST || 0), 0), )?.toFixed(2) : 0; const sgstTotal = OrderDetailGST && OrderDetailGST.length > 0 ? Number( - OrderDetailGST?.reduce((sum, item) => sum + (item.SGST || 0), 0) + OrderDetailGST?.reduce((sum, item) => sum + (item.SGST || 0), 0), )?.toFixed(2) : 0; const igstTotal = OrderDetailIGST && OrderDetailIGST.length > 0 ? Number( - OrderDetailIGST?.reduce((sum, item) => sum + (item.TaxAmt || 0), 0) + OrderDetailIGST?.reduce((sum, item) => sum + (item.TaxAmt || 0), 0), )?.toFixed(2) : 0; @@ -217,39 +217,39 @@ const TaxInvoice = ({ cgstTotal, sgstTotal, igstTotal, - 'roundoff vaules' + "roundoff vaules", ); function RoundOffFun(amount) { const roundedAmount = Math.round(amount); const roundOffValue = parseFloat((roundedAmount - amount).toFixed(2)); // const symbol = roundOffValue > 0 ? '+' : ''; // Add "+" symbol for positive values ${symbol} console.log( - 'Rounded Amount:', + "Rounded Amount:", roundedAmount, - 'Round Off Value:', - roundOffValue + "Round Off Value:", + roundOffValue, ); return `${roundOffValue.toFixed(2)}`; } - console.log('=== DEBUG INFO ==='); - console.log('table2Data?.productDetails:', table2Data?.productDetails); - console.log('GlobaldummyData:', GlobaldummyData); - console.log('TakeawayData:', TakeawayData); - console.log('DineInData:', DineInData); - console.log('PageSize:', PageSize); + console.log("=== DEBUG INFO ==="); + console.log("table2Data?.productDetails:", table2Data?.productDetails); + console.log("GlobaldummyData:", GlobaldummyData); + console.log("TakeawayData:", TakeawayData); + console.log("DineInData:", DineInData); + console.log("PageSize:", PageSize); // Allow up to 10 items per page const chunkSize = - table2Data?.OrderType !== 'E' + table2Data?.OrderType !== "E" ? isMobile ? 7 - : PageSize == 'A5' + : PageSize == "A5" ? 9 : 8 : isMobile ? 10 - : PageSize == 'A5' + : PageSize == "A5" ? 12 : 11; let dataSource = []; @@ -263,12 +263,12 @@ const TaxInvoice = ({ } console.log( - 'Final DataSource:', + "Final DataSource:", dataSource, - 'Length:', + "Length:", dataSource.length, - 'ChunkSize:', - chunkSize + "ChunkSize:", + chunkSize, ); const paginatedChunks = []; @@ -296,24 +296,24 @@ const TaxInvoice = ({ paginatedChunks.push([]); // Empty chunk for footer-only page } console.log( - 'Paginated Chunks:', + "Paginated Chunks:", paginatedChunks.length, - 'Chunks:', - paginatedChunks.map((chunk, i) => `Chunk ${i}: ${chunk.length} items`) + "Chunks:", + paginatedChunks.map((chunk, i) => `Chunk ${i}: ${chunk.length} items`), ); - console.log('Should footer be on new page:', shouldFooterBeOnNewPage); + console.log("Should footer be on new page:", shouldFooterBeOnNewPage); return (
{paginatedChunks?.map((dataChunk, chunkIndex) => ( @@ -322,16 +322,16 @@ const TaxInvoice = ({ className={ isMobile ? `invoice-wrapper container pdf-page` - : `invoice-wrapper container print-chunk${chunkIndex > 0 ? ' print-page-break' : ''}` + : `invoice-wrapper container print-chunk${chunkIndex > 0 ? " print-page-break" : ""}` } style={{ - display: 'flex', - flexDirection: 'column', + display: "flex", + flexDirection: "column", // justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) ? "space-between" : "", - height: isMobile ? '275mm' : PageSize == 'A5' ? '130mm' : '245mm', - marginBottom: '0', + height: isMobile ? "275mm" : PageSize == "A5" ? "130mm" : "245mm", + marginBottom: "0", pageBreakAfter: - chunkIndex < paginatedChunks.length - 1 ? 'always' : 'auto', + chunkIndex < paginatedChunks.length - 1 ? "always" : "auto", }} > {renderInvoiceContent(dataChunk, chunkIndex)} @@ -343,7 +343,7 @@ const TaxInvoice = ({ function renderInvoiceContent(dataChunk, chunkIndex) { console.log( `Rendering page ${chunkIndex + 1}, chunk has ${dataChunk.length} items:`, - dataChunk + dataChunk, ); const isFirstPage = chunkIndex === 0; @@ -355,7 +355,7 @@ const TaxInvoice = ({ paginatedChunks.length - 1 - (shouldFooterBeOnNewPage ? 1 : 0); const shouldShowTaxDetails = isLastDataChunk && dataChunk.length > 0; console.log( - `Page ${chunkIndex + 1}: isFirstPage=${isFirstPage}, isLastPage=${isLastPage}, isFooterOnlyPage=${isFooterOnlyPage},datachunkslength=${dataChunk.length}` + `Page ${chunkIndex + 1}: isFirstPage=${isFirstPage}, isLastPage=${isLastPage}, isFooterOnlyPage=${isFooterOnlyPage},datachunkslength=${dataChunk.length}`, ); return ( @@ -365,26 +365,26 @@ const TaxInvoice = ({ <>
-

- {table2Data?.OrderType === 'E' - ? 'Estimate' +

+ {table2Data?.OrderType === "E" + ? "Estimate" : BillName ? BillName - : 'TAX INVOICE'} + : "TAX INVOICE"}

-
- {ReprintType == 'Duplicate' - ? '(DUPLICATE FOR RECIPIENT)' - : '(ORIGINAL FOR RECIPIENT)'} +
+ {ReprintType == "Duplicate" + ? "(DUPLICATE FOR RECIPIENT)" + : "(ORIGINAL FOR RECIPIENT)"}
@@ -392,54 +392,54 @@ const TaxInvoice = ({ )} {/* Main Container - Always show */} -
+
{/* Top Section - Company and Invoice Details - Only on first page */} {isFirstPage && ( -
+
{/* Left - Company Details */}
- {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' + {!estimatePrintHeader && table2Data?.OrderType === "E" ? ( + "" ) : (
{invoiceData.companyName}
-
+
{invoiceData.companyspecname}
{invoiceData.companyAddress.address1}
{invoiceData.companyAddress.address2}
- {invoiceData.companyAddress.city}{' '} + {invoiceData.companyAddress.city}{" "} {invoiceData.companyAddress.zip ? ` - ${invoiceData.companyAddress.zip}` - : ''} + : ""}
{invoiceData.companyAddress.state}
{invoiceData.companyGSTIN && ( -
+
GSTIN/UIN: {invoiceData.companyGSTIN}
)} @@ -452,7 +452,7 @@ const TaxInvoice = ({ Mobile: +91 {invoiceData.companyMobile} {invoiceData.companyMobile2 ? `, ${invoiceData.companyMobile2}` - : ''} + : ""}
)}
@@ -460,16 +460,16 @@ const TaxInvoice = ({ {/* Buyer Details */}
-
Buyer (Bill to)
-
+
Buyer (Bill to)
+
{invoiceData.customerName}
{invoiceData.customerAddress.address1 && ( @@ -481,11 +481,12 @@ const TaxInvoice = ({ {invoiceData.customerMobile && (
Mobile: {invoiceData.customerMobile}
)} - {(invoiceData.customerGSTIN && table2Data?.OrderType !== 'E') && ( -
- GSTIN/UIN: {invoiceData.customerGSTIN} -
- )} + {invoiceData.customerGSTIN && + table2Data?.OrderType !== "E" && ( +
+ GSTIN/UIN: {invoiceData.customerGSTIN} +
+ )} {invoiceData.customerAddress.state && (
State Name: {invoiceData.customerAddress.state}
)} @@ -493,29 +494,29 @@ const TaxInvoice = ({
{/* Right - Invoice Details */} -
+
{/* Invoice No and Date */}
-
Invoice No.
-
+
Invoice No.
+
{invoiceData.invoiceNo}
Dated
-
+
{invoiceData.invoiceDate}
@@ -524,31 +525,31 @@ const TaxInvoice = ({ {/* Delivery Note and Payment Terms */}
-
Delivery Note
+
Delivery Note
-
Mode/Terms of Payment
+
Mode/Terms of Payment
@@ -556,31 +557,31 @@ const TaxInvoice = ({ {/* Reference and Other References */}
-
Reference No. & Date
+
Reference No. & Date
-
Other References
+
Other References
@@ -588,60 +589,60 @@ const TaxInvoice = ({ {/* Buyer's Order */}
-
Buyer's Order No.
+
Buyer's Order No.
-
Dated
+
Dated
{/* Dispatch Details */}
-
Dispatch Doc No.
+
Dispatch Doc No.
-
Delivery Note Date
+
Delivery Note Date
@@ -649,26 +650,26 @@ const TaxInvoice = ({ {/* Dispatched through and Destination */}
-
Dispatched through
+
Dispatched through
-
+
Destination
@@ -678,12 +679,12 @@ const TaxInvoice = ({ {/* Terms of Delivery */}
-
Terms of Delivery
+
Terms of Delivery
@@ -694,15 +695,15 @@ const TaxInvoice = ({ {!isFirstPage && (
-

- {isFooterOnlyPage ? 'Tax Invoice' : 'Tax Invoice '} +

+ {isFooterOnlyPage ? "Tax Invoice" : "Tax Invoice "}

-
+
Invoice No: {invoiceData.invoiceNo}
@@ -713,67 +714,67 @@ const TaxInvoice = ({
{/* Table Header */}
SL.No
Description of Goods
HSN/SAC
Quantity
Rate
{/*
per
*/} -
+
Amount
@@ -785,102 +786,102 @@ const TaxInvoice = ({
{chunkIndex * chunkSize + index + 1}
- {item.ProdName || 'Product Name'} + {item.ProdName || "Product Name"}
{item.BrandName && (
- {item.BrandName}{' '} + {item.BrandName}{" "}
)} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( (items) => - items.SerialNumber && items.SerialNumber !== '' + items.SerialNumber && items.SerialNumber !== "", )?.map((a, i) => (
{a.SerialNumber}
)) - : ''} + : ""} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (id) => id.IMEI1 !== '' || id.IMEI2 !== '' + (id) => id.IMEI1 !== "" || id.IMEI2 !== "", )?.map((id, i) => { - const imei1 = id.IMEI1 || ''; - const imei2 = id.IMEI2 || ''; + const imei1 = id.IMEI1 || ""; + const imei2 = id.IMEI2 || ""; return (
- {[imei1, imei2].filter(Boolean).join(',')} + {[imei1, imei2].filter(Boolean).join(",")}
); }) - : ''} + : ""}
- {item.HSN || ''} + {item.HSN || ""}
- {item.SalesQty || 1} {item.UomName || 'NOS'} + {item.SalesQty || 1} {item.UomName || "NOS"}
{Number( - table2Data?.OrderType !== 'E' + table2Data?.OrderType !== "E" ? item.Rate - item.ProdTaxAmt - : item.Rate || 0 - ).toLocaleString('en-IN', { + : item.Rate || 0, + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, })} @@ -888,17 +889,17 @@ const TaxInvoice = ({ {/*
{item.UomName || 'NOS'}
*/}
{Number( - table2Data?.OrderType !== 'E' + table2Data?.OrderType !== "E" ? item.WithoutTaxRate - : item.TotalAmt || 0 - ).toLocaleString('en-IN', { + : item.TotalAmt || 0, + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, })} @@ -911,150 +912,150 @@ const TaxInvoice = ({ {/* Total without tax amount */}
-
+
-
-
-
+
+
+
{/*
*/}
- ₹{' '} + ₹{" "} {Number( - table2Data?.OrderType !== 'E' + table2Data?.OrderType !== "E" ? invoiceData?.totalBillAmount - : invoiceData?.grandTotal - ).toLocaleString('en-IN', { + : invoiceData?.grandTotal, + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, })}
- {table2Data?.OrderType !== 'E' && ( + {table2Data?.OrderType !== "E" && ( <> {/* CGST */} {OrderDetailGST && OrderDetailGST.length > 0 && ( <>
CGST
{/*
*/}
{OrderDetailGST && OrderDetailGST.length > 0 ? Number( OrderDetailGST?.reduce( (sum, item) => sum + (item.CGST || 0), - 0 - ) - ).toLocaleString('en-IN', { + 0, + ), + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : '0.00'} + : "0.00"}
{/* SGST */}
SGST
{/*
*/}
{OrderDetailGST && OrderDetailGST.length > 0 ? Number( OrderDetailGST?.reduce( (sum, item) => sum + (item.SGST || 0), - 0 - ) - ).toLocaleString('en-IN', { + 0, + ), + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : '0.00'} + : "0.00"}
@@ -1063,54 +1064,54 @@ const TaxInvoice = ({ {OrderDetailIGST && OrderDetailIGST.length > 0 && (
IGST
{/*
*/}
{OrderDetailIGST && OrderDetailIGST.length > 0 ? Number( OrderDetailIGST?.reduce( (sum, item) => sum + (item.TaxAmt || 0), - 0 - ) - ).toLocaleString('en-IN', { + 0, + ), + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : '0.00'} + : "0.00"}
)} @@ -1119,34 +1120,34 @@ const TaxInvoice = ({ {/* Rounding Off */}
-
+
ROUNDING OFF
-
-
-
+
+
+
{/*
*/} -
+
{RoundOffFun( - table2Data?.OrderType !== 'E' + table2Data?.OrderType !== "E" ? roundOffValue - : roundOffEstimateValue + : roundOffEstimateValue, )}
@@ -1156,61 +1157,61 @@ const TaxInvoice = ({
 
 
 
 
 
{/*
 
*/}
 
@@ -1219,60 +1220,60 @@ const TaxInvoice = ({ {/* Total */}
-
+
Total
-
+
{totalQuantity || invoiceData.productDetails?.reduce( (sum, item) => sum + (item.SalesQty || 0), - 0 + 0, ) || - 0}{' '} + 0}{" "} NOS
-
+
{/*
*/}
- ₹{' '} + ₹{" "} {Number(invoiceData.grandTotal).toLocaleString( - 'en-IN', + "en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, - } + }, )}
@@ -1283,71 +1284,71 @@ const TaxInvoice = ({ // Show empty row when no data
-
No items to display
-
-
-
-
-
+
-
@@ -1362,83 +1363,83 @@ const TaxInvoice = ({ {/* Amount in Words */}
-
+
Amount Chargeable (in words)
-
+
INR {numberToWords(Math.floor(invoiceData.grandTotal))} Only

E. & O.E

- {table2Data?.OrderType !== 'E' && ( + {table2Data?.OrderType !== "E" && ( <> {/* Tax Breakdown Table */} -
+
{OrderDetailGST && OrderDetailGST.length > 0 ? ( <> {/* Tax Table Header - Main Headers */}
HSN/SAC
Taxable Value
CGST
SGST/UTGST
Tax Amount
@@ -1447,64 +1448,64 @@ const TaxInvoice = ({ {/* Tax Table Sub-Headers */}
Rate
Amount
Rate
Amount
@@ -1513,94 +1514,94 @@ const TaxInvoice = ({
- {taxItem.HSN || ''} + {taxItem.HSN || ""}
{Number( - taxItem.WithOutTaxAmount || 0 - ).toLocaleString('en-IN', { + taxItem.WithOutTaxAmount || 0, + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, })}
{taxItem.TaxPercentage - ? taxItem.TaxPercentage / 2 + '%' - : '0%'} + ? taxItem.TaxPercentage / 2 + "%" + : "0%"}
{Number(taxItem.CGST || 0).toLocaleString( - 'en-IN', + "en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, - } + }, )}
{taxItem.TaxPercentage - ? taxItem.TaxPercentage / 2 + '%' - : '0%'} + ? taxItem.TaxPercentage / 2 + "%" + : "0%"}
{Number(taxItem.SGST || 0).toLocaleString( - 'en-IN', + "en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, - } + }, )}
-
+
{Number( - (taxItem.CGST || 0) + (taxItem.SGST || 0) - ).toLocaleString('en-IN', { + (taxItem.CGST || 0) + (taxItem.SGST || 0), + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, })} @@ -1609,27 +1610,27 @@ const TaxInvoice = ({ ))}
Total
{OrderDetailGST && OrderDetailGST.length > 0 @@ -1637,81 +1638,81 @@ const TaxInvoice = ({ OrderDetailGST?.reduce( (sum, item) => sum + (item.WithOutTaxAmount || 0), - 0 - ) - ).toLocaleString('en-IN', { + 0, + ), + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : '0.00'} + : "0.00"}
{OrderDetailGST && OrderDetailGST.length > 0 ? Number( OrderDetailGST?.reduce( (sum, item) => sum + (item.CGST || 0), - 0 - ) - ).toLocaleString('en-IN', { + 0, + ), + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : '0.00'} + : "0.00"}
{OrderDetailGST && OrderDetailGST.length > 0 ? Number( OrderDetailGST?.reduce( (sum, item) => sum + (item.SGST || 0), - 0 - ) - ).toLocaleString('en-IN', { + 0, + ), + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : '0.00'} + : "0.00"}
{OrderDetailGST && OrderDetailGST.length > 0 ? Number( OrderDetailGST?.reduce( (sum, item) => sum + (item.CGST || 0) + (item.SGST || 0), - 0 - ) - ).toLocaleString('en-IN', { + 0, + ), + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : '0.00'} + : "0.00"}
@@ -1720,41 +1721,41 @@ const TaxInvoice = ({ {/* Tax Table Header - Main Headers */}
HSN/SAC
Taxable Value
IGST
Tax Amount
@@ -1762,47 +1763,47 @@ const TaxInvoice = ({ {/* Tax Table Sub-Headers */}
Rate
Amount
{/* Tax Table Rows - Dynamic from OrderDetailGST */} @@ -1810,97 +1811,97 @@ const TaxInvoice = ({
- {taxItem.HSN || ''} + {taxItem.HSN || ""}
{Number( - taxItem.WithOutTaxAmount || 0 - ).toLocaleString('en-IN', { + taxItem.WithOutTaxAmount || 0, + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, })}
{taxItem.TaxPercentage - ? taxItem.TaxPercentage + '%' - : '0%'} + ? taxItem.TaxPercentage + "%" + : "0%"}
{Number(taxItem.TaxAmt || 0).toLocaleString( - 'en-IN', + "en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, - } + }, )}
-
+
{Number(taxItem.TaxAmt || 0).toLocaleString( - 'en-IN', + "en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, - } + }, )}
- ))}{' '} + ))}{" "}
Total
{OrderDetailIGST && OrderDetailIGST.length > 0 @@ -1908,55 +1909,55 @@ const TaxInvoice = ({ OrderDetailIGST?.reduce( (sum, item) => sum + (item.WithOutTaxAmount || 0), - 0 - ) - ).toLocaleString('en-IN', { + 0, + ), + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : '0.00'} + : "0.00"}
{OrderDetailIGST && OrderDetailIGST.length > 0 ? Number( OrderDetailIGST?.reduce( (sum, item) => sum + (item.TaxAmt || 0), - 0 - ) - ).toLocaleString('en-IN', { + 0, + ), + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : '0.00'} + : "0.00"}
{OrderDetailIGST && OrderDetailIGST.length > 0 ? Number( OrderDetailIGST?.reduce( (sum, item) => sum + (item.TaxAmt || 0), - 0 - ) - ).toLocaleString('en-IN', { + 0, + ), + ).toLocaleString("en-IN", { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : '0.00'} + : "0.00"}
@@ -1965,50 +1966,50 @@ const TaxInvoice = ({ {/* Tax Table Header - Main Headers */}
HSN/SAC
Taxable Value
CGST
SGST/UTGST
Tax Amount
@@ -2017,199 +2018,199 @@ const TaxInvoice = ({ {/* Tax Table Sub-Headers */}
Rate
Amount
Rate
Amount
-
0.00
0%
0.00
0%
0.00
-
+
0.00
{/* Tax Table Total */}
Total
- {'0.00'} + {"0.00"}
- {'0.00'} + {"0.00"}
- {'0.00'} + {"0.00"}
- {'0.00'} + {"0.00"}
@@ -2219,31 +2220,31 @@ const TaxInvoice = ({ {/* Tax Amount in Words */}
- Tax Amount (in words):{' '} - - INR{' '} + Tax Amount (in words):{" "} + + INR{" "} {numberToWords( Math.floor( invoiceData.taxAmount || OrderDetailGST?.reduce( (sum, item) => sum + (item.CGST || 0) + (item.SGST || 0), - 0 + 0, ) || Number( OrderDetailIGST?.reduce( (sum, item) => sum + (item.TaxAmt || 0), - 0 - ) + 0, + ), ) || - 0 - ) - )}{' '} + 0, + ), + )}{" "} Only
@@ -2252,29 +2253,33 @@ const TaxInvoice = ({ )} {/* Bank Details and Signature */}
- {/* Declaration */}
Declaration @@ -2286,73 +2291,73 @@ const TaxInvoice = ({
- {/* Signature Section */}
{/* Bank Details */}
- {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' + {!estimatePrintHeader && table2Data?.OrderType === "E" ? ( + "" ) : ( -
+
Company's Bank Details
)} - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' + {!estimatePrintHeader && table2Data?.OrderType === "E" ? ( + "" ) : (
A/c Holder's Name: - - {' '} + + {" "} {invoiceData.companyName}
Bank Name: - - {' '} - {invoiceData.bankDetails?.BankName || ''} + + {" "} + {invoiceData.bankDetails?.BankName || ""}
- A/c No.:{' '} - - {invoiceData.bankDetails?.AccountNo || ''} + A/c No.:{" "} + + {invoiceData.bankDetails?.AccountNo || ""}
- Branch & IFS Code:{' '} - - {invoiceData.bankDetails?.BankBranch || ''} &{' '} - {invoiceData.bankDetails?.IFSCCode || ''} + Branch & IFS Code:{" "} + + {invoiceData.bankDetails?.BankBranch || ""} &{" "} + {invoiceData.bankDetails?.IFSCCode || ""}
{invoiceData.bankDetails?.SWIFTCode && (
- + SWIFT Code: - - {' '} - {invoiceData.bankDetails?.SWIFTCode || ''} + + {" "} + {invoiceData.bankDetails?.SWIFTCode || ""}
)} @@ -2361,21 +2366,21 @@ const TaxInvoice = ({
- {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' + {!estimatePrintHeader && table2Data?.OrderType === "E" ? ( + "" ) : (
for {invoiceData.companyName} @@ -2383,28 +2388,28 @@ const TaxInvoice = ({ )}
{/*
DD
@@ -2412,7 +2417,7 @@ const TaxInvoice = ({
ELECTRONICS
*/}
-
+
Authorised Signatory
@@ -2427,9 +2432,9 @@ const TaxInvoice = ({ {isLastPage && (
This is a Computer Generated Invoice
diff --git a/src/Pages/Preference/PreferenceList.jsx b/src/Pages/Preference/PreferenceList.jsx index a966c06..06142d0 100644 --- a/src/Pages/Preference/PreferenceList.jsx +++ b/src/Pages/Preference/PreferenceList.jsx @@ -750,7 +750,16 @@ const PreferenceList = () => { {renderCheckbox('scanlayout', 'Do you Want Scan Layout Page?')}
-
+ +
+
+
{ icon={} />
-
-
+
); diff --git a/src/Pages/Preference/PreferenceList.scss b/src/Pages/Preference/PreferenceList.scss index a99d800..4f7302a 100644 --- a/src/Pages/Preference/PreferenceList.scss +++ b/src/Pages/Preference/PreferenceList.scss @@ -1,12 +1,12 @@ .preferences-list { - max-height: 84vh; + max-height: 75vh; overflow-y: auto; background: #fff; width: 100%; scrollbar-width: thin; scroll-behavior: smooth; border-radius: 12px; - padding-bottom: 4rem; + padding-bottom: 3rem; .preference-headers { font-size: 1.2rem; @@ -41,7 +41,7 @@ } .ant-form-item { - margin-bottom: 1.2rem; + margin-bottom: 1rem; } .ant-checkbox-wrapper, @@ -49,11 +49,6 @@ margin-right: 1rem; } - .ant-btn { - margin-top: 2rem; - float: right; - } - // Optional: Scrollbar for long modals &::-webkit-scrollbar { width: 6px; @@ -89,7 +84,7 @@ padding: 10px 0; > div { - font-family: 'Poppins'; + font-family: "Poppins"; font-weight: 400; font-size: 14px; margin: 4px 0; @@ -154,3 +149,13 @@ } } } +.PreferencesBTN { + display: flex; + align-items: flex-start; + justify-content: flex-end; + width: 100%; + margin-top: 1rem; + .primary_Button { + width: 200px !important; + } +} diff --git a/src/Styles/BookingScreen/Components/BSCategories/BSCategoryHorizontal.scss b/src/Styles/BookingScreen/Components/BSCategories/BSCategoryHorizontal.scss index 481d7cb..1014ca4 100644 --- a/src/Styles/BookingScreen/Components/BSCategories/BSCategoryHorizontal.scss +++ b/src/Styles/BookingScreen/Components/BSCategories/BSCategoryHorizontal.scss @@ -325,7 +325,7 @@ } .CategoryHorizontalNew { - padding: 1rem 1rem; + padding: 10px 10px; font-family: 'Inter', sans-serif; display: flex; align-items: center; diff --git a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss index 4e4645d..02b1696 100644 --- a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss +++ b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss @@ -116,7 +116,7 @@ .CustomerActions { display: flex; align-items: center; - gap: 0.1rem; + gap: 0.3rem; .RiVerifiedBadgeFill { transition: all 0.2s ease-in-out; diff --git a/src/Styles/Reports/KOT/kot.scss b/src/Styles/Reports/KOT/kot.scss index 4aa8107..fe9faa2 100644 --- a/src/Styles/Reports/KOT/kot.scss +++ b/src/Styles/Reports/KOT/kot.scss @@ -71,7 +71,7 @@ .kot-date { display: flex; font-size: 14px; - font-family: 'Gilroy'; + font-family: "Gilroy"; font-weight: 500; border-radius: 5px; color: #212529 !important; @@ -122,7 +122,7 @@ right: 0; } .ant-segmented-item-label { - font-family: 'Poppins'; + font-family: "Poppins"; font-size: 12px !important; } .ant-segmented-item-selected { @@ -134,9 +134,7 @@ } } -.kot-search-dev - :where(.css-dev-only-do-not-override-2i2tap).ant-segmented - .ant-segmented-group { +.kot-search-dev :where(.css-dev-only-do-not-override-2i2tap).ant-segmented .ant-segmented-group { position: relative; display: flex; //srinath @@ -149,9 +147,7 @@ rgba(0, 0, 0, 0.3) 0px 3px 7px -3px; } -.kot-search-dev - :where(.css-dev-only-do-not-override-2i2tap).ant-segmented - .ant-segmented-item-selected { +.kot-search-dev :where(.css-dev-only-do-not-override-2i2tap).ant-segmented .ant-segmented-item-selected { background-color: #ffffff; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03), @@ -168,6 +164,13 @@ margin: 12px 0 12px 0; height: 70vh; overflow: scroll; + + .ant-table-thead { + background-color: #2c88ee !important; + } + .ant-table-cell { + padding: 6px !important; + } @media (max-width: 768px) { height: 60vh; scrollbar-width: thin; @@ -179,7 +182,7 @@ } table { tbody { - font-family: 'Poppins'; + font-family: "Poppins"; > tr:nth-child(even) { background-color: #b4b4b4; } @@ -221,7 +224,7 @@ transition: all 0.2s ease; min-width: 70px; text-align: center; - font-family: 'Poppins', sans-serif; + font-family: "Poppins", sans-serif; color: #fff; -webkit-text-stroke-width: 0.1px; From 936e6b9476238698fd24a53286fcc90595edb3ec Mon Sep 17 00:00:00 2001 From: Tamilselvan Date: Fri, 30 Jan 2026 19:09:15 +0530 Subject: [PATCH 02/20] i have just changed Ui and Functinality --- src/Pages/StockMaster/StockForm.jsx | 2846 ++++++++++++++------------- 1 file changed, 1513 insertions(+), 1333 deletions(-) diff --git a/src/Pages/StockMaster/StockForm.jsx b/src/Pages/StockMaster/StockForm.jsx index 8d2481b..e4b86f9 100644 --- a/src/Pages/StockMaster/StockForm.jsx +++ b/src/Pages/StockMaster/StockForm.jsx @@ -12,6 +12,7 @@ import { ArrowRightOutlined, PlusCircleOutlined, InfoCircleOutlined, + SearchOutlined, } from '@ant-design/icons'; import { Form, @@ -22,10 +23,11 @@ import { AutoComplete, Switch, } from 'antd'; -import { IoAddCircleSharp } from 'react-icons/io5'; +import { IoAddCircleSharp, IoSettingsOutline } from 'react-icons/io5'; import { ScannerInputField } from '../../Components/Forms/ScannerInputField.jsx'; import { InputField } from '../../Components/Forms/InputField.jsx'; import Buttons from '../../Components/Forms/Buttons.jsx'; +import { Modal } from 'antd'; import { Messages } from '../../Components/Notifications/Messages.jsx'; import { DeleteFilled } from '@ant-design/icons'; import { changeBreadCrumb } from '../../Features/AppPage/CenterPage.js'; @@ -74,6 +76,8 @@ import { productTypeDataSelector, getProductTypeData, bulkpostdata, + postFieldSetup, + getFieldSetupData, } from '../../Features/ProductPage/ProductPage.js'; import { postConfiguration } from '../../Features/ConfigMasterPage/ConfigMasterPage.js'; import SupplierProductMappingForm from '../SupplierProductMapping/SuplierProductMappingForm.jsx'; @@ -85,7 +89,7 @@ import { getSupplaierIdwithTypeBasedProducts, postSupplaierProducts, } from '../../Features/SupplierProductMapping/SupplierProductMapping.js'; -import { getCommonAppPreference } from '../../Features/BrachLogin/BranchLogin.js'; +import { ApplicationPreferences, getCommonAppPreference } from '../../Features/BrachLogin/BranchLogin.js'; import { getConfigType, getPaymentOptionFeatureApi, @@ -157,12 +161,12 @@ const EditableCell = ({ margin: 0, }} name={dataIndex} - // rules={[ - // (dataIndex == "imei1" || dataIndex == "imei2") && { - // pattern: /^[0-9]{15}$/, - // message: 'IMEI must be a 15-digit number' - // } - // ]} + // rules={[ + // (dataIndex == "imei1" || dataIndex == "imei2") && { + // pattern: /^[0-9]{15}$/, + // message: 'IMEI must be a 15-digit number' + // } + // ]} > - {/* {dataIndex === "CurrentAmt" && Array.isArray(record[dataIndex]) - ? record[dataIndex]?.map((item, index) => ( - - {item.CurrentAmt + "-" + item.CurrentAmt} - - )) - : children} */} + { const BrandData = useSelector(brandDataSelector); const UomData = useSelector(uomDataSelector); const ProductTypeData = useSelector(productTypeDataSelector); + const appPreferences = useSelector(ApplicationPreferences) const [applicationRestrictedFields, setApplicationRestrictedFields] = useState({ DatesAndExpiry: false, BatchAndModelDetails: false, AmountPerPieceDetail: false, }); + const [selectedAdditionalColumn, setSelectedAdditionalColumn] = useState([]); + console.log(selectedAdditionalColumn, "selectedAdditionalColumn") + const [showColumnModal, setShowColumnModal] = useState(false); + const [tempSelectedColumns, setTempSelectedColumns] = useState([]); + const [tableFieldPreferences, setTableFieldPreferences] = useState([]); + const [selectedFields, setSelectedFields] = useState([]); const [SupplierData, setSupplierData] = useState([]); const [StockOpen, setStockOpen] = useState('N'); const [SupplierOpen, setSupplierOpen] = useState('own'); @@ -275,6 +282,7 @@ const StockForm = ({ formType }) => { const [imageSubCategoryUrl, setSubCategoryImageUrl] = useState(''); const [imageBrandUrl, setBrandImageUrl] = useState(''); const [PurchaseData, setPurchaseData] = useState([]); + console.log(PurchaseData, "PurchaseData") const [additionalInfoModal, setAdditionalInfoModal] = useState(false); const [selectedRowIndex, setSelectedRowIndex] = useState(null); const [selectedRowRecord, setSelectedRowRecord] = useState({}); @@ -342,6 +350,24 @@ const StockForm = ({ formType }) => { const [extractorData, setExtractorData] = useState(null); const [isLoading, setIsLoading] = useState(false); const [loadingText, setLoadingText] = useState(''); + const [filteredPurchaseData, setFilteredPurchaseData] = useState([]); + const [searchValue, setSearchValue] = useState(''); + const isSearching = Boolean(searchValue?.trim()); + useEffect(() => { + if (searchValue?.trim()) { + const search = searchValue.toLowerCase(); + + const filtered = PurchaseData.filter(item => + item?.ProdName?.toLowerCase().includes(search) + ); + + setFilteredPurchaseData(filtered); + } else { + setFilteredPurchaseData([]); + } + }, [PurchaseData, searchValue]); + + const items = [ { name: 'Home', @@ -357,6 +383,9 @@ const StockForm = ({ formType }) => { link: null, }, ]; + const categoryId = appPreferences?.find( + p => p?.PreferredCatName?.toLowerCase() === "purchase entry" + )?.PreferredCatId; useEffect(() => { dispatch(changeBreadCrumb({ items: items })); dispatch( @@ -519,20 +548,27 @@ const StockForm = ({ formType }) => { }; useEffect(() => { - let total = PurchaseData?.reduce((accumulator, currentValue) => { - return accumulator + currentValue.Amount; + const total = PurchaseData?.reduce((acc, item) => { + return acc + Number(item?.Amount || 0); }, 0); - setSelInvoiceAmount(!isNaN(total) && total !== 0 ? total : null); + const invoiceAmount = + !isNaN(total) && total !== 0 ? total : null; + + setSelInvoiceAmount(invoiceAmount); + formRef.current?.setFieldsValue({ - InvoiceAmount: !isNaN(total) && total !== 0 ? total : null, + InvoiceAmount: invoiceAmount, }); - let totaltax = PurchaseData?.reduce((accumulator, currentValue) => { - return accumulator + currentValue.TaxAmt; + + const totalTax = PurchaseData?.reduce((acc, item) => { + return acc + Number(item?.TaxAmt || 0); }, 0); - setTotalTaxAmount(totaltax); + + setTotalTaxAmount(totalTax); }, [PurchaseData]); + const getPurchaseOrders = async () => { const { data: res } = await dispatch( PendingOrdersPE({ CompId, AppId, BranchId }) @@ -576,7 +612,26 @@ const StockForm = ({ formType }) => { ); return { mappedSupplierProducts, SuppId: finalList?.[0]?.SuppId }; }; - + useEffect(() => { + getFieldSetup(); + }, [categoryId]) + const getFieldSetup = async () => { + try { + const response = await dispatch(getFieldSetupData({ AppId, CompId, BranchId, categoryId, Type: "PE" })).unwrap(); + if (response?.data?.statusCode === 1) { + console.log(response?.data?.data?.[0]?.ConfigDtl, "Field Setup Data"); + setSelectedFields(response?.data?.data?.[0]?.ConfigDtl?.filter(c => c.ConfigId && c.Access === 'Y')?.map(c => c.ConfigId) || []); + setSelectedAdditionalColumn(response?.data?.data?.[0]?.ConfigDtl?.filter(c => c.ConfigId && c.Access === 'Y')?.map(c => c.ConfigName) || []) + setTableFieldPreferences(response?.data?.data?.[0]?.ConfigDtl?.map(c => ({ + value: c.ConfigId, + label: c.ConfigName, + access: c.Access + })) || []); + } + } catch (error) { + console.error('Error fetching field setup:', error); + } + }; const AddSupplierimg = async (subSupplierData) => { const addSupplierData = { CompId: getSession('CompId'), @@ -688,8 +743,8 @@ const StockForm = ({ formType }) => { const allSupplierProducts = response?.data?.data || []; const matchingProdIds = []; - const NewImageProducts=[] - console.log(unmatchedProducts,"unmatchedProductsunmatchedProducts") + const NewImageProducts = [] + console.log(unmatchedProducts, "unmatchedProductsunmatchedProducts") // check if the unmatched products exists in our products list unmatchedProducts.forEach((item) => { const match = allSupplierProducts?.[0]?.ProductDetails.find( @@ -700,89 +755,89 @@ const StockForm = ({ formType }) => { if (match) { matchingProdIds.push(match.ProdId); } - else{ + else { NewImageProducts.push(item?.parsedData); } }); - console.log(NewImageProducts,"NewImageProductsNewImageProducts") + console.log(NewImageProducts, "NewImageProductsNewImageProducts") // Bulk upload new image products if (NewImageProducts.length > 0) { - const newProductsData = NewImageProducts.map(product => ({ - AppId: AppId || 0, - CompId: CompId || "", - BranchId: BranchId || "", - CreatedBy: UserId || 0, - ProdName: product.description?.trim() || "", - ProdVariantName: "", - Size: 1 || "", - UOM: product.unit || "", - MRP: parseFloat(product.rate) || 0, - WhSalePrice: 0, - SellPrice: parseFloat(product.rate) || 0, - ProdCat: "General", - ProdSubCat: "", - Brand: "", - AutoGenerateQr: "", - QRCode: "", - StockAvailable: 'No', - TaxId: "", - HSNCode: "", - PartNumber: "", - Rack: 0, - ManufDate: "", - ExpDate: "", - AvailableFrom: "", - AvailableTo: "", - ProdLogo: "", - OnePcsAvailable: "No", - AutoGenerateSingleQr:'No', - TaxId: 'NIL - 0%', - OnePcQR: "", - TokenAvailable: 'No', - OpeningQty: 0, - QtyBasedPrice: "", - InwardDate: "", - SuppId: suppId || "", - Reference: "", - ReceivedQty: 0, - AcceptedQty: 0, - RejectedQty: 0, - RejectionReason: "", - IssuedQty: 0, - BalanceQty: 0, - InwardPrice: 0, - OfferPrice: 0, - SpecialPrice: 0, - Cess: 0, - })); + const newProductsData = NewImageProducts.map(product => ({ + AppId: AppId || 0, + CompId: CompId || "", + BranchId: BranchId || "", + CreatedBy: UserId || 0, + ProdName: product.description?.trim() || "", + ProdVariantName: "", + Size: 1 || "", + UOM: product.unit || "", + MRP: parseFloat(product.rate) || 0, + WhSalePrice: 0, + SellPrice: parseFloat(product.rate) || 0, + ProdCat: "General", + ProdSubCat: "", + Brand: "", + AutoGenerateQr: "", + QRCode: "", + StockAvailable: 'No', + TaxId: "", + HSNCode: "", + PartNumber: "", + Rack: 0, + ManufDate: "", + ExpDate: "", + AvailableFrom: "", + AvailableTo: "", + ProdLogo: "", + OnePcsAvailable: "No", + AutoGenerateSingleQr: 'No', + TaxId: 'NIL - 0%', + OnePcQR: "", + TokenAvailable: 'No', + OpeningQty: 0, + QtyBasedPrice: "", + InwardDate: "", + SuppId: suppId || "", + Reference: "", + ReceivedQty: 0, + AcceptedQty: 0, + RejectedQty: 0, + RejectionReason: "", + IssuedQty: 0, + BalanceQty: 0, + InwardPrice: 0, + OfferPrice: 0, + SpecialPrice: 0, + Cess: 0, + })); - const bulkResponse = await dispatch(bulkpostdata({ ProdDetails: newProductsData })).unwrap(); - - if (bulkResponse?.data?.statusCode === 1) { - // After successful bulk upload, check the condition again - const updatedResponse = await dispatch( - getSupplaierIdBasedProducts({ CompId, AppId, BranchId, SuppId: suppId }) - ).unwrap(); - if (updatedResponse?.data?.statusCode === 1) { - const updatedAllSupplierProducts = updatedResponse?.data?.data || []; - const updatedMatchingProdIds = []; - - unmatchedProducts.forEach((item) => { - const match = updatedAllSupplierProducts?.[0]?.ProductDetails.find( - (supp) => - supp?.ProdName?.toLowerCase() === - item?.parsedData?.description?.toLowerCase() - ); - if (match) { - updatedMatchingProdIds.push(match.ProdId); - } - }); - - if (updatedMatchingProdIds.length > 0) { - matchingProdIds.push(...updatedMatchingProdIds); - } + const bulkResponse = await dispatch(bulkpostdata({ ProdDetails: newProductsData })).unwrap(); + + if (bulkResponse?.data?.statusCode === 1) { + // After successful bulk upload, check the condition again + const updatedResponse = await dispatch( + getSupplaierIdBasedProducts({ CompId, AppId, BranchId, SuppId: suppId }) + ).unwrap(); + if (updatedResponse?.data?.statusCode === 1) { + const updatedAllSupplierProducts = updatedResponse?.data?.data || []; + const updatedMatchingProdIds = []; + + unmatchedProducts.forEach((item) => { + const match = updatedAllSupplierProducts?.[0]?.ProductDetails.find( + (supp) => + supp?.ProdName?.toLowerCase() === + item?.parsedData?.description?.toLowerCase() + ); + if (match) { + updatedMatchingProdIds.push(match.ProdId); } + }); + + if (updatedMatchingProdIds.length > 0) { + matchingProdIds.push(...updatedMatchingProdIds); } + } + } } // if there is matching products, map them to the supplier if (matchingProdIds.length > 0) { @@ -828,6 +883,7 @@ const StockForm = ({ formType }) => { for (const item of matchedProducts) { if (item.matchFound) { const newProduct = await ProductDropDownChange( + item?.selectedProduct.ProdVariantName, item.selectedProdId, { label: item.selectedProduct.ProdName }, mappedSupplierProducts, @@ -914,6 +970,8 @@ const StockForm = ({ formType }) => { for (const item of matchedProducts) { if (item.matchFound) { const newProduct = await ProductDropDownChange( + + item?.selectedProduct?.ProdVariantName, item.selectedProdId, { label: item.selectedProduct.ProdName }, supplierProducts, @@ -1118,12 +1176,12 @@ const StockForm = ({ formType }) => { formRef?.current?.getFieldsValue(), 'formRefformRefformRefformRef' ); - if(extractorData?.invoiceNo !== null && extractorData?.invoiceNo !== ""){ - formRef?.current?.setFieldsValue({ - SuppInvoiceNo: extractorData?.invoiceNo, - }); + if (extractorData?.invoiceNo !== null && extractorData?.invoiceNo !== "") { + formRef?.current?.setFieldsValue({ + SuppInvoiceNo: extractorData?.invoiceNo, + }); } - + formRef?.current?.setFieldsValue({ PaymentAmount: extractorData?.TotalAmtData, }); @@ -1206,6 +1264,7 @@ const StockForm = ({ formType }) => { }; const ProductDropDownChange = async ( + VariantName, ProdId, option, productsList, @@ -1213,55 +1272,58 @@ const StockForm = ({ formType }) => { extractedItem, existingProducts ) => { + setProductSearchText(''); setSelectedProductName(option?.label ? option?.label : ''); formRef?.current?.resetFields(['VarProdId']); setselectedProductVariantData(null); setSelectedProductData(ProdId); - let x = (productsList || productData)?.find( - (e) => e.ProdId == ProdId - )?.ProdName; - let OnePcsAvailable = - (productsList || productData)?.find((e) => e.ProdId == ProdId) - ?.OnePcsAvailable == 'Y'; - let variantValues1 = await dispatch( - getProdvaraiantdata({ - CompId: SupplierCompId, - AppId: SupplierAppId, - BranchId: SupplierBranchId, - prodName: x, - }) - ).unwrap(); - let variants = variantValues1?.data?.data; - let cc = variants?.filter((variant) => - variant?.ProductDetail?.some((e) => e.ProdId == ProdId) - )?.[0]?.ProductDetail; + // let x = (productsList || productData)?.find( + // (e) => e.ProdId == ProdId + // )?.ProdName; + let OnePcsAvailable = (productsList || productData)?.find((e) => e.ProdId == ProdId && e?.ProdVariantName == VariantName)?.OnePcsAvailable == 'Y'; + // let variantValues1 = await dispatch( + // getProdvaraiantdata({ + // CompId: SupplierCompId, + // AppId: SupplierAppId, + // BranchId: SupplierBranchId, + // prodName: x, + // }) + // ).unwrap(); + // let variants = variantValues1?.data?.data; - setVariants( - cc?.[0]?.ProdVariantDetails?.map((detail) => ({ - ...detail, - ProdIdProdName: `${detail.ProdVariantName} ${detail.ProdId}`, - OnePcsAvailable, - })) - ); + // let cc = variants?.filter((variant) => + // variant?.ProductDetail?.some((e) => e.ProdId == ProdId) + // )?.[0]?.ProductDetail; - if ( - cc?.[0]?.ProdVariantDetails?.length < 2 || - (extractedProduct ? cc?.[0]?.ProdVariantDetails?.length > 0 : false) + // setVariants( + // cc?.[0]?.ProdVariantDetails?.map((detail) => ({ + // ...detail, + // ProdIdProdName: `${detail.ProdVariantName} ${detail.ProdId}`, + // OnePcsAvailable, + // })) + // ); + + if (true + // cc?.[0]?.ProdVariantDetails?.length < 2 || + // (extractedProduct ? cc?.[0]?.ProdVariantDetails?.length > 0 : false) ) { // let getSuppId = (productsList || productData)?.filter((item) => item.ProdId == ProdId); formRef.current?.setFieldsValue({ ProdId: ProdId }); await setSelectedProductData(ProdId); // await setSelectedSupplierData(getSuppId?.[0]?.["SuppId"]) ,CustSuppId:getSuppId?.[0]?.["SuppId"] - if ((existingProducts || PurchaseData)?.some((e) => e.ProdId == ProdId)) { + if ((existingProducts || PurchaseData)?.some((e) => e.ProdId == ProdId && e?.ProdVariantName == VariantName)) { + const existingProduct = (existingProducts || PurchaseData)?.find((e) => e.ProdId == ProdId && e?.ProdVariantName == VariantName); setMessageType('error'); - setMessageData('Already Product Exists'); + setMessageData(`Product "${existingProduct?.ProdName} - ${existingProduct?.ProdVariantName}" already exists`); return null; - } else { + } + else { + let ProductData1 = (productsList || productData)?.find( - (e) => e.ProdId == ProdId + (e) => e.ProdId == ProdId && e?.ProdVariantName == VariantName ); let DefaultVariant = ProductData1?.ProdVariantPriceDetails?.find( (item) => item?.DefaultVariant === 'Y' && item?.ReceivedQty === 0 @@ -1275,10 +1337,13 @@ const StockForm = ({ formType }) => { SellPrice: ProductData1?.SellPrice, StockAvailable: ProductData1?.StockAvailable, OnePcsAvailable: ProductData1?.OnePcsAvailable, - NumberofPieceinside: ProductData1?.NoOfPcs, - AmountPerPiece: ProductData1?.OnePcsPrice, + // NumberofPieceinside: ProductData1?.NoOfPcs, + // AmountPerPiece: ProductData1?.OnePcsPrice, + OnePcsPrice: ProductData1?.OnePcsPrice, + NoOfPcs: ProductData1?.NoOfPcs, TaxId: ProductData1?.TaxId, TaxPercentage: ProductData1?.TaxPercentage, + ProdVariantName: ProductData1?.ProdVariantName, }; const qty = extractedProduct @@ -1304,7 +1369,7 @@ const StockForm = ({ formType }) => { RejectedQty: qty - acceptedQty, OfferPrice: 0, SpecialPrice: 0, - ProdVariantName: 'Variant 1', + // ProdVariantName: 'Variant 1', FreeItem: 0, TaxAmt: 0, TaxType: SelectedPurcTaxType ? SelectedPurcTaxType : 0, @@ -1330,6 +1395,7 @@ const StockForm = ({ formType }) => { let productName = {}; productName.label = `${matchedProduct?.ProdName} (${matchedProduct.Size} ${matchedProduct.UomName})${matchedProduct?.BrandName ? ` - ${matchedProduct?.BrandName}` : ''}`; const newProduct = await ProductDropDownChange( + matchedProduct?.ProdVariantName, matchedProduct.ProdId, productName ); @@ -1380,115 +1446,6 @@ const StockForm = ({ formType }) => { VarProdId: null, }); }; - const ProductVariantDropDownChange = (value) => { - const ProdName2 = Variants?.filter( - (item) => item.ProdIdProdName === value - )?.[0]?.ProdVariantName; - - const ProdName1 = PurchaseData?.some( - (item) => - item.ProdId === selectedProductData && - item.ProdVariantName === ProdName2 - ); - if (ProdName1) { - setMessageType('error'); - setMessageData('Already variant Exists'); - } else { - const ProdName = Variants?.filter( - (item) => item.ProdIdProdName === value - )?.[0]?.ProdVariantName; - const OnePcsAvailable = Variants?.filter( - (item) => item.ProdIdProdName === value - )?.[0]?.OnePcsAvailable; - formRef?.current?.setFieldsValue({ VarProdId: value }); - setselectedProductVariantData(ProdName); - - let ProductData1 = productData?.find( - (e) => e.ProdId == selectedProductData - ); - let mrp; - let sellprice; - if (ProdName == 'Variant 1') { - mrp = ProductData1?.MRP; - sellprice = ProductData1?.SellPrice; - } else { - mrp = ProductData1?.ProdVariantPriceDetails?.find( - (item) => item.ProdVariantName == ProdName - )?.MRP; - sellprice = ProductData1?.ProdVariantPriceDetails?.find( - (item) => item.ProdVariantName == ProdName - )?.SellPrice; - } - let DefaultVariant = ProductData1?.ProdVariantPriceDetails?.find( - (item) => item?.ProdVariantName === ProdName && item?.ReceivedQty === 0 - )?.DefaultVariant; - let ProduData2 = { - DefaultVariant: DefaultVariant, - ProdId: ProductData1?.ProdId, - MRP: mrp, - ProdName: ProductData1?.ProdName, - UomName: ProductData1?.UomName, - SellPrice: sellprice, - StockAvailable: ProductData1?.StockAvailable, - OnePcsAvailable: ProductData1?.OnePcsAvailable, - NumberofPieceinside: ProductData1?.NoOfPcs, - AmountPerPiece: ProductData1?.OnePcsPrice, - TaxId: ProductData1?.TaxId, - TaxPercentage: ProductData1?.TaxPercentage, - }; - // ProduData2["StockAvailable"]="Y" - - const localId = uuidv4(); - let tempPurData = { - ...ProduData2, - BalanceQty: 0, - InwardPrice: 0, - PurcDisc: 0, - Amount: 0, - WhSalePrice: 0, - ReceivedQty: 0, - AcceptedQty: 0, - FreeItem: 0, - RejectedQty: 0, - OfferPrice: 0, - SpecialPrice: 0, - ProdVariantName: ProdName, - // 'TaxId': PurcselectedTax ? PurcselectedTax : 0, - TaxAmt: 0, - TaxType: SelectedPurcTaxType ? SelectedPurcTaxType : 0, - PurcDiscType: 'P', - localId: localId, - PurchaseTax: 0, - }; - form?.setFieldsValue({ - [`SellPrice${localId}`]: tempPurData?.SellPrice, - [`PurchaseTax${localId}`]: tempPurData?.PurchaseTax, - }); - - setPurchaseData([tempPurData, ...PurchaseData]); - - Delete - ? (form.setFieldsValue({ - [`BalanceQty${index}`]: undefined, - [`ReceivedQty${index}`]: undefined, - [`AcceptedQty${index}`]: undefined, - [`RejectedQty${index}`]: undefined, - [`Amount${index}`]: undefined, - [`FreeQty${index}`]: undefined, - [`InwardPrice${index}`]: undefined, - [`MRP${index}`]: undefined, - [`PurcDisc${index}`]: undefined, - [`SellPrice${index}`]: undefined, - [`WhSalePrice${index}`]: undefined, - [`offerSalePrice${index}`]: undefined, - [`splSalePrice${index}`]: undefined, - [`NumberofPieceinside${index}`]: undefined, - [`AmountPerPiece${index}`]: undefined, - }), - setDelete(false)) - : ' '; - } - }; const handleTaxDropDownChange = async (TaxId) => { formProductRef.current?.setFieldsValue({ TaxId: TaxId }); @@ -1789,98 +1746,134 @@ const StockForm = ({ formType }) => { if (Delete) { form.setFieldsValue({ - BalanceQty: { [localId]: undefined }, - ReceivedQty: { [localId]: undefined }, - AcceptedQty: { [localId]: undefined }, - RejectedQty: { [localId]: undefined }, - Amount: { [localId]: undefined }, - FreeQty: { [localId]: undefined }, - InwardPrice: { [localId]: undefined }, - MRP: { [localId]: undefined }, - PurcDisc: { [localId]: undefined }, - SellPrice: { [localId]: undefined }, - WhSalePrice: { [localId]: undefined }, - offerSalePrice: { [localId]: undefined }, - splSalePrice: { [localId]: undefined }, - NumberofPieceinside: { [localId]: undefined }, - AmountPerPiece: { [localId]: undefined }, - PurcDiscType: { [localId]: undefined }, + [`BalanceQty${localId}`]: undefined, + [`ReceivedQty${localId}`]: undefined, + [`AcceptedQty${localId}`]: undefined, + [`RejectedQty${localId}`]: undefined, + [`Amount${localId}`]: undefined, + [`Freeqty${localId}`]: undefined, + [`InwardPrice${localId}`]: undefined, + [`MRP${localId}`]: undefined, + [`PurcDisc${localId}`]: undefined, + [`SellPrice${localId}`]: undefined, + [`WhSalePrice${localId}`]: undefined, + [`offerSalePrice${localId}`]: undefined, + [`splSalePrice${localId}`]: undefined, + [`NumberofPieceinside${localId}`]: undefined, + [`AmountPerPiece${localId}`]: undefined, + [`PurcDiscType${localId}`]: undefined, + [`ManufDate${localId}`]: undefined, + [`ExpDate${localId}`]: undefined, + [`OnePcsPrice${localId}`]: undefined, + [`NoOfPcs${localId}`]: undefined, }); setDelete(false); } else { form.setFieldsValue({ - BalanceQty: { [localId]: record?.BalanceQty }, - ReceivedQty: { [localId]: record?.ReceivedQty }, - AcceptedQty: { [localId]: record?.AcceptedQty }, - RejectedQty: { [localId]: record?.RejectedQty }, - PurcDiscType: { [localId]: record?.PurcDiscType }, - Amount: { [localId]: record?.Amount }, - FreeQty: { [localId]: record?.FreeItem }, - InwardPrice: { [localId]: record?.InwardPrice }, - MRP: { [localId]: record?.MRP }, - PurcDisc: { [localId]: record?.PurcDisc }, - SellPrice: { [localId]: record?.SellPrice }, - WhSalePrice: { [localId]: record?.WhSalePrice }, - offerSalePrice: { [localId]: record?.OfferPrice }, - splSalePrice: { [localId]: record?.SpecialPrice }, - NumberofPieceinside: { [localId]: record?.NumberofPieceinside }, - AmountPerPiece: { [localId]: record?.AmountPerPiece }, + [`BalanceQty${localId}`]: record?.BalanceQty, + [`ReceivedQty${localId}`]: record?.ReceivedQty, + [`AcceptedQty${localId}`]: record?.AcceptedQty, + [`RejectedQty${localId}`]: record?.RejectedQty, + [`Freeqty${localId}`]: record?.FreeItem, + [`MRP${localId}`]: record?.MRP, + [`ManufDate${localId}`]: record?.ManufDate, + [`ExpDate${localId}`]: record?.ExpDate, + [`SellPrice${localId}`]: record?.SellPrice, + [`WhSalePrice${localId}`]: record?.WhSalePrice, + [`PurcDiscType${localId}`]: record?.PurcDiscType, + [`Amount${localId}`]: record?.Amount, + [`InwardPrice${localId}`]: record?.InwardPrice, + [`PurcDisc${localId}`]: record?.PurcDisc, + [`offerSalePrice${localId}`]: record?.OfferPrice, + [`splSalePrice${localId}`]: record?.SpecialPrice, + [`OnePcsPrice${localId}`]: record?.OnePcsPrice, + [`NoOfPcs${localId}`]: record?.NoOfPcs, + + }); + if (applicationRestrictedFields.BatchAndModelDetails) { form.setFieldsValue({ - BatchRef: { [localId]: record?.BatchRef }, + [`BatchRef${localId}`]: record?.BatchRef, }); } } }; - const save = async (index) => { + const save = async (localId) => { try { - const row = await form?.validateFields(); + const row = await form.validateFields(); const modifiedObject = {}; + for (const key in row) { - const newKey = key.slice(0, -1); // Remove the last character ("0") from the key - modifiedObject[newKey] = row[key]; + // remove localId suffix from field names + if (key.endsWith(localId)) { + const newKey = key.replace(localId, ''); + modifiedObject[newKey] = row[key]; + } } - const newData = [...PurchaseData]; - // const index = newData.findIndex((item) => recordKey === item.InwardDtlId); - if (index > -1) { - const item = newData[index]; - newData.splice(index, 1, { ...item, ...modifiedObject }); - setPurchaseData(newData); - setEditingKey(''); - } + setPurchaseData((prev) => + prev.map((item) => + item.localId === localId + ? { ...item, ...modifiedObject } + : item + ) + ); + + setEditingKey(''); } catch (err) { console.error('Save failed:', err); } }; - const handleKeyPress = async (e, record, index) => { + + const handleKeyPress = async (e, record) => { if (e.key === 'Enter') { try { await form.validateFields(); - save(index); + save(record.localId); } catch (error) { console.error('Save failed:', error); } } }; - const openAdditionalInfoModal = (record, index) => { - console.log(record, 'recordrecord'); - if (record?.ReceivedQty === 0 || record?.ReceivedQty === '') { - setMessageType('error'); - setMessageData('Please Enter Qty'); - return; - } - setSelectedRowIndex(index); - setSelectedRowRecord(record); - setAdditionalInfoModal(true); + + const formatDateForDisplay = (dateString) => { + if (!dateString) return ''; + return moment(dateString).format('DD-MMM-YY'); }; + + const updateRowValues = (localId, updates) => { + setPurchaseData((prev) => + prev.map((item) => + item.localId === localId ? { ...item, ...updates } : item + ) + ); + + const formUpdates = {}; + Object.keys(updates).forEach((key) => { + formUpdates[`${key}${localId}`] = updates[key]; + }); + + form.setFieldsValue(formUpdates); + }; + const updateRowValue = (localId, key, value) => { + setPurchaseData((prev) => + prev.map((item) => + item.localId === localId ? { ...item, [key]: value } : item + ) + ); + + form.setFieldsValue({ + [`${key}${localId}`]: value, + }); + } + const columns = [ { title: 'SL.NO', @@ -1891,13 +1884,24 @@ const StockForm = ({ formType }) => { ), }, { - title: 'Product Name', + title: 'Name', dataIndex: 'ProdName', key: 'ProdName', align: 'left', render: (text, record, index) => ( - {record?.ProdName + '(' + record?.ProdVariantName + ')'} + {record?.ProdName} + + ), + }, + { + title: 'Variant', + dataIndex: 'ProdVariantName', + key: 'ProdVariantName', + align: 'left', + render: (text, record, index) => ( + + {record?.ProdVariantName} ), }, @@ -1934,9 +1938,9 @@ const StockForm = ({ formType }) => { ]} > handleKeyPress(e, record, index)} + onPressEnter={(e) => handleKeyPress(e, record)} onBlur={(e) => handleQtyChange(e, record)} - onChange={(e) => handleQtyChange(e, record, index)} + onChange={(e) => handleQtyChange(e, record)} inputMode="decimal" onInput={(e) => { let cleanedValue = e.target.value.replace(/[^0-9.]/g, ''); // Remove invalid characters @@ -1961,7 +1965,7 @@ const StockForm = ({ formType }) => { { title: ( - Purchase Rate / Unit + Purchase Rate/unit ), dataIndex: 'InwardPrice', @@ -1991,9 +1995,9 @@ const StockForm = ({ formType }) => { ]} > handleKeyPress(e, record, index)} - onChange={(e) => handlePurrateChange(e, record, index)} - onBlur={(e) => handlePurrateChange(e, record, index)} + onPressEnter={(e) => handleKeyPress(e, record)} + onChange={(e) => handlePurrateChange(e, record)} + onBlur={(e) => handlePurrateChange(e, record)} inputMode="decimal" onInput={(e) => { let cleanedValue = e.target.value.replace(/[^0-9.]/g, ''); // Remove invalid characters @@ -2024,7 +2028,7 @@ const StockForm = ({ formType }) => { ), dataIndex: 'PurchaseTax', key: 'PurchaseTax', - width: 120, + // width: 120, editable: true, render: (text, record, index) => { return isEditing(record, index) ? ( @@ -2075,9 +2079,9 @@ const StockForm = ({ formType }) => { ]} > handleKeyPress(e, record, index)} - onChange={(e) => handleTaxChange(e, record, index)} - onBlur={(e) => handleTaxChange(e, record, index)} + onPressEnter={(e) => handleKeyPress(e, record)} + onChange={(e) => handleTaxChange(e, record)} + onBlur={(e) => handleTaxChange(e, record)} inputMode="decimal" onInput={(e) => { let value = e.target.value.replace(/[^0-9.]/g, ''); @@ -2104,15 +2108,52 @@ const StockForm = ({ formType }) => { key: 'Amount', editable: true, }, + ...(selectedAdditionalColumn.includes("Mrp") ? [ + { + title: 'MRP', + dataIndex: 'MRP', + key: 'MRP', + editable: true, + // width: 150, + render: (text, record) => { + const localId = record.localId; + + return isEditing(record) ? ( + + { + const value = e.target.value; + + if (!/^\d*\.?\d*$/.test(value)) { + setMessageType('error'); + setMessageData('Only numeric values are allowed'); + return; + } + + updateRowValues(record.localId, { + MRP: value, + SellPrice: value, + }); + }} + onPressEnter={(e) => handleKeyPress(e, record)} + /> + + + ) : ( + text + ) + } + }] : []), { title: ( - Selling Price / Unit + Selling Price ), dataIndex: 'SellPrice', key: 'SellPrice', - width: 120, + width: 70, editable: true, render: (text, record, index) => { return isEditing(record, index) ? ( @@ -2125,9 +2166,9 @@ const StockForm = ({ formType }) => { ]} > handleKeyPress(e, record, index)} - onChange={(e) => handleSellPriceChange(e, record, index)} - onBlur={(e) => handleSellPriceChange(e, record, index)} + onPressEnter={(e) => handleKeyPress(e, record)} + onChange={(e) => handleSellPriceChange(e, record)} + onBlur={(e) => handleSellPriceChange(e, record)} inputMode="decimal" onInput={(e) => { let cleanedValue = e.target.value.replace(/[^0-9.]/g, ''); // Remove invalid characters @@ -2147,25 +2188,425 @@ const StockForm = ({ formType }) => { ); }, }, - { - title: 'Additional Info', - dataIndex: 'AdditionalInfo', - key: 'AdditionalInfo', - width: 120, - align: 'center', - render: (text, record, index) => { - return ( - <> - {' '} - openAdditionalInfoModal(record, index)} - className="shape-preview" - /> - - ); + + ...(selectedAdditionalColumn.includes("Amount Per Piece") ? [ + { + title: "Amount per piece", + dataIndex: 'OnePcsPrice', + key: 'OnePcsPrice', + width: 70, + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + handleKeyPress(e, record)} + onChange={(e) => { + const newData = PurchaseData.map((item) => + item.localId === record?.localId ? { ...item, OnePcsPrice: e.target.value } : item + ); + setPurchaseData(newData); + }} + placeholder="OnePcsPrice" + /> + + ) : ( + text + ); + }, + }] : []), + ...(selectedAdditionalColumn.includes("Amount Per Piece") ? [ + { + title: "Number of piece", + dataIndex: 'NoOfPcs', + key: 'NoOfPcs', + width: 70, + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + handleKeyPress(e, record)} + onChange={(e) => { + const newData = PurchaseData.map((item) => + item.localId === record?.localId ? { ...item, NoOfPcs: e.target.value } : item + ); + setPurchaseData(newData); + }} + placeholder="NoOfPcs" + /> + + ) : ( + text + ); + }, + }] : []), + ...(selectedAdditionalColumn.includes("Wholesale Price") ? [ + { + title: "Wholesale price", + dataIndex: 'WhSalePrice', + key: 'WhSalePrice', + width: 70, + editable: true, + render: (text, record) => { + return isEditing(record) ? ( + + handleKeyPress(e, record)} + onChange={(e) => { + const value = e.target.value; + + // 🚫 block non-numeric + if (!/^\d*\.?\d*$/.test(value)) return; + + updateRowValue(record.localId, 'WhSalePrice', value); + }} + /> + + ) : ( + text + ); + }, + } + ] : []), + + ...(selectedAdditionalColumn.includes("Manufacture Date") ? [ + { + title: 'Manuf.Date', + dataIndex: 'ManufDate', + key: 'ManufDate', + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + { + const formattedDate = dateString === '' ? undefined : moment(dateString, ['DD-MM-YYYY']).format('YYYY-MM-DDTHH:mm:ss'); + const newData = PurchaseData.map((item) => + item.localId === record?.localId ? { ...item, ManufDate: formattedDate } : item + ); + setPurchaseData(newData); + form.setFieldsValue({ + [`ManufDate${record?.localId}`]: formattedDate + }); + }} + valueData={record?.ManufDate} + cancelFuture={true} + /> + + ) : ( + formatDateForDisplay(text) + ); + }, + }] : []), + ...(selectedAdditionalColumn.includes("Expiry Date") ? [ + { + title: 'Exp.Date', + dataIndex: 'ExpDate', + key: 'ExpDate', + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + { + const formattedDate = dateString === '' ? undefined : moment(dateString, ['DD-MM-YYYY']).format('YYYY-MM-DDTHH:mm:ss'); + const newData = PurchaseData.map((item) => + item.localId === record?.localId ? { ...item, ExpDate: formattedDate } : item + ); + setPurchaseData(newData); + form.setFieldsValue({ + [`ExpDate${record?.localId}`]: formattedDate + }); + }} + valueData={record?.ExpDate} + cancelFuture={false} + /> + + ) : ( + formatDateForDisplay(text) + ); + }, + }] : []), + + ...(selectedAdditionalColumn.includes("Hsn") ? [ + { + title: 'Hsn', + dataIndex: 'Hsn', + key: 'Hsn', + editable: true, + // width: 130, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + handleKeyPress(e, record)} + onChange={(e) => { + const newData = PurchaseData.map((item) => + item.localId === record?.localId ? { ...item, PurchaseHSNCode: e.target.value } : item + ); + setPurchaseData(newData); + }} + placeholder="HSN code" + /> + + ) : ( + text + ); + }, + }] : []), + ...(selectedAdditionalColumn.includes("Model No") ? [ + { + title: 'Model', + dataIndex: 'Model', + key: 'Model', + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + handleKeyPress(e, record, index)} + onChange={(e) => { + const newData = PurchaseData.map((item) => + item.localId === record?.localId ? { ...item, ModelNumber: e.target.value } : item + ); + setPurchaseData(newData); + }} + placeholder="Model No" + /> + + ) : ( + text + ); + }, + }] : []), + ...(selectedAdditionalColumn.includes("Batch No") ? [ + { + title: 'Batch', + dataIndex: 'Batch', + key: 'Batch', + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + handleKeyPress(e, record, index)} + onChange={(e) => { + const newData = PurchaseData.map((item) => + item.localId === record?.localId ? { ...item, BatchRef: e.target.value } : item + ); + setPurchaseData(newData); + }} + placeholder="Batch No" + /> + + ) : ( + text + ); + }, + }] : []), + + ...(selectedAdditionalColumn.includes("Rejected Qty") ? + [ + { + title: 'Rejected Qty', + dataIndex: 'RejectedQty', + key: 'RejectedQty', + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + handleKeyPress(e, record, index)} + onChange={(e) => { + const inputValue = e.target.value; + const rejectedQty = parseFloat(inputValue) || 0; + const receivedQty = parseFloat(record.ReceivedQty) || 0; + + if (inputValue !== '' && rejectedQty >= receivedQty) { + setMessageType('error'); + setMessageData('Rejected Qty cannot be greater than or Equal to Received Qty'); + form.setFieldsValue({ + [`RejectedQty${record?.localId}`]: record.RejectedQty || 0 + }); + return; + } + + const acceptedQty = receivedQty - rejectedQty; + const totalAmount = acceptedQty * (parseFloat(record.InwardPrice) || 0); + + const newData = PurchaseData.map((item) => + item.localId === record?.localId ? { + ...item, + RejectedQty: parseFloat(inputValue) || 0, + AcceptedQty: acceptedQty, + Amount: totalAmount + } : item + ); + setPurchaseData(newData); + }} + placeholder="Rejected Qty" + /> + + ) : ( + text + ); + }, + }] : []), + + + + + ...(selectedAdditionalColumn.includes("Free Qty") ? [ + { + title: 'Free Qty', + dataIndex: 'Freeqty', + key: 'Freeqty', + editable: true, + render: (text, record) => { + return isEditing(record) ? ( + + handleKeyPress(e, record)} + onChange={(e) => { + const value = e.target.value; + + // 🚫 block non-numeric + if (!/^\d*$/.test(value)) return; + + updateRowValue(record.localId, 'Freeqty', value); + }} + /> + + ) : ( + text + ); + }, }, - }, + ] : []), + + ...(selectedAdditionalColumn.includes("IMEI") ? [ + { + title: 'IMEI', + dataIndex: 'AdditionalInfo', + key: 'AdditionalInfo', + width: 120, + align: 'center', + render: (text, record, index) => { + const hasQty = record?.ReceivedQty && parseFloat(record.ReceivedQty) > 0; + return ( + <> + {' '} + { + if (hasQty) { + + setSelectedRowIndex(index); + handleModelDataOpen(record); + + } else { + setMessageType('error'); + setMessageData('Please Enter Qty'); + } + }} + className="shape-preview" + /> + + ); + }, + }] : []), { title: 'Action', dataIndex: 'Action', @@ -2181,176 +2622,258 @@ const StockForm = ({ formType }) => { style={{ color: '#FF4D4F', }} - onClick={() => statusFormatters(record, index)} + onClick={() => statusFormatters(record)} /> ), }, ]; - const statusFormatters = (record, index) => { + + const statusFormatters = (record) => { const localId = record?.localId; - const Data = PurchaseData.filter((_, i) => i !== index); + + // Remove row using localId (not index) + const data = PurchaseData.filter( + (item) => item?.localId !== localId + ); + setDelete(true); + + // Clear form fields for this row + form.setFieldsValue({ [`BalanceQty${localId}`]: undefined, [`ReceivedQty${localId}`]: undefined, [`AcceptedQty${localId}`]: undefined, [`RejectedQty${localId}`]: undefined, - [`Amount${localId}`]: undefined, - [`FreeQty${localId}`]: undefined, - [`InwardPrice${localId}`]: undefined, + [`Freeqty${localId}`]: undefined, [`MRP${localId}`]: undefined, - [`PurcDisc${localId}`]: undefined, + [`ManufDate${localId}`]: undefined, + [`ExpDate${localId}`]: undefined, [`SellPrice${localId}`]: undefined, [`WhSalePrice${localId}`]: undefined, + [`PurcDiscType${localId}`]: undefined, + [`Amount${localId}`]: undefined, + [`InwardPrice${localId}`]: undefined, + [`PurcDisc${localId}`]: undefined, [`offerSalePrice${localId}`]: undefined, [`splSalePrice${localId}`]: undefined, + [`OnePcsPrice${localId}`]: undefined, + [`NoOfPcs${localId}`]: undefined, }); - setVariants(); - setPurchaseData(Data); + setVariants(undefined); + setPurchaseData(data); setSelectedProductData(null); - formRef?.current?.setFieldsValue({ ProdId: null }); + + formRef?.current?.setFieldsValue({ + ProdId: null, + }); }; - const handleQtyChange = (e, record, index) => { + + + + const handleQtyChange = (e, record) => { const { localId } = record; + + const sourceData = PurchaseData; + + const findIndex = sourceData.findIndex( + (item) => item?.localId === localId + ); + + if (findIndex === -1) return; + const inputValue = e.target.value; - setDataSource([]); - setDataSourceBackup([]); - // Validate if inputValue is numeric + + // ✅ Numeric validation if (!/^\d*\.?\d*$/.test(inputValue)) { setMessageType('error'); setMessageData('Only numeric values are allowed'); return; } - const qty = inputValue; - const acceptedQty = parseFloat(qty); + const qty = Number(inputValue) || 0; + const acceptedQty = qty; - const newData = PurchaseData.map((item, index1) => { - if (index1 === index) { - return { - ...item, - Amount: - isNaN(parseFloat(item?.InwardPrice)) || isNaN(acceptedQty) - ? 0 - : parseFloat(item?.InwardPrice) * acceptedQty, - PurcDisc: 0, - BalanceQty: qty, - ReceivedQty: qty, - AcceptedQty: !isNaN(acceptedQty) ? acceptedQty : 0, - RejectedQty: !isNaN(qty - acceptedQty) ? qty - acceptedQty : 0, - ProductIdentifierDtls: [], - }; - } - return item; - }); + const newData = [...PurchaseData]; + + const item = newData[findIndex]; + + newData[findIndex] = { + ...item, + Amount: + isNaN(Number(item?.InwardPrice)) || isNaN(acceptedQty) + ? 0 + : Number(item?.InwardPrice) * acceptedQty, + PurcDisc: 0, + BalanceQty: qty, + ReceivedQty: qty, + AcceptedQty: acceptedQty, + RejectedQty: 0, + ProductIdentifierDtls: [], + }; setPurchaseData(newData); + + // ✅ Sync form values form.setFieldsValue({ - ...form.getFieldsValue(), [`PurcDisc${localId}`]: 0, [`BalanceQty${localId}`]: qty, [`ReceivedQty${localId}`]: qty, - [`AcceptedQty${localId}`]: !isNaN(acceptedQty) ? acceptedQty : 0, - [`RejectedQty${localId}`]: !isNaN(qty - acceptedQty) - ? qty - acceptedQty - : 0, - // ReceivedQty: qty, - // AcceptedQty: acceptedQty, - // RejectedQty: qty - acceptedQty, + [`AcceptedQty${localId}`]: acceptedQty, + [`RejectedQty${localId}`]: 0, }); }; - const handlePurrateChange = (e, record, index) => { - const { localId, PurcDisc, PurcDiscType, PurchaseTax } = record; + + + const handlePurrateChange = (e, record) => { + const { localId, PurcDisc, PurcDiscType } = record; const PurcRate = e.target.value; + + // ✅ Numeric validation if (!/^\d*\.?\d*$/.test(PurcRate)) { setMessageType('error'); setMessageData('Only numeric values are allowed'); return; } - const Amount = parseFloat(PurcRate) * record?.AcceptedQty; + + const acceptedQty = Number(record?.AcceptedQty) || 0; + const rate = Number(PurcRate) || 0; + const amount = rate * acceptedQty; + + // 🔍 Find correct index using localId + const findIndex = PurchaseData.findIndex( + (item) => item?.localId === localId + ); + + if (findIndex === -1) return; + + const item = PurchaseData[findIndex]; + + // 🧮 Discount calculation let discountAmt = 0; if (PurcDiscType === 'P') { - discountAmt = (Amount * Number(PurcDisc)) / 100; + discountAmt = (amount * Number(PurcDisc || 0)) / 100; } else { - discountAmt = Number(PurcDisc); + discountAmt = Number(PurcDisc || 0); } - // You can calculate acceptedQty based on your requirement - const newData = PurchaseData.map((item, index1) => { - if (index1 === index) { - return { - ...item, - PurcDisc: 0, - InwardPrice: Delete ? 0 : PurcRate, - Amount: !isNaN(Amount) ? Amount : 0, - TaxAmt: - (parseInt(Amount) * parseInt(item?.TaxPercentage)) / - (100 + parseInt(item?.TaxPercentage))?.toFixed(2), - }; - } - return item; - }); - formRef?.current?.setFieldsValue({ - PaymentAmount: newData?.reduce((acc, data) => acc + data?.Amount, 0), - }); - setPaymentAmount(newData?.reduce((acc, data) => acc + data?.Amount, 0)); + + // 🧮 Tax calculation + const taxPercent = Number(item?.TaxPercentage || 0); + const taxAmt = + taxPercent > 0 + ? ((amount - discountAmt) * taxPercent) / (100 + taxPercent) + : 0; + + // ✅ Update data immutably + const newData = [...PurchaseData]; + + newData[findIndex] = { + ...item, + PurcDisc: 0, + InwardPrice: Delete ? 0 : rate, + Amount: !isNaN(amount) ? amount : 0, + TaxAmt: taxAmt.toFixed(2), + }; + setPurchaseData(newData); + + // 🔄 Update payment amount + const totalAmount = newData.reduce( + (acc, data) => acc + Number(data?.Amount || 0), + 0 + ); + + setPaymentAmount(totalAmount); + + formRef?.current?.setFieldsValue({ + PaymentAmount: totalAmount, + }); + + // 🔄 Sync row form fields form.setFieldsValue({ [`PurcDisc${localId}`]: 0, - InwardPrice: { [localId]: Delete ? 0 : PurcRate }, - Amount: { [localId]: !isNaN(Amount) ? Amount : 0 }, + [`InwardPrice${localId}`]: Delete ? 0 : rate, + [`Amount${localId}`]: !isNaN(amount) ? amount : 0, }); }; - const handleSellPriceChange = (e, record, index) => { + + const handleSellPriceChange = (e, record) => { const { localId } = record; const value = e?.target?.value; + + // ✅ Numeric validation if (!/^\d*\.?\d*$/.test(value)) { setMessageType('error'); setMessageData('Only numeric values are allowed'); return; } - const newData = PurchaseData?.map((item, index1) => { - if (index1 === index) { - return { - ...item, - SellPrice: value, - }; - } - return item; - }); + + // 🔍 Find correct row using localId + const findIndex = PurchaseData.findIndex( + (item) => item?.localId === localId + ); + + if (findIndex === -1) return; + + // ✅ Immutable update + const newData = [...PurchaseData]; + + newData[findIndex] = { + ...newData[findIndex], + SellPrice: value, + }; + + setPurchaseData(newData); + + // 🔄 Sync form field form.setFieldsValue({ [`SellPrice${localId}`]: value, }); - setPurchaseData(newData); }; - const handleTaxChange = (e, record, index) => { + const handleTaxChange = (e, record) => { const { localId } = record; const value = e?.target?.value; + + // ✅ Numeric validation if (!/^\d*\.?\d*$/.test(value)) { setMessageType('error'); setMessageData('Only numeric values are allowed'); return; } - const newData = PurchaseData?.map((item, index1) => { - if (index1 === index) { - return { - ...item, - PurchaseTax: parseFloat(value) || 0, - }; - } - return item; - }); - form.setFieldsValue({ - [`PurchaseTax${localId}`]: parseFloat(value) || 0, - }); + + const taxValue = Number(value) || 0; + + // 🔍 Find correct row + const findIndex = PurchaseData.findIndex( + (item) => item?.localId === localId + ); + + if (findIndex === -1) return; + + // ✅ Immutable update + const newData = [...PurchaseData]; + + newData[findIndex] = { + ...newData[findIndex], + PurchaseTax: taxValue, + }; + setPurchaseData(newData); + + // 🔄 Sync form value + form.setFieldsValue({ + [`PurchaseTax${localId}`]: taxValue, + }); }; + + const purchaseStatusChange = (value) => { setPurchaseStatus(value); }; @@ -2477,41 +3000,35 @@ const StockForm = ({ formType }) => { }, []); }; + + const onFinish = async ({ PaymentType, PaymentAmount = 0, ...values }) => { try { + // =============================== + // 1️⃣ TAX VALIDATION + // =============================== const invalidTaxItems = PurchaseData?.filter((item) => { const tax = item.PurchaseTax; - - if (tax === undefined || tax === '' || tax === null) { - return false; - } - + if (tax === undefined || tax === '' || tax === null) return false; const num = Number(tax); - - if (isNaN(num)) { - return true; - } - - if (num < 0 || num > 99) { - return true; - } - - return false; + return isNaN(num) || num < 0 || num > 99; }); - if (invalidTaxItems && invalidTaxItems.length > 0) { + if (invalidTaxItems.length > 0) { setMessageType('error'); - setMessageData( - 'Please enter valid tax percentage (0-99%) for all items' - ); + setMessageData('Please enter valid tax percentage (0–99%) for all items'); return; } + + // =============================== + // 2️⃣ SELL PRICE > MRP CHECK + // =============================== if ( PurchaseData?.some( (item) => item.SellPrice && item.MRP && - parseFloat(item.SellPrice) > parseFloat(item.MRP) + Number(item.SellPrice) > Number(item.MRP) ) ) { setMessageType('error'); @@ -2519,160 +3036,185 @@ const StockForm = ({ formType }) => { return; } - if (PurchaseData.length === 0) { + // =============================== + // 3️⃣ NO PRODUCT CHECK + // =============================== + if (!PurchaseData || PurchaseData.length === 0) { setMessageType('error'); setMessageData('No Product Selected'); return; } - if ( - !PurchaseData?.every( - (item) => - (parseFloat(item.BalanceQty) ? parseFloat(item.BalanceQty) : 0) !== - 0 && item.Amount !== 0 - ) - ) { - setMessageType('error'); - setMessageData('Please Enter Qty And Amount'); - return; - } + // =============================== + // 4️⃣ FILTER VALID / INVALID ROWS + // =============================== + const validRows = []; + const invalidRowNumbers = []; - if (!PurchaseData?.every((item) => item.AcceptedQty !== 0)) { - setMessageType('error'); - setMessageData('Qty & Rejected Qty Should not be same'); - return; - } - if (SupplierOpen === 'paid') { - const { SuppInvoiceNo, SuppInvoiceDate } = - (await formRef?.current?.getFieldsValue()) || {}; - if (!SuppInvoiceNo && !SuppInvoiceDate) { - setMessageType('error'); - setMessageData( - `Enter The ${invoiceType === 'I' ? 'Invoice ' : 'Delivery Challan'} No and Date` - ); - return; - } else if (!SuppInvoiceNo) { - setMessageType('error'); - setMessageData( - `Enter The ${invoiceType === 'I' ? 'Invoice ' : 'Delivery Challan'} No` - ); - return; - } else if (!SuppInvoiceDate) { - setMessageType('error'); - setMessageData( - `Enter The ${invoiceType === 'I' ? 'Invoice ' : 'Delivery Challan'} Date` - ); - return; + PurchaseData.forEach((item, index) => { + const qty = Number(item.BalanceQty) || 0; + const amount = Number(item.Amount) || 0; + + if (qty > 0 && amount > 0) { + validRows.push(item); + } else { + invalidRowNumbers.push(index + 1); } - } - - const images = getUniqueImageArray(PurchaseData); - - const postData = { - ...values, - InvoiceAmount: PurchaseData?.reduce( - (acc, data) => acc + data?.Amount, - 0 - ), - CompId, - BranchId, - AppId, - CreatedBy: UserId, - PurOrderStatus: purchaseStatus, - TaxAmount: TotalTaxAmount?.toFixed(2), - BillAmount: (SelInvoiceAmount - TotalTaxAmount)?.toFixed(2), - TotalAmount: SelInvoiceAmount, - PurOrderInvoiceNo: purchaseOrderId, - PaymentStatus: 'S', - LocationType: SupplierData?.find( - (item) => item?.SuppId === selectedSupplierData - )?.Type, - ImageDetails: images || [], - }; - - const fieldsToRemove = [ - 'InwardDtlId', - 'InwardId', - 'UomName', - 'ProdName', - 'UOMName', - ]; - - const processedData = PurchaseData?.map((item) => { - const cleanItem = { ...item }; - fieldsToRemove.forEach((field) => delete cleanItem[field]); - return { - ...cleanItem, - TaxType: SelectedPurcTaxType || 0, - BalanceQty: cleanItem.AcceptedQty, - OnePcsPrice: cleanItem.AmountPerPiece, - NoOfPcs: cleanItem.NumberofPieceinside, - }; }); - const isPaidSelected = PurchaseTypeData?.some( - (item) => - item.ConfigId === SelectedPurchaseType && item.ConfigName === 'Cash' - ); - if ( - (SupplierOpen !== 'own' || selectedSupplierName) && - selectedSupplierData && - isPaidSelected - ) { - postData.PaymentAmount = PaymentAmount; - postData.PaymentType = selectedPaymentMode; - } else { - postData.PaymentType = PaymentType; - } - - postData['ProdDetails'] = processedData; - - if (formType === 'edit') { - postData['ProdId'] = editstate?.ProdId; - postData['InwardId'] = editstate?.InwardId; - postData['InwardDtlId'] = editstate?.InwardDtlId; - postData['UpdatedBy'] = UserId; - } - - let response; - try { - if (formType === 'add') { - response = await dispatch(postPurchaseData(postData)).unwrap(); - } else { - response = await dispatch(putStockData(postData)).unwrap(); - } - } catch (err) { - if (err?.message === 'Request failed with status code 422') { - response = { - data: { - statusCode: 0, - response: 'Please Give Required Fields', - data: [], - }, - }; - } - } - - if (response?.data?.statusCode === 1) { - navigate(`${subDirectory}setting/purchase-entry/`, { - state: { - Notiffy: { - messageType: 'success', - messageData: response?.data?.response, - }, - }, - }); - } else { + if (validRows.length === 0) { setMessageType('error'); - setMessageData(response?.data?.response); + setMessageData('Please enter Qty and Amount for at least one product'); + return; } - } catch (errorInfo) { - console.log('Validation Failed:', errorInfo); + + // =============================== + // 5️⃣ CONFIRMATION FOR INVALID ROWS + // =============================== + if (invalidRowNumbers.length > 0) { + Modal.confirm({ + title: '⚠️ Incomplete Product Rows', + width: 520, + centered: true, + content: ( +
+

+ Some products are missing Qty or Amount. +

+ +

+ Affected row(s): {invalidRowNumbers.join(', ')} +

+ +

+ Are you sure you want to continue without these products? +

+
+ ), + okText: 'Continue Anyway', + cancelText: 'Go Back', + okButtonProps: { danger: true }, + onOk: () => + proceedSubmit(validRows, values, PaymentType, PaymentAmount), + }); + + return; + } + + // If all rows valid + await proceedSubmit(validRows, values, PaymentType, PaymentAmount); + } catch (error) { + console.error(error); setMessageType('error'); - setMessageData('Please correct the highlighted fields'); - return; + setMessageData('Something went wrong'); } }; + const proceedSubmit = async ( + filteredPurchaseData, + values, + PaymentType, + PaymentAmount + ) => { + const images = getUniqueImageArray(filteredPurchaseData); + const postData = { + ...values, + InvoiceAmount: filteredPurchaseData.reduce( + (acc, item) => acc + Number(item.Amount || 0), + 0 + ), + CompId, + BranchId, + AppId, + CreatedBy: UserId, + PurOrderStatus: purchaseStatus, + TaxAmount: TotalTaxAmount?.toFixed(2), + BillAmount: (SelInvoiceAmount - TotalTaxAmount)?.toFixed(2), + TotalAmount: SelInvoiceAmount, + PurOrderInvoiceNo: purchaseOrderId, + PaymentStatus: 'S', + LocationType: SupplierData?.find( + (item) => item?.SuppId === selectedSupplierData + )?.Type, + ImageDetails: images || [], + }; + + const fieldsToRemove = [ + 'InwardDtlId', + 'InwardId', + 'UomName', + 'ProdName', + 'UOMName', + ]; + + const processedData = filteredPurchaseData.map((item) => { + const cleanItem = { ...item }; + fieldsToRemove.forEach((field) => delete cleanItem[field]); + + return { + ...cleanItem, + TaxType: SelectedPurcTaxType || 0, + BalanceQty: cleanItem.AcceptedQty, + OnePcsPrice: cleanItem.OnePcsPrice, + NoOfPcs: cleanItem.NoOfPcs, + }; + }); + + const isPaidSelected = PurchaseTypeData?.some( + (item) => + item.ConfigId === SelectedPurchaseType && item.ConfigName === 'Cash' + ); + + if ( + (SupplierOpen !== 'own' || selectedSupplierName) && + selectedSupplierData && + isPaidSelected + ) { + postData.PaymentAmount = PaymentAmount; + postData.PaymentType = selectedPaymentMode; + } else { + postData.PaymentType = PaymentType; + } + + postData.ProdDetails = processedData; + + if (formType === 'edit') { + postData.ProdId = editstate?.ProdId; + postData.InwardId = editstate?.InwardId; + postData.InwardDtlId = editstate?.InwardDtlId; + postData.UpdatedBy = UserId; + } + + let response; + try { + response = + formType === 'add' + ? await dispatch(postPurchaseData(postData)).unwrap() + : await dispatch(putStockData(postData)).unwrap(); + } catch (err) { + response = { + data: { + statusCode: 0, + response: 'Please Give Required Fields', + }, + }; + } + + if (response?.data?.statusCode === 1) { + navigate(`${subDirectory}setting/purchase-entry/`, { + state: { + Notiffy: { + messageType: 'success', + messageData: response?.data?.response, + }, + }, + }); + } else { + setMessageType('error'); + setMessageData(response?.data?.response); + } + }; + + const onComplete = useCallback(() => { setMessageData(null); @@ -3003,73 +3545,12 @@ const StockForm = ({ formType }) => { // command - const handleRejectedQty = () => { - const formData = productAddInfoRef?.current?.getFieldsValue(); - const rejectedQty = - formData?.RejectedQty === '' ? 0 : parseFloat(formData?.RejectedQty); - const receivedQty = parseFloat(formData.ReceivedQty) - ? parseFloat(formData.ReceivedQty) - : 0; - let acceptedQty = receivedQty; - let newRejectedQty = 0; - if (isNaN(rejectedQty)) { - newRejectedQty = ''; - } else if (rejectedQty >= receivedQty) { - setMessageType('error'); - setMessageData( - 'Rejected Qty cannot be greater than or Equal to Received Qty' - ); - } else { - newRejectedQty = rejectedQty; - acceptedQty = receivedQty - rejectedQty; - } - let totalAmount = - acceptedQty * (parseFloat(selectedRowRecord?.InwardPrice) || 0); - setSelectedRowRecord((prev) => ({ - ...prev, - AcceptedQty: acceptedQty, - RejectedQty: newRejectedQty === '' ? 0 : newRejectedQty, - ProductIdentifierDtls: [], - Amount: totalAmount, - })); + ; - productAddInfoRef?.current?.setFieldsValue({ - RejectedQty: newRejectedQty === '' ? 0 : newRejectedQty, - AcceptedQty: acceptedQty, - }); - }; - const handleFreeQtyChange = (e) => { - const inputValue = e?.target?.value; - if (!/^\d*\.?\d*$/.test(inputValue)) { - setMessageType('error'); - setMessageData('Only numeric values are allowed'); - return; - } - - const freeQty = inputValue === '' ? '' : parseFloat(inputValue); - - setSelectedRowRecord((prev) => ({ - ...prev, - FreeItem: freeQty, - })); - }; - - const handleMRPChange = (e) => { - let value = e?.target?.value === '' ? 0 : parseFloat(e?.target?.value); - productAddInfoRef?.current?.setFieldsValue({ SellPrice: null, MRP: value }); - setSelectedRowRecord((prev) => ({ ...prev, SellPrice: null, MRP: value })); - productAddInfoRef?.current?.validateFields(); - }; - - const handleHSNChange = (e) => { - const value = e?.target?.value; - productAddInfoRef?.current?.setFieldsValue({ PurchaseHSNCode: value }); - setSelectedRowRecord((prev) => ({ ...prev, PurchaseHSNCode: value })); - }; const validateSellPrice = (record) => (_, value) => { if (!value) { @@ -3091,103 +3572,7 @@ const StockForm = ({ formType }) => { return Promise.resolve(); }; - const handleAmountPerPiecechange = (e) => { - const inputValue = e?.target?.value; - - const amountPerPiece = inputValue === '' ? '' : parseFloat(inputValue); - - if (selectedRowRecord?.OnePcsAvailable === 'Y') { - setSelectedRowRecord((prev) => ({ - ...prev, - AmountPerPiece: amountPerPiece, - })); - } - }; - - const handleNumberofPieceinsidechange = (e) => { - const inputValue = e?.target?.value; - - const numberOfPieceInside = inputValue === '' ? '' : parseFloat(inputValue); - - if (selectedRowRecord?.OnePcsAvailable === 'Y') { - setSelectedRowRecord((prev) => ({ - ...prev, - NumberofPieceinside: numberOfPieceInside, - })); - } - }; - - const handleManufactureDate = (date, dateString) => { - const formattedDate = - dateString === '' - ? undefined - : moment(dateString, ['DD-MM-YYYY']).format('YYYY-MM-DDTHH:mm:ss'); - productAddInfoRef?.current?.setFieldsValue({ - ManufDate: date, - }); - setSelectedRowRecord((prev) => ({ ...prev, ManufDate: formattedDate })); - }; - - const handleExpireDate = (date, dateString) => { - const formattedDate = - dateString === '' - ? undefined - : moment(dateString, ['DD-MM-YYYY']).format('YYYY-MM-DDTHH:mm:ss'); - productAddInfoRef?.current?.setFieldsValue({ - ExpDate: date, - }); - setSelectedRowRecord((prev) => ({ ...prev, ExpDate: formattedDate })); - }; - - const handleBatchRefChange = (e) => { - const value = parseInt(e?.target?.value); - if (!/^\d*\.?\d*$/.test(value)) { - return; - } - productAddInfoRef?.current?.setFieldsValue({ - BatchRef: value, - }); - setSelectedRowRecord((prev) => ({ ...prev, BatchRef: value })); - }; - - const handleModelNoChange = (e) => { - const value = parseInt(e?.target?.value); - if (!/^\d*\.?\d*$/.test(value)) { - return; - } - productAddInfoRef?.current?.setFieldsValue({ - ModelNumber: value, - }); - setSelectedRowRecord((prev) => ({ ...prev, ModelNumber: value })); - }; - - const handleAddtnlDtlsSubmit = async (values) => { - if ( - selectedRowIndex == null || - !Array.isArray(PurchaseData) || - selectedRowIndex >= PurchaseData.length - ) { - return; - } - - const newData = { ...selectedRowRecord, ...values }; - - const updatedData = PurchaseData.map((item, index) => - index === selectedRowIndex ? newData : item - ); - console.log(updatedData, 'updatedData'); - setPurchaseData(updatedData); - await handleAdditionalInfoClose(); - }; - - const handleAdditionalInfoClose = async () => { - setAdditionalInfoModal(false); - setSelectedRowIndex(null); - setSelectedRowRecord({}); - await productAddInfoRef?.current?.resetFields(); - }; - - const handleModelDataOpen = () => { + const handleModelDataOpen = (selectedRowRecord) => { const acceptedQty = parseInt(selectedRowRecord?.AcceptedQty) || 0; const productIdentifiers = selectedRowRecord?.ProductIdentifierDtls || []; @@ -3238,6 +3623,7 @@ const StockForm = ({ formType }) => { }; const handleModelDataSumbitOrClose = () => { + setimeiSerialOpen(false); const productIdentifierDtls = dataSource ?.filter( @@ -3249,12 +3635,42 @@ const StockForm = ({ formType }) => { IMEI2: item.imei2 || '', MacId: item.Macid || '', })); - setSelectedRowRecord((prev) => ({ - ...prev, - ProductIdentifierDtls: productIdentifierDtls, - })); - }; + const newData = PurchaseData.map((item, index) => + index === selectedRowIndex ? { ...item, ProductIdentifierDtls: productIdentifierDtls } : item + ); + setPurchaseData(newData); + }; + const handleFieldSetupSubmit = async () => { + + const postData = { + "AppId": AppId, + "CompId": CompId, + "BranchId": BranchId, + "Type": "PE", + "FormType": "Purchase Entry", + "TypeId": categoryId, + "ConfigDtl": selectedFields?.map((field) => ({ + "ConfigId": field, + "Access": 'Y', + })), + "CreatedBy": UserId + } + + const response = await dispatch(postFieldSetup(postData))?.unwrap(); + + if (response?.data?.statusCode === 1) { + setSelectedAdditionalColumn([...tempSelectedColumns]); + setShowColumnModal(false); + setTempSelectedColumns([]) + setMessageType("success"); + setMessageData(response?.data?.response); + await getFieldSetup(); + } else { + setMessageType("error"); + setMessageData("Failed to set up fields"); + } + } const handleModalSubmited = () => { setIsModalOpen(false); }; @@ -3362,7 +3778,7 @@ const StockForm = ({ formType }) => {
)}
-
+
{
-
+

Supplier Details

@@ -3511,19 +3927,19 @@ const StockForm = ({ formType }) => { options={ SupplierData ? SupplierData.filter( - (obj, index, self) => - index === - self.findIndex( - (t) => t.SuppId === obj.SuppId - ) // remove dup SuppId - ).map((option) => ({ - key: `${option.SuppId}-${option.Type}`, // 👈 unique key - value: option.SuppId, - label: - option.Type === 'Branch' - ? `${option.SuppName} (${option.Type}) [${option.SuppId}]` - : `${option.SuppName} (${option.Type})`, - })) + (obj, index, self) => + index === + self.findIndex( + (t) => t.SuppId === obj.SuppId + ) // remove dup SuppId + ).map((option) => ({ + key: `${option.SuppId}-${option.Type}`, // 👈 unique key + value: option.SuppId, + label: + option.Type === 'Branch' + ? `${option.SuppName} (${option.Type}) [${option.SuppId}]` + : `${option.SuppName} (${option.Type})`, + })) : [] } label={} @@ -3682,88 +4098,88 @@ const StockForm = ({ formType }) => { item.ConfigId === SelectedPurchaseType && item.ConfigName === 'Cash' ) && ( - <> - - ({ - value: mode.ModeId, - label: mode.ModeName, - }))} - label={ - - } - className="field-DropDown" - onChangeFunction={handlePaymentModeChange} - valueData={selectedPaymentMode} - /> - - { - if ( - value === undefined || - value === null || - value === '' - ) { - return Promise.resolve(); - } - if (Number(value) === 0) { - return Promise.reject( - 'Payment Amount cannot be 0' - ); - } - if ( - isNaN(value) || - Number(value) < 0 - ) { - return Promise.reject( - 'Payment Amount cannot be less than 0' - ); - } - return Promise.resolve(); + <> + - - Payment Amount - - } - inputMode="decimal" - disable={!payAmountDisable} - isOnChange={paymentAmount ? true : false} - min={0} - type="number" - value={paymentAmount} - onChange={(e) => { - formRef?.current?.setFieldsValue({ - PaymentAmount: e?.target?.value, - }); - setPaymentAmount(e?.target?.value); - }} - /> - - - )} + ]} + > + ({ + value: mode.ModeId, + label: mode.ModeName, + }))} + label={ + + } + className="field-DropDown" + onChangeFunction={handlePaymentModeChange} + valueData={selectedPaymentMode} + /> + + { + if ( + value === undefined || + value === null || + value === '' + ) { + return Promise.resolve(); + } + if (Number(value) === 0) { + return Promise.reject( + 'Payment Amount cannot be 0' + ); + } + if ( + isNaN(value) || + Number(value) < 0 + ) { + return Promise.reject( + 'Payment Amount cannot be less than 0' + ); + } + return Promise.resolve(); + }, + }, + ]} + > + + Payment Amount + + } + inputMode="decimal" + disable={!payAmountDisable} + isOnChange={paymentAmount ? true : false} + min={0} + type="number" + value={paymentAmount} + onChange={(e) => { + formRef?.current?.setFieldsValue({ + PaymentAmount: e?.target?.value, + }); + setPaymentAmount(e?.target?.value); + }} + /> + + + )}
@@ -3791,8 +4207,9 @@ const StockForm = ({ formType }) => { className="field-DropDown" value={selectedProductName} filterOption={(input, option) => { + const [prodId, variantName] = option.value.split('_'); const product = productData.find( - (p) => p.ProdId === option.value + (p) => p.ProdId === prodId && (p.ProdVariantName || 'Variant1') === variantName ); const nameMatch = option.label ?.toLowerCase() @@ -3805,14 +4222,19 @@ const StockForm = ({ formType }) => { options={ !scanner ? productData?.map((option) => ({ - value: option.ProdId, - label: `${option.ProdName} (${option.Size} ${option.UomName})${option?.BrandName ? ` - ${option?.BrandName}` : ''}`, - })) + + value: `${option.ProdId}_${option.ProdVariantName}`, + label: `${option.ProdName} (${option.Size} ${option.UomName})${option?.BrandName ? ` - ${option?.BrandName}` : ''} - ${option.ProdVariantName}`, + + })) : [] } onSelect={async (value, option) => { + const [prodId, variantName] = value.split('_'); + const product = productData.find(p => p.ProdId === prodId && (p.ProdVariantName) === variantName); const newProduct = await ProductDropDownChange( - value, + product?.ProdVariantName, + prodId, option ); if (newProduct) { @@ -3851,22 +4273,59 @@ const StockForm = ({ formType }) => { />
- {/* - - */} + - setIsModalOpen(true)} /> + setIsModalOpen(true)} size={18} /> + + + + + {isModalOpen && ( { onMappingAdded={handleModalSubmited} /> )} - {Variants?.length > 1 && ( - - ({ - value: option.ProdIdProdName, - label: option.ProdVariantName, - }))} - label={'Variant Name'} - className="field-DropDown" - onChangeFunction={(e) => - ProductVariantDropDownChange(e) - } - valueData={selectedProductVariantData} - disabled={editstate?.ProdId ? true : false} - /> - {/* - + +
{ + setTempSelectedColumns([...selectedAdditionalColumn]); + setShowColumnModal(true); + }}> + + - */} - - )} + +
+
+ } + onChange={(e) => { + const value = e.target.value.toLowerCase(); + setSearchValue(value); + }} + style={{ width: '300px' }} + /> +
+
+ +
{ maxwidth: '500px', overflowX: 'auto', scrollbarWidth: 'thin', + maxHeight: "50vh" }} > -
+ {/* 0 ? filteredPurchaseData : PurchaseData} columns={columns} rowClassName="editable-row" onRow={(record, index) => ({ @@ -3932,48 +4398,75 @@ const StockForm = ({ formType }) => { }, })} pagination={false} + /> */} + +
({ + onClick: () => { + edit(record); + }, + })} + pagination={false} + locale={{ + emptyText: isSearching ? 'No matching products found' : 'No data', + }} /> + - {PurchaseData?.length > 0 && ( -
-
- -
- {PurchaseData.reduce( - (acc, data) => acc + data?.Amount, - 0 - )?.toFixed(2)} -
-
- {!orderType && ( -
- -
- )} -
- )} + -
- } - /> -
+ + + {PurchaseData?.length > 0 && ( +
+
+ +
+ {PurchaseData.reduce( + (acc, data) => acc + data?.Amount, + 0 + )?.toFixed(2)} +
+
+ {!orderType && ( +
+ +
+ )} +
+ )} + + } + /> + + { autoComplete="off" label="GST No" autocapitalize="on" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> @@ -4101,10 +4594,10 @@ const StockForm = ({ formType }) => { // isOnChange={formType == 'edit' ? true : false} inputMode="numeric" onInput={(e) => - (e.target.value = e.target.value.replace( - /[^0-9]/g, - '' - )) + (e.target.value = e.target.value.replace( + /[^0-9]/g, + '' + )) } /> @@ -4116,7 +4609,7 @@ const StockForm = ({ formType }) => { MailId} autocomplete="off" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> @@ -4143,7 +4636,7 @@ const StockForm = ({ formType }) => { Point of Contact} autocomplete="off" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> @@ -4165,7 +4658,7 @@ const StockForm = ({ formType }) => { label={} autocomplete="off" maxLength="10" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> @@ -4176,7 +4669,7 @@ const StockForm = ({ formType }) => { POC MailId} autocomplete="off" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> @@ -4459,18 +4952,18 @@ const StockForm = ({ formType }) => { Sales Price} - // isOnChange={(editstate?.SellPrice || QrcodeExistsData?.[0]?.SellPrice)? true : false} + // isOnChange={(editstate?.SellPrice || QrcodeExistsData?.[0]?.SellPrice)? true : false} /> ({ @@ -4530,7 +5023,7 @@ const StockForm = ({ formType }) => { // isOnchanges={(editstate?.Brand || SelectedBrand)?true:false} onChangeFunction={handleBrandDropDownChange} valueData={SelectedBrand} - // disabled={editstate?.Brand ? true : false} + // disabled={editstate?.Brand ? true : false} /> { onSelectFuntion={(e) => openAmountPerPieceAvailable(e) } - // disabled={editstate?.QRCode ? true : false} + // disabled={editstate?.QRCode ? true : false} /> {(QrcodeAuto == 'N' || editstate?.QRCode) && ( @@ -4669,38 +5162,38 @@ const StockForm = ({ formType }) => { {(QrcodeAutoSingle == 'N' || editstate?.OnePcQR) && ( -
- - { - await validateSafeInput(value); // To block HTML tags & SQL keywords - return Promise.resolve(); +
+ + { + await validateSafeInput(value); // To block HTML tags & SQL keywords + return Promise.resolve(); + }, }, - }, - ]} - > - + - {QrcodeSingleExistsVal && - QrcodeSingleExistsVal} - -
- )} + /> + {QrcodeSingleExistsVal && + QrcodeSingleExistsVal} +
+
+ )} )} @@ -4725,7 +5218,7 @@ const StockForm = ({ formType }) => {
)} @@ -5185,9 +5678,10 @@ const StockForm = ({ formType }) => { title="IMEI /Serial Number / Mac Id" open={imeiSerialOpen} footer={true} + width={600} buttonText="Submit" children={ -
+
'editable-row'} @@ -5201,365 +5695,51 @@ const StockForm = ({ formType }) => { handleSubmit={handleModelDataSumbitOrClose} handleCancel={handleModelDataSumbitOrClose} > + -

{`${selectedRowRecord?.ProdName} (${selectedRowRecord?.ProdVariantName})`}

-
-
- - - - - { - let cleanedValue = e.target.value.replace( - /[^0-9.]/g, - '' - ); - const parts = cleanedValue.split('.'); - - if (cleanedValue.startsWith('.')) { - cleanedValue = '0' + cleanedValue; - } - - e.target.value = - parts.length > 2 - ? `${parts[0]}.${parts.slice(1).join('')}` - : cleanedValue; - }} - /> - - - - - { - if ( - value === undefined || - value === null || - value === '' - ) { - return Promise.resolve(); - } - - if (!/^[0-9]\d*(\.\d+)?$/.test(value)) { - return Promise.reject( - 'Please enter a valid FreeQty' - ); - } - - if (value.toString().length > 10) { - return Promise.reject( - 'FreeQty cannot exceed more than 10 characters' - ); - } - - return Promise.resolve(); - }, - }, - ]} - > - - -
- { - if (value === undefined || value === '') - return Promise.resolve(); - - if (value.length > 30) { - return Promise.reject( - 'HSN cannot exceed 30 characters' - ); - } - - return Promise.resolve(); - }, - }, - ]} - > - { + setShowColumnModal(false); + setSelectedFields([...selectedAdditionalColumn.map(col => + tableFieldPreferences?.find(pref => pref.label === col)?.value + ).filter(Boolean)]); + setTempSelectedColumns([...selectedAdditionalColumn]); + }} + > +
+ {tableFieldPreferences?.map((option) => ( +
+ +
+ ))} +
+
+ setExtractorModalVisible(false)} From caf182a863c54d9325648059a46d2b13b3e42776 Mon Sep 17 00:00:00 2001 From: Tamilselvan Date: Fri, 30 Jan 2026 19:10:12 +0530 Subject: [PATCH 03/20] i have just changed Ui and Functinalityy --- src/Features/StockMaster/StockMaster.js | 2 +- src/Styles/Stock/StockMaster.scss | 98 ++++++++++++++++++++----- 2 files changed, 79 insertions(+), 21 deletions(-) diff --git a/src/Features/StockMaster/StockMaster.js b/src/Features/StockMaster/StockMaster.js index dcb8387..1724919 100644 --- a/src/Features/StockMaster/StockMaster.js +++ b/src/Features/StockMaster/StockMaster.js @@ -31,7 +31,7 @@ export const getInvoiceImageData = createAsyncThunk( formData.append("file", file); // 👈 actual file here const response = await axiosRetailOcrData.post( - "/invoiceupload", + "/invoice", formData, { headers: { diff --git a/src/Styles/Stock/StockMaster.scss b/src/Styles/Stock/StockMaster.scss index f04cd93..8274819 100644 --- a/src/Styles/Stock/StockMaster.scss +++ b/src/Styles/Stock/StockMaster.scss @@ -36,13 +36,14 @@ } .Product-table { + table { border-spacing: unset; } } .Product-table .ant-input { - width: 5rem !important; + width: 4rem !important; } .Product-table .ant-picker { @@ -87,7 +88,7 @@ width: 180px !important; } - > div:nth-child(2) { + >div:nth-child(2) { p { display: none !important; } @@ -145,7 +146,7 @@ max-width: 130px !important; } - > td:nth-child(3) { + >td:nth-child(3) { .ant-input { width: max-content !important; max-width: 70px !important; @@ -153,7 +154,7 @@ } } - > td:nth-child(5) { + >td:nth-child(5) { .ant-input { width: max-content !important; max-width: 100px !important; @@ -202,6 +203,8 @@ flex-direction: row; gap: 1.5rem; padding-top: 0.5rem; + justify-content: space-between; + width: 100%; & .field-DropDown { width: 200px !important; @@ -299,8 +302,8 @@ } } -.inputForm .ant-table-content { - width: 70vw; +.inputFormSTOCKFORM .ant-table-content { + width: 100% !important; } .pe-inward-date { @@ -322,24 +325,22 @@ } .purchase-status { - > div:nth-child(1) { + >div:nth-child(1) { display: flex; align-items: center; gap: 10px; - > p { + >p { padding-bottom: 0 !important; } } } .purchase-status-data { - margin-top: 10px; display: flex; align-items: center; gap: 30px; justify-content: flex-end; - padding: 1rem 3rem; width: 100%; } @@ -447,7 +448,7 @@ .invoice-date { .ant-form-item-control-input-content { - > label { + >label { font-family: 'Poppins'; font-weight: 500; } @@ -473,7 +474,7 @@ gap: 1rem; margin-bottom: 10px; - > button { + >button { font-family: 'Poppins'; background-color: #ef4444; color: #fff; @@ -481,8 +482,8 @@ align-items: center; .ant-btn-icon { - > span { - > svg { + >span { + >svg { width: 13px; height: 13px; } @@ -516,6 +517,8 @@ } .stockformTabele { + width: 80vw; + .float-label, .ant-select { width: 60px !important; @@ -563,9 +566,7 @@ width: 100%; } - .inputForm .ant-table-content { - width: 100vw; - } + .stock-input { // width: 100vw; @@ -607,13 +608,12 @@ width: 100%; } - .inputForm .ant-table-content { - width: 100vw; - } + .stock-input { width: 100vw; } + .tipsForUpload { ul li { font-size: 10px !important; @@ -689,14 +689,17 @@ top: 0; opacity: 1; } + 50% { opacity: 0.8; } + 100% { top: calc(100% - 3px); opacity: 1; } } + .preview-text-data { display: flex; flex-direction: column; @@ -724,6 +727,7 @@ font-weight: 500; } } + .loading-overlay { position: absolute; top: 0; @@ -761,12 +765,66 @@ 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } } + .purchase-receipt-table { .ant-input { padding-top: 6px !important; } + + .ant-table-cell { + padding: 5px !important; + } } + + +.addallProductTBN { + border: none; + outline: none; + padding: 8px 16px; + width: max-content; + font-family: "Poppins"; + font-weight: 500; + font-size: 14px; + cursor: pointer; + background-color: #1292ee; + height: max-content; + color: #fff; + border-radius: 4px; +} + +.productSearchRecipt { + display: flex; + align-items: center; + flex-wrap: nowrap; + flex-direction: row-reverse; + gap: 1rem; + + .ant-input-affix-wrapper { + width: 250px !important; + } + + .ant-input { + padding: 3px 14px 6px 11px !important; + } +} + +.finalSubmitPRBTN { + display: flex; + align-items: center; + justify-content: flex-end; + gap: 1rem; + margin-top: 1rem; +} + +.imeiSNTable { + + .ant-input { + padding: 4px 4px !important; + text-align: center; + } +} \ No newline at end of file From 1f914f9c8f33a49956a2cf860e7f5f2943dae926 Mon Sep 17 00:00:00 2001 From: Tamilselvan Date: Mon, 2 Feb 2026 10:22:04 +0530 Subject: [PATCH 04/20] chnaged --- .../BookingFunctionality/CustomerOrders.jsx | 774 +++++++++++------- 1 file changed, 458 insertions(+), 316 deletions(-) diff --git a/src/Pages/BookingScreen/Components/BookingFunctionality/CustomerOrders.jsx b/src/Pages/BookingScreen/Components/BookingFunctionality/CustomerOrders.jsx index b926437..795b359 100644 --- a/src/Pages/BookingScreen/Components/BookingFunctionality/CustomerOrders.jsx +++ b/src/Pages/BookingScreen/Components/BookingFunctionality/CustomerOrders.jsx @@ -1,339 +1,481 @@ -import { useDispatch } from "react-redux"; -import { changeOrderCardDetails, CustomerOrderList, getProductsearch } from "../../../../Features/BookingScreen/BookingData/BookingData"; -import { useEffect, useState } from "react"; -import { ExtractDateFormate, getSession } from "../../../../Services/Others"; -import { Tables } from "../../../../Components/Tables/Table"; -import { IoEye } from "react-icons/io5"; -import { DatePicker, Modal } from "antd"; -import dayjs from "dayjs"; +import { useDispatch } from 'react-redux'; +import { + changeOrderCardDetails, + CustomerOrderList, + getProductsearch, + getStockDetailsByVariantName, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; +import { useEffect, useState } from 'react'; +import { ExtractDateFormate, getSession } from '../../../../Services/Others'; +import { Tables } from '../../../../Components/Tables/Table'; +import { IoEye } from 'react-icons/io5'; +import { DatePicker, Modal } from 'antd'; +import dayjs from 'dayjs'; import { v4 as uuidv4 } from 'uuid'; - +import { Buttons, DefaultModal } from '../../../../../ownLib/my-ui-lib'; +import { ArrowRightOutlined } from '@ant-design/icons'; const CustomerOrders = ({ CustomerDetails, close }) => { + const CompId = getSession('CompId'); + const BranchId = getSession('BranchId'); + const AppId = getSession('AppId'); + const { RangePicker } = DatePicker; + const dispatch = useDispatch(); + const [custpmerOrderData, setCustpmerOrderData] = useState(); + console.log(CustomerDetails, 'CustomerDetails'); - const CompId = getSession('CompId'); - const BranchId = getSession('BranchId'); - const AppId = getSession('AppId'); - const { RangePicker } = DatePicker; - const dispatch = useDispatch(); - const [custpmerOrderData, setCustpmerOrderData] = useState(); - console.log(CustomerDetails, 'CustomerDetails'); + const [page, setpage] = useState(1); + const [selectedProducts, setSelectedProducts] = useState(); + const [productModal, setProductModal] = useState(false); + const [selectedRange, setSelectedRange] = useState([dayjs(), dayjs()]); + const [stockDetailModel, setStockDetailModel] = useState(false); + const [StockDetails, setStockDetails] = useState([]); + console.log(StockDetails, 'StockDetails'); + useEffect(() => { + if (selectedRange && selectedRange[0] && selectedRange[1]) { + customerFetch(); + } + }, [selectedRange]); - const [page, setpage] = useState(1); - const [selectedProducts, setSelectedProducts] = useState(); - const [productModal, setProductModal] = useState(false); - const [selectedRange, setSelectedRange] = useState([dayjs(), dayjs()]); + const getApiRange = () => { + if (!selectedRange || !selectedRange[0] || !selectedRange[1]) + return { fromDate: '', toDate: '' }; - useEffect(() => { - setSelectedRange([dayjs(), dayjs()]); - customerFetch(); - }, []); - - useEffect(() => { - if (selectedRange && selectedRange[0] && selectedRange[1]) { - customerFetch(); - } - }, [selectedRange]); - - const getApiRange = () => { - if (!selectedRange || !selectedRange[0] || !selectedRange[1]) return { fromDate: '', toDate: '' }; - - return { - fromDate: selectedRange[0].format('YYYY-MM-DD'), - toDate: selectedRange[1].format('YYYY-MM-DD'), - }; + return { + fromDate: selectedRange[0].format('YYYY-MM-DD'), + toDate: selectedRange[1].format('YYYY-MM-DD'), }; + }; - const customerFetch = async () => { - const { fromDate, toDate } = getApiRange(); - const data = { - AppId: AppId, - BranchId: BranchId, - CompId: CompId, - MobileNo: CustomerDetails?.value, - FromDate: fromDate, - ToDate: toDate, - } - const response = await dispatch(CustomerOrderList(data)).unwrap(); - if (response?.data?.statusCode === 1) { - setCustpmerOrderData(response?.data?.data) - } - else { - setCustpmerOrderData() - } + const customerFetch = async () => { + const { fromDate, toDate } = getApiRange(); + const data = { + AppId: AppId, + BranchId: BranchId, + CompId: CompId, + MobileNo: CustomerDetails?.value, + FromDate: fromDate, + ToDate: toDate, + }; + const response = await dispatch(CustomerOrderList(data)).unwrap(); + if (response?.data?.statusCode === 1) { + setCustpmerOrderData(response?.data?.data); + } else { + setCustpmerOrderData(); + } + }; + const ViewProductdetails = (products) => { + setSelectedProducts(products); + setProductModal(true); + }; + const handlePageChange = (current) => { + setpage(current); + }; + // const handleRowDataClick = (record) => { + // dispatch(changeOrderCardDetails(record?.productDetails)); + // close(); + // }; + + // const getProductsearchData = async (prodName) => { + // const data = { + // CompId, + // BranchId, + // AppId, + // ProdName: prodName + // } + // const response = await dispatch(getProductsearch(data)).unwrap(); + // console.log(response, 'response23232323'); + + // } + const getLastBuyQty = (index, variant, prodId) => { + const productDetails = custpmerOrderData?.[index]?.productDetails; + if (!productDetails) return 0; + + let SalesQty = 0; + for (let i = 0; i < productDetails.length; i++) { + const product = productDetails[i]; + if (product?.ProdId === prodId && product?.ProdVariantName === variant) { + SalesQty += product?.SalesQty; + } } + return SalesQty; + }; - const ViewProductdetails = (products) => { - setSelectedProducts(products); - setProductModal(true); - }; - const handlePageChange = (current) => { - setpage(current); - }; - // const handleRowDataClick = (record) => { - // dispatch(changeOrderCardDetails(record?.productDetails)); - // close(); - // }; - - - - const getProductsearchData = async (prodName) => { - const data = { - CompId, - BranchId, - AppId, - ProdName: prodName - } - const response = await dispatch(getProductsearch(data)).unwrap(); - console.log(response, 'response23232323'); - + const getStockAllocation = (StockDtls, Qty) => { + let AllocatedData = []; + let RemainngQty = Qty; + for (let i = 0; i < StockDtls?.length; i++) { + const stock = StockDtls[i]; + if (RemainngQty <= 0) break; + if (stock?.BalanceQty > 0) { + const allocQty = Math.min(stock.BalanceQty, RemainngQty); + AllocatedData.push({ + InwardDtlId: stock.InwardDtlId, + AllocatedQty: allocQty, + MRP: stock?.MRP, + SellPrice: stock?.SellPrice, + InwardId: stock?.InwardId, + BatchRef: stock?.BatchRef, + SuppId: stock?.SuppName, + SuppName: stock?.SuppName, + InwardDate: stock?.InwardDate, + }); + RemainngQty -= allocQty; + } } - const handleRowDataClick = (record) => { - if (!record?.productDetails?.length) return; - const prodName = record.productDetails[0]?.ProdName; - getProductsearchData(prodName); - - console.log(record.productDetails[0]?.ProdName, 'record?.productDetails'); - - const formattedData = record.productDetails.map((prod) => ({ - ProdCat: prod.ProdCat, - Type: prod.Type, - - OverallQuantity: prod.OverallQuantity ?? 0, - ActiveStatus: record.ActiveStatus, - - AvailableFrom: prod.AvailableFrom, - AvailableTo: prod.AvailableTo, - - Cess: prod.Cess ?? 0, - HSNCode: prod.HSN ?? null, - - BrandName: prod.BrandName ?? null, - OpeningQty: prod.OpeningQty ?? 0, - PartNumber: prod.PartNumber ?? null, - - ProdId: prod.ProdId, - ProdLogo: prod.ProdLogo ?? null, - ProdName: prod.ProdName, - - QRCode: prod.QRCode ?? null, - QtyBasedPrice: prod.QtyBasedPrice ?? null, - Rack: prod.Rack ?? null, - Size: prod.Size, - - StockAvailable: prod.StockAvailable ?? null, - TokenAvailable: prod.TokenAvailable ?? null, - - TaxId: prod.ProdTaxId ?? null, - TaxPercentage: prod.ProdTaxPercentage ?? 0, - TaxName: prod.TaxName ?? null, - - UniqueId: prod.UniqueId ?? null, - UomName: prod.UomName, - - SinglePc: prod.SinglePc ?? null, - NoOfPcs: prod.NoOfPcs ?? 0, - - ProdVariantName: prod.ProdVariantName ?? null, - VariantAvailableFrom: prod.VariantAvailableFrom ?? null, - VariantAvailableTo: prod.VariantAvailableTo ?? null, - - BalanceQty: prod.BalanceQty ?? 0, - BatchRef: prod.BatchRef ?? null, - - FullProductIdentifierDtls: prod.ProductIdentifierDtls ?? [], - - InwardDate: prod.BookingDate ?? null, - InwardDtlId: prod.InwardDtlId ?? null, - InwardId: prod.InwardId ?? null, - - MRP: prod.MRP ?? 0, - OrderRate: prod.Rate ?? 0, - SellingPrice: prod.Rate ?? 0, - - SuppId: prod.SuppId ?? null, - SuppName: prod.SuppName ?? null, - - OverAllPcs: prod.OverAllPcs ?? 0, - Offer: prod.OfferAmt ?? 0, - - BookingTypeName: prod.BookingTypeName ?? null, - CounterName: prod.CounterName ?? null, - - DiscountLimitType: prod.DiscountLimitType ?? null, - DiscountLimit: prod.DiscountLimit ?? 0, - - BookedDate: prod.BookedDate ?? [], - BalanceBookedQty: prod.BalanceBookedQty ?? null, - - ScaleType: prod.ScaleType ?? "", - - localId: prod.localId ?? uuidv4(), - - OrderQty: prod.SalesQty ?? 0, - TotalAmt: prod.TotalAmt ?? 0, - TaxAmt: prod.TaxAmt ?? 0, - WithoutTaxRate: prod.WithoutTaxRate ?? 0, - })); - - dispatch(changeOrderCardDetails(formattedData)); - close(); + return AllocatedData; + }; + const handleRowDataClick = async (record, index) => { + if (!record?.productDetails?.length) return; + let products = record?.productDetails?.map((e) => ({ + prodId: e?.ProdId, + ProdVariantName: e?.ProdVariantName, + })); + let Data = { + products: products, }; + let Response = await dispatch(getStockDetailsByVariantName(Data)).unwrap(); + if (Response?.data?.statusCode == 1) { + const result = + Response?.data?.data?.flatMap((product) => + product?.ProductDetail?.flatMap((detail) => + detail?.ProdVariantDetails?.flatMap((variant) => { + const prevQty = getLastBuyQty( + index, + variant.ProdVariantName, + variant.ProdId + ); + const allocations = getStockAllocation( + variant?.StockDetails, + prevQty + ); - const columns = [ - { - title: 'Sl.No', - key: 'sno', - align: 'center', - render: (_, __, index) => (page - 1) * 10 + index + 1, - onCell: (record) => ({ - onClick: () => handleRowDataClick(record), - style: { cursor: 'pointer' }, - }), - }, - { - title: 'Sales Date', - dataIndex: 'SalesDate', - key: 'SalesDate', - align: 'center', - render: (text) => ExtractDateFormate(text), - onCell: (record) => ({ - onClick: () => handleRowDataClick(record), - style: { cursor: 'pointer' }, - }), - }, - { - title: 'Amount', - dataIndex: 'NetAmount', - key: 'NetAmount', - align: 'center', - onCell: (record) => ({ - onClick: () => handleRowDataClick(record), - style: { cursor: 'pointer' }, - }), - }, + const safeAllocations = + allocations?.length > 0 + ? allocations + : [ + { + InwardDtlId: variant?.StockDetails?.[0]?.InwardDtlId, + InwardId: variant?.StockDetails?.[0]?.InwardId, + InwardDate: variant?.StockDetails?.[0]?.InwardDate, + AllocatedQty: prevQty, + SellPrice: variant?.StockDetails?.[0]?.SellPrice ?? 0, + MRP: variant?.StockDetails?.[0]?.MRP ?? 0, + OrderRate: variant?.StockDetails?.[0]?.SellPrice ?? 0, + TotalAmt: + (prevQty ?? 0) * + (variant?.StockDetails?.[0]?.SellPrice ?? 0), + BatchRef: null, + SuppId: null, + SuppName: null, + }, + ]; - { - title: 'No of Products', - key: 'productCount', - align: 'center', - render: (_, record) => ( - { - e.stopPropagation(); // 👈 IMPORTANT - ViewProductdetails(record.productDetails); - }} - > - {record?.productDetails?.length || 0} - - ), - }, - ]; + return safeAllocations.map((allocation) => ({ + ...variant, - const productColumns = [ - { - title: 'Sl.No', - key: 'sno', - align: 'center', - render: (_, __, index) => index + 1, - }, - { - title: 'Product Name', - dataIndex: 'ProdName', - key: 'ProdName', - align: 'center', - render: (_, record) => - `${record?.ProdName || '-'}${record?.UomName ? ` ${record.Size + record.UomName}` : ''}`, - }, - { - title: 'Qty', - dataIndex: 'SalesQty', - key: 'SalesQty', - align: 'center', - render: (_, record) => - record?.SalesQty || '-', - }, - { - title: 'Variant', - key: 'ProdVariantName', - align: 'ProdVariantName', - render: (_, record) => - record?.ProdVariantName || '-', - }, - { - title: 'Rate', - key: 'Rate', - align: 'right', - render: (_, record) => - record?.Rate || 0, - }, - { - title: 'MRP', - key: 'MRP', - align: 'right', - render: (_, record) => - record?.MRP || 0, - }, - ]; + // ===== PRODUCT LEVEL ===== + ProdId: detail.ProdId, + ProdName: detail.ProdName, + ProdCat: product.ProdCat, + BrandName: detail.BrandName ?? null, - const disableFutureDates = (current) => { - return current && current > dayjs().endOf('day'); - }; - const onRangeChange = (dates) => { - setSelectedRange(dates); - }; - const getRangePickerValue = () => selectedRange || [dayjs(), dayjs()]; + // ===== VARIANT / STOCK ===== + PreviousPurchasedQty: prevQty, + available: + detail?.StockAvailable === 'N' + ? true + : (variant.OverAllQty ?? 0) >= prevQty, + InwardDtlId: allocation.InwardDtlId, + InwardId: allocation.InwardId, + OrderQty: allocation.AllocatedQty, + InwardDate: allocation.InwardDate, + TotalAmt: + (allocation.AllocatedQty ?? 0) * (allocation.SellPrice ?? 0), - return ( - <> -
-
-

Customer Name : {CustomerDetails?.CustName}

-

Customer Name : {CustomerDetails?.value}

-
-
- - -
+ BalanceQty: detail.BalanceQty ?? 0, + BatchRef: allocation.BatchRef, + + // ===== PRICE ===== + MRP: allocation.MRP ?? 0, + OrderRate: allocation.SellPrice ?? 0, + SellingPrice: allocation.SellPrice ?? 0, + + // ===== TAX ===== + TaxId: detail.TaxId ?? null, + TaxPercentage: detail.TaxPercentage ?? 0, + TaxAmt: detail.TaxAmt ?? 0, + TaxName: detail.TaxName, + WithoutTaxRate: detail.WithoutTaxRate ?? 0, + + // ===== OTHERS ===== + SinglePc: 'N', + Size: detail.Size, + StockAvailable: detail.StockAvailable, + PartNumber: detail.PartNumber, + SuppId: allocation.SuppId, + SuppName: allocation.SuppName, + QRCode: detail.QRCode, + QtyBasedPrice: detail.QtyBasedPrice, + HSNCode: detail.HSNCode ?? null, + Rack: detail.Rack ?? null, + + BookingTypeName: 'TakeAway', + ActiveStatus: 'A', + ModelNumber: null, + NoOfPcs: 0, + Offer: 0, + OpeningQty: 0, + FullProductIdentifierDtls: [], + CounterName: product.CounterName, + Type: 'P', + + // ===== META ===== + UniqueId: detail.UniqueId, + UomName: detail.UomName, + ScaleType: detail.ScaleType ?? '', + TokenAvailable: detail.TokenAvailable, + localId: uuidv4(), + })); + }) + ) + ) ?? []; + + setStockDetails(result); + setpage(1); + setStockDetailModel(true); + } + + // close(); + }; + + const handleSave = () => { + let Data = StockDetails?.filter((e) => e?.available == true)?.map( + ({ stockDetails, available, PreviousPurchasedQty, ...rest }) => rest + ); + dispatch(changeOrderCardDetails(Data)); + close(); + }; + const columns = [ + { + title: 'Sl.No', + key: 'sno', + align: 'center', + render: (_, __, index) => (page - 1) * 10 + index + 1, + onCell: (record, index) => ({ + onClick: () => handleRowDataClick(record, index), + style: { cursor: 'pointer' }, + }), + }, + { + title: 'Sales Date', + dataIndex: 'SalesDate', + key: 'SalesDate', + align: 'center', + render: (text) => ExtractDateFormate(text), + onCell: (record, index) => ({ + onClick: () => handleRowDataClick(record, index), + style: { cursor: 'pointer' }, + }), + }, + { + title: 'Amount', + dataIndex: 'NetAmount', + key: 'NetAmount', + align: 'center', + onCell: (record, index) => ({ + onClick: () => handleRowDataClick(record, index), + style: { cursor: 'pointer' }, + }), + }, + + { + title: 'No of Products', + key: 'productCount', + align: 'center', + render: (_, record) => ( + { + e.stopPropagation(); // 👈 IMPORTANT + ViewProductdetails(record.productDetails); + }} + > + {record?.productDetails?.length || 0} + + ), + }, + ]; + const stockcolumns = [ + { + title: 'Sl.No', + key: 'sno', + align: 'center', + render: (_, __, index) => (page - 1) * 10 + index + 1, + }, + { + title: 'Product', + key: 'ProdName', + dataIndex: 'ProdName', + align: 'center', + }, + { + title: 'Variant', + key: 'ProdVariantName', + dataIndex: 'ProdVariantName', + align: 'center', + }, + + { + title: 'Purchased Qty', + key: 'PreviousPurchasedQty', + dataIndex: 'PreviousPurchasedQty', + align: 'center', + }, + { + title: 'Total Qty', + key: 'OverAllQty', + dataIndex: 'OverAllQty', + align: 'center', + render: (value, record) => + record?.StockAvailable == 'N' ? '-' : record?.OverAllQty, + }, + + { + title: 'available', + key: 'available', + dataIndex: 'available', + align: 'center', + render: (value) => (value ? 'Yes' : 'No'), + }, + ]; + + const productColumns = [ + { + title: 'Sl.No', + key: 'sno', + align: 'center', + render: (_, __, index) => index + 1, + }, + { + title: 'Product Name', + dataIndex: 'ProdName', + key: 'ProdName', + align: 'center', + render: (_, record) => + `${record?.ProdName || '-'}${record?.UomName ? ` ${record.Size + record.UomName}` : ''}`, + }, + { + title: 'Qty', + dataIndex: 'SalesQty', + key: 'SalesQty', + align: 'center', + render: (_, record) => record?.SalesQty || '-', + }, + { + title: 'Variant', + key: 'ProdVariantName', + align: 'ProdVariantName', + render: (_, record) => record?.ProdVariantName || '-', + }, + { + title: 'Rate', + key: 'Rate', + align: 'right', + render: (_, record) => record?.Rate || 0, + }, + { + title: 'MRP', + key: 'MRP', + align: 'right', + render: (_, record) => record?.MRP || 0, + }, + ]; + + const disableFutureDates = (current) => { + return current && current > dayjs().endOf('day'); + }; + const onRangeChange = (dates) => { + setSelectedRange(dates); + }; + const getRangePickerValue = () => selectedRange || [dayjs(), dayjs()]; + + return ( + <> +
+
+

Customer Name : {CustomerDetails?.CustName}

+

Customer Name : {CustomerDetails?.value}

+
+
+ + +
+
+ +
+ {' '} + setProductModal(false)} + > + + +
+ + { + setStockDetailModel(false); + setStockDetails([]); + }} + footer={false} + width={700} + children={ +
+ {' '} +
+ } + handleSubmit={() => { + handleSave(); + }} + />
+
+ } + /> + + ); +}; -
- {' '} - - - setProductModal(false)} - > - - - -
- - ) -} - -export default CustomerOrders; \ No newline at end of file +export default CustomerOrders; From ecd0a2c814c599157e04e219d8c3a525b5d83d73 Mon Sep 17 00:00:00 2001 From: karthikalakshmi Date: Mon, 2 Feb 2026 11:25:31 +0530 Subject: [PATCH 05/20] Table settings insales page --- src/Features/ThemeChange/ThemeChange.js | 9 +- .../Components/BSCombo/BSC1Search.jsx | 4 + .../MainPage/SelectionComponent.jsx | 6 +- .../OtherConponents/Reprint/BSReprint.jsx | 6 +- .../UtillComponents/AllSalesPageSettings.jsx | 112 +- .../UtillComponents/AllSalesPageSettings.scss | 76 ++ .../UtillComponents/TableHeadersetting.jsx | 955 ++++++++++++++++++ .../Components/BSNavbar/BSNavbar3.scss | 50 +- 8 files changed, 1140 insertions(+), 78 deletions(-) create mode 100644 src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.scss create mode 100644 src/Pages/BookingScreen/Components/UtillComponents/TableHeadersetting.jsx diff --git a/src/Features/ThemeChange/ThemeChange.js b/src/Features/ThemeChange/ThemeChange.js index c097192..7cd788e 100644 --- a/src/Features/ThemeChange/ThemeChange.js +++ b/src/Features/ThemeChange/ThemeChange.js @@ -364,7 +364,14 @@ export const getPrintSelectionComponentData = createAsyncThunk( ); } ); - +export const getSalesTemplate = createAsyncThunk( + 'theme/getSalesTemplate', + async (Data) => { + return await axiosRetailInstanceData.get( + `${apiUrl}/ThemeMaster?compId=${Data.CompId}&branchId=${Data.BranchId}&appId=${Data.AppId}` + ); + } +); export const PricingAppPricingNameData = createAsyncThunk( 'theme/PricingAppPricingNameData', async (data) => { diff --git a/src/Pages/BookingScreen/Components/BSCombo/BSC1Search.jsx b/src/Pages/BookingScreen/Components/BSCombo/BSC1Search.jsx index 77aa16d..f968310 100644 --- a/src/Pages/BookingScreen/Components/BSCombo/BSC1Search.jsx +++ b/src/Pages/BookingScreen/Components/BSCombo/BSC1Search.jsx @@ -1942,6 +1942,8 @@ export default function BSC1Search(props) { ?.StockDetails?.[stockIndex]?.OnePcsPrice : a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] ?.StockDetails?.[stockIndex]?.MRP, + FullProductIdentifierDtls:a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] + ?.StockDetails?.[stockIndex]?.ProductIdentifierDtls, OrderRate: parseFloat(TotalOrderRate).toFixed(2), SellingPrice: parseFloat(TotalOrderRate).toFixed(2), SuppId: @@ -2071,6 +2073,8 @@ export default function BSC1Search(props) { Offer: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] ?.StockDetails?.[stockIndex]?.OfferPrice, + FullProductIdentifierDtls:a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] + ?.StockDetails?.[stockIndex]?.ProductIdentifierDtls, BookingTypeName: BookingType, CounterName: a?.CounterName, }; diff --git a/src/Pages/BookingScreen/Components/MainPage/SelectionComponent.jsx b/src/Pages/BookingScreen/Components/MainPage/SelectionComponent.jsx index 7097f3d..29dc690 100644 --- a/src/Pages/BookingScreen/Components/MainPage/SelectionComponent.jsx +++ b/src/Pages/BookingScreen/Components/MainPage/SelectionComponent.jsx @@ -2278,6 +2278,7 @@ const SelectionComponent = forwardRef((props, ref) => { }); }; const validateFontsTable = async (values) => { + console.log(values,"table font") const apiUrl = `https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyDP1HqNkLI53iIAH-SB9_mt_24QdkUZ_24`; fetch(apiUrl) .then((response) => response.json()) @@ -4982,7 +4983,9 @@ const SelectionComponent = forwardRef((props, ref) => { className="plusOutlinedIcon" /> - + { handleSubmit={TablehandleSubmit} buttonText="SAVE" /> -
{SelectedBillTableCheckValues?.filter( (item) => diff --git a/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx b/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx index 2a3abf5..f1294f6 100644 --- a/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx +++ b/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx @@ -1237,7 +1237,7 @@ function BSReprint() { CreatedDate={orderDetail?.CreatedDate} PaymentStatus={reprintData?.[0]?.OrderPaymentDtl} Preference={SettingDataSelector} - + printDatas={printDatas} /> ))} @@ -1370,7 +1370,7 @@ function BSReprint() { label: option.ConfigName, }))} label={ - + } className="field-DropDown-Emp" onChangeFunction={(e) => reprintReasonDropDownChange(e)} @@ -1565,6 +1565,7 @@ function BSReprint() { CreatedDate={orderDetail?.CreatedDate} PaymentStatus={reprintData?.[0]?.OrderPaymentDtl} Preference={SettingDataSelector} + printDatas={printDatas} /> ))} @@ -1626,6 +1627,7 @@ function BSReprint() { CreatedDate={orderDetail?.CreatedDate} PaymentStatus={reprintData?.[0]?.OrderPaymentDtl} Preference={SettingDataSelector} + printDatas={printDatas} /> ))} diff --git a/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.jsx b/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.jsx index a561fbc..6deaca4 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.jsx @@ -1,67 +1,83 @@ import { useState } from "react"; -import { IoMdSettings } from "react-icons/io"; +import { IoMdAdd, IoMdSettings } from "react-icons/io"; import { DefaultModal } from "../../../../Components/Modal/DefaultModal"; import TooltipWrapper from "../../../../Components/Tooltip/Tooltip"; +import "./AllSalesPageSettings.scss" +import TableHeadersetting from "./TableHeadersetting"; +import PaymentOptions from "../../../Payment/PaymentOptions/PaymentOptions"; + + + const AllSalesPageSettings = () => { - const [settingModal,setsettingModal] = useState(false) - const [checkboxItems, setCheckboxItems] = useState([ - { id: 'item1', label: 'Show Details', checked: true }, - { id: 'item2', label: 'Auto Refresh', checked: false }, - { id: 'item3', label: 'Notifications', checked: true } - ]) - console.log(settingModal,"settingModal") + const [settingModal, setsettingModal] = useState(false) + const [selectedComponent, setselectedComponent] = useState('Payment') + + const onclose = () => { setsettingModal(false) } - return ( + const ComponentSelect = (value) => { + setselectedComponent(value); + }; + return ( <> - -
setsettingModal(true)} - style={{ - cursor: 'pointer', - display: 'flex', - alignItems: 'center', - gap: '5px', - padding: '5px 10px', - borderRadius: '4px', - - fontSize: '14px', - }} - > - -
-
+ +
setsettingModal(true)} + style={{ + cursor: 'pointer', + display: 'flex', + alignItems: 'center', + gap: '5px', + padding: '5px 10px', + borderRadius: '4px', + fontSize: '14px', + }} + > + +
+
-
- {checkboxItems.map(item => ( -
- + title={"Settings"} + width={700} + > + +
+
+
ComponentSelect('Payment')} + > + Payment Option
- ))} +
ComponentSelect('Table')} + > + Table +
+
+ {selectedComponent == "Payment" && +
+ +
+ } + + { + selectedComponent === "Table" && + + } +
- - + + ) } diff --git a/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.scss b/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.scss new file mode 100644 index 0000000..25ef74c --- /dev/null +++ b/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.scss @@ -0,0 +1,76 @@ +/// Another swtich button style code + +.SettingsListSwitchBTN { + display: inline-flex; + gap: 16px; + font-family: "Poppins"; + margin-bottom: 12px; + border-bottom: 1px solid #d1d5db; +} + +.SettingsListSwitchBTN > div { + font-size: 22px; + font-weight: 600; + cursor: pointer; + color: #6b7280; + display: flex; + align-items: center; + gap: 6px; + position: relative; + border: none; + background: transparent; + font-family: "Gilroy"; + transition: color 0.2s ease; + @media (max-width: 600px) { + font-size: 18px; + } +} + +.SettingsListSwitchBTN > div:hover { + color: #0f172a; +} + +.SettingsSwitchBTN > div.selected { + color: #0f172a; +} + +.SettingsListSwitchBTN > div.selected::after { + content: ""; + position: absolute; + left: 0; + bottom: -1px; + width: 100%; + height: 2px; + background: #2c88ee; + border-radius: 2px; +} + +.SettingsListSwitchBTN > div.selected svg { + color: #4765db !important; +} + +// End +.settingsales-DropDown-Selection { + width: 150px !important; +} +.settingaddNewSalesFiledBTN { + background-color: #2563eb; + // background-color: #1292ee; + color: #fff !important; + width: max-content; + height: max-content; + padding: 4px 8px; + font-size: 13px; + font-weight: 400; + display: flex; + align-items: center; + gap: 4px; + cursor: pointer; + border-radius: 6px; + svg { + color: #fff !important; + font-weight: 500; + display: flex; + font-size: 16px; + } +} \ No newline at end of file diff --git a/src/Pages/BookingScreen/Components/UtillComponents/TableHeadersetting.jsx b/src/Pages/BookingScreen/Components/UtillComponents/TableHeadersetting.jsx new file mode 100644 index 0000000..2bf0876 --- /dev/null +++ b/src/Pages/BookingScreen/Components/UtillComponents/TableHeadersetting.jsx @@ -0,0 +1,955 @@ +import { Checkbox, Form, Modal, Row } from 'antd'; +import { DropDowns } from '../../../../Components/Forms/DropDown'; +import { InputField } from '../../../../Components/Forms/InputField'; +import { validateSafeInput } from '../../../../Services/Others'; +import { DefaultModal } from '../../../../Components/Modal/DefaultModal'; +import { CloseOutlined, ArrowRightOutlined } from '@ant-design/icons'; +import { IoMdAdd } from 'react-icons/io'; +import { useCallback, useEffect, useState } from 'react'; +import { SwatchesPicker } from 'react-color'; +import { RadioGrpButton } from '../../../../Components/Forms/RadioGroup'; +import { useSelector } from 'react-redux'; +import { + getSalesTemplate, + postColorData, + postTableFontData, + putSelectionComponentData, + StoredSessionData, +} from '../../../../Features/ThemeChange/ThemeChange'; +import { useDispatch } from 'react-redux'; +import Buttons from '../../../../Components/Forms/Buttons'; +import { Messages } from '../../../../Components/Notifications/Messages'; + +const TableHeadersetting = () => { + const dispatch = useDispatch(); + const SessionData = useSelector(StoredSessionData); + const AppId = SessionData?.AppId; + const CompId = SessionData?.CompId; + const BranchId = SessionData?.BranchId; + const UserId = SessionData?.UserId; + const UserType = SessionData?.UserType; + const [messageType, setMessageType] = useState(null); + const [messageData, setMessageData] = useState(null); + const [TemplateDetails, setTemplateDetails] = useState([]); + const [TableFontData, setTableFontData] = useState([ + { FontId: 1, SessionFont: 'Arial' }, + { FontId: 2, SessionFont: 'Roboto' }, + { FontId: 3, SessionFont: 'Open Sans' }, + { FontId: 4, SessionFont: 'Lato' }, + { FontId: 5, SessionFont: 'Montserrat' }, + ]); + const [selectedTableFont, setSelectedTableFont] = useState(); + console.log(selectedTableFont, 'selectedTableFontselectedTableFont'); + const [TableFontModelopen, setTableFontModelopen] = useState(false); + const [SelectedTableColor, setSelectedTableColor] = useState(null); + const [Tableform] = Form.useForm(); + const [billingSettings, setBillingSettings] = useState(); + console.log(billingSettings,"billingSettingsbillingSettings") + const [SelectedBillTableCheckValues, setSelectedBillTableCheckValues] = + useState([]); + const backgroundOptionId = billingSettings?.ComponentOptionsDetails?.find( + (item) => item?.OptionName === 'Background' + )?.OptionId; + + const hasBackground = + SelectedBillTableCheckValues?.includes(backgroundOptionId); + const OverallbackgroundOptionId = + billingSettings?.ComponentOptionsDetails?.find( + (item) => item?.OptionName === 'OverallBackground' + )?.OptionId; + + const hasOverallBackground = SelectedBillTableCheckValues?.includes( + OverallbackgroundOptionId + ); + console.log(billingSettings, 'billingSettingsbillingSettings'); + const [TableBackgroundColorData, setTableBackgroundColorData] = useState([ + { + ColorId: 4, + SessionId: 55, + OptionId: 108, + FontColor: '#000000', + BackgroundColor: '#f06292', + ThemeName: 'Theme 4', + ActiveStatus: 'A', + }, + { + ColorId: 14, + SessionId: 55, + OptionId: 108, + FontColor: '#000000', + BackgroundColor: '#52C41A', + ThemeName: 'Theme 14', + ActiveStatus: 'A', + }, + { + ColorId: 23, + SessionId: 55, + OptionId: 108, + FontColor: '#000000', + BackgroundColor: '#0d47a1', + ThemeName: 'Theme 23', + ActiveStatus: 'A', + }, + { + ColorId: 25, + SessionId: 55, + OptionId: 108, + FontColor: '#000000', + BackgroundColor: '#f8bbd0', + ThemeName: 'Theme 25', + ActiveStatus: 'A', + }, + { + ColorId: 29, + SessionId: 55, + OptionId: 108, + FontColor: '#000000', + BackgroundColor: '#ffcdd2', + ThemeName: 'Theme 29', + ActiveStatus: 'A', + }, + ]); + const [BillingOverallColorsList, setBillingOverallColorsList] = useState([ + { + ColorId: 9, + SessionId: 57, + OptionId: 204, + FontColor: '#000000', + BackgroundColor: '#bbdefb', + ThemeName: 'Theme 9', + ActiveStatus: 'A', + }, + { + ColorId: 19, + SessionId: 57, + OptionId: 204, + FontColor: '#000000', + BackgroundColor: '#d7ccc8', + ThemeName: 'Theme 19', + ActiveStatus: 'A', + }, + { + ColorId: 20, + SessionId: 57, + OptionId: 209, + FontColor: '#000000', + BackgroundColor: '#c5cae9', + ThemeName: 'Theme 20', + ActiveStatus: 'A', + }, + { + ColorId: 22, + SessionId: 57, + OptionId: 204, + FontColor: '#000000', + BackgroundColor: '#ffffff', + ThemeName: 'Theme 22', + ActiveStatus: 'A', + }, + { + ColorId: 30, + SessionId: 57, + OptionId: 209, + FontColor: '#000000', + BackgroundColor: '#3f51b5', + ThemeName: 'Theme 30', + ActiveStatus: 'A', + }, + { + ColorId: 66, + SessionId: 57, + OptionId: 205, + FontColor: '#000000', + BackgroundColor: '#d1c4e9', + ThemeName: 'Theme 65', + ActiveStatus: 'A', + }, + { + ColorId: 67, + SessionId: 57, + OptionId: 205, + FontColor: '#000000', + BackgroundColor: '#8bc34a', + ThemeName: 'Theme 66', + ActiveStatus: 'A', + }, + ]); + const [BillUploadColor, setBillUploadColor] = useState(false); + const [TableColorType, setTableColorType] = useState('Y'); + const [TablebackgroundColor, setTablebackgroundColor] = useState('#009b00'); + const [tableBGHex, setTableBGHex] = useState( + TablebackgroundColor?.replace('#', '').trim() + ); + const [TablefontColor, setTablefontColor] = useState('#000000'); + const [tableFontHex, setTableFontHex] = useState( + TablefontColor?.replace('#', '').trim() + ); + const [BillingUploadOverallColor, setBillingUploadOverallColor] = + useState(false); + const [BillingOverallColor, setBillingOverallColor] = useState('#000000'); + const [billingOverallHex, setBillingOverallHex] = useState( + BillingOverallColor?.replace('#', '').trim() + ); + const [selectOverallSelected, setSelectOverallSelected] = useState(true); + const [dropdownBillingOverallColor, setdropdownBillingOverallColor] = + useState(null); + const [FirstOnClick, setFirstOnClick] = useState(false); + + useEffect(() => { + GetTemplatedetails(); + }, []); + + const GetTemplatedetails = async () => { + let Data = { + CompId: CompId, + AppId: AppId, + BranchId: BranchId, + }; + const templateresponse = await dispatch(getSalesTemplate(Data)).unwrap(); + let AllDetails = templateresponse?.data?.data; + setTemplateDetails(AllDetails?.Templates); + let selectedBilling = AllDetails?.Templates?.[0]?.ComponentDetails?.find( + (item) => item?.SessionName === 'BookingBilling' + ); + let AllBillingdetails = AllDetails?.Components?.find( + (item) => item?.ComponentName === selectedBilling?.ComponentName + ); + console.log(AllDetails, AllDetails?.Templates, 'templateresponse'); + setBillingSettings(AllBillingdetails); + const optionIds = selectedBilling?.FieldDetails?.map( + (item) => item?.OptionId + ); + setSelectedBillTableCheckValues(optionIds); + let allcolordata = AllDetails?.Colors?.filter(item => item.SessionId === selectedBilling?.SessionId) + let Allfontdata = AllDetails?.Fonts?.filter(item => item.SessionId === selectedBilling?.SessionId) + setTableFontData(Allfontdata) + let selectedFont = AllDetails?.Templates?.[0]?.FontDetail?.find(item=>item?.SessionId === selectedBilling?.SessionId) + + setSelectedTableFont(selectedFont?.FontId) + // setTableBackgroundColorData + console.log(Allfontdata, 'All table colors'); + // BookingBilling templateData?.['BookingBilling']?.[0] + }; + + const BillTableSelectlistonChange = (checkedValues) => { + setSelectedBillTableCheckValues(checkedValues); + }; + const handleChange = (itemId, checked) => { + setBillingSettings((prev) => + prev.map((item) => (item.id === itemId ? { ...item, checked } : item)) + ); + }; + const selectFont3 = (value) => { + setSelectedTableFont(value); + }; + const TablehandleUploadFonts = () => { + setTableFontModelopen(true); + }; + const TablehandleCancel = () => { + setTableFontModelopen(false); + Tableform.resetFields(); + }; + const selectTableColor = async (value) => { + await setSelectedTableColor(value); + formRef.current?.setFieldsValue({ TableColor: value }); + }; + const BillhandleUploadColor = () => { + setBillUploadColor(true); + }; + const handleColorChange4 = (color, event) => { + if (TableColorType == 'Y') { + setTablebackgroundColor(color['hex']); + setTableBGHex(color?.hex?.replace('#', '').trim()); + } + if (TableColorType == 'N') { + setTablefontColor(color['hex']); + setTableFontHex(color?.hex?.replace('#', '').trim()); + } + }; + + const handleBackgroundColorSubmit= async () => { + if (TablebackgroundColor !== TablefontColor) { + let response; + try { + let postData = { + BackgroundColor: TablebackgroundColor, + FontColor: TablefontColor, + CreatedBy: UserId, + SessionId: billingSettings?.SessionId, + OptionId: backgroundOptionId, + }; + response = await dispatch(postColorData(postData)).unwrap(); + } catch (err) { + if (err['message'] == 'Request failed with status code 422') { + response = { + data: { + statusCode: 0, + response: 'Color Not Added', + data: [], + }, + }; + } + } + if (response?.data?.statusCode == 1) { + if (response?.data?.response == 'Color Already Exists') { + setMessageType('warning'); + setMessageData(response?.data?.response); + } else { + setMessageType('success'); + setMessageData(response?.data?.response); + // BillsetUploadColor(false); + } + + } else { + setMessageData(response?.data?.response); + setMessageType('error'); + } + } else { + setMessageData('Please select different color for background and font'); + setMessageType('warning'); + } + }; + const TableonCancel4 = () => { + setBillUploadColor(false); + }; + const handleTableHexChange = (e) => { + if (TableColorType?.toLowerCase() === 'y') { + setTableBGHex(e?.target?.value); + if (e?.target?.value === '' || !isHexColor(`#${e.target.value}`)) { + e.target.value = '009b00'; + } + setTablebackgroundColor(`#${e.target.value}`); + } + if (TableColorType?.toLowerCase() === 'n') { + setTableFontHex(e?.target?.value); + if (e?.target?.value === '' || !isHexColor(`#${e.target.value}`)) { + e.target.value = '000000'; + } + setTablefontColor(`#${e.target.value}`); + } + }; + const handleBillingOverallHexCode = (e) => { + setBillingOverallHex(e?.target?.value); + if (e?.target?.value === '' || !isHexColor(`#${e.target.value}`)) { + e.target.value = '000000'; + } + setBillingOverallColor(`#${e.target.value}`); + }; + const handleBillingOverallColorChange = (color, event) => { + setBillingOverallColor(color['hex']); + setBillingOverallHex(color?.hex?.replace('#', '').trim()); + }; + const handleBillingOverallColorSubmit = async () => { + let response; + + // try { + // let postData = { + // BackgroundColor: BillingOverallColor, + // FontColor: '#000000', + // CreatedBy: getSession('UserId'), + // SessionId: BillingTableData[0]?.SessionId, + // OptionId: BillTableCheckList[0]?.ComponentOptionsDetails?.filter( + // (item) => item.OptionName == 'OverallBackground' + // )?.[0]?.OptionId, + // }; + // response = await dispatch(postColorData(postData)).unwrap(); + // } catch (err) { + // if (err['message'] == 'Request failed with status code 422') { + // response = { + // data: { + // statusCode: 0, + // response: 'Color Not Added', + // data: [], + // }, + // }; + // } + // } + // if (response?.data?.statusCode == 1) { + // if (response?.data?.response == 'Color Already Exists') { + // setMessageType('warning'); + // setMessageData(response?.data?.response); + // } else { + // setMessageType('success'); + // setMessageData(response?.data?.response); + // setBillingUploadOverallColor(false); + // } + // let OverallBillingdata = { + // SessionID: BillingTableData[0]?.SessionId, + // OptionName: 'OverallBackground', + // }; + // dispatch(getBillingOverallBackgroundColors(OverallBillingdata)).unwrap; + // } else { + // setMessageData(response?.data?.response); + // setMessageType('error'); + // } + }; + const selectBillingOverallColor = async (value) => { + await setdropdownBillingOverallColor(value); + formRef.current?.setFieldsValue({ BillingOverallColor: value }); + let billOverallColorVal = BillingOverallColorsList?.filter( + (data) => data?.ColorId === value + ); + }; + const openColour4 = (value) => { + setTableColorType(value); + }; + const handleBillingUploadOverallColor = () => { + setBillingUploadOverallColor(true); + }; + + const TablehandleSubmit = async () => { + const values = await Tableform.validateFields(); + validateFontsTable(values); + }; + const validateFontsTable = async (values) => { + console.log(values,"valuesvalues") + const apiUrl = `https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyDP1HqNkLI53iIAH-SB9_mt_24QdkUZ_24`; + fetch(apiUrl) + .then((response) => response.json()) + .then(async (data) => { + const fontNames = data?.items?.map((item) => item.family); + + if (fontNames.includes(formatFontName(values['TableFont']))) { + let response; + try { + + let postData = { + SessionFont: formatFontName(values['TableFont']), + CreatedBy: UserId, + SessionId: billingSettings?.SessionId, + }; + response = await dispatch(postTableFontData(postData)).unwrap(); + } catch (err) { + if (err['message'] == 'Request failed with status code 422') { + response = { + data: { + statusCode: 0, + response: 'Font Not Added', + data: [], + }, + }; + } + } + if (response?.data?.statusCode == 1) { + setTableFontModelopen(false); + setMessageData(response?.data?.response); + if (response?.data?.response == 'Font Already Exists') { + setMessageType('warning'); + } else { + setMessageType('success'); + } + + dispatch(getTableFonts(BillingTableData?.[0]?.SessionId)).unwrap; + Tableform.resetFields(); + } else { + setMessageData(response?.data?.response); + setMessageType('error'); + } + } else { + setMessageType('warning'); + setMessageData('Please give the Correct google fonts Name!'); + + } + }) + .catch((error) => { + console.error('Error fetching fonts:', error); + }); + }; + function formatFontName(input) { + return input + ?.toLowerCase() + .split(/\s+/) + .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) // Capitalize each word + .join(' '); + } + const HandleSubmit = async () => { + console.log(TemplateDetails, 'TemplateDetails.ColorDetail'); + const result = { + AppId: AppId, + CompId: CompId, + UserId: UserId, + BranchId: BranchId, + ColorId: TemplateDetails?.[0]?.ColorDetail?.map((c) => c.ColorId), + FontId: TemplateDetails?.[0]?.FontDetail?.map(f => + f.SessionName === "BookingBilling" ? selectedTableFont : f.FontId + ), + CreatedBy: UserId, + TemplateDetails: TemplateDetails?.[0]?.ComponentDetails.map((comp) => ({ + ComponentId: comp.ComponentId, // ✅ dynamic + ComponentDetails: + comp.SessionName === 'BookingBilling' + ? SelectedBillTableCheckValues?.map((id) => ({ OptionId: id })) // ✅ NEW checked list + : comp.FieldDetails.map((field) => ({ OptionId: field.OptionId })), // existing + })), + }; + console.log(result, 'final result to submit'); + var response = await dispatch(putSelectionComponentData(result)).unwrap(); + if (response?.data?.statusCode == 1) { + if ( + response?.data?.response === 'Application Template Already Exists' + ) { + setMessageType('warning'); + setMessageData('Application Template Already Exists'); + setFirstOnClick(false); + } else { + setMessageType('success'); + setMessageData('Template Details Added Successfully'); + setFirstOnClick(false); + } + dispatch(changeScanTemplate({})) + + } else { + setMessageType('error'); + setMessageData(response?.data?.response); + setFirstOnClick(false); + } + }; + const onComplete = useCallback(() => { + setMessageData(null); + setMessageType(null); + }, []); + + return ( + <> + +
+ + + {billingSettings?.ComponentOptionsDetails?.map((value, key) => ( + Navholdoption(value.OptionName)} + key={value?.OptionId} + disabled={value.OptionName === 'Item' ? true : false} + > + {value.OptionName} + + ))} + + + {/* {billingSettings?.ComponentOptionsDetails?.map((item) => ( +
+ handleChange(item.id, e.target.checked)} + > + {item.label} + +
+ ))} */} +
+
+

BillTable Font

+ ({ + value: option.FontId, + label: option.SessionFont, + }))} + label="Font" + onChangeFunction={selectFont3} + className="settingsales-DropDown-Selection" + isOnchanges={!!selectedTableFont} + valueData={selectedTableFont} + /> +
+ Add + +
+
+ +
+
+ { + await validateSafeInput(value); // To block HTML tags & SQL keywords + return Promise.resolve(); + }, + }, + ]} + > + + +
+
+

* Google Fonts Only

+ + } + handleCancel={TablehandleCancel} + handleSubmit={TablehandleSubmit} + buttonText="SAVE" + /> + {hasBackground ? ( +
+
+
+ +

+ BillTable Background Color +

+ ({ + value: option.ColorId, + label: ( +
+
+ +     + +
+
{option.ThemeName}
+
+ ), + }))} + labelChange={true} + label="Color" + className="field-DropDown-Selection" + onChangeFunction={selectTableColor} + // isOnchanges={SelectedTableColor ? true : false} + // valueData={SelectedTableColor} + /> +
+
+
+ Add + +
+
+
+ ) : null} + {hasOverallBackground ? ( +
+ { + setBillingUploadOverallColor(false); + }} + /> + } + width={400} + footer={null} + > +
+
+

+ Selected Color:{' '} +

+
+
+
+ +
+
+ + + +
+ +
+
+
+
+ +

+ BillTable Overall-Background +

+ ({ + value: option.ColorId, + label: ( +
+
+ +     + +
+
{option.ThemeName}
+
+ ), + }))} + labelChange={true} + label={

Overall Background

} + className="field-DropDown-Selection" + onChangeFunction={selectBillingOverallColor} + isOnchanges={dropdownBillingOverallColor ? true : false} + valueData={dropdownBillingOverallColor} + /> +
+
+
+ Add + +
+
+
+ ) : null} + } + width={400} + footer={null} + > +
+
+ openColour4(e)} + /> +
+ +
+
+ +
+
+

+ {' '} + Selected Background Color :{' '} +

+
+ <>| +
+
+

+ {' '} + Selected Font Color :{' '} +

+
+
+
+
+ + + +
+ +
+
+
+ } + htmlType={true} + handleSubmit={HandleSubmit} + + /> +
+ + ); +}; +export default TableHeadersetting; diff --git a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss index 3ae00bf..581fe75 100644 --- a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss +++ b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss @@ -552,31 +552,31 @@ } } - &::before { - content: ''; - position: absolute; - inset: 0; - padding: 1px; // border thickness - border-radius: inherit; - background: linear-gradient( - 270deg, - #fff3bac4, - #ffcc00, - #fff3baa1, - #ffcc00, - #fff3baab, - #ffcc00 - ); - background-size: 300% 300%; - animation: rainbowBorder 5s linear infinite; - // -webkit-mask: - // linear-gradient(#fff 0 0) content-box, - // linear-gradient(#fff 0 0); - -webkit-mask-composite: xor; - mask-composite: exclude; - pointer-events: none; - z-index: -1; - } + // &::before { + // content: ''; + // position: absolute; + // inset: 0; + // padding: 1px; // border thickness + // border-radius: inherit; + // background: linear-gradient( + // 270deg, + // #fff3bac4, + // #ffcc00, + // #fff3baa1, + // #ffcc00, + // #fff3baab, + // #ffcc00 + // ); + // background-size: 300% 300%; + // animation: rainbowBorder 5s linear infinite; + // // -webkit-mask: + // // linear-gradient(#fff 0 0) content-box, + // // linear-gradient(#fff 0 0); + // -webkit-mask-composite: xor; + // mask-composite: exclude; + // pointer-events: none; + // z-index: -1; + // } @keyframes rainbowBorder { 0% { From ae9b8377b2dc63eb574301a5c8a19021334f8cc0 Mon Sep 17 00:00:00 2001 From: karthikalakshmi Date: Mon, 2 Feb 2026 11:55:35 +0530 Subject: [PATCH 06/20] Update src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss --- .../Components/BSNavbar/BSNavbar3.scss | 50 ++++--------------- 1 file changed, 11 insertions(+), 39 deletions(-) diff --git a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss index 581fe75..02b1696 100644 --- a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss +++ b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar3.scss @@ -26,7 +26,7 @@ align-items: center; gap: 1rem; color: #fff; - font-family: 'Inter', ui-sans-serif, system-ui, sans-serif; + font-family: "Inter", ui-sans-serif, system-ui, sans-serif; white-space: nowrap; .CiShopIcon { @@ -46,7 +46,7 @@ .homeIcon { display: flex; - font-family: 'Inter', ui-sans-serif, system-ui, sans-serif; + font-family: "Inter", ui-sans-serif, system-ui, sans-serif; justify-content: center; gap: 0.5rem; font-size: 16px; @@ -78,7 +78,7 @@ font-weight: 400; -webkit-text-stroke-width: 0.2px; border-radius: 50px; - font-family: 'Poppins', sans-serif !important; + font-family: "Poppins", sans-serif !important; } .BsnavbarSearchMain { @@ -116,7 +116,7 @@ .CustomerActions { display: flex; align-items: center; - gap: 0.1rem; + gap: 0.3rem; .RiVerifiedBadgeFill { transition: all 0.2s ease-in-out; @@ -279,7 +279,7 @@ font-weight: 400; -webkit-text-stroke-width: 0.2px; border-radius: 50px; - font-family: 'Poppins', sans-serif !important; + font-family: "Poppins", sans-serif !important; } .BsNavbarUser { @@ -412,7 +412,7 @@ } div { - font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; + font-family: "Inter", ui-sans-serif, system-ui, sans-serif !important; font-weight: 400; font-size: 0.9rem; } @@ -442,7 +442,7 @@ border-radius: 10px; border: 1px solid #ccc; box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px; - font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; + font-family: "Inter", ui-sans-serif, system-ui, sans-serif !important; } .profileImage { @@ -481,7 +481,7 @@ width: 100%; padding: 10px 12px; font-size: 16px; - font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; + font-family: "Inter", ui-sans-serif, system-ui, sans-serif !important; font-weight: 500; -webkit-text-stroke-width: 0.1px; border: none; @@ -536,7 +536,7 @@ padding: 0.2rem 0.9rem; border-radius: 0.75rem; font-size: 0.7rem; - font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; + font-family: "Inter", ui-sans-serif, system-ui, sans-serif !important; cursor: pointer; position: relative; z-index: 0; @@ -552,32 +552,6 @@ } } - // &::before { - // content: ''; - // position: absolute; - // inset: 0; - // padding: 1px; // border thickness - // border-radius: inherit; - // background: linear-gradient( - // 270deg, - // #fff3bac4, - // #ffcc00, - // #fff3baa1, - // #ffcc00, - // #fff3baab, - // #ffcc00 - // ); - // background-size: 300% 300%; - // animation: rainbowBorder 5s linear infinite; - // // -webkit-mask: - // // linear-gradient(#fff 0 0) content-box, - // // linear-gradient(#fff 0 0); - // -webkit-mask-composite: xor; - // mask-composite: exclude; - // pointer-events: none; - // z-index: -1; - // } - @keyframes rainbowBorder { 0% { background-position: 0% 50%; @@ -630,7 +604,7 @@ padding: 0.1rem 0.1rem; border-radius: 7px; white-space: nowrap; - font-family: 'Poppins', sans-serif; + font-family: "Poppins", sans-serif; width: 110px; line-height: 1.3; @@ -735,7 +709,6 @@ cursor: pointer; } - .MultiSearchIconDiv3 { background-color: #ffffff; color: #1292ee !important; @@ -748,7 +721,6 @@ height: 32px; padding: 4px; - svg { font-size: 22px; width: 32px !important; @@ -756,4 +728,4 @@ display: flex; } -} \ No newline at end of file +} From 5fc555c67c0a78318b555aea9346a8eb4ac44ad4 Mon Sep 17 00:00:00 2001 From: Tamilselvan Date: Mon, 2 Feb 2026 12:10:21 +0530 Subject: [PATCH 07/20] ijust addded getStockDetailsByVariantName --- .../BookingScreen/BookingData/BookingData.js | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/Features/BookingScreen/BookingData/BookingData.js b/src/Features/BookingScreen/BookingData/BookingData.js index e3f29b2..39188e4 100644 --- a/src/Features/BookingScreen/BookingData/BookingData.js +++ b/src/Features/BookingScreen/BookingData/BookingData.js @@ -18,6 +18,15 @@ export const getNotification = createAsyncThunk( ); } ); +export const getStockDetailsByVariantName = createAsyncThunk( + 'BookingData/getStockDetailsByVariantName', + async (data) => { + return await axiosRetailInstanceData.post( + `/productVariantListByname`, + data + ); + } +); export const getLayoutCategories = createAsyncThunk( 'BookingData/getLayoutCategories', @@ -787,37 +796,34 @@ export const getPaymentOptionFeatureApi = createAsyncThunk( ); export const getProductsearch = createAsyncThunk( - "BookingData/getProductsearch", + 'BookingData/getProductsearch', async ( { CompId, BranchId, AppId, ProdName }, { signal, rejectWithValue } ) => { try { if (!CompId || !BranchId || !AppId || !ProdName) { - return rejectWithValue("Invalid params"); + return rejectWithValue('Invalid params'); } - const response = await axiosRetailInstanceData.get( - `/productCardList`, - { - params: { - CompId, - BranchId, - AppId, - ProdName, - }, - signal, // ✅ Abort works here - } - ); + const response = await axiosRetailInstanceData.get(`/productCardList`, { + params: { + CompId, + BranchId, + AppId, + ProdName, + }, + signal, // ✅ Abort works here + }); return response.data; // ✅ return only data } catch (error) { // ✅ Abort error – ignore - if (error.name === "CanceledError" || error.name === "AbortError") { + if (error.name === 'CanceledError' || error.name === 'AbortError') { throw error; } - return rejectWithValue(error.response?.data || "API Error"); + return rejectWithValue(error.response?.data || 'API Error'); } } ); @@ -1423,7 +1429,7 @@ export const getMissedOrderids = createAsyncThunk( export const CustomerOrderList = createAsyncThunk( 'CustomerOrderList/LastBuyProductList', async (data) => { - const { AppId, CompId, BranchId, MobileNo,FromDate,ToDate } = data; + const { AppId, CompId, BranchId, MobileNo, FromDate, ToDate } = data; if ( AppId != null && AppId != undefined && @@ -1441,8 +1447,7 @@ export const CustomerOrderList = createAsyncThunk( return await axiosRetailInstanceData.get( `/LastBuyProductList?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&mobileNo=${MobileNo}&fromDate=${FromDate}&toDate=${ToDate}` ); - } - else if ( + } else if ( AppId != null && AppId != undefined && CompId != null && @@ -1456,7 +1461,6 @@ export const CustomerOrderList = createAsyncThunk( `/LastBuyProductList?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&mobileNo=${MobileNo}` ); } - } ); @@ -1477,8 +1481,6 @@ export const getmultipleSearch = createAsyncThunk( } ); - - const initialState = { PrintStyle: null, CustId: null, @@ -1967,9 +1969,8 @@ const BookingData = createSlice({ state.SelectedDatas = []; } }), - - builder.addCase(getProductsearch.fulfilled, (state, action) => { - console.log(action?.payload,"mohanaacacacca") + builder.addCase(getProductsearch.fulfilled, (state, action) => { + console.log(action?.payload, 'mohanaacacacca'); if (action?.payload?.statusCode === 1) { state.SelectedDatas = action?.payload?.data; } else { From fbcfadfcde42e27c201ec4cda092e9f946e18a2c Mon Sep 17 00:00:00 2001 From: karthikalakshmi Date: Mon, 2 Feb 2026 15:50:08 +0530 Subject: [PATCH 08/20] table settings Full functionality --- .../UtillComponents/AllSalesPageSettings.jsx | 153 ++++++------ .../UtillComponents/AllSalesPageSettings.scss | 179 ++++++++++---- .../UtillComponents/TableHeadersetting.jsx | 231 +++++++++--------- .../Template/SalesCountForStandard.jsx | 2 + 4 files changed, 316 insertions(+), 249 deletions(-) diff --git a/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.jsx b/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.jsx index 6deaca4..43f933e 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.jsx @@ -1,84 +1,77 @@ -import { useState } from "react"; -import { IoMdAdd, IoMdSettings } from "react-icons/io"; -import { DefaultModal } from "../../../../Components/Modal/DefaultModal"; -import TooltipWrapper from "../../../../Components/Tooltip/Tooltip"; - -import "./AllSalesPageSettings.scss" -import TableHeadersetting from "./TableHeadersetting"; -import PaymentOptions from "../../../Payment/PaymentOptions/PaymentOptions"; - +import { useState } from 'react'; +import { IoMdAdd, IoMdSettings } from 'react-icons/io'; +import { DefaultModal } from '../../../../Components/Modal/DefaultModal'; +import TooltipWrapper from '../../../../Components/Tooltip/Tooltip'; +import './AllSalesPageSettings.scss'; +import TableHeadersetting from './TableHeadersetting'; +import PaymentOptions from '../../../Payment/PaymentOptions/PaymentOptions'; const AllSalesPageSettings = () => { - const [settingModal, setsettingModal] = useState(false) - const [selectedComponent, setselectedComponent] = useState('Payment') - - - const onclose = () => { - setsettingModal(false) - } - const ComponentSelect = (value) => { - setselectedComponent(value); - }; - return ( - <> - -
setsettingModal(true)} - style={{ - cursor: 'pointer', - display: 'flex', - alignItems: 'center', - gap: '5px', - padding: '5px 10px', - borderRadius: '4px', - fontSize: '14px', - }} - > - -
-
- - + const [settingModal, setsettingModal] = useState(false); + const [selectedComponent, setselectedComponent] = useState('Payment'); -
-
-
ComponentSelect('Payment')} - > - Payment Option -
-
ComponentSelect('Table')} - > - Table -
-
- {selectedComponent == "Payment" && -
- -
- } - - { - selectedComponent === "Table" && - - } - -
-
- - ) -} - -export default AllSalesPageSettings; \ No newline at end of file + const onclose = () => { + setsettingModal(false); + }; + const ComponentSelect = (value) => { + setselectedComponent(value); + }; + return ( + <> + +
setsettingModal(true)} + style={{ + cursor: 'pointer', + display: 'flex', + alignItems: 'center', + gap: '5px', + padding: '5px 10px', + borderRadius: '4px', + fontSize: '14px', + backgroundColor: '#f0f0f0', + }} + > + +
+
+ + +
+
+
ComponentSelect('Payment')} + > + Payment Option +
+
ComponentSelect('Table')} + > + Table +
+
+
+ {selectedComponent == 'Payment' && ( +
+ +
+ )} + + {selectedComponent === 'Table' && } +
+
+
+ + ); +}; + +export default AllSalesPageSettings; diff --git a/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.scss b/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.scss index 25ef74c..4c41b2f 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.scss +++ b/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.scss @@ -1,58 +1,141 @@ -/// Another swtich button style code +// /// Another swtich button style code -.SettingsListSwitchBTN { - display: inline-flex; - gap: 16px; - font-family: "Poppins"; - margin-bottom: 12px; - border-bottom: 1px solid #d1d5db; +// .SettingsListSwitchBTN { +// display: inline-flex; +// gap: 16px; +// font-family: "Poppins"; +// margin-bottom: 12px; +// border-bottom: 1px solid #d1d5db; +// } + +// .SettingsListSwitchBTN > div { +// font-size: 22px; +// font-weight: 600; +// cursor: pointer; +// color: #6b7280; +// display: flex; +// align-items: center; +// gap: 6px; +// position: relative; +// border: none; +// background: transparent; +// font-family: "Gilroy"; +// transition: color 0.2s ease; +// @media (max-width: 600px) { +// font-size: 18px; +// } +// } + +// .SettingsListSwitchBTN > div:hover { +// color: #0f172a; +// } + +// .SettingsSwitchBTN > div.selected { +// color: #0f172a; +// } + +// .SettingsListSwitchBTN > div.selected::after { +// content: ""; +// position: absolute; +// left: 0; +// bottom: -1px; +// width: 100%; +// height: 2px; +// background: #2c88ee; +// border-radius: 2px; +// } + +// .SettingsListSwitchBTN > div.selected svg { +// color: #4765db !important; +// } + +// // End +// .settingsales-DropDown-Selection { +// width: 150px !important; +// } +// .settingaddNewSalesFiledBTN { +// background-color: #2563eb; +// // background-color: #1292ee; +// color: #fff !important; +// width: max-content; +// height: max-content; +// padding: 4px 8px; +// font-size: 13px; +// font-weight: 400; +// display: flex; +// align-items: center; +// gap: 4px; +// cursor: pointer; +// border-radius: 6px; +// svg { +// color: #fff !important; +// font-weight: 500; +// display: flex; +// font-size: 16px; +// } +// } + +.AllSalesPageSettingsMainDiv { + width: 100%; + height: 100%; + display: flex; + align-items: flex-start; + gap: 1rem; + font-family: "Poppins", sans-serif; + justify-content: flex-start; } -.SettingsListSwitchBTN > div { - font-size: 22px; - font-weight: 600; - cursor: pointer; - color: #6b7280; +.SettingsComponentDiv { + height: max-content; + max-height: 80vh; + width: 100%; + scrollbar-width: thin; + padding-right: 10px; + overflow: auto; + .option-maindiv{ display: flex; - align-items: center; + align-items: flex-start; + flex-wrap: wrap; + } +} + +.SettingsListSwitchBTN { + display: flex; + align-items: flex-start; + flex-direction: column; gap: 6px; - position: relative; - border: none; - background: transparent; - font-family: "Gilroy"; - transition: color 0.2s ease; - @media (max-width: 600px) { - font-size: 18px; + width: 210px; + height: 100%; + overflow: auto; + background-color: #d8e5ff; + padding: 5px; + border-radius: 4px; + height: 80vh; + div { + width: 100%; + background-color: #fff; + outline: none; + border: none; + font-family: "Poppins", sans-serif; + padding: 8px 6px; + cursor: pointer; + border-radius: 4px; + transition: all 0.2s ease-in-out; + font-size: 14px; + font-weight: 400; + + &:hover { + background-color: #d1d8ec; + } + &.selected { + background-color: #ffffff; + color: #2563eb; + font-weight: 500; + border-right: 3px solid #2563eb; + } } } -.SettingsListSwitchBTN > div:hover { - color: #0f172a; -} - -.SettingsSwitchBTN > div.selected { - color: #0f172a; -} - -.SettingsListSwitchBTN > div.selected::after { - content: ""; - position: absolute; - left: 0; - bottom: -1px; - width: 100%; - height: 2px; - background: #2c88ee; - border-radius: 2px; -} - -.SettingsListSwitchBTN > div.selected svg { - color: #4765db !important; -} - -// End -.settingsales-DropDown-Selection { - width: 150px !important; -} .settingaddNewSalesFiledBTN { background-color: #2563eb; // background-color: #1292ee; @@ -73,4 +156,4 @@ display: flex; font-size: 16px; } -} \ No newline at end of file +} diff --git a/src/Pages/BookingScreen/Components/UtillComponents/TableHeadersetting.jsx b/src/Pages/BookingScreen/Components/UtillComponents/TableHeadersetting.jsx index 2bf0876..5c9c47b 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/TableHeadersetting.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/TableHeadersetting.jsx @@ -11,6 +11,7 @@ import { RadioGrpButton } from '../../../../Components/Forms/RadioGroup'; import { useSelector } from 'react-redux'; import { getSalesTemplate, + getTemplate, postColorData, postTableFontData, putSelectionComponentData, @@ -20,7 +21,7 @@ import { useDispatch } from 'react-redux'; import Buttons from '../../../../Components/Forms/Buttons'; import { Messages } from '../../../../Components/Notifications/Messages'; -const TableHeadersetting = () => { +const TableHeadersetting = ({setModalOpen}) => { const dispatch = useDispatch(); const SessionData = useSelector(StoredSessionData); const AppId = SessionData?.AppId; @@ -61,6 +62,10 @@ const TableHeadersetting = () => { const hasOverallBackground = SelectedBillTableCheckValues?.includes( OverallbackgroundOptionId ); + // Hold and addcustomer OptionsDetails + const [HoldButton, setHoldButton] = useState(false); + const [AddCustomerButton, setAddCustomerButton] = useState(false); + const [DineInChecked,setDineInChecked] = useState(false) console.log(billingSettings, 'billingSettingsbillingSettings'); const [TableBackgroundColorData, setTableBackgroundColorData] = useState([ { @@ -109,71 +114,7 @@ const TableHeadersetting = () => { ActiveStatus: 'A', }, ]); - const [BillingOverallColorsList, setBillingOverallColorsList] = useState([ - { - ColorId: 9, - SessionId: 57, - OptionId: 204, - FontColor: '#000000', - BackgroundColor: '#bbdefb', - ThemeName: 'Theme 9', - ActiveStatus: 'A', - }, - { - ColorId: 19, - SessionId: 57, - OptionId: 204, - FontColor: '#000000', - BackgroundColor: '#d7ccc8', - ThemeName: 'Theme 19', - ActiveStatus: 'A', - }, - { - ColorId: 20, - SessionId: 57, - OptionId: 209, - FontColor: '#000000', - BackgroundColor: '#c5cae9', - ThemeName: 'Theme 20', - ActiveStatus: 'A', - }, - { - ColorId: 22, - SessionId: 57, - OptionId: 204, - FontColor: '#000000', - BackgroundColor: '#ffffff', - ThemeName: 'Theme 22', - ActiveStatus: 'A', - }, - { - ColorId: 30, - SessionId: 57, - OptionId: 209, - FontColor: '#000000', - BackgroundColor: '#3f51b5', - ThemeName: 'Theme 30', - ActiveStatus: 'A', - }, - { - ColorId: 66, - SessionId: 57, - OptionId: 205, - FontColor: '#000000', - BackgroundColor: '#d1c4e9', - ThemeName: 'Theme 65', - ActiveStatus: 'A', - }, - { - ColorId: 67, - SessionId: 57, - OptionId: 205, - FontColor: '#000000', - BackgroundColor: '#8bc34a', - ThemeName: 'Theme 66', - ActiveStatus: 'A', - }, - ]); + const [BillingOverallColorsList, setBillingOverallColorsList] = useState(); const [BillUploadColor, setBillUploadColor] = useState(false); const [TableColorType, setTableColorType] = useState('Y'); const [TablebackgroundColor, setTablebackgroundColor] = useState('#009b00'); @@ -211,21 +152,55 @@ const TableHeadersetting = () => { let selectedBilling = AllDetails?.Templates?.[0]?.ComponentDetails?.find( (item) => item?.SessionName === 'BookingBilling' ); + let selectedNavbar =AllDetails?.Templates?.[0]?.ComponentDetails?.find( + (item) => item?.SessionName === 'BookingNavbar' + ); let AllBillingdetails = AllDetails?.Components?.find( (item) => item?.ComponentName === selectedBilling?.ComponentName ); - console.log(AllDetails, AllDetails?.Templates, 'templateresponse'); + console.log(AllDetails, selectedNavbar, 'templateresponse'); setBillingSettings(AllBillingdetails); const optionIds = selectedBilling?.FieldDetails?.map( (item) => item?.OptionId ); setSelectedBillTableCheckValues(optionIds); - let allcolordata = AllDetails?.Colors?.filter(item => item.SessionId === selectedBilling?.SessionId) + let Allfontdata = AllDetails?.Fonts?.filter(item => item.SessionId === selectedBilling?.SessionId) setTableFontData(Allfontdata) let selectedFont = AllDetails?.Templates?.[0]?.FontDetail?.find(item=>item?.SessionId === selectedBilling?.SessionId) setSelectedTableFont(selectedFont?.FontId) + const hasHold = selectedNavbar?.FieldDetails?.some( + item => item.OptionName === "Hold" + ); + const hasAddcustomer = selectedNavbar?.FieldDetails?.some( + item => item.OptionName === "AddCustomer" + ); + const hasDinein = selectedNavbar?.FieldDetails?.some( + item => item.OptionName === "DineIn" + ); + setHoldButton(hasHold) + setAddCustomerButton(hasAddcustomer) + setDineInChecked(hasDinein) + let allcolordata = AllDetails?.Colors?.filter(item => item.SessionId === selectedBilling?.SessionId && item.OptionName === "OverallBackground") + setBillingOverallColorsList(allcolordata) + let allBackcolordata = AllDetails?.Colors?.filter(item => item.SessionId === selectedBilling?.SessionId && item.OptionName === "Background") + + setTableBackgroundColorData(allBackcolordata) + let selectedcolors = AllDetails?.Templates?.[0]?.ColorDetail?.filter(item=>item?.SessionName === 'BookingBilling') + console.log(selectedcolors, 'selectedOverallBackgroudcolor') + selectedcolors?.forEach((item) => { + if (item?.['BackgroundColor']) { + setSelectedTableColor(item?.['ColorId']); + } else if (item?.['OverallBackgroundColor']) { + + setdropdownBillingOverallColor(item?.['ColorId']); + + } + }); + // await setdropdownBillingOverallColor(selectedOverallBackgroudcolor); + // formRef.current?.setFieldsValue({ BillingOverallColor: value }); + // setTableBackgroundColorData console.log(Allfontdata, 'All table colors'); // BookingBilling templateData?.['BookingBilling']?.[0] @@ -251,7 +226,7 @@ const TableHeadersetting = () => { }; const selectTableColor = async (value) => { await setSelectedTableColor(value); - formRef.current?.setFieldsValue({ TableColor: value }); + // formRef.current?.setFieldsValue({ TableColor: value }); }; const BillhandleUploadColor = () => { setBillUploadColor(true); @@ -299,7 +274,8 @@ const TableHeadersetting = () => { setMessageData(response?.data?.response); // BillsetUploadColor(false); } - + GetTemplatedetails() + setBillUploadColor(false) } else { setMessageData(response?.data?.response); setMessageType('error'); @@ -341,54 +317,47 @@ const TableHeadersetting = () => { }; const handleBillingOverallColorSubmit = async () => { let response; - - // try { - // let postData = { - // BackgroundColor: BillingOverallColor, - // FontColor: '#000000', - // CreatedBy: getSession('UserId'), - // SessionId: BillingTableData[0]?.SessionId, - // OptionId: BillTableCheckList[0]?.ComponentOptionsDetails?.filter( - // (item) => item.OptionName == 'OverallBackground' - // )?.[0]?.OptionId, - // }; - // response = await dispatch(postColorData(postData)).unwrap(); - // } catch (err) { - // if (err['message'] == 'Request failed with status code 422') { - // response = { - // data: { - // statusCode: 0, - // response: 'Color Not Added', - // data: [], - // }, - // }; - // } - // } - // if (response?.data?.statusCode == 1) { - // if (response?.data?.response == 'Color Already Exists') { - // setMessageType('warning'); - // setMessageData(response?.data?.response); - // } else { - // setMessageType('success'); - // setMessageData(response?.data?.response); - // setBillingUploadOverallColor(false); - // } - // let OverallBillingdata = { - // SessionID: BillingTableData[0]?.SessionId, - // OptionName: 'OverallBackground', - // }; - // dispatch(getBillingOverallBackgroundColors(OverallBillingdata)).unwrap; - // } else { - // setMessageData(response?.data?.response); - // setMessageType('error'); - // } + + try { + let postData = { + BackgroundColor: BillingOverallColor, + FontColor: '#000000', + CreatedBy:UserId, + SessionId: billingSettings?.SessionId, + OptionId: OverallbackgroundOptionId, + }; + response = await dispatch(postColorData(postData)).unwrap(); + } catch (err) { + if (err['message'] == 'Request failed with status code 422') { + response = { + data: { + statusCode: 0, + response: 'Color Not Added', + data: [], + }, + }; + } + } + if (response?.data?.statusCode == 1) { + if (response?.data?.response == 'Color Already Exists') { + setMessageType('warning'); + setMessageData(response?.data?.response); + } else { + setMessageType('success'); + setMessageData(response?.data?.response); + setBillingUploadOverallColor(false); + } + GetTemplatedetails() + BillingUploadOverallColor(false) + } else { + setMessageData(response?.data?.response); + setMessageType('error'); + } }; const selectBillingOverallColor = async (value) => { await setdropdownBillingOverallColor(value); - formRef.current?.setFieldsValue({ BillingOverallColor: value }); - let billOverallColorVal = BillingOverallColorsList?.filter( - (data) => data?.ColorId === value - ); + // formRef.current?.setFieldsValue({ BillingOverallColor: value }); + }; const openColour4 = (value) => { setTableColorType(value); @@ -440,6 +409,7 @@ const TableHeadersetting = () => { } dispatch(getTableFonts(BillingTableData?.[0]?.SessionId)).unwrap; + GetTemplatedetails() Tableform.resetFields(); } else { setMessageData(response?.data?.response); @@ -469,7 +439,14 @@ const TableHeadersetting = () => { CompId: CompId, UserId: UserId, BranchId: BranchId, - ColorId: TemplateDetails?.[0]?.ColorDetail?.map((c) => c.ColorId), + ColorId: [ + ...(TemplateDetails?.[0]?.ColorDetail + ?.filter(c => c.SessionName !== "BookingBilling") + ?.map(c => c.ColorId) || []), + + SelectedTableColor, + dropdownBillingOverallColor, +], FontId: TemplateDetails?.[0]?.FontDetail?.map(f => f.SessionName === "BookingBilling" ? selectedTableFont : f.FontId ), @@ -496,8 +473,8 @@ const TableHeadersetting = () => { setMessageData('Template Details Added Successfully'); setFirstOnClick(false); } - dispatch(changeScanTemplate({})) - + await dispatch(getTemplate({ CompId, BranchId, AppId })).unwrap(); + setModalOpen(false) } else { setMessageType('error'); setMessageData(response?.data?.response); @@ -538,7 +515,19 @@ const TableHeadersetting = () => { value={value?.OptionId} // onClick={() => Navholdoption(value.OptionName)} key={value?.OptionId} - disabled={value.OptionName === 'Item' ? true : false} + disabled={ + value.OptionName === 'Hold' && HoldButton + ? true + : value.OptionName === 'AddCustomer' && + AddCustomerButton + ? true + : value.OptionName === 'Item' + ? true + : value.OptionName === 'UnpaidBill' && + !DineInChecked + ? true + : false + } > {value.OptionName} @@ -682,8 +671,8 @@ const TableHeadersetting = () => { label="Color" className="field-DropDown-Selection" onChangeFunction={selectTableColor} - // isOnchanges={SelectedTableColor ? true : false} - // valueData={SelectedTableColor} + isOnchanges={SelectedTableColor ? true : false} + valueData={SelectedTableColor} />
diff --git a/src/Pages/BookingScreen/Template/SalesCountForStandard.jsx b/src/Pages/BookingScreen/Template/SalesCountForStandard.jsx index 2ec42d9..1bd9777 100644 --- a/src/Pages/BookingScreen/Template/SalesCountForStandard.jsx +++ b/src/Pages/BookingScreen/Template/SalesCountForStandard.jsx @@ -60,6 +60,7 @@ import { GoPackageDependencies } from 'react-icons/go'; import { Messages } from '../../../../ownLib/my-ui-lib.js'; import ShortcutKeyHelper from '../Components/UtillComponents/ShortcutKeyHelper.jsx'; +import AllSalesPageSettings from '../Components/UtillComponents/AllSalesPageSettings.jsx'; const SalesCountForStandard = ({ DineInAccess, @@ -830,6 +831,7 @@ const SalesCountForStandard = ({ )} {preferenceshortcutkey && } +
{Customisebillno && } {SessionData?.FeatureAddonData?.FeatureDtls?.find( From 3676a3f41dd68e5312277e1cbdfee9ba0dbc23ef Mon Sep 17 00:00:00 2001 From: karthikalakshmi Date: Mon, 2 Feb 2026 19:34:35 +0530 Subject: [PATCH 09/20] FIX #51 Issue Solving for updated --- src/Features/PurchaseOrder/PurchaseOrder.js | 2 +- .../Components/BSCombo/BSC1Payment.jsx | 3 + .../UtillComponents/ProductPriceChange.jsx | 884 ++++++++++-------- 3 files changed, 480 insertions(+), 409 deletions(-) diff --git a/src/Features/PurchaseOrder/PurchaseOrder.js b/src/Features/PurchaseOrder/PurchaseOrder.js index 127732b..b1b0994 100644 --- a/src/Features/PurchaseOrder/PurchaseOrder.js +++ b/src/Features/PurchaseOrder/PurchaseOrder.js @@ -101,7 +101,7 @@ export const getPurProdvaraiantdata = createAsyncThunk( data?.prodName !== undefined ) { return await axiosRetailInstanceData.get( - `/ProductCardList?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}&prodName=${encodeURIComponent(data?.prodName)}` + `/ProductCardList?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}&prodName=${encodeURIComponent(data?.prodName)}&type=S` ); } } diff --git a/src/Pages/BookingScreen/Components/BSCombo/BSC1Payment.jsx b/src/Pages/BookingScreen/Components/BSCombo/BSC1Payment.jsx index 30d3c65..5a06ee1 100644 --- a/src/Pages/BookingScreen/Components/BSCombo/BSC1Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSCombo/BSC1Payment.jsx @@ -327,7 +327,10 @@ const BSC1Payment = (props) => { )?.PreferenceCatDetails; const sportsAppPreference = commonModulePreference?.find( (preference) => preference?.PreferredSubCatName === 'SportsApp' + && + preference?.PreferredStatus == 'Y' ); + console.log(sportsAppPreference,commonModulePreference,"sportsAppPreference") const bookingTypePreference = appPreferences?.find( (preference) => preference?.PreferredCatName === 'Booking Type' )?.PreferenceCatDetails; diff --git a/src/Pages/BookingScreen/Components/UtillComponents/ProductPriceChange.jsx b/src/Pages/BookingScreen/Components/UtillComponents/ProductPriceChange.jsx index c9f35a6..d55a9eb 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/ProductPriceChange.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/ProductPriceChange.jsx @@ -1,449 +1,517 @@ -import { shallowEqual, useSelector } from "react-redux"; -import { GlobalAccessForOthers, GlobalCardAccess, GlobalCombosearch, GlobalItemCard, GlobalProductCategorie, GlobalSelectedDatas, GlobalWithoutSubCatItemCard, triggerProductCard } from "../../../../Features/BookingScreen/BookingData/BookingData"; -import { DefaultModal } from "../../../../Components/Modal/DefaultModal"; -import { useCallback, useEffect, useRef, useState } from "react"; -import { Tables } from "../../../../Components/Tables/Table"; -import { InputField } from "../../../../Components/Forms/InputField"; -import { Form, Pagination, Tooltip } from "antd"; -import { getSession } from "../../../../Services/Others"; -import { Messages } from "../../../../Components/Notifications/Messages"; -import { useDispatch } from "react-redux"; -import { PutStockPrice } from "../../../../Features/StockPriceUpdate/StockPriceUpdateMaster"; -import PriceChange from "../../../../Images/PayOptImgs/PriceChange.svg" +import { shallowEqual, useSelector } from 'react-redux'; +import { + GlobalAccessForOthers, + GlobalCardAccess, + GlobalCombosearch, + GlobalItemCard, + GlobalProductCategorie, + GlobalSelectedDatas, + GlobalWithoutSubCatItemCard, + triggerProductCard, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; +import { DefaultModal } from '../../../../Components/Modal/DefaultModal'; +import { useCallback, useEffect, useRef, useState } from 'react'; +import { Tables } from '../../../../Components/Tables/Table'; +import { InputField } from '../../../../Components/Forms/InputField'; +import { Form, Pagination, Tooltip } from 'antd'; +import { getSession } from '../../../../Services/Others'; +import { Messages } from '../../../../Components/Notifications/Messages'; +import { useDispatch } from 'react-redux'; +import { PutStockPrice } from '../../../../Features/StockPriceUpdate/StockPriceUpdateMaster'; +import PriceChange from '../../../../Images/PayOptImgs/PriceChange.svg'; -const ProductPriceChange = ({ showButton = true, priceChangeProduct = null, productPriceChange = false, setProductPriceChange = () => { }, setPriceChangeProduct = () => { } }) => { +const ProductPriceChange = ({ + showButton = true, + priceChangeProduct = [], + productPriceChange = false, + setProductPriceChange = () => {}, + setPriceChangeProduct = () => {}, +}) => { + const formRef = useRef(null); + const dispatch = useDispatch(); - const formRef = useRef(null); - const dispatch = useDispatch(); + const AppId = getSession('AppId'); + const CompId = getSession('CompId'); + const BranchId = getSession('BranchId'); + const UserId = getSession('UserId'); - const AppId = getSession('AppId'); - const CompId = getSession('CompId'); - const BranchId = getSession('BranchId'); - const UserId = getSession('UserId'); + const [messageData, setMessageData] = useState(null); + const [messageType, setMessageType] = useState(null); + const [currentPage, setCurrentPage] = useState(1); + const [pageSize] = useState(10); - const [messageData, setMessageData] = useState(null); - const [messageType, setMessageType] = useState(null); - const [currentPage, setCurrentPage] = useState(1); - const [pageSize] = useState(10); + const [noSubcatCardData, setNoSubcatCardData] = useState(); + const [priceChangeModal, setPriceChangeModal] = useState(false); - const [noSubcatCardData, setNoSubcatCardData] = useState(); - const [priceChangeModal, setPriceChangeModal] = useState(false); + const comboSearch = useSelector(GlobalCombosearch); + const ProdCat = useSelector(GlobalProductCategorie, shallowEqual); + const ItemCard = useSelector(GlobalItemCard, shallowEqual); + const withoutSubCatItemCard = useSelector( + GlobalWithoutSubCatItemCard, + shallowEqual + ); + const CardAccess = useSelector(GlobalCardAccess, shallowEqual); + const globalAccessForOthers = useSelector( + GlobalAccessForOthers, + shallowEqual + ); + const SelectedDatas = useSelector(GlobalSelectedDatas, shallowEqual); + const [tableData, setTableData] = useState([]); + const [editingKey, setEditingKey] = useState(null); + const [priceChangedProducts, setPriceChangedProducts] = useState([]); + console.log(comboSearch, 'comboSearch'); - const comboSearch = useSelector(GlobalCombosearch); - const ProdCat = useSelector(GlobalProductCategorie, shallowEqual); - const ItemCard = useSelector(GlobalItemCard, shallowEqual); - const withoutSubCatItemCard = useSelector(GlobalWithoutSubCatItemCard, shallowEqual); - const CardAccess = useSelector(GlobalCardAccess, shallowEqual); - const globalAccessForOthers = useSelector(GlobalAccessForOthers, shallowEqual); - const SelectedDatas = useSelector(GlobalSelectedDatas, shallowEqual); - const [tableData, setTableData] = useState([]); - const [editingKey, setEditingKey] = useState(null); - const [priceChangedProducts, setPriceChangedProducts] = useState([]); - console.log(comboSearch, "comboSearch") + // console.log(noSubcatCardData, "noSubcatCardData") - // console.log(noSubcatCardData, "noSubcatCardData") + useEffect(() => { + if ( + ProdCat && + (ItemCard || withoutSubCatItemCard) && + (!noSubcatCardData || noSubcatCardData?.length === 0) + ) { + setNoSubcatCardData( + ItemCard?.length === 0 ? withoutSubCatItemCard : ItemCard + ); + } + }, [ProdCat, ItemCard, withoutSubCatItemCard, noSubcatCardData]); - useEffect(() => { - if (ProdCat && (ItemCard || withoutSubCatItemCard) && (!noSubcatCardData || noSubcatCardData?.length === 0)) { - setNoSubcatCardData(ItemCard?.length === 0 ? withoutSubCatItemCard : ItemCard); - } - }, [ProdCat, ItemCard, withoutSubCatItemCard, noSubcatCardData]); + const priceChangeColumns = [ + { + title: 'S.No', + dataIndex: 'SlNo', + key: 'SlNo', + width: '60px', + align: 'center', + render: (text, record, index) => ( +
{(currentPage - 1) * pageSize + index + 1}
+ ), + }, + { + title: 'Product Name', + dataIndex: 'ProdName', + key: 'ProdName', + }, + { + title: 'Old MRP', + dataIndex: 'MRP', + key: 'MRP', + width: '100px', + align: 'right', + }, + { + title: 'New MRP (Optional)', + dataIndex: 'NewMRP', + key: 'NewMRP', + width: '100px', + align: 'right', + render: (text, record, index) => { + // if (index === editingKey) { - const priceChangeColumns = [ - { - title: 'S.No', - dataIndex: 'SlNo', - key: 'SlNo', - width: '60px', - align: 'center', - render: (text, record, index) =>
{(currentPage - 1) * pageSize + index + 1}
- }, - { - title: 'Product Name', - dataIndex: 'ProdName', - key: 'ProdName', - }, - { - title: 'Old MRP', - dataIndex: 'MRP', - key: 'MRP', - width: '100px', - align: 'right', - }, - { - title: 'New MRP (Optional)', - dataIndex: 'NewMRP', - key: 'NewMRP', - width: '100px', - align: 'right', - render: (text, record, index) => { - // if (index === editingKey) { + // } + // return
{text ? text : 'Enter New MRP'}
+ return ( + { + if (value === '') { + return Promise.resolve(); + } else if (parseFloat(value) < 1) { + return Promise.reject(`MRP should be greater than 0`); + } + return Promise.resolve(); + }, + }, + ]} + > + handleNewMRPChange(e?.target?.value, index)} + inputMode="decimal" + onInput={(e) => { + let cleanedValue = e.target.value.replace(/[^0-9.]/g, ''); // Remove invalid characters + const parts = cleanedValue.split('.'); - // } - // return
{text ? text : 'Enter New MRP'}
- return ( - { - if (value === '') { - return Promise.resolve(); - } else if (parseFloat(value) < 1) { - return Promise.reject(`MRP should be greater than 0`) - } - return Promise.resolve(); - }, - }, - ]}> - handleNewMRPChange(e?.target?.value, index)} - inputMode="decimal" - onInput={(e) => { - let cleanedValue = e.target.value.replace( - /[^0-9.]/g, - '' - ); // Remove invalid characters - const parts = cleanedValue.split('.'); + if (cleanedValue.startsWith('.')) { + cleanedValue = '0' + cleanedValue; + } - if (cleanedValue.startsWith('.')) { - cleanedValue = '0' + cleanedValue; - } + e.target.value = + parts.length > 2 + ? `${parts[0]}.${parts.slice(1).join('')}` + : cleanedValue; + }} + /> + + ); + }, + }, + { + title: 'Old Sell Price', + dataIndex: 'SellPrice', + key: 'SellPrice', + width: '120px', + align: 'right', + }, + { + title: 'New Sell Price', + dataIndex: 'NewSellPrice', + key: 'NewSellPrice', + width: '160px', + align: 'right', + render: (text, record, index) => { + // if (index === editingKey) { - e.target.value = - parts.length > 2 - ? `${parts[0]}.${parts.slice(1).join('')}` - : cleanedValue; - }} - /> -
- ); - }, - }, - { - title: 'Old Sell Price', - dataIndex: 'SellPrice', - key: 'SellPrice', - width: '120px', - align: 'right', - }, - { - title: 'New Sell Price', - dataIndex: 'NewSellPrice', - key: 'NewSellPrice', - width: '160px', - align: 'right', - render: (text, record, index) => { - // if (index === editingKey) { + // } + // return
{text ? text : 'Enter New Sell Price'}
+ return ( + { + if (value === '') { + return Promise.resolve(); + } else if (parseFloat(value) < 1) { + return Promise.reject( + `Sell Price should be greater than 0` + ); + } + return Promise.resolve(); + }, + }, + ]} + > + + handleNewSellPriceChange(e?.target?.value, index) + } + inputMode="decimal" + onInput={(e) => { + let cleanedValue = e.target.value.replace(/[^0-9.]/g, ''); // Remove invalid characters + const parts = cleanedValue.split('.'); - // } - // return
{text ? text : 'Enter New Sell Price'}
- return ( - { - if (value === '') { - return Promise.resolve(); - } else if (parseFloat(value) < 1) { - return Promise.reject(`Sell Price should be greater than 0`) - } - return Promise.resolve(); - }, - }, - ]} - > - handleNewSellPriceChange(e?.target?.value, index)} - inputMode="decimal" - onInput={(e) => { - let cleanedValue = e.target.value.replace( - /[^0-9.]/g, - '' - ); // Remove invalid characters - const parts = cleanedValue.split('.'); + if (cleanedValue.startsWith('.')) { + cleanedValue = '0' + cleanedValue; + } - if (cleanedValue.startsWith('.')) { - cleanedValue = '0' + cleanedValue; - } + e.target.value = + parts.length > 2 + ? `${parts[0]}.${parts.slice(1).join('')}` + : cleanedValue; + }} + /> + + ); + }, + }, + ]; - e.target.value = - parts.length > 2 - ? `${parts[0]}.${parts.slice(1).join('')}` - : cleanedValue; - }} - /> -
- ); - }, - }, - ]; + const cardData = !globalAccessForOthers + ? CardAccess + ? SelectedDatas?.length > 1 + ? SelectedDatas + : SelectedDatas?.[0]?.AppId === 0 && SelectedDatas?.[0]?.CompId === 0 + ? [] + : SelectedDatas + : ItemCard?.length === 0 || + (ItemCard?.[0]?.AppId === 0 && ItemCard?.[0]?.CompId === 0) + ? noSubcatCardData + : ItemCard + : []; - const cardData = !globalAccessForOthers - ? CardAccess - ? SelectedDatas?.length > 1 - ? SelectedDatas - : SelectedDatas?.[0]?.AppId === 0 && SelectedDatas?.[0]?.CompId === 0 - ? [] - : SelectedDatas - : ItemCard?.length === 0 || (ItemCard?.[0]?.AppId === 0 && ItemCard?.[0]?.CompId === 0) - ? noSubcatCardData - : ItemCard - : ''; + console.log(cardData, 'noSubcatCardDatanoSubcatCardData', ItemCard); - console.log(cardData, "noSubcatCardDatanoSubcatCardData", ItemCard) + useEffect(() => { + + const extractStockDtls = (data) => { + if (data?.length === 0 || !data) return []; - useEffect(() => { - const extractStockDtls = (data) => { - if (data?.length === 0) return []; + let stockDtls = [];git - let stockDtls = []; + data?.forEach((item) => { + let products = item?.ProductDetail?.flatMap((product) => product); - data?.forEach(item => { - let products = item?.ProductDetail?.flatMap(product => product); + let variants = products?.flatMap( + (product) => product?.ProdVariantDetails + ); + const filteredVariants = variants?.filter( + (variant) => variant?.StockDetails?.length > 0 + ); + const stocks = filteredVariants?.flatMap((variant) => + variant?.StockDetails?.map((stock) => ({ + ...stock, + ProdName: + products?.[0]?.ProdName + + (variant?.ProdVariantName + ? ` (${variant?.ProdVariantName})` + : ''), + StockAvailable: products?.[0]?.StockAvailable, + ProdVariantName: variant?.ProdVariantName, + })) + ); - let variants = products?.flatMap(product => product?.ProdVariantDetails); - const filteredVariants = variants?.filter(variant => variant?.StockDetails?.length > 0); - const stocks = filteredVariants?.flatMap(variant => - variant?.StockDetails?.map(stock => ({ - ...stock, - ProdName: products?.[0]?.ProdName + (variant?.ProdVariantName ? ` (${variant?.ProdVariantName})` : ''), - StockAvailable: products?.[0]?.StockAvailable, - ProdVariantName: variant?.ProdVariantName - })) - ); + stockDtls.push( + ...stocks?.filter((stock) => + stock?.StockAvailable === 'Y' ? stock?.BatchRef : true + ) + ); + }); + console.log('extractStockDtls', stockDtls); + return stockDtls; + }; + setTableData(extractStockDtls(priceChangeProduct || cardData || [])); + setCurrentPage(1); + }, [cardData, priceChangeProduct]); - stockDtls.push(...stocks?.filter(stock => - stock?.StockAvailable === 'Y' - ? stock?.BatchRef - : true - )); + const handleNewMRPChange = (value, index) => { + const updatedTableData = [...tableData]; + updatedTableData[index].NewMRP = value; + setTableData(updatedTableData); + updatedTableData[index].NewSellPrice = null; + formRef.current.setFieldsValue({ + [`NewMRP${index}`]: value, + [`NewSellPrice${index}`]: null, + }); - }); - console.log("extractStockDtls", stockDtls); - return stockDtls; - } - setTableData(extractStockDtls(priceChangeProduct || cardData)) - setCurrentPage(1) - }, [cardData, priceChangeProduct]) + const priceChangedProdList = [...priceChangedProducts]; + const prodIndex = priceChangedProdList?.findIndex( + (prod) => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId + ); + if (prodIndex !== -1) { + priceChangedProdList[prodIndex] = { + ...priceChangedProdList?.[prodIndex], + NewMRP: value, + NewSellPrice: null, + }; + } + setPriceChangedProducts(priceChangedProdList); + }; - const handleNewMRPChange = (value, index) => { - - const updatedTableData = [...tableData]; - updatedTableData[index].NewMRP = value; - setTableData(updatedTableData); + const handleNewSellPriceChange = (value, index) => { + const updatedTableData = [...tableData]; + if (updatedTableData[index]?.NewMRP) { + if (parseFloat(value) > parseFloat(updatedTableData[index]?.NewMRP)) { + setMessageType('error'); + setMessageData('New Sell Price cannot be greater than New MRP'); + formRef.current.setFieldsValue({ + [`NewSellPrice${index}`]: null, + }); updatedTableData[index].NewSellPrice = null; - formRef.current.setFieldsValue({ - [`NewMRP${index}`]: value, - [`NewSellPrice${index}`]: null, - }); - - const priceChangedProdList = [...priceChangedProducts]; - const prodIndex = priceChangedProdList?.findIndex(prod => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId); - if (prodIndex !== -1) { - priceChangedProdList[prodIndex] = { - ...priceChangedProdList?.[prodIndex], - NewMRP: value, - NewSellPrice: null, - }; - } - setPriceChangedProducts(priceChangedProdList); - } - - const handleNewSellPriceChange = (value, index) => { - const updatedTableData = [...tableData]; - if (updatedTableData[index]?.NewMRP) { - if (parseFloat(value) > parseFloat(updatedTableData[index]?.NewMRP)) { - setMessageType('error'); - setMessageData('New Sell Price cannot be greater than New MRP'); - formRef.current.setFieldsValue({ - [`NewSellPrice${index}`]: null, - }); - updatedTableData[index].NewSellPrice = null; - setTableData(updatedTableData); - const priceChangedProdList = [...priceChangedProducts]; - const prodIndex = priceChangedProdList?.findIndex(prod => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId); - - if (prodIndex !== -1) { - priceChangedProdList.splice(prodIndex, 1); - } - setPriceChangedProducts(priceChangedProdList); - return; - } - } - if (!updatedTableData[index]?.NewMRP && updatedTableData[index]?.MRP) { - if (parseFloat(value) > parseFloat(updatedTableData[index]?.MRP)) { - setMessageType('error'); - setMessageData('New Sell Price cannot be greater than MRP'); - formRef.current.setFieldsValue({ - [`NewSellPrice${index}`]: null, - }); - updatedTableData[index].NewSellPrice = null; - setTableData(updatedTableData); - const priceChangedProdList = [...priceChangedProducts]; - const prodIndex = priceChangedProdList?.findIndex(prod => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId); - - if (prodIndex !== -1) { - priceChangedProdList.splice(prodIndex, 1); - } - setPriceChangedProducts(priceChangedProdList); - return; - } - } - updatedTableData[index].NewSellPrice = value; setTableData(updatedTableData); - formRef.current.setFieldsValue({ - [`NewSellPrice${index}`]: value, - }); - const priceChangedProdList = [...priceChangedProducts]; - const prodIndex = priceChangedProdList?.findIndex(prod => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId); + const prodIndex = priceChangedProdList?.findIndex( + (prod) => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId + ); if (prodIndex !== -1) { - priceChangedProdList[prodIndex] = { - ...priceChangedProdList[prodIndex], - SellPrice: String(value) - }; - } else { - priceChangedProdList.push({ - ProdId: updatedTableData[index]?.ProdId, - ProdName: updatedTableData[index]?.ProdName, - MRP: String(updatedTableData[index]?.NewMRP || updatedTableData[index]?.MRP), - SellPrice: String(value), - AdjComment: "string", - InwardDtlId: updatedTableData[index]?.InwardDtlId - }); + priceChangedProdList.splice(prodIndex, 1); } - setPriceChangedProducts(priceChangedProdList); + return; + } } + if (!updatedTableData[index]?.NewMRP && updatedTableData[index]?.MRP) { + if (parseFloat(value) > parseFloat(updatedTableData[index]?.MRP)) { + setMessageType('error'); + setMessageData('New Sell Price cannot be greater than MRP'); + formRef.current.setFieldsValue({ + [`NewSellPrice${index}`]: null, + }); + updatedTableData[index].NewSellPrice = null; + setTableData(updatedTableData); + const priceChangedProdList = [...priceChangedProducts]; + const prodIndex = priceChangedProdList?.findIndex( + (prod) => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId + ); - const edit = (record, index) => { - console.log("edit", record, index); - setEditingKey(index); - } - - const handleSubmit = async () => { - console.log("submit"); - - if (priceChangedProducts?.length > 0) { - console.log("priceChangedProducts", priceChangedProducts); - const validation = priceChangedProducts?.every((prod) => { - if (parseFloat(prod?.MRP) < parseFloat(prod?.SellPrice)) { - setMessageType('error'); - setMessageData(`${prod?.ProdName}: MRP cannot be less than Sell Price`); - return false; - } - if (!parseFloat(prod?.SellPrice) || !parseFloat(prod?.MRP)) { - setMessageType('error'); - setMessageData(`${prod?.ProdName}: Please give Sell Price or MRP`); - return false; - } - return true; - }); - if (!validation) return; - - const data = { - AppId: AppId, - CompId: CompId, - BranchId: BranchId, - ProductDetails: priceChangedProducts, - UpdatedBy: UserId, - } - - const res = await dispatch(PutStockPrice(data))?.unwrap(); - if (res?.data?.statusCode === 1) { - setMessageData('Price Changed Successfully'); - setMessageType('success'); - setPriceChangeModal(false); - setProductPriceChange(false); - setEditingKey(null); - setPriceChangedProducts([]); - setTableData([]); - dispatch(triggerProductCard()) - setPriceChangeProduct(null); - formRef.current.resetFields(); - } else { - setMessageData('Error Updating Product Price') - setMessageType('error'); - } - } else { - setMessageType('error'); - setMessageData('No changes made / No sell price entered'); + if (prodIndex !== -1) { + priceChangedProdList.splice(prodIndex, 1); } + setPriceChangedProducts(priceChangedProdList); + return; + } + } + updatedTableData[index].NewSellPrice = value; + setTableData(updatedTableData); + formRef.current.setFieldsValue({ + [`NewSellPrice${index}`]: value, + }); + const priceChangedProdList = [...priceChangedProducts]; + const prodIndex = priceChangedProdList?.findIndex( + (prod) => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId + ); + + if (prodIndex !== -1) { + priceChangedProdList[prodIndex] = { + ...priceChangedProdList[prodIndex], + SellPrice: String(value), + }; + } else { + priceChangedProdList.push({ + ProdId: updatedTableData[index]?.ProdId, + ProdName: updatedTableData[index]?.ProdName, + MRP: String( + updatedTableData[index]?.NewMRP || updatedTableData[index]?.MRP + ), + SellPrice: String(value), + AdjComment: 'string', + InwardDtlId: updatedTableData[index]?.InwardDtlId, + }); } - const onComplete = useCallback(() => { - setMessageData(null); - setMessageType(null); - }, []) + setPriceChangedProducts(priceChangedProdList); + }; - return ( - <> + const edit = (record, index) => { + console.log('edit', record, index); + setEditingKey(index); + }; - - {showButton ? - - : <>} - { - setPriceChangeModal(false); - setProductPriceChange(false); - setEditingKey(null); - setPriceChangedProducts([]); - formRef?.current?.resetFields(); - setPriceChangeProduct(null); - }} - handleSubmit={handleSubmit} + const handleSubmit = async () => { + console.log('submit'); + + if (priceChangedProducts?.length > 0) { + console.log('priceChangedProducts', priceChangedProducts); + const validation = priceChangedProducts?.every((prod) => { + if (parseFloat(prod?.MRP) < parseFloat(prod?.SellPrice)) { + setMessageType('error'); + setMessageData( + `${prod?.ProdName}: MRP cannot be less than Sell Price` + ); + return false; + } + if (!parseFloat(prod?.SellPrice) || !parseFloat(prod?.MRP)) { + setMessageType('error'); + setMessageData(`${prod?.ProdName}: Please give Sell Price or MRP`); + return false; + } + return true; + }); + if (!validation) return; + + const data = { + AppId: AppId, + CompId: CompId, + BranchId: BranchId, + ProductDetails: priceChangedProducts, + UpdatedBy: UserId, + }; + + const res = await dispatch(PutStockPrice(data))?.unwrap(); + if (res?.data?.statusCode === 1) { + setMessageData('Price Changed Successfully'); + setMessageType('success'); + setPriceChangeModal(false); + setProductPriceChange(false); + setEditingKey(null); + setPriceChangedProducts([]); + setTableData([]); + dispatch(triggerProductCard()); + setPriceChangeProduct(null); + formRef.current.resetFields(); + } else { + setMessageData('Error Updating Product Price'); + setMessageType('error'); + } + } else { + setMessageType('error'); + setMessageData('No changes made / No sell price entered'); + } + }; + + const onComplete = useCallback(() => { + setMessageData(null); + setMessageType(null); + }, []); + + return ( + <> + + {showButton ? ( + + + + ) : ( + <> + )} + { + setPriceChangeModal(false); + setProductPriceChange(false); + setEditingKey(null); + setPriceChangedProducts([]); + formRef?.current?.resetFields(); + setPriceChangeProduct(null); + }} + handleSubmit={handleSubmit} + > +
+ {/*
Note : Click on a row to edit/modify
*/} +
+ ({ + onClick: () => { + edit(record, index); + }, + })} + /> +
-
- {/*
Note : Click on a row to edit/modify
*/} - - ({ - onClick: () => { - edit(record, index); - }, - })} - /> -
- setCurrentPage(page)} - showSizeChanger={false} - showTotal={(total, range) => `${range[0]}-${range[1]} of ${total} items`} - /> -
- -
- - - ) -} + setCurrentPage(page)} + showSizeChanger={false} + showTotal={(total, range) => + `${range[0]}-${range[1]} of ${total} items` + } + /> +
+ +
+
+ + ); +}; -export default ProductPriceChange; \ No newline at end of file +export default ProductPriceChange; From 544bb96ab663170c7e48187e44ced404f580bf49 Mon Sep 17 00:00:00 2001 From: Tamilselvan Date: Tue, 3 Feb 2026 12:18:32 +0530 Subject: [PATCH 10/20] enhancepurchaseentry --- src/Pages/StockMaster/StockBulkUpload.jsx | 460 ++++++++++++++-------- src/Pages/StockMaster/StockList.jsx | 140 ++++--- 2 files changed, 374 insertions(+), 226 deletions(-) diff --git a/src/Pages/StockMaster/StockBulkUpload.jsx b/src/Pages/StockMaster/StockBulkUpload.jsx index 7f55e98..ded6234 100644 --- a/src/Pages/StockMaster/StockBulkUpload.jsx +++ b/src/Pages/StockMaster/StockBulkUpload.jsx @@ -1,4 +1,10 @@ -import React, { useState, useRef, useEffect, useContext, useCallback } from 'react'; +import React, { + useState, + useRef, + useEffect, + useContext, + useCallback, +} from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { read, utils } from 'xlsx'; import ExcelJS from 'exceljs'; @@ -19,12 +25,15 @@ import { MdOutlineAppRegistration } from 'react-icons/md'; import { DefaultModal } from '../../Components/Modal/DefaultModal.jsx'; import Buttons from '../../Components/Forms/Buttons.jsx'; import { IoClose } from 'react-icons/io5'; -import { ArrowRightOutlined } from '@ant-design/icons' +import { ArrowRightOutlined } from '@ant-design/icons'; import { ApplicationPreferences } from '../../Features/BrachLogin/BranchLogin.js'; import FormHeader from '../PageComponents/FormHeader.jsx'; import { DropDowns } from '../../Components/Forms/DropDown.jsx'; import { getSession } from '../../Services/Others.js'; -import { getFieldSetupData, postFieldSetup } from '../../Features/ProductPage/ProductPage.js'; +import { + getFieldSetupData, + postFieldSetup, +} from '../../Features/ProductPage/ProductPage.js'; import { Messages } from '../../Components/Notifications/Messages.jsx'; import { getPurchaseSupplierAndWareHouseData } from '../../Features/PurchaseOrder/PurchaseOrder.js'; import { getSupplaierIdwithTypeBasedProducts } from '../../Features/SupplierProductMapping/SupplierProductMapping.js'; @@ -57,10 +66,10 @@ const StockExcel = ({ const dispatch = useDispatch(); - const AppId = getSession("AppId"); - const CompId = getSession("CompId"); - const BranchId = getSession("BranchId"); - const UserId = getSession("UserId"); + const AppId = getSession('AppId'); + const CompId = getSession('CompId'); + const BranchId = getSession('BranchId'); + const UserId = getSession('UserId'); const formRef = useRef(null); const fileInputRef = useRef(fileInputRefSelector); @@ -70,14 +79,14 @@ const StockExcel = ({ const excelFileError = useSelector(excelFileErrorSelector); const ApplicationPreferenceData = useSelector(ApplicationPreferences); const purchaseReceiptBulkUploadCatId = ApplicationPreferenceData?.find( - p => p?.PreferredCatName?.toLowerCase() === "purchase receipt bulk" + (p) => p?.PreferredCatName?.toLowerCase() === 'purchase receipt bulk' )?.PreferredCatId; const [worksheet1, setWorksheet1] = useState(null); const [editdelete, seteditdelete] = useState(''); const [Datas, setDatas] = useState(); - console.log(Datas, "Datas") + console.log(Datas, 'Datas'); const [showSupplierModal, setShowSupplierModal] = useState(false); const [suppliers, setSuppliers] = useState([]); const [selectedSupplier, setSelectedSupplier] = useState(null); @@ -96,7 +105,7 @@ const StockExcel = ({ useEffect(() => { getFieldSetup(); - }, [purchaseReceiptBulkUploadCatId]) + }, [purchaseReceiptBulkUploadCatId]); const onComplete = useCallback(() => { setMessageData(null); @@ -105,19 +114,33 @@ const StockExcel = ({ const getFieldSetup = async () => { try { - const response = await dispatch(getFieldSetupData({ AppId, CompId, BranchId, categoryId: purchaseReceiptBulkUploadCatId, Type: 'EB' })).unwrap(); + const response = await dispatch( + getFieldSetupData({ + AppId, + CompId, + BranchId, + categoryId: purchaseReceiptBulkUploadCatId, + Type: 'EB', + }) + ).unwrap(); if (response?.data?.statusCode === 1) { - console.log(response?.data?.data?.[0]?.ConfigDtl, "Field Setup Data"); - setSelectedFields(response?.data?.data?.[0]?.ConfigDtl?.filter(c => c.ConfigId && c.Access === 'Y')?.map(c => c.ConfigId) || []); - setTableFieldPreferences(response?.data?.data?.[0]?.ConfigDtl?.map(c => ({ - value: c.ConfigId, - label: c.ConfigName, - access: c.Access - })) || []); + console.log(response?.data?.data?.[0]?.ConfigDtl, 'Field Setup Data'); + setSelectedFields( + response?.data?.data?.[0]?.ConfigDtl?.filter( + (c) => c.ConfigId && c.Access === 'Y' + )?.map((c) => c.ConfigId) || [] + ); + setTableFieldPreferences( + response?.data?.data?.[0]?.ConfigDtl?.map((c) => ({ + value: c.ConfigId, + label: c.ConfigName, + access: c.Access, + })) || [] + ); setFieldValues(response?.data?.data?.[0]?.ConfigDtl); } else { - setMessageType("error"); - setMessageData("Failed to fetch field setup"); + setMessageType('error'); + setMessageData('Failed to fetch field setup'); } } catch (error) { console.error('Error fetching field setup:', error); @@ -131,7 +154,7 @@ const StockExcel = ({ slicedData.forEach((item, index) => { // Skip empty rows - if (!item || Object.values(item).every(val => !val)) return; + if (!item || Object.values(item).every((val) => !val)) return; const rowData = { key: index, @@ -164,8 +187,10 @@ const StockExcel = ({ if (String(supplierValue).trim() === 'Self') { rowData.OwnWithPaid = item['2']; // Shift all subsequent columns by 1 - Object.keys(rowData).forEach(key => { - if (!['key', 'InwardDate', 'Supplier', 'OwnWithPaid'].includes(key)) { + Object.keys(rowData).forEach((key) => { + if ( + !['key', 'InwardDate', 'Supplier', 'OwnWithPaid'].includes(key) + ) { const currentIndex = parseInt(Object.keys(rowData).indexOf(key)); rowData[key] = item[currentIndex.toString()]; } @@ -182,18 +207,26 @@ const StockExcel = ({ { key: 'BatchNo', header: 'Batch No.' }, { key: 'ModelNo', header: 'Model No.' }, { key: 'RejectedQty', header: 'Rejected Qty' }, - { key: 'FreeQty', header: 'Free Qty' } + { key: 'FreeQty', header: 'Free Qty' }, + { key: 'WholesalePrice', header: 'Wholesale Price' }, ]; // Get headers from first row to determine which optional fields exist const headers = excelData[0]; - optionalFields.forEach(field => { + optionalFields.forEach((field) => { if (headers.includes(field.header)) { rowData[field.key] = item[currentColIndex.toString()]; currentColIndex++; } }); - if (rowData?.Amount && rowData?.MRP && rowData?.SalesPrice && rowData?.ProductName && rowData?.PaymentAmount) { + if ( + rowData?.PurchaseRate && + rowData?.Amount && + rowData?.MRP && + rowData?.SalesPrice && + rowData?.ProductName && + rowData?.PaymentAmount + ) { ExcelToJsConversion.push(rowData); } }); @@ -292,12 +325,17 @@ const StockExcel = ({ // ...existing code... const handleDownload = async () => { try { - if (!supplierProducts || supplierProducts.length === 0 || !selectedSupplierData) { + if ( + !supplierProducts || + supplierProducts.length === 0 || + !selectedSupplierData + ) { setMessageData('No products available to generate Excel.'); setMessageType('warning'); return; } - const supplierDisplayName = getSupplierDisplayName(selectedSupplierData) || 'Supplier'; + const supplierDisplayName = + getSupplierDisplayName(selectedSupplierData) || 'Supplier'; // Fetch excelColumns config (optional fields access) let excelColumns = []; try { @@ -314,12 +352,17 @@ const StockExcel = ({ excelColumns = response?.data?.data?.[0]?.ConfigDtl || []; } } catch (err) { - console.warn('Failed to fetch excelColumns config, proceeding with defaults', err); + console.warn( + 'Failed to fetch excelColumns config, proceeding with defaults', + err + ); excelColumns = []; } const isOptionalFieldAllowed = (name) => { - const found = excelColumns.find((c) => String(c.ConfigName).trim() === String(name).trim()); + const found = excelColumns.find( + (c) => String(c.ConfigName).trim() === String(name).trim() + ); return found ? found.Access === 'Y' : false; }; @@ -331,7 +374,7 @@ const StockExcel = ({ allowBlank: allowBlank, showErrorMessage: true, errorTitle: 'Invalid Number', - error: 'Please enter a valid number' + error: 'Please enter a valid number', }; }; @@ -374,12 +417,20 @@ const StockExcel = ({ pushCol('Amount Per Piece', 'AmountPerPiece', true); pushCol('Number of Piece Inside', 'NumberofPieceInside', true); - if (isOptionalFieldAllowed('Manufacture Date')) pushCol('Manufacture Date', 'ManufDate', false); - if (isOptionalFieldAllowed('Expire Date')) pushCol('Expire Date', 'ExpDate', false); - if (isOptionalFieldAllowed('Batch No.')) pushCol('Batch No.', 'BatchNo', false); - if (isOptionalFieldAllowed('Model No.')) pushCol('Model No.', 'ModelNo', false); - if (isOptionalFieldAllowed('Rejected Qty')) pushCol('Rejected Qty', 'RejectedQty', false); - if (isOptionalFieldAllowed('Free Qty')) pushCol('Free Qty', 'FreeQty', false); + if (isOptionalFieldAllowed('Manufacture Date')) + pushCol('Manufacture Date', 'ManufDate', false); + if (isOptionalFieldAllowed('Expire Date')) + pushCol('Expire Date', 'ExpDate', false); + if (isOptionalFieldAllowed('Batch No.')) + pushCol('Batch No.', 'BatchNo', false); + if (isOptionalFieldAllowed('Model No.')) + pushCol('Model No.', 'ModelNo', false); + if (isOptionalFieldAllowed('Rejected Qty')) + pushCol('Rejected Qty', 'RejectedQty', false); + if (isOptionalFieldAllowed('Free Qty')) + pushCol('Free Qty', 'FreeQty', false); + if (isOptionalFieldAllowed('Wholesale Price')) + pushCol('Wholesale Price', 'WholesalePrice', false); worksheet.columns = columns.map((c) => ({ header: c.header, @@ -388,7 +439,11 @@ const StockExcel = ({ c.key === 'ProdName' || c.key === 'VariantName' ? 40 : c.key === 'Quantity' - ? 10 : c.key === 'Supplier' || c.key === 'InvoiceDeliveryChallan' || c.key === 'SupplierInvoiceNumber' ? 30 + ? 10 + : c.key === 'Supplier' || + c.key === 'InvoiceDeliveryChallan' || + c.key === 'SupplierInvoiceNumber' + ? 30 : 20, })); @@ -410,12 +465,21 @@ const StockExcel = ({ }; }); - hiddenSheet.addRow(['ProductName', 'VariantName', 'MRP', 'SellPrice', 'Number of Piece Inside', 'Amount Per Piece']); + hiddenSheet.addRow([ + 'ProductName', + 'VariantName', + 'MRP', + 'SellPrice', + 'Number of Piece Inside', + 'Amount Per Piece', + ]); let currentRow = 2; const productNames = supplierProducts.map((p) => p.ProdName); supplierProducts.forEach((product) => { - const activeVariants = (product.ProdVariantPriceDetails || []).filter(v => v.ActiveStatus === 'A'); + const activeVariants = (product.ProdVariantPriceDetails || []).filter( + (v) => v.ActiveStatus === 'A' + ); const uniqueVariantsMap = new Map(); activeVariants.forEach((variant) => { const variantName = variant.ProdVariantName; @@ -442,7 +506,8 @@ const StockExcel = ({ .trim() .replace(/[^A-Za-z0-9_]/g, '_') .replace(/^(\d)/, '_$1'); - if (!safeName) safeName = `Product_${Math.random().toString(36).slice(2, 8)}`; + if (!safeName) + safeName = `Product_${Math.random().toString(36).slice(2, 8)}`; const rangeRef = `ProductVariantMap!$B$${startRow}:$B$${endRow}`; try { workbook.definedNames.add(rangeRef, safeName); @@ -452,10 +517,41 @@ const StockExcel = ({ }); const startDataRow = 2; - const numberOfRows = 50; - for (let i = 0; i < numberOfRows; i++) { - worksheet.addRow({}); - } + const today = new Date(); + + // Pre-populate all products and variants as rows + supplierProducts.forEach((product) => { + const activeVariants = (product.ProdVariantPriceDetails || []).filter( + (v) => v.ActiveStatus === 'A' + ); + const uniqueVariantsMap = new Map(); + activeVariants.forEach((variant) => { + const variantName = variant.ProdVariantName; + if (!uniqueVariantsMap.has(variantName)) { + uniqueVariantsMap.set(variantName, variant); + } + }); + const uniqueVariants = Array.from(uniqueVariantsMap.values()); + + uniqueVariants.forEach((variant) => { + const rowData = { + InwardDate: today, + Supplier: supplierDisplayName, + ProdName: product.ProdName, + VariantName: variant.ProdVariantName, + MRP: variant.MRP || 0, + SalesPrice: variant.SellPrice || 0, + NumberofPieceInside: variant.NoOfPcs || 0, + AmountPerPiece: variant.OnePcsPrice || 0, + }; + + if (String(selectedSupplierData?.SuppName).trim() === 'Self') { + rowData.OwnWithPaid = ''; + } + + worksheet.addRow(rowData); + }); + }); const colKeyToIndex = {}; worksheet.columns.forEach((c, idx) => { @@ -473,47 +569,19 @@ const StockExcel = ({ return s; }; - const today = new Date(); const inwardDateCol = colIndex('InwardDate'); - if (inwardDateCol) { - const cell = worksheet.getCell(`${colLetter(inwardDateCol)}${startDataRow}`); - cell.value = today; - cell.numFmt = 'yyyy-mm-dd'; - } + const numberOfRows = worksheet.rowCount; - const supplierName = selectedSupplierData?.SuppName || ''; - const productNamesLiteral = productNames.join(','); - - for (let r = startDataRow; r < startDataRow + numberOfRows; r++) { + for (let r = startDataRow; r <= numberOfRows; r++) { if (colIndex('ProdName')) { const cIdx = colIndex('ProdName'); - const letter = colLetter(cIdx); - const prodCellRef = `${letter}${r}`; - const cell = worksheet.getCell(prodCellRef); - cell.dataValidation = { - type: 'list', - allowBlank: false, - formulae: [`"${productNamesLiteral}"`], - }; - cell.protection = { locked: false }; + const cell = worksheet.getCell(r, cIdx); + cell.protection = { locked: true }; } if (colIndex('VariantName')) { const cIdx = colIndex('VariantName'); - const letter = colLetter(cIdx); - const varCellRef = `${letter}${r}`; - const productColLetter = colLetter(colIndex('ProdName')); - const productCellRef = `${productColLetter}${r}`; - const formula = `INDIRECT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(${productCellRef}," ","_"),"-","_"),"&","_"),"/","_"),".","_"),"(","_"),")","_"),"[","_"),"]","_"),",","_"))`; - const cell = worksheet.getCell(varCellRef); - cell.dataValidation = { - type: 'list', - allowBlank: true, - formulae: [formula], - showErrorMessage: true, - errorTitle: 'Invalid Variant', - error: 'Please select a variant from the dropdown' - }; - cell.protection = { locked: false }; + const cell = worksheet.getCell(r, cIdx); + cell.protection = { locked: true }; } if (colIndex('Quantity')) { const cIdx = colIndex('Quantity'); @@ -544,7 +612,8 @@ const StockExcel = ({ error: 'Must be a valid number and less than total quantity', showInputMessage: true, promptTitle: 'Rejected Qty', - prompt: 'Enter rejected quantity (must be less than total quantity)' + prompt: + 'Enter rejected quantity (must be less than total quantity)', }; rejCell.protection = { locked: false }; } @@ -565,31 +634,55 @@ const StockExcel = ({ formulae: [new Date(1900, 0, 1)], showErrorMessage: true, errorTitle: 'Invalid Date', - error: 'Please enter a valid date' + error: 'Please enter a valid date', }; dCell.protection = { locked: false }; } if (colIndex('Supplier')) { const cIdx = colIndex('Supplier'); const cell = worksheet.getCell(r, cIdx); - cell.dataValidation = { type: 'list', formulae: [`"${supplierDisplayName}"`] }; - cell.value = supplierDisplayName; - cell.protection = { locked: false }; + cell.protection = { locked: true }; } + if (colIndex('OwnWithPaid')) { const cIdx = colIndex('OwnWithPaid'); const cell = worksheet.getCell(r, cIdx); - cell.dataValidation = { type: 'list', formulae: ['"Own,With Paid"'] }; + + cell.dataValidation = { + type: 'list', + formulae: ['"Own,With Paid"'], + allowBlank: true + }; + + if (!cell.value) { + cell.value = 'Own'; + } + cell.protection = { locked: false }; } + if (colIndex('InvoiceDeliveryChallan')) { const cIdx = colIndex('InvoiceDeliveryChallan'); const cell = worksheet.getCell(r, cIdx); - cell.dataValidation = { type: 'list', formulae: ['"Invoice,Delivery Challan"'] }; + + cell.dataValidation = { + type: 'list', + formulae: ['"Invoice,Delivery Challan"'], + allowBlank: true, + }; + + // ✅ Default value + if (!cell.value) { + cell.value = 'Invoice'; + } + cell.protection = { locked: false }; } + if (colIndex('SupplierInvoiceNumber')) { - worksheet.getCell(r, colIndex('SupplierInvoiceNumber')).protection = { locked: false }; + worksheet.getCell(r, colIndex('SupplierInvoiceNumber')).protection = { + locked: false, + }; } if (colIndex('SupplierInvoiceDate')) { const cell = worksheet.getCell(r, colIndex('SupplierInvoiceDate')); @@ -601,12 +694,14 @@ const StockExcel = ({ formulae: [new Date(1900, 0, 1)], showErrorMessage: true, errorTitle: 'Invalid Date', - error: 'Please enter a valid date' + error: 'Please enter a valid date', }; cell.protection = { locked: false }; } if (colIndex('DeliveryChallanNo')) { - worksheet.getCell(r, colIndex('DeliveryChallanNo')).protection = { locked: false }; + worksheet.getCell(r, colIndex('DeliveryChallanNo')).protection = { + locked: false, + }; } if (colIndex('DeliveryInvoiceDate')) { const cell = worksheet.getCell(r, colIndex('DeliveryInvoiceDate')); @@ -618,63 +713,33 @@ const StockExcel = ({ formulae: [new Date(1900, 0, 1)], showErrorMessage: true, errorTitle: 'Invalid Date', - error: 'Please enter a valid date' + error: 'Please enter a valid date', }; cell.protection = { locked: false }; } if (colIndex('MRP')) { const mrpCol = colIndex('MRP'); - const prodCol = colIndex('ProdName'); - const varCol = colIndex('VariantName'); const mrpCell = worksheet.getCell(r, mrpCol); - const prodLetter = colLetter(prodCol); - const varLetter = colLetter(varCol); - mrpCell.value = { - formula: `IF(OR(${prodLetter}${r}="",${varLetter}${r}=""),"",SUMPRODUCT((ProductVariantMap!$A$2:$A$1000=${prodLetter}${r})*(ProductVariantMap!$B$2:$B$1000=${varLetter}${r})*ProductVariantMap!$C$2:$C$1000))` - }; mrpCell.numFmt = '#,##0.00'; mrpCell.protection = { locked: false }; - addNumberValidation(mrpCell, true, 0); } if (colIndex('SalesPrice')) { const spCol = colIndex('SalesPrice'); - const prodCol = colIndex('ProdName'); - const varCol = colIndex('VariantName'); const spCell = worksheet.getCell(r, spCol); - const prodLetter = colLetter(prodCol); - const varLetter = colLetter(varCol); - spCell.value = { - formula: `IF(OR(${prodLetter}${r}="",${varLetter}${r}=""),"",SUMPRODUCT((ProductVariantMap!$A$2:$A$1000=${prodLetter}${r})*(ProductVariantMap!$B$2:$B$1000=${varLetter}${r})*ProductVariantMap!$D$2:$D$1000))` - }; spCell.numFmt = '#,##0.00'; spCell.protection = { locked: false }; - addNumberValidation(spCell, true, 0); } if (colIndex('NumberofPieceInside')) { const nopCol = colIndex('NumberofPieceInside'); - const prodCol = colIndex('ProdName'); - const varCol = colIndex('VariantName'); const nopCell = worksheet.getCell(r, nopCol); - const prodLetter = colLetter(prodCol); - const varLetter = colLetter(varCol); - nopCell.value = { - formula: `IF(OR(${prodLetter}${r}="",${varLetter}${r}=""),"",SUMPRODUCT((ProductVariantMap!$A$2:$A$1000=${prodLetter}${r})*(ProductVariantMap!$B$2:$B$1000=${varLetter}${r})*ProductVariantMap!$E$2:$E$1000))` - }; nopCell.numFmt = '#,##0'; - addNumberValidation(nopCell, true, 0); + nopCell.protection = { locked: false }; } if (colIndex('AmountPerPiece')) { const appCol = colIndex('AmountPerPiece'); - const prodCol = colIndex('ProdName'); - const varCol = colIndex('VariantName'); const appCell = worksheet.getCell(r, appCol); - const prodLetter = colLetter(prodCol); - const varLetter = colLetter(varCol); - appCell.value = { - formula: `IF(OR(${prodLetter}${r}="",${varLetter}${r}=""),"",SUMPRODUCT((ProductVariantMap!$A$2:$A$1000=${prodLetter}${r})*(ProductVariantMap!$B$2:$B$1000=${varLetter}${r})*ProductVariantMap!$F$2:$F$1000))` - }; appCell.numFmt = '#,##0.00'; - addNumberValidation(appCell, true, 0); + appCell.protection = { locked: false }; } if (colIndex('PaymentType')) { const cIdx = colIndex('PaymentType'); @@ -708,13 +773,16 @@ const StockExcel = ({ pmCell.dataValidation = { type: 'list', allowBlank: true, - formulae: [`IF(${paymentTypeLetter}${r}="Paid",ValidationHelper!$A$1:$A$3,"")`], + formulae: [ + `IF(${paymentTypeLetter}${r}="Paid",ValidationHelper!$A$1:$A$3,"")`, + ], showErrorMessage: true, errorTitle: 'Invalid Payment Mode', error: 'Select Cash, Credit, or UPI when Payment Type is Paid', showInputMessage: true, promptTitle: 'Payment Mode', - prompt: 'If Payment Type is Credit, leave empty. If Paid, select: Cash, Credit, or UPI' + prompt: + 'If Payment Type is Credit, leave empty. If Paid, select: Cash, Credit, or UPI', }; pmCell.protection = { locked: false }; } @@ -729,7 +797,7 @@ const StockExcel = ({ formulae: [new Date(1900, 0, 1)], showErrorMessage: true, errorTitle: 'Invalid Date', - error: 'Please enter a valid date' + error: 'Please enter a valid date', }; dueCell.protection = { locked: false }; } @@ -744,7 +812,7 @@ const StockExcel = ({ formulae: [new Date(1900, 0, 1)], showErrorMessage: true, errorTitle: 'Invalid Date', - error: 'Please enter a valid date' + error: 'Please enter a valid date', }; manufCell.protection = { locked: false }; } @@ -759,7 +827,7 @@ const StockExcel = ({ formulae: [new Date(1900, 0, 1)], showErrorMessage: true, errorTitle: 'Invalid Date', - error: 'Please enter a valid date' + error: 'Please enter a valid date', }; expCell.protection = { locked: false }; } @@ -769,7 +837,9 @@ const StockExcel = ({ const rLetter = colLetter(rIdx); const qLetter = colLetter(qIdx); const recCell = worksheet.getCell(`${rLetter}${r}`); - recCell.value = { formula: `IF(${qLetter}${r}="","",${qLetter}${r})` }; + recCell.value = { + formula: `IF(${qLetter}${r}="","",${qLetter}${r})`, + }; addNumberValidation(recCell, true, 0); } if (colIndex('AcceptedQty') && colIndex('Quantity')) { @@ -782,15 +852,21 @@ const StockExcel = ({ const formulaCell = worksheet.getCell(`${aLetter}${r}`); if (rejLetter) { formulaCell.value = { - formula: `IF(${qLetter}${r}="","",MAX(0,${qLetter}${r}-IF(${rejLetter}${r}="",0,${rejLetter}${r})))` + formula: `IF(${qLetter}${r}="","",MAX(0,${qLetter}${r}-IF(${rejLetter}${r}="",0,${rejLetter}${r})))`, }; } else { - formulaCell.value = { formula: `IF(${qLetter}${r}="","",${qLetter}${r})` }; + formulaCell.value = { + formula: `IF(${qLetter}${r}="","",${qLetter}${r})`, + }; } addNumberValidation(formulaCell, true, 0); formulaCell.protection = { locked: true }; } - if (colIndex('PaymentAmount') && colIndex('Quantity') && colIndex('PurchaseRate')) { + if ( + colIndex('PaymentAmount') && + colIndex('Quantity') && + colIndex('PurchaseRate') + ) { const payIdx = colIndex('PaymentAmount'); const qIdx = colIndex('Quantity'); const pIdx = colIndex('PurchaseRate'); @@ -812,7 +888,11 @@ const StockExcel = ({ formulaCell.numFmt = '#,##0.00'; addNumberValidation(formulaCell, true, 0); } - if (colIndex('Amount') && colIndex('Quantity') && colIndex('PurchaseRate')) { + if ( + colIndex('Amount') && + colIndex('Quantity') && + colIndex('PurchaseRate') + ) { const amtIdx = colIndex('Amount'); const qIdx = colIndex('Quantity'); const pIdx = colIndex('PurchaseRate'); @@ -827,11 +907,21 @@ const StockExcel = ({ formula: `IF(${qLetter}${r}="","",IF(${rejLetter}${r}="",(${qLetter}${r})*${pLetter}${r},(${qLetter}${r}-${rejLetter}${r})*${pLetter}${r}))`, }; } else { - amtCell.value = { formula: `IF(${qLetter}${r}="","",(${qLetter}${r})*${pLetter}${r})` }; + amtCell.value = { + formula: `IF(${qLetter}${r}="","",(${qLetter}${r})*${pLetter}${r})`, + }; } amtCell.numFmt = '#,##0.00'; addNumberValidation(amtCell, true, 0); } + if (colIndex('WholesalePrice')) { + const cIdx = colIndex('WholesalePrice'); + const letter = colLetter(cIdx); + const cell = worksheet.getCell(`${letter}${r}`); + cell.protection = { locked: false }; + cell.numFmt = '#,##0.00'; + addNumberValidation(cell, true, 0); + } } await worksheet.protect('', { @@ -1070,6 +1160,12 @@ const StockExcel = ({ key: 'FreeQty', editable: true, }, + { + title: 'Wholesale Price', + dataIndex: 'WholesalePrice', + key: 'WholesalePrice', + editable: true, + }, ]; const column = columns?.map((col) => { @@ -1205,7 +1301,7 @@ const StockExcel = ({ RetailPrice: row?.RetailPrice, AmountperPiece: row?.AmountperPiece, NumberofPieceInside: row?.NumberofPieceInside, - WholeSale: row?.WholeSale, + WholesalePrice: row?.WholesalePrice, Offer: row?.Offer, SplPrice: row?.SplPrice, ReceivedQuantity: row?.ReceivedQuantity, @@ -1245,31 +1341,31 @@ const StockExcel = ({ const handleFieldSetupSubmit = async () => { const postData = { - "AppId": AppId, - "CompId": CompId, - "BranchId": BranchId, - "Type": "EB", - "FormType": "PurchaseEntry", - "TypeId": purchaseReceiptBulkUploadCatId, - "ConfigDtl": selectedFields?.map((field) => ({ - "ConfigId": field, - "Access": 'Y', + AppId: AppId, + CompId: CompId, + BranchId: BranchId, + Type: 'EB', + FormType: 'PurchaseEntry', + TypeId: purchaseReceiptBulkUploadCatId, + ConfigDtl: selectedFields?.map((field) => ({ + ConfigId: field, + Access: 'Y', })), - "CreatedBy": UserId - } + CreatedBy: UserId, + }; const response = await dispatch(postFieldSetup(postData))?.unwrap(); if (response?.data?.statusCode === 1) { - setMessageType("success"); + setMessageType('success'); setMessageData(response?.data?.response); setFieldSetup(false); await getFieldSetup(); } else { - setMessageType("error"); - setMessageData("Failed to set up fields"); + setMessageType('error'); + setMessageData('Failed to set up fields'); } - } + }; const handleFieldSelect = (value) => { setSelectedFields((prev) => { @@ -1320,7 +1416,7 @@ const StockExcel = ({ } catch (error) { console.error('Error fetching suppliers:', error); setMessageData('Failed to fetch suppliers.'); - setMessageType('error') + setMessageType('error'); } }, [CompId, AppId, BranchId, dispatch]); @@ -1331,14 +1427,22 @@ const StockExcel = ({ const type = supplierData.Type; const LocationType = - type === 'Supplier' ? 'S' : type === 'Branch' ? 'B' : type === 'WareHouse' ? 'W' : ''; + type === 'Supplier' + ? 'S' + : type === 'Branch' + ? 'B' + : type === 'WareHouse' + ? 'W' + : ''; const response = await dispatch( getSupplaierIdwithTypeBasedProducts({ CompId: LocationType === 'S' ? CompId : supplierData?.SuppCompId, AppId: LocationType === 'S' ? AppId : supplierData?.SuppAppId, - BranchId: LocationType === 'S' ? BranchId : supplierData?.SuppBranchId, - SuppId: LocationType === 'S' ? supplierId : supplierData?.SuppBranchId, + BranchId: + LocationType === 'S' ? BranchId : supplierData?.SuppBranchId, + SuppId: + LocationType === 'S' ? supplierId : supplierData?.SuppBranchId, LocationType, }) )?.unwrap(); @@ -1349,25 +1453,24 @@ const StockExcel = ({ } else { setSupplierProducts([]); setMessageData('No products are mapped to this supplier.'); - setMessageType('warning') + setMessageType('warning'); } } else { setSupplierProducts([]); setMessageData('Failed to fetch supplier products.'); - setMessageType('error') + setMessageType('error'); } } catch (error) { console.error('Error fetching supplier products:', error); setMessageData('An error occurred while fetching products.'); - setMessageType('error') + setMessageType('error'); } }; - const handleSupplierBasedProducts = useCallback(async () => { if (!selectedSupplier) { setMessageData('Please select a supplier.'); - setMessageType('warning') + setMessageType('warning'); return; } @@ -1400,19 +1503,25 @@ const StockExcel = ({ onSubmit={handleFileSubmit} >
-
+

UPLOAD YOUR EXCEL

-
+
+ +
@@ -1549,7 +1658,9 @@ const StockExcel = ({ children={
- +
@@ -1558,11 +1669,16 @@ const StockExcel = ({ label="Select fields" // valueData={selectedFields} onChangeFunction={handleFieldSelect} - options={tableFieldPreferences?.filter(p => !selectedFields?.some(s => s === p.value))} /> + options={tableFieldPreferences?.filter( + (p) => !selectedFields?.some((s) => s === p.value) + )} + />
{selectedFields - ?.map((id) => tableFieldPreferences?.find((p) => p.value === id)) + ?.map((id) => + tableFieldPreferences?.find((p) => p.value === id) + ) .filter(Boolean) .map((field) => (
diff --git a/src/Pages/StockMaster/StockList.jsx b/src/Pages/StockMaster/StockList.jsx index b7bad33..e32cc5e 100644 --- a/src/Pages/StockMaster/StockList.jsx +++ b/src/Pages/StockMaster/StockList.jsx @@ -11,7 +11,11 @@ import { Tables } from '../../Components/Tables/Table'; import FormHeader from '../PageComponents/FormHeader.jsx'; import Search from '../../Components/Forms/Search.jsx'; import Buttons from '../../Components/Forms/Buttons'; -import { getSession, dateFormatChange, ExtractDateFormate } from '../../Services/Others'; +import { + getSession, + dateFormatChange, + ExtractDateFormate, +} from '../../Services/Others'; import { Messages } from '../../Components/Notifications/Messages'; import { getStockData, @@ -175,12 +179,16 @@ const StockList = () => { }; const getPreference = async () => { const data = { AppId: AppId, CompId: CompId, BranchId: BranchId }; - const { data: res } = await dispatch(getPreferenceData(data)).unwrap() - const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find((setting) => setting?.SettingIdName?.toLowerCase() === "decimal" && setting?.SettingValue === 'Y'); + const { data: res } = await dispatch(getPreferenceData(data)).unwrap(); + const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'decimal' && + setting?.SettingValue === 'Y' + ); if (decimalSetting) { - setAllowDecimal(true) + setAllowDecimal(true); } - } + }; const actionsFormatter = async (row, rowIndex) => { navigate( `${subDirectory}setting/purchase-entry/update`, @@ -200,11 +208,15 @@ const StockList = () => { }; const handlePrevImage = () => { - setCurrentImageIndex(prev => prev > 0 ? prev - 1 : productImageDetails.length - 1); + setCurrentImageIndex((prev) => + prev > 0 ? prev - 1 : productImageDetails.length - 1 + ); }; const handleNextImage = () => { - setCurrentImageIndex(prev => prev < productImageDetails.length - 1 ? prev + 1 : 0); + setCurrentImageIndex((prev) => + prev < productImageDetails.length - 1 ? prev + 1 : 0 + ); }; const handleProductmodalCancel = () => { @@ -218,7 +230,7 @@ const StockList = () => { setImageModal(false); setProductImageDetails([]); setCurrentImageIndex(0); - } + }; // WRITED BY SREE function safeRound(amountStr) { if (amountStr == null) return allowDecimal ? '0.00' : '0'; @@ -254,7 +266,8 @@ const StockList = () => { ), filteredValue: [searchedText], onFilter: (value, record) => { - return extractLastNumberOrderId(record.InvoiceNo, record?.FYStatus)?.toString() + return extractLastNumberOrderId(record.InvoiceNo, record?.FYStatus) + ?.toString() .toLowerCase() .includes(value.toLowerCase()); }, @@ -273,11 +286,8 @@ const StockList = () => { key: 'CustSuppName', align: 'center', render: (text, row) => ( - - {row?.CustSuppName || '-'} - + {row?.CustSuppName || '-'} ), - }, { title: 'Supp Invoice No', @@ -285,11 +295,8 @@ const StockList = () => { key: 'SuppInvoiceNo', align: 'center', render: (text, row) => ( - - {row?.SuppInvoiceNo || '-'} - + {row?.SuppInvoiceNo || '-'} ), - }, { @@ -323,17 +330,17 @@ const StockList = () => { align: 'center', render: (data, record) => { if (data?.length > 0) { - return viewImages(data)} - /> + return ( + viewImages(data)} + /> + ); } else { - return

-

+ return

-

; } - } - - , - } + }, + }, ]; const Proddetailcolumns = [ { @@ -529,9 +536,11 @@ const StockList = () => { useEffect(() => { let updatedExceldatasubmit = Exceldatasubmit?.map((excelItem) => { - - const [productName, sizeAndUom] = (excelItem?.ProductName?.split(' (')) || []; - const [size, uomName] = (sizeAndUom ? sizeAndUom.slice(0, -1).split(' ') : []); + const [productName, sizeAndUom] = + excelItem?.ProductName?.split(' (') || []; + const [size, uomName] = sizeAndUom + ? sizeAndUom.slice(0, -1).split(' ') + : []; const matchingProduct = Productdata?.find( (product) => @@ -584,17 +593,17 @@ const StockList = () => { // Helper function to check if product already exists in ProdDetails const isDuplicateProduct = (prodDetails, newItem) => { - return prodDetails.some(item => - item.ProdName === newItem.ProdName && - item.VariantName === newItem.VariantName && - item.MRP === newItem.MRP && - item.SalesPrice === newItem.SalesPrice && - item.Quantity === newItem.Quantity && - item.RejectedQty === newItem.RejectedQty + return prodDetails.some( + (item) => + item.ProdName === newItem.ProdName && + item.VariantName === newItem.VariantName && + item.MRP === newItem.MRP && + item.SalesPrice === newItem.SalesPrice && + item.Quantity === newItem.Quantity && + item.RejectedQty === newItem.RejectedQty ); }; - const handleSubmit = async () => { let FilterData = Exceldatasubmit?.filter((a) => a['ProductName'] != ''); if (FilterData && FilterData.length > 0) { @@ -618,7 +627,7 @@ const StockList = () => { DeliveryInvoiceDate: data.DeliveryInvoiceDate, DueDate: data.DueDate, }, - products: [] + products: [], }; } @@ -636,7 +645,6 @@ const StockList = () => { }; const formattedData = Object.values(groupedData).map((group) => { - const { groupInfo, products } = group; // Calculate totals based on products @@ -666,25 +674,33 @@ const StockList = () => { PaymentMode: groupInfo.PaymentMode, PaymentAmount: PaymentAmount.toFixed(2), InvoiceDate: groupInfo.InwardDate - ? moment(groupInfo.InwardDate, 'YYYY-MM-DD').format('YYYY-MM-DDTHH:mm:ss') + ? moment(groupInfo.InwardDate, 'YYYY-MM-DD').format( + 'YYYY-MM-DDTHH:mm:ss' + ) : null, SuppInvoiceNo: groupInfo.SupplierInvoiceNumber, SuppInvoiceDate: groupInfo.SupplierInvoiceDate - ? moment(groupInfo.SupplierInvoiceDate, 'YYYY-MM-DD').format('YYYY-MM-DDTHH:mm:ss') + ? moment(groupInfo.SupplierInvoiceDate, 'YYYY-MM-DD').format( + 'YYYY-MM-DDTHH:mm:ss' + ) : null, DeliveryChallanNo: groupInfo.DeliveryChallanNo, DeliveryInvoiceDate: groupInfo.DeliveryInvoiceDate - ? moment(groupInfo.DeliveryInvoiceDate, 'YYYY-MM-DD').format('YYYY-MM-DDTHH:mm:ss') + ? moment(groupInfo.DeliveryInvoiceDate, 'YYYY-MM-DD').format( + 'YYYY-MM-DDTHH:mm:ss' + ) : null, DueDate: groupInfo.DueDate - ? moment(groupInfo.DueDate, 'YYYY-MM-DD').format('YYYY-MM-DDTHH:mm:ss') + ? moment(groupInfo.DueDate, 'YYYY-MM-DD').format( + 'YYYY-MM-DDTHH:mm:ss' + ) : null, InvoiceAmount: Totalamount.toFixed(2), TaxAmount: Totaltax.toFixed(2), TotalAmount: Totalamount.toFixed(2), BillAmount: Billamount.toFixed(2), - PaymentStatus: "S", - PurOrderStatus: "P", + PaymentStatus: 'S', + PurOrderStatus: 'P', ProdDetails: products.map((item) => ({ ProdName: item.ProductName, ProdVariantName: item.VariantName, @@ -694,10 +710,14 @@ const StockList = () => { AcceptedQty: item.AcceptedQty, FreeQty: item.FreeQty, ManufDate: item.ManufactureDate - ? moment(item.ManufactureDate, 'YYYY-MM-DD').format('YYYY-MM-DDTHH:mm:ss') + ? moment(item.ManufactureDate, 'YYYY-MM-DD').format( + 'YYYY-MM-DDTHH:mm:ss' + ) : null, ExpDate: item.ExpireDate - ? moment(item.ExpireDate, 'YYYY-MM-DD').format('YYYY-MM-DDTHH:mm:ss') + ? moment(item.ExpireDate, 'YYYY-MM-DD').format( + 'YYYY-MM-DDTHH:mm:ss' + ) : null, BatchNo: item.BatchNo, ModelNo: item.ModelNo, @@ -707,6 +727,7 @@ const StockList = () => { SellPrice: item.SalesPrice, OnePcsPrice: item.AmountPerPiece, NoOfPcs: item.NumberofPieceInside, + WhSalePrice: item.WholesalePrice })), }; }); @@ -905,31 +926,35 @@ const StockList = () => { width={600} className={'padding-less-modal'} children={ -
+
{productImageDetails?.length > 0 && ( -
+
{productImageDetails.length > 1 && ( <> )} -
+
{productImageDetails.length > 1 && ( <> @@ -937,7 +962,14 @@ const StockList = () => { )}
)} -
+
{currentImageIndex + 1} of {productImageDetails.length}
From b2b86477caaa4e4d8b4c89a474fbcec666425f05 Mon Sep 17 00:00:00 2001 From: karthikalakshmi Date: Tue, 3 Feb 2026 13:45:31 +0530 Subject: [PATCH 11/20] FIX #57 Print header color issue Integration --- src/Features/ThemeChange/ThemeChange.js | 7 + .../BSBillingEditQuantity.jsx | 245 +- .../PrintMainPage/SelectionComponent.jsx | 23 +- .../UtillComponents/ShortcutKeyHelper.jsx | 11 +- .../PrintTemplates/A4/A4Standard.jsx | 3520 +++++++--- .../PrintTemplates/A4/PrintA4Style11.jsx | 3318 ++++----- .../PrintTemplates/A4/TaxInvoice.jsx | 1743 ++--- .../ThermalPrinter/PrintStyle1.jsx | 13 +- .../ThermalPrinter/PrintStyle10.jsx | 15 +- .../ThermalPrinter/PrintStyle11.jsx | 5140 ++++++++++---- .../ThermalPrinter/PrintStyle12.jsx | 5146 ++++++++++---- .../ThermalPrinter/PrintStyle2.jsx | 18 +- .../ThermalPrinter/PrintStyle3.jsx | 6125 +++++++++++++---- .../ThermalPrinter/PrintStyle4.jsx | 14 +- .../ThermalPrinter/PrintStyle5.jsx | 5 + 15 files changed, 17967 insertions(+), 7376 deletions(-) diff --git a/src/Features/ThemeChange/ThemeChange.js b/src/Features/ThemeChange/ThemeChange.js index 7cd788e..68306ec 100644 --- a/src/Features/ThemeChange/ThemeChange.js +++ b/src/Features/ThemeChange/ThemeChange.js @@ -470,6 +470,7 @@ const initialState = { notes: false, SignatureImage: '', BillName: '', + SelectedHeaderColor: '#000000', allColors: [], allColorsCat: [], LayoutOverallColorsList: [], @@ -2146,6 +2147,9 @@ const ThemeSlice = createSlice({ changeBillName: (state, action) => { state.BillName = action?.payload; }, + changeSelectedHeaderColor: (state, action) => { + state.SelectedHeaderColor = action?.payload; + }, changeCurrentColor: (state, action) => { const { color } = action?.payload; state.CurrentColor = color; @@ -2690,6 +2694,7 @@ export const { changeOthersTheme, changeActiveTheme, changeScanTemplate, + changeSelectedHeaderColor, } = ThemeSlice.actions; export const GlobalPricingAppPricingName = (state) => @@ -2720,6 +2725,8 @@ export const GlobalthemeFormat = (state) => state.theme?.themeFormat; export const Globalnotes = (state) => state.theme?.notes; export const GlobalSignatureImage = (state) => state.theme?.SignatureImage; export const GlobalBillName = (state) => state.theme?.BillName; +export const GlobalSelectedPrintHeaderColor = (state) => + state.theme?.SelectedHeaderColor; export const changeCurrentColorValue = (state) => state.theme?.CurrentColor; export const changeCurrentTextValue = (state) => state.theme?.CurrentText; diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx index a30d951..74f5029 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx @@ -87,11 +87,13 @@ const BSBillingEditQuantity = (props) => { ); const ReorderProductData = useSelector(GlobalReorderProductDetails); const templateData = useSelector(getTemplateData); - const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some( - (item) => item?.OptionName == 'Offer' - ) || (templateData?.BookingCombo1?.[1]?.some( - (item) => item?.OptionName == 'Offer' - )); + const OfferCheckedInSetup = + templateData?.BookingNavbar?.[1].some( + (item) => item?.OptionName == 'Offer' + ) || + templateData?.BookingCombo1?.[1]?.some( + (item) => item?.OptionName == 'Offer' + ); const [ClearQuantity, setClearQuantity] = useState(false); const CartOrderDetails = useSelector(GlobalOrderCardDetails); const SettingDataSelector = useSelector(PreferenceData); @@ -704,7 +706,7 @@ const BSBillingEditQuantity = (props) => { return ( cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OfferMessage?.[0]?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && cartItem?.OfferMode === editedProduct?.OfferMode && cartItem?.BookingTypeName !== editedProduct?.BookingTypeName ); @@ -838,7 +840,7 @@ const BSBillingEditQuantity = (props) => { cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OrderRate === editedProduct?.OrderRate && cartItem?.BookingTypeName !== - editedProduct?.BookingTypeName && + editedProduct?.BookingTypeName && !cartItem?.OfferMode && cartItem?.Offer === 0 ); @@ -852,7 +854,7 @@ const BSBillingEditQuantity = (props) => { cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OrderRate === editedProduct?.OrderRate && cartItem?.BookingTypeName !== - editedProduct?.BookingTypeName && + editedProduct?.BookingTypeName && cartItem?.OfferMode === editedProduct?.OfferMode && cartItem?.Offer > 0 ); @@ -985,7 +987,7 @@ const BSBillingEditQuantity = (props) => { ) ) && product?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && product?.OfferMode === editedProduct?.OfferMode ) { const freeQty = @@ -1018,7 +1020,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1101,7 +1103,7 @@ const BSBillingEditQuantity = (props) => { ) ) && product?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && product?.OfferMode === editedProduct?.OfferMode ) { return { @@ -1131,7 +1133,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1318,7 +1320,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1420,7 +1422,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1574,7 +1576,7 @@ const BSBillingEditQuantity = (props) => { ) && cartItem?.Offer && isFreeProductApplicable?.OfferId === - cartItem?.OfferMessage?.[0]?.OfferId + cartItem?.OfferMessage?.[0]?.OfferId ); } ); @@ -1863,11 +1865,11 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && product?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode) + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode) ) { return { ...product, @@ -1901,11 +1903,11 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode); + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -2046,7 +2048,7 @@ const BSBillingEditQuantity = (props) => { cartItem?.Offer > 0 && isFreeProductApplicable?.OfferMode === cartItem?.OfferMode && isFreeProductApplicable?.OfferId === - cartItem?.OfferMessage?.[0]?.OfferId + cartItem?.OfferMessage?.[0]?.OfferId ); } ); @@ -2149,11 +2151,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2224,12 +2226,12 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && product?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode) + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode) ) { return { ...product, @@ -2263,13 +2265,13 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode); + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -2351,11 +2353,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.InwardDtlId === - sameBookingTypeProduct.InwardDtlId && + sameBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - sameBookingTypeProduct.BookingTypeName && + sameBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - sameBookingTypeProduct.OrderRate && + sameBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2408,11 +2410,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.InwardDtlId === - sameBookingTypeProduct.InwardDtlId && + sameBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - sameBookingTypeProduct.BookingTypeName && + sameBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - sameBookingTypeProduct.OrderRate && + sameBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2501,11 +2503,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem?.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem?.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem?.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem?.OfferMode && cartItem?.Offer > 0 ) { @@ -2534,11 +2536,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2568,11 +2570,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2671,12 +2673,12 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && product?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode) + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode) ) { return { ...product, @@ -2710,12 +2712,12 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0] + ?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode); + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -2794,11 +2796,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.InwardDtlId === - sameBookingTypeProduct.InwardDtlId && + sameBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - sameBookingTypeProduct.BookingTypeName && + sameBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - sameBookingTypeProduct.OrderRate && + sameBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2857,11 +2859,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2933,12 +2935,12 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && product?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode) + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode) ) { return { ...product, @@ -2972,12 +2974,12 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0] + ?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode); + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -3131,17 +3133,17 @@ const BSBillingEditQuantity = (props) => { changeOrderCardDetails( CartOrderDetails?.map((i) => i?.InwardDtlId == updatedProduct?.InwardDtlId && - i?.BookingTypeName == updatedProduct?.BookingTypeName && - i?.localId === updatedProduct?.localId + i?.BookingTypeName == updatedProduct?.BookingTypeName && + i?.localId === updatedProduct?.localId ? { - ...updatedProduct, - Offer: 0, - OfferType: - updatedProduct?.Type === 'C' - ? updatedProduct?.OfferType - : null, - OfferMessage: null, - } + ...updatedProduct, + Offer: 0, + OfferType: + updatedProduct?.Type === 'C' + ? updatedProduct?.OfferType + : null, + OfferMessage: null, + } : i ) ) @@ -3158,9 +3160,10 @@ const BSBillingEditQuantity = (props) => { const UpdatedCartItemWithOffer = { ...updatedProduct, - Offer: (bestOffer?.OfferMode === 'I' || bestOffer?.OfferMode === 'Q') ? - bestOffer?.OfferAmount || updatedProduct.Offer : - updatedProduct.Offer || bestOffer?.OfferAmount, + Offer: + bestOffer?.OfferMode === 'I' || bestOffer?.OfferMode === 'Q' + ? bestOffer?.OfferAmount || updatedProduct.Offer + : updatedProduct.Offer || bestOffer?.OfferAmount, OfferType: updatedProduct?.OfferType || bestOffer?.OfferType, OfferMessage: updatedProduct?.OfferMessage || bestOffer?.OfferMessage, }; @@ -3175,10 +3178,11 @@ const BSBillingEditQuantity = (props) => { !c.SalesId && ((c?.OfferModeType && c?.OfferMode === 'B' ? true - : c?.OfferMode !== 'B') - && c?.OfferMode !== 'P' - && c?.OfferMode !== 'C' && c?.OfferMode !== 'O' - && c?.OfferMode !== 'L' + : c?.OfferMode !== 'B') && + c?.OfferMode !== 'P' && + c?.OfferMode !== 'C' && + c?.OfferMode !== 'O' && + c?.OfferMode !== 'L' ? true : c?.Offer === 0); @@ -3708,9 +3712,10 @@ const BSBillingEditQuantity = (props) => { /> - -
+ 'Change' + //
+ // + //
} open={EditOpen} width={600} @@ -3817,38 +3822,38 @@ const BSBillingEditQuantity = (props) => { ✖
-
-
AddQuantity(1)}> +
+
AddQuantity(1)}> 1
-
AddQuantity(2)}> +
AddQuantity(2)}> 2
-
AddQuantity(3)}> +
AddQuantity(3)}> 3
-
AddQuantity(4)}> +
AddQuantity(4)}> 4
-
AddQuantity(5)}> +
AddQuantity(5)}> 5
-
AddQuantity(6)}> +
AddQuantity(6)}> 6
-
AddQuantity(7)}> +
AddQuantity(7)}> 7
-
AddQuantity(8)}> +
AddQuantity(8)}> 8
-
AddQuantity(9)}> +
AddQuantity(9)}> 9
-
AddQuantity(0)}> +
AddQuantity(0)}> 0
@@ -3903,7 +3908,7 @@ const BSBillingEditQuantity = (props) => { ? `${parts[0]}.${parts.slice(1).join('')}` : cleanedValue; }} - // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} + // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} /> )} @@ -3966,7 +3971,7 @@ const BSBillingEditQuantity = (props) => { ? `${parts[0]}.${parts.slice(1).join('')}` : cleanedValue; }} - // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} + // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} /> {/* {
{((RadioBtnSelection == 'Price' && disableSubmitButton) || RadioBtnSelection == 'Quantity') && ( - } - > - )} + } + > + )}
diff --git a/src/Pages/BookingScreen/Components/PrintMainPage/SelectionComponent.jsx b/src/Pages/BookingScreen/Components/PrintMainPage/SelectionComponent.jsx index c1d674c..7bb7913 100644 --- a/src/Pages/BookingScreen/Components/PrintMainPage/SelectionComponent.jsx +++ b/src/Pages/BookingScreen/Components/PrintMainPage/SelectionComponent.jsx @@ -68,6 +68,7 @@ import { changeSelectedLogo, changeSelectedCredit, changeSelectedTax, + changeSelectedHeaderColor, } from '../../../../Features/ThemeChange/ThemeChange'; import '../../../../Styles/BookingScreen/Components/SelectionComponent/SelectionComponent.scss'; import { useAuth } from '../../../../AuthContext.jsx'; @@ -732,6 +733,13 @@ const SelectionComponent = forwardRef((props, ref) => { ) ? dispatch(changeNotes(true)) : dispatch(changeNotes(false)); + + checkedValues?.includes( + sizeCheckList.find((item) => item.ConfigName === 'Header Colour') + ?.ConfigId + ) + ? setisheadercolour(true) + : setisheadercolour(false); }; const handleOptions = async () => { @@ -1278,12 +1286,7 @@ const SelectionComponent = forwardRef((props, ref) => { > {sizeCheckList - ?.filter( - (item) => - item.ConfigName && - (SelectedStyleName == 'TaxInvoice' || - item.ConfigName != 'Header Colour') - ) + ?.filter((item) => item.ConfigName) ?.map((value, key) => ( {
)} - {isheadercolour && SelectedStyleName == 'TaxInvoice' && ( + {isheadercolour && ( + // {isheadercolour && SelectedStyleName == 'TaxInvoice' && (
Header Color { + setSelectedColour(color); + dispatch(changeSelectedHeaderColor(color)); + }} placeholder="Select color" />
diff --git a/src/Pages/BookingScreen/Components/UtillComponents/ShortcutKeyHelper.jsx b/src/Pages/BookingScreen/Components/UtillComponents/ShortcutKeyHelper.jsx index 60f9491..b314106 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/ShortcutKeyHelper.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/ShortcutKeyHelper.jsx @@ -1,6 +1,7 @@ import React, { useState } from 'react'; -import { Modal, List, Typography, Tooltip } from 'antd'; +import { List, Typography, Tooltip } from 'antd'; import { FaKeyboard } from 'react-icons/fa'; +import { DefaultModal } from '../../../../Components/Modal/DefaultModal'; const { Title, Text } = Typography; @@ -40,15 +41,15 @@ const ShortcutKeyHelper = ({}) => {
- - Keyboard Shortcuts + Keyboard Shortcuts
} open={isModalOpen} - onCancel={() => setIsModalOpen(false)} + handleCancel={() => setIsModalOpen(false)} footer={null} width={500} > @@ -65,7 +66,7 @@ const ShortcutKeyHelper = ({}) => { )} /> - + ); }; diff --git a/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx b/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx index b293a10..c4daf07 100644 --- a/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx @@ -1,10 +1,10 @@ -import React from "react"; -import { useDispatch, useSelector } from "react-redux"; +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; import { extractLastNumber, extractLastNumberOrderId, -} from "../../../../Services/Others"; -import Logo from '../../../../Images/Logo.jpg' +} from '../../../../Services/Others'; +import Logo from '../../../../Images/Logo.jpg'; import { GlobalprintSlNo, GlobalprintItem, @@ -27,14 +27,19 @@ import { 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" + GlobalSelectedPrintHeaderColor, +} 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, +const InvoiceTemplate = ({ + index, totalQuantityFilter, Date1, CashierName, @@ -48,23 +53,27 @@ const InvoiceTemplate = ({ index, PrintLogo, PrintGreeting, base64Image, - printDatas, isPdf, sportsAppPreference, MembershipApplied = null }) => { + 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"]; + 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); @@ -81,44 +90,50 @@ const InvoiceTemplate = ({ index, const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); const GlobalSignatureImages = useSelector(GlobalSignatureImage); const GlobalIsnotes = useSelector(Globalnotes); - const GlobalthemeFormatr = useSelector(GlobalthemeFormat) - const GlobalBilltext = useSelector(GlobalBillName) + 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 estimatePrintHeader = + SettingData?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' + )?.SettingValue === 'Y'; const keysLength = Object.keys(table2Data ?? {}).length; - console.log(GlobalDiscount, Discount, "Discount"); + 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) + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + + 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 day = currentDate.getDate().toString().padStart(2, '0'); const monthNames = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', ]; const monthIndex = currentDate.getMonth(); const year = currentDate.getFullYear().toString().slice(-2); @@ -126,19 +141,19 @@ const InvoiceTemplate = ({ index, const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; const TakeawayData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === "takeaway" + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' ); const DineInData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === "dine in" + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' ); let PaymentStatusSuccess = PaymentStatus?.filter( - (ps) => ps.PaymentStatus === "S" + (ps) => ps.PaymentStatus === 'S' ); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, 0 ); - const PackageDetails = table2Data?.PackageDtl + const PackageDetails = table2Data?.PackageDtl; const DineInTotal = DineInData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, 0 @@ -162,63 +177,71 @@ const InvoiceTemplate = ({ index, const offers = table2Data?.OrderOfferDetails || []; let TotalOfferAmount = 0; - console.log(table2Data, "productsDatakl") + console.log(table2Data, 'productsDatakl'); // Calculate SalesWiseOffers total amount - offers.forEach(offer => { + offers.forEach((offer) => { if (offer.TableName === 'SalesWiseOffers') { TotalOfferAmount += offer.OfferAmount; } }); - const hasMappedOffer = offers.some(offer => - ["ItemWiseOffers", "BundleOffers", "QuantityWiseOffers"].includes(offer.TableName) + 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); + 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); + 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" + 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: "" + 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" + 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", + name: 'Acrylic Scanner Box', + hsn: '39204900', + uom: 'INR', qty: 1, rate: 6501, amount: 6501, @@ -228,15 +251,15 @@ const InvoiceTemplate = ({ index, cgstAmount: 0, sgstRate: 0, sgstAmount: 0, - igstRate: 18.00, + igstRate: 18.0, igstAmount: 1170, - totalAmount: 7671 + totalAmount: 7671, }, { sr: 2, name: '32" Wide Angle view display FHD', - hsn: "84716030", - uom: "INR", + hsn: '84716030', + uom: 'INR', qty: 1, rate: 48317, amount: 48317, @@ -246,15 +269,15 @@ const InvoiceTemplate = ({ index, cgstAmount: 0, sgstRate: 0, sgstAmount: 0, - igstRate: 18.00, + igstRate: 18.0, igstAmount: 8697, - totalAmount: 57014 + totalAmount: 57014, }, { sr: 3, - name: "Service charges", - hsn: "999630", - uom: "INR", + name: 'Service charges', + hsn: '999630', + uom: 'INR', qty: 1, rate: 25000, amount: 25000, @@ -264,11 +287,10 @@ const InvoiceTemplate = ({ index, cgstAmount: 0, sgstRate: 0, sgstAmount: 0, - igstRate: 18.00, + igstRate: 18.0, igstAmount: 4500, - totalAmount: 29500 + totalAmount: 29500, }, - ], totals: { beforeTax: 83660, @@ -277,21 +299,22 @@ const InvoiceTemplate = ({ index, cgst: 0, totalGst: 15059, afterTax: 98719, - amountInWords: "Ninety Eight Thousand Seven Hundred and Nineteen Rupees Only" + amountInWords: + 'Ninety Eight Thousand Seven Hundred and Nineteen Rupees Only', }, bankDetails: { - bankName: "State Bank of India", - accountNo: "34850253701", - ifscCode: "SBIN0006242", - branchName: "Mookandapalli" - } + bankName: 'State Bank of India', + accountNo: '34850253701', + ifscCode: 'SBIN0006242', + branchName: 'Mookandapalli', + }, }; - const chunkSize = isMobile ? 11 : PageSize == "A5" ? 8 : 9; + const chunkSize = isMobile ? 11 : PageSize == 'A5' ? 8 : 9; let dataSource = []; if (GlobaldummyData || TakeawayData?.length > 0) { - dataSource = GlobaldummyData ? "" : TakeawayData; + dataSource = GlobaldummyData ? '' : TakeawayData; } else if (DineInData?.length > 0) { dataSource = DineInData; } @@ -300,50 +323,100 @@ const InvoiceTemplate = ({ index, 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); + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + const shouldFooterBeOnNewPage = + lastChunkRows > (isMobile ? 11 : PageSize == 'A5' ? 4 : 6); - console.log(table2Data, "table2Datah") + 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 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 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" + '', + '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', ]; - const b = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"]; - if (num === 0) return "Zero"; + 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 < 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) : ""); + 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 ( + numberToWords(Math.floor(num / 1000)) + + ' Thousand' + + (num % 1000 ? ' ' + numberToWords(num % 1000) : '') + ); - return "Number too large"; + return 'Number too large'; }; return (

Total Invoice Amount in Words:

-

+

{numberToWords(amount)}

@@ -352,54 +425,52 @@ const InvoiceTemplate = ({ index, const products = [ { - ProdName: "ITEM 1", + ProdName: 'ITEM 1', Rate: 88.0, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, - HSN: "01", + HSN: '01', }, { - ProdName: "ITEM 2", + ProdName: 'ITEM 2', Rate: 300.0, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, - HSN: "02", + HSN: '02', }, { - ProdName: "ITEM 3", + ProdName: 'ITEM 3', Rate: 200.0, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, - HSN: "03", + HSN: '03', }, { - ProdName: "ITEM 4", + ProdName: 'ITEM 4', Rate: 30.0, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, - HSN: "04", + HSN: '04', }, { - ProdName: "ITEM 5", + ProdName: 'ITEM 5', Rate: 30.0, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, - HSN: "05", + HSN: '05', }, - ]; - return ( <> <> - {FormatTheme ? - -
+ {FormatTheme ? ( +
{paginatedChunks.map((dataChunk, chunkIndex) => ( -
0 ? ' print-page-break' : ''}`} +
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}> - + 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}

+
+ {!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 + )}
-

{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" && ( + {table2Data?.OrderType === 'E' && (
- Estimate{" "} + Estimate{' '}
)} - {table2Data?.OrderType === "E" ? ( - "" + {table2Data?.OrderType === 'E' ? ( + '' ) : (
- {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} - + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + + ' Bill' + : ''}
)}
- - {GlobaldummyData ? + {GlobaldummyData ? (
-

Details of Receiver | Billed to

+

+ Details of Receiver | Billed to +

-
Name : +
+ 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} + + {'XXXYYY'} + ) : ( + table2Data?.CustomerDetails?.[0]?.CustSuppName )}
-
State: {table2Data?.CustomerDetails?.[0]?.State}
- {table2Data?.CustomerDetails?.[0]?.CustGSTNo &&
GST: {table2Data?.CustomerDetails?.[0]?.CustGSTNo}
} +
+ 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 && } + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} {GlobaldummyData - ? GlobalItem && : - Item == true && } - + ? GlobalItem && ( + + ) + : Item == true && ( + + )} {GlobaldummyData - ? GlobalHsnCode && : - HsnCode == true && } + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} {GlobaldummyData - ? GlobalQuantity && - : Quantity == true && } + ? 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 && ( - + ? GlobalMRP && ( + ) - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && ( - + ) + : 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 && ( - - )} - - ))} - - - + ) : ( +
+ ({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(',')} +
+ ); + }) + : ''} + + )} + {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.NoS.No + S.No + ItemItemItem + Item + HSN HSN HSN + HSN{' '} + Qty { WeightasKg ?'Qty/Kg' :'Qty'}Qty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + UOM UOMMRPMRPRateRateDisDisTax %Tax %AmountAmount
- {chunkIndex * chunkSize + idx + 1} - MRP - {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}) - - ))} -
+ MRP + + )} - :
- ({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 ( + {GlobaldummyData + ? GlobalRate && ( +
Rate + Rate + Dis + Dis + Tax % + Tax % + Amount + Amount +
+ {chunkIndex * chunkSize + idx + 1} + + {chunkIndex * chunkSize + idx + 1} + + {item?.ProdName} + +
{item?.ProdName}
+ {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? (
- {[imei1, imei2] - .filter(Boolean) - .join(",")} + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))}
- ); - }) - : ""} -
- {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} -
+ {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} +
@@ -1132,403 +1520,947 @@ const InvoiceTemplate = ({ index,
)} - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - <> - {(sportsAppPreference && MembershipApplied) &&
{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
} + {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 : +
+
+
+ Items : +
+
+ {GlobaldummyData + ? '7' + : totalQuantityFilter?.length}
-
{GlobaldummyData ? 736 : table2Data?.BillAmount}
-
- {OrderDetailGST?.map((item, index) => ( -
-
-
- Taxable Amount : -
-
{Number(item.WithOutTaxAmount).toFixed(2)}
-
+
+
+ Qty : +
+
+ {GlobaldummyData ? '9' : totalQuantity} +
+
-
-
- CGST ({item.TaxPercentage / 2}%) : -
-
{Number(item.CGST).toFixed(2)}
+
+
+ Off : +
+
+ {( + Number(TotalOfferAmount || 0) + + Number(table2Data?.OverallDisc || 0) + ).toFixed(2)} +
+
+
+
+ Amount :₹ +
+
+ {GlobaldummyData + ? '1066' + : table2Data?.NetAmount} +
+
+
+ {/* Summary */} +
+ {GlobaldummyData ? ( +
+ +
+ ) : ( +
+ +
+ )} + {table2Data?.OrderType !== 'E' && ( +
+
+
+ Total Taxable Amount :
- -
-
- SGST ({item.TaxPercentage / 2}%) : -
-
{Number(item.SGST).toFixed(2)}
-
- -
-
- Total (incl GST) : -
-
{Number(item.TotalAmt).toFixed(2)}
+
+ {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)} +
+
- {/*
+ {/*
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. -
  3. Please check the product before leaving the counter.
  4. -
-
) - : - (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") ? '' : } -
+ {/* 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} +
+
+
+ )} -

(Common Seal)

+ +
+ {GlobaldummyData + ? GlobaltermsAndConditions && ( +
+

+ Terms & Conditions +

+
    +
  1. + Once goods are sold, they are not + exchangeable or refundable. +
  2. +
  3. + Please check the product before + leaving the counter. +
  4. +
+
+ ) + : 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} +

+ + {/*
*/} +
+ )} +
- {/*
*/} - - - - - {/* Copy Labels */} -
- {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

- -
-
) : - Notestext && (
-

{Notestext}

- - {/*
*/} -
) - } -
-
- - } + + )}
//
))}
{/*
*/} - {shouldFooterBeOnNewPage && FormatTheme && + {shouldFooterBeOnNewPage && FormatTheme && (
-
<> - {(sportsAppPreference && MembershipApplied) &&
{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
} + {sportsAppPreference && MembershipApplied && ( +
{`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
+ )}
-
-
- Items : +
+
+ Items : +
+
+ {GlobaldummyData ? '7' : totalQuantityFilter?.length}
-
{GlobaldummyData ? "7" : totalQuantityFilter?.length}
-
-
- Qty : +
+
+ Qty : +
+
+ {GlobaldummyData ? '9' : totalQuantity}
-
{GlobaldummyData ? "9" : totalQuantity}
-
-
- Off : +
+
+ Off : +
+
+ {( + Number(TotalOfferAmount || 0) + + Number(table2Data?.OverallDisc || 0) + ).toFixed(2)}
-
{(Number(TotalOfferAmount || 0) + Number(table2Data?.OverallDisc || 0)).toFixed(2)}
-
-
- Amount :₹ +
+
+ Amount :₹ +
+
+ {GlobaldummyData ? '1066' : table2Data?.NetAmount}
-
{GlobaldummyData - ? "1066" - : (table2Data?.NetAmount)}
{/*
*/} {/* Summary */}
- {GlobaldummyData ?
- -
:
- -
} - {table2Data?.OrderType !== 'E' &&
- - -
-
- Total Taxable Amount : -
-
{GlobaldummyData ? 736 : table2Data?.BillAmount}
+ {GlobaldummyData ? ( +
+
- -
- {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)}
-
+ ) : ( +
+ +
+ )} + {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)} +
+
+ Total Amount Payable + + {Number( + GlobaldummyData ? 736 : table2Data?.NetAmount + )?.toFixed(2)} + +
+
+ {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}
-
-
- )} + {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. -
  3. Please check the product before leaving the counter.
  4. -
-
) - : - (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 + ? GlobaltermsAndConditions && ( +
+

+ Terms & Conditions +

+
    +
  1. + Once goods are sold, they are not + exchangeable or refundable. +
  2. +
  3. + Please check the product before leaving + the counter. +
  4. +
+
+ ) + : 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.

+

+ Certified that the particulars given above are true + and correct. +

- {GlobaldummyData ?

Company Name

- :

"For" {companyName}

} + {GlobaldummyData ? ( +

Company Name

+ ) : ( +

+ {' '} + "For" {companyName} +

+ )}

Authorised Signatory

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

(Common Seal)

@@ -1537,177 +2469,294 @@ const InvoiceTemplate = ({ index, {/* Copy Labels */}
- {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

+ {GlobaldummyData + ? GlobalIsnotes && ( +
+

+ Notes : 10 days Return policy +

-
-
) : - Notestext && (
-

{Notestext}

+
+
+ ) + : Notestext && ( +
+

+ {Notestext} +

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

{GlobaldummyData ? "Company Name" : companyName}

+ {!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} +
+ ))}
-

{companyAddress}

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

Details of Receiver | Billed to

+

+ Details of Receiver | Billed to +

-
Name : +
+ 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} - + {'XXXYYY'} + ) : ( + table2Data?.CustomerDetails?.[0]?.CustSuppName )}
-
State: {table2Data?.CustomerDetails?.[0]?.State}
+
+ 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 && } + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} {GlobaldummyData - ? GlobalItem && : - Item == true && } - + ? GlobalItem && ( + + ) + : Item == true && ( + + )} {GlobaldummyData - ? GlobalHsnCode && : - HsnCode == true && } + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} {GlobaldummyData - ? GlobalQuantity && - : Quantity == true && } + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} {/* */} {GlobaldummyData - ? GlobalMRP && - : MRP == true && } + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} {GlobaldummyData - ? GlobalRate && - : Rate == true && } + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} {GlobaldummyData - ? GlobalDiscount && - : Discount == true && } + ? GlobalDiscount && ( + + ) + : Discount == true && ( + + )} {GlobaldummyData - ? GlobalTax && - : (Tax && table2Data?.OrderType !== 'E') && } + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} {GlobaldummyData - ? GlobalAmount && - : Amount == true && } + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} {/* @@ -1729,328 +2778,575 @@ const InvoiceTemplate = ({ index, */} - {((GlobaldummyData ? products : productsData) || []).map((item, idx) => ( - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && ( - + {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 && ( - - )} - - ))} - - - + +  {' '} + {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(',')} +
+ ); + }) + : ''} + + )} + {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.NoS.NoS.NoItemItemItemItemHSN HSN HSN HSN Qty { WeightasKg ?'Qty/Kg' :'Qty'}Qty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + UOM UOMMRPMRPMRPMRPRateRateRateRateDisDisDisDisTax %Tax %Tax % + Tax % + AmountAmountAmountAmountTaxable IGST
- {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 + {((GlobaldummyData ? products : productsData) || []).map( + (item, idx) => ( +
+ {idx + 1} + + {idx + 1} + + {item?.ProdName} + +
{item?.ProdName}
+
+ ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} ) - )?.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} -
+ {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} + {' '} + Items:{GlobaldummyData ? '7' : totalQuantityFilter?.length}
- {" "} - Qty:{GlobaldummyData ? "9" : totalQuantity} + {' '} + Qty:{GlobaldummyData ? '9' : totalQuantity}
{/* {ExtraChargeTotal > 0 &&

Extra Charges:{ExtraChargeTotal}

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

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

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

)}
Amount :₹ {GlobaldummyData - ? "1066" + ? '1066' : Number(table2Data?.NetAmount).toFixed(2)}
{/* Summary */}
- {GlobaldummyData ?
- -
:
- -
} - {table2Data?.OrderType !== 'E' &&
- - -
-
- Total Taxable Amount : -
-
{GlobaldummyData ? 736 : table2Data?.BillAmount}
+ {GlobaldummyData ? ( +
+
- -
- {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)}
-
+ ) : ( +
+ +
+ )} + {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)} +
-
- {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}
-
-
- )} + {(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. -
  3. Please check the product before leaving the counter.
  4. -
-
) - : - (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 + ? GlobaltermsAndConditions && ( +
+

+ Terms & Conditions +

+
    +
  1. + Once goods are sold, they are not exchangeable + or refundable. +
  2. +
  3. + Please check the product before leaving the + counter. +
  4. +
+
+ ) + : 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.

+

+ Certified that the particulars given above are true and + correct. +

- {GlobaldummyData ?

Company Name

- :

"For" {companyName}

} + {GlobaldummyData ? ( +

Company Name

+ ) : ( +

"For" {companyName}

+ )}

Authorised Signatory

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

(Common Seal)

@@ -2059,25 +3355,31 @@ const InvoiceTemplate = ({ index, {/* Copy Labels */}
- {GlobaldummyData ? GlobalIsnotes && - (
-

Notes : 10 days Return policy

+ {GlobaldummyData + ? GlobalIsnotes && ( +
+

+ Notes : 10 days Return policy +

-
-
) : - Notestext && (
-

{Notestext}

+
+
+ ) + : Notestext && ( +
+

+ {Notestext} +

- {/*
*/} -
) - } + {/*
*/} +
+ )}
- - } + )} ); }; -export default InvoiceTemplate; \ No newline at end of file +export default InvoiceTemplate; diff --git a/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx b/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx index 73fe486..b011940 100644 --- a/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx @@ -324,7 +324,7 @@ const PrintA4Style11 = ({
)} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( Mobile: +91{' '} {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} @@ -485,175 +485,176 @@ const PrintA4Style11 = ({ > {GlobaldummyData ? GlobalSlNo && ( - - S.No - - ) + + S.No + + ) : SLNO == true && ( - - S.No - - )} + + S.No + + )} {GlobaldummyData ? GlobalItem && Item : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode == true && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity == true && ( - - { WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP == true && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate == true && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount == true && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) - : (Tax && table2Data?.OrderType !== 'E') && ( - - Tax % - - )} + + Tax % + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -662,180 +663,181 @@ const PrintA4Style11 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.name} : Item == true && ( - -
{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 + +
{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'} ) - )?.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?.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(',')} +
+ ); + }) + : ''} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.quantity} - - ) + + {item?.quantity} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.mrp} - - ) + + {item?.mrp} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {' '} - {item?.MRP} - - )} + + {' '} + {item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - {item.discount} - ) + {item.discount} + ) : Discount == true && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - {item.ProdTaxPercentage} - ) - : (Tax && table2Data?.OrderType !== 'E') && ( - - {item?.ProdTaxPercentage || 0} - - )} + {item.ProdTaxPercentage} + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.price} - - ) + + {item?.price} + + ) : Amount == true && ( - - {item?.Type != 'C' - ? item?.TotalAmt - - item?.OfferAmt || 0 - : item?.TotalAmt - - item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.TotalAmt - + item?.OfferAmt || 0 + : item?.TotalAmt - + item?.OfferValue || 0} + + )} ))} @@ -874,7 +876,7 @@ const PrintA4Style11 = ({
ITEMS
Qty
{TotalOfferAmount > 0 || - table2Data?.OverallDisc ? ( + table2Data?.OverallDisc ? (
OFFER
) : ( '' @@ -900,11 +902,11 @@ const PrintA4Style11 = ({ : totalQuantity}
{TotalOfferAmount > 0 || - table2Data?.OverallDisc ? ( + table2Data?.OverallDisc ? (
{Number( TotalOfferAmount + - table2Data?.OverallDisc + table2Data?.OverallDisc ).toFixed(2)}
) : ( @@ -927,40 +929,40 @@ const PrintA4Style11 = ({ {GlobaldummyData ? '1066' : Number( - table2Data?.NetAmount - ).toFixed(2)} + table2Data?.NetAmount + ).toFixed(2)}
{GlobaldummyData ? GlobalCredit && ( -
-
Advance Amount:
-
Opening Balance:
-
- ) +
+
Advance Amount:
+
Opening Balance:
+
+ ) : CreditDetails && - table2Data?.CustomerDetails?.length > - 0 && ( -
- {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0] - ?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > + 0 && ( +
+ {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0] + ?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0] .OldCreditBal > 0 ? ( @@ -973,8 +975,8 @@ const PrintA4Style11 = ({ }

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

{' '} Opening Balance:{' '} @@ -988,51 +990,88 @@ const PrintA4Style11 = ({ )} - {/* 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} -
- )} + {/* 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 && + {table2Data?.OrderType !== 'E' && + OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0 && ( <> -

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

+

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

- - + - - - @@ -1040,28 +1079,52 @@ const PrintA4Style11 = ({ {OrderDetailGST?.map((item) => ( - - - + + ))} @@ -1101,58 +1164,58 @@ const PrintA4Style11 = ({ {GlobaldummyData ? GlobalQrcodet && ( -
- -
- Scan to Pay{' '} +
+ +
+ Scan to Pay{' '} +
+
+ ₹ + {GlobaldummyData + ? '1,066' + : Number( + table2Data?.NetAmount + ).toFixed(2)} +
-
- ₹ - {GlobaldummyData - ? '1,066' - : Number( - table2Data?.NetAmount - ).toFixed(2)} -
-
- ) + ) : Qrcodet && - paymentTypeUPI && ( -
- -
- Scan to Pay{' '} + paymentTypeUPI && ( +
+ +
+ Scan to Pay{' '} +
+
+ ₹ + {GlobaldummyData + ? '1,066' + : Number( + table2Data?.NetAmount + ).toFixed(2)} +
-
- ₹ - {GlobaldummyData - ? '1,066' - : Number( - table2Data?.NetAmount - ).toFixed(2)} -
-
- )} + )}
-

- Notes : 10 days Return policy -

+
+

+ Notes : 10 days Return policy +

-
-
- ) +
+
+ ) : Notestext && ( -
-

- {Notestext} -

+
+

+ {Notestext} +

-
-
- )} +
+
+ )}
{GlobaldummyData ? GlobaltermsAndConditions && ( -
-

- Terms & Conditions -

-
    -
  1. - Once goods are sold, they are - not exchangeable or refundable. -
  2. -
  3. - Please check the product before - leaving the counter. -
  4. -
-
- ) +

+ Terms & Conditions +

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

0 && ( +

- Terms & Conditions -

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

+ Terms & Conditions +

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

- Signature -

- -
- ) +

+ Signature +

+ +
+ ) : Signature == true && ( -
-

- Signature -

- -
- )} +

+ Signature +

+ + + )} )} @@ -1445,177 +1508,178 @@ const PrintA4Style11 = ({ > {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') && ( - - )} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} {GlobaldummyData ? GlobalAmount && ( - - ) + + ) : Amount == true && ( - - )} + + )} @@ -1624,158 +1688,159 @@ const PrintA4Style11 = ({ {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') && ( - - )} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} {GlobaldummyData ? GlobalAmount && ( - - ) + + ) : Amount == true && ( - - )} + + )} ))} @@ -1814,7 +1879,7 @@ const PrintA4Style11 = ({
ITEMS
Qty
{TotalOfferAmount > 0 || - table2Data?.OverallDisc ? ( + table2Data?.OverallDisc ? (
OFFER
) : ( '' @@ -1840,11 +1905,11 @@ const PrintA4Style11 = ({ : totalQuantity} {TotalOfferAmount > 0 || - table2Data?.OverallDisc ? ( + table2Data?.OverallDisc ? (
{Number( TotalOfferAmount + - table2Data?.OverallDisc + table2Data?.OverallDisc ).toFixed(2)}
) : ( @@ -1867,40 +1932,40 @@ const PrintA4Style11 = ({ {GlobaldummyData ? '1066' : Number( - table2Data?.NetAmount - ).toFixed(2)} + table2Data?.NetAmount + ).toFixed(2)} {GlobaldummyData ? GlobalCredit && ( -
-
Advance Amount:
-
Opening Balance:
-
- ) +
+
Advance Amount:
+
Opening Balance:
+
+ ) : CreditDetails && - table2Data?.CustomerDetails?.length > - 0 && ( -
- {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0] - ?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > + 0 && ( +
+ {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0] + ?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0] .OldCreditBal > 0 ? ( @@ -1913,8 +1978,8 @@ const PrintA4Style11 = ({ }

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

{' '} Opening Balance:{' '} @@ -1928,51 +1993,88 @@ const PrintA4Style11 = ({ )} - {/* 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} -
- )} + {/* 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 && + {table2Data?.OrderType !== 'E' && + OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0 && ( <> -

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

+

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

GST Rate + + 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.WithOutTaxAmount + ).toFixed(2)}{' '} {' '} - {Number(item.TotalAmt).toFixed(2)} + {Number(item.CGST).toFixed( + 2 + )} + + {' '} + {Number(item.SGST).toFixed( + 2 + )} + + {' '} + {Number( + item.TotalAmt + ).toFixed(2)}
- S.No - + S.No + - S.No - + S.No + ItemItem - HSN - + HSN + - HSN - + HSN + - Qty - + Qty + - { WeightasKg ?'Qty/Kg' :'Qty'} - + {WeightasKg ? 'Qty/Kg' : 'Qty'} + - MRP - + MRP + - MRP - + MRP + - Rate - + Rate + - Rate - + Rate + - Dis{' '} - + Dis{' '} + - Dis{' '} - + Dis{' '} + - Tax % - - Tax % - + Tax % + + Tax % + - Amt - + Amt + - Amt - + Amt +
- {index + 1} - + {index + 1} + - {chunkIndex * chunkSize + index + 1} - + {chunkIndex * chunkSize + index + 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?.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?.HSN} - + {item?.HSN} + - {item?.SalesQty} - + {item?.SalesQty} + - {item?.SalesQty} - + {item?.SalesQty} + - {item?.MRP} - + {item?.MRP} + - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + - {item?.Rate} - + {item?.Rate} + - {' '} - {item?.Rate} - + {' '} + {item?.Rate} + {item.discount}{item.discount} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + {item.ProdTaxPercentage} - {item?.ProdTaxPercentage || 0} - {item.ProdTaxPercentage} + {item?.ProdTaxPercentage || 0} + - {item?.TotalAmt} - + {item?.TotalAmt} + - {item?.Type != 'C' - ? item?.TotalAmt - - item?.OfferAmt || 0 - : item?.TotalAmt - - item?.OfferValue || 0} - + {item?.Type != 'C' + ? item?.TotalAmt - + item?.OfferAmt || 0 + : item?.TotalAmt - + item?.OfferValue || 0} +
- - + - - - @@ -1980,28 +2082,52 @@ const PrintA4Style11 = ({ {OrderDetailGST?.map((item) => ( - - - + + ))} @@ -2039,58 +2165,58 @@ const PrintA4Style11 = ({ {GlobaldummyData ? GlobalQrcodet && ( -
- -
- Scan to Pay{' '} +
+ +
+ Scan to Pay{' '} +
+
+ ₹ + {GlobaldummyData + ? '1,066' + : Number( + table2Data?.NetAmount + ).toFixed(2)} +
-
- ₹ - {GlobaldummyData - ? '1,066' - : Number( - table2Data?.NetAmount - ).toFixed(2)} -
-
- ) + ) : Qrcodet && - paymentTypeUPI && ( -
- -
- Scan to Pay{' '} + paymentTypeUPI && ( +
+ +
+ Scan to Pay{' '} +
+
+ ₹ + {GlobaldummyData + ? '1,066' + : Number( + table2Data?.NetAmount + ).toFixed(2)} +
-
- ₹ - {GlobaldummyData - ? '1,066' - : Number( - table2Data?.NetAmount - ).toFixed(2)} -
-
- )} + )}
-

- Notes : 10 days Return policy -

+
+

+ Notes : 10 days Return policy +

-
-
- ) +
+
+ ) : Notestext && ( -
-

- {Notestext} -

+
+

+ {Notestext} +

-
-
- )} +
+
+ )}
{GlobaldummyData ? GlobaltermsAndConditions && ( -
-

- Terms & Conditions -

-
    -
  1. - Once goods are sold, they are - not exchangeable or refundable. -
  2. -
  3. - Please check the product before - leaving the counter. -
  4. -
-
- ) +

+ Terms & Conditions +

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

0 && ( +

- Terms & Conditions -

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

+ Terms & Conditions +

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

- Signature -

- -
- ) +

+ Signature +

+ +
+ ) : Signature == true && ( -
-

- Signature -

- -
- )} +

+ Signature +

+ + + )} )} @@ -2426,34 +2552,34 @@ const PrintA4Style11 = ({ {GlobaldummyData ? GlobalCredit && ( -
-
Advance Amount:
-
Opening Balance:
-
- ) +
+
Advance Amount:
+
Opening Balance:
+
+ ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
- {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
+ {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -2471,47 +2597,68 @@ const PrintA4Style11 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* 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} -
- )} +

+ {' '} + 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 && + {table2Data?.OrderType !== 'E' && + OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0 && ( <> -

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

+

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

GST Rate + + 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.WithOutTaxAmount + ).toFixed(2)}{' '} {' '} - {Number(item.TotalAmt).toFixed(2)} + {Number(item.CGST).toFixed( + 2 + )} + + {' '} + {Number(item.SGST).toFixed( + 2 + )} + + {' '} + {Number( + item.TotalAmt + ).toFixed(2)}
- - + - - - @@ -2524,21 +2671,19 @@ const PrintA4Style11 = ({ - - @@ -2578,54 +2723,54 @@ const PrintA4Style11 = ({ {GlobaldummyData ? GlobalQrcodet && ( -
- -
- Scan to Pay{' '} +
+ +
+ Scan to Pay{' '} +
+
+ ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
-
- ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
-
- ) + ) : Qrcodet && - paymentTypeUPI && ( -
- -
- Scan to Pay{' '} + paymentTypeUPI && ( +
+ +
+ Scan to Pay{' '} +
+
+ ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
-
- ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
-
- )} + )}
-

- Notes : 10 days Return policy -

+
+

+ Notes : 10 days Return policy +

-
-
- ) +
+
+ ) : Notestext && ( -
-

- {Notestext} -

+
+

+ {Notestext} +

-
-
- )} +
+
+ )}
{GlobaldummyData ? GlobaltermsAndConditions && ( -
-

- Terms & Conditions -

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

- Terms & Conditions -

-
    - {TermsAndConditions?.map((item) => ( -
  1. - {item?.TermsandConditions} +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not exchangeable + or refundable.
    2. - ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
- )} +
  • + 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 +

    + +
    + ) : Signature == true && ( -
    -

    - Signature -

    - -
    - )} +

    + Signature +

    + + + )} )} @@ -2933,31 +3078,31 @@ const PrintA4Style11 = ({ {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > 0 ? (

    @@ -2977,36 +3122,47 @@ const PrintA4Style11 = ({ )} - {/* 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} -
    - )} + {/* 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 && + {table2Data?.OrderType !== 'E' && + OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0 && ( <> -

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

    +

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

    GST Rate + + GST Rate + Taxable Amount + CGST + SGST + Total
    {' '} - {Number(item.WithOutTaxAmount).toFixed(2)}{' '} + {Number(item.WithOutTaxAmount).toFixed( + 2 + )}{' '} {' '} {Number(item.CGST).toFixed(2)} + {' '} {Number(item.SGST).toFixed(2)} + {' '} {Number(item.TotalAmt).toFixed(2)}
    - + @@ -3035,15 +3191,11 @@ const PrintA4Style11 = ({ {' '} {Number(item.CGST).toFixed(2)} - - @@ -3083,50 +3235,50 @@ const PrintA4Style11 = ({ {GlobaldummyData ? GlobalQrcodet && ( -
    - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    -
    - ) + ) : Qrcodet && - paymentTypeUPI && ( -
    - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} + paymentTypeUPI && ( +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    -
    - )} + )}
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : Notestext && ( -
    -

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    {GlobaldummyData ? GlobaltermsAndConditions && ( -
    -

    - Terms & Conditions -

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

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} +

      + Terms & Conditions +

      +
        +
      1. + Once goods are sold, they are not exchangeable or + refundable.
      2. - ))} - {/*
      3. Please check the product before leaving the counter.
      4. */} -
      -
    - )} +
  • + 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 +

    + +
    + ) : Signature == true && ( -
    -

    - Signature -

    - -
    - )} +

    + Signature +

    + + + )} diff --git a/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx b/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx index 2ddd7f9..f4c6f83 100644 --- a/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx @@ -1,11 +1,14 @@ -import React from "react"; -import { useSelector } from "react-redux"; -import { GlobalPritdummyData } from "../../../../Features/ThemeChange/ThemeChange"; -import { isMobile } from "react-device-detect"; -import { extractLastNumberOrderId } from "../../../../Services/Others"; -import moment from "moment"; -import { settingDataSelector } from "../../../../Features/PreferenceMaster/PreferenceMaster"; -import { PreferenceData } from "../../../../Features/BookingScreen/BookingData/BookingData"; +import React from 'react'; +import { useSelector } from 'react-redux'; +import { + GlobalPritdummyData, + GlobalSelectedPrintHeaderColor, +} from '../../../../Features/ThemeChange/ThemeChange'; +import { isMobile } from 'react-device-detect'; +import { extractLastNumberOrderId } from '../../../../Services/Others'; +import moment from 'moment'; +import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; +import { PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; const TaxInvoice = ({ index, @@ -25,138 +28,140 @@ const TaxInvoice = ({ const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find( (setting) => - setting?.SettingIdName?.toLowerCase() === "estimateprintheader", - )?.SettingValue === "Y"; + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' + )?.SettingValue === 'Y'; let BillName = printDatas?.PrintHdrName; - let companyColour = printDatas?.PrintHdrColor ?? "#00000"; + let companyColour = printDatas?.PrintHdrColor ?? '#00000'; + + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); // Function to convert number to words const numberToWords = (num) => { const a = [ - "", - "One", - "Two", - "Three", - "Four", - "Five", - "Six", - "Seven", - "Eight", - "Nine", - "Ten", - "Eleven", - "Twelve", - "Thirteen", - "Fourteen", - "Fifteen", - "Sixteen", - "Seventeen", - "Eighteen", - "Nineteen", + '', + '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", + '', + '', + 'Twenty', + 'Thirty', + 'Forty', + 'Fifty', + 'Sixty', + 'Seventy', + 'Eighty', + 'Ninety', ]; - if (num === 0) return "Zero"; + 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] : ""); + 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) : "") + ' Hundred' + + (num % 100 ? ' and ' + numberToWords(num % 100) : '') ); if (num < 100000) return ( numberToWords(Math.floor(num / 1000)) + - " Thousand" + - (num % 1000 ? " " + numberToWords(num % 1000) : "") + ' Thousand' + + (num % 1000 ? ' ' + numberToWords(num % 1000) : '') ); if (num < 10000000) return ( numberToWords(Math.floor(num / 100000)) + - " Lakh" + - (num % 100000 ? " " + numberToWords(num % 100000) : "") + ' Lakh' + + (num % 100000 ? ' ' + numberToWords(num % 100000) : '') ); if (num < 1000000000) return ( numberToWords(Math.floor(num / 10000000)) + - " Crore" + - (num % 10000000 ? " " + numberToWords(num % 10000000) : "") + ' Crore' + + (num % 10000000 ? ' ' + numberToWords(num % 10000000) : '') ); - return "Number too large"; + return 'Number too large'; }; // Helper to format date as 7-Aug-2025 function formatDateToDDMMMYYYY(dateStr) { - console.log(dateStr, "dateStrdateStr"); - if (!dateStr) return ""; + console.log(dateStr, 'dateStrdateStr'); + if (!dateStr) return ''; const date = new Date(dateStr); if (isNaN(date)) return dateStr; // fallback if invalid date const day = date.getDate(); - const month = date.toLocaleString("en-US", { month: "short" }); + const month = date.toLocaleString('en-US', { month: 'short' }); const year = date.getFullYear(); return `${day}-${month}-${year}`; } function removeTimeFromDate(dateStr) { - if (!dateStr) return ""; + if (!dateStr) return ''; // Split on ":" — first part will be "DD-MM-YYYY" - const parts = dateStr.split(":"); + const parts = dateStr.split(':'); return parts[0] || dateStr; } console.log( Date1, - moment(Date1).format("DD-MMM-YYYY"), - "datadatadatadatadatadata", + moment(Date1).format('DD-MMM-YYYY'), + 'datadatadatadatadatadata' ); // Extract data from table2Data - mapping from A4Standard structure const invoiceData = { // Company Details - mapped from A4Standard - companyName: table2Data?.CompName || table2Data?.BrName || "", - companyspecname: table2Data?.AppSpecificName || "", + companyName: table2Data?.CompName || table2Data?.BrName || '', + companyspecname: table2Data?.AppSpecificName || '', companyAddress: { - address1: table2Data?.AddressDetails?.[0]?.Address1 || "", - address2: table2Data?.AddressDetails?.[0]?.Address2 || "", - city: table2Data?.AddressDetails?.[0]?.City || "", - state: table2Data?.AddressDetails?.[0]?.State || "", - zip: table2Data?.AddressDetails?.[0]?.Zip || "", + address1: table2Data?.AddressDetails?.[0]?.Address1 || '', + address2: table2Data?.AddressDetails?.[0]?.Address2 || '', + city: table2Data?.AddressDetails?.[0]?.City || '', + state: table2Data?.AddressDetails?.[0]?.State || '', + zip: table2Data?.AddressDetails?.[0]?.Zip || '', }, - companyGSTIN: table2Data?.CompGSTIN || table2Data?.BrGSTIN || "", - companyEmail: table2Data?.CompanyEmail || table2Data?.BrEmail || "", - companyMobile: table2Data?.BrMobile || "", - companyMobile2: table2Data?.BrMobile2 || "", + companyGSTIN: table2Data?.CompGSTIN || table2Data?.BrGSTIN || '', + companyEmail: table2Data?.CompanyEmail || table2Data?.BrEmail || '', + companyMobile: table2Data?.BrMobile || '', + companyMobile2: table2Data?.BrMobile2 || '', // Invoice Details - mapped from A4Standard invoiceNo: table2Data?.OrderId ? extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus) - : "", - invoiceDate: moment(Date1).format("DD-MMM-YYYY"), + : '', + invoiceDate: moment(Date1).format('DD-MMM-YYYY'), // Customer Details - mapped from A4Standard CustomerDetails array customerName: table2Data?.CustomerDetails?.[0]?.CustSuppName || table2Data?.CustSuppName || - "", + '', customerMobile: - table2Data?.CustomerDetails?.[0]?.MobileNo || table2Data?.MobileNo || "", + table2Data?.CustomerDetails?.[0]?.MobileNo || table2Data?.MobileNo || '', customerGSTIN: table2Data?.CustomerDetails?.[0]?.CustGSTNo || table2Data?.CustGSTIN || - "", + '', customerAddress: { - address1: table2Data?.CustomerDetails?.[0]?.Address1 || "", - address2: table2Data?.CustomerDetails?.[0]?.Address2 || "", - state: table2Data?.CustomerDetails?.[0]?.State || "", + address1: table2Data?.CustomerDetails?.[0]?.Address1 || '', + address2: table2Data?.CustomerDetails?.[0]?.Address2 || '', + state: table2Data?.CustomerDetails?.[0]?.State || '', }, // Product Details - mapped from A4Standard productDetails @@ -167,7 +172,7 @@ const TaxInvoice = ({ taxAmount: Number(OrderDetailGST), grandTotal: Number(table2Data?.NetAmount || table2Data?.GrandTotal), totalBillAmount: Number( - table2Data?.BillAmount || table2Data?.NetAmount || 0, + table2Data?.BillAmount || table2Data?.NetAmount || 0 ), // Bank Details - mapped from A4Standard bankDetails: table2Data?.BankDetails?.[0] || null, @@ -176,31 +181,31 @@ const TaxInvoice = ({ let PageSize = printDatas?.PageSize; const TakeawayData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === "takeaway", + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' ); const DineInData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === "dine in", + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' ); let PaymentStatusSuccess = PaymentStatus?.filter( - (ps) => ps.PaymentStatus === "S", + (ps) => ps.PaymentStatus === 'S' ); // Calculate GST/IGST totals const cgstTotal = OrderDetailGST && OrderDetailGST.length > 0 ? Number( - OrderDetailGST?.reduce((sum, item) => sum + (item.CGST || 0), 0), + OrderDetailGST?.reduce((sum, item) => sum + (item.CGST || 0), 0) )?.toFixed(2) : 0; const sgstTotal = OrderDetailGST && OrderDetailGST.length > 0 ? Number( - OrderDetailGST?.reduce((sum, item) => sum + (item.SGST || 0), 0), + OrderDetailGST?.reduce((sum, item) => sum + (item.SGST || 0), 0) )?.toFixed(2) : 0; const igstTotal = OrderDetailIGST && OrderDetailIGST.length > 0 ? Number( - OrderDetailIGST?.reduce((sum, item) => sum + (item.TaxAmt || 0), 0), + OrderDetailIGST?.reduce((sum, item) => sum + (item.TaxAmt || 0), 0) )?.toFixed(2) : 0; @@ -217,39 +222,39 @@ const TaxInvoice = ({ cgstTotal, sgstTotal, igstTotal, - "roundoff vaules", + 'roundoff vaules' ); function RoundOffFun(amount) { const roundedAmount = Math.round(amount); const roundOffValue = parseFloat((roundedAmount - amount).toFixed(2)); // const symbol = roundOffValue > 0 ? '+' : ''; // Add "+" symbol for positive values ${symbol} console.log( - "Rounded Amount:", + 'Rounded Amount:', roundedAmount, - "Round Off Value:", - roundOffValue, + 'Round Off Value:', + roundOffValue ); return `${roundOffValue.toFixed(2)}`; } - console.log("=== DEBUG INFO ==="); - console.log("table2Data?.productDetails:", table2Data?.productDetails); - console.log("GlobaldummyData:", GlobaldummyData); - console.log("TakeawayData:", TakeawayData); - console.log("DineInData:", DineInData); - console.log("PageSize:", PageSize); + console.log('=== DEBUG INFO ==='); + console.log('table2Data?.productDetails:', table2Data?.productDetails); + console.log('GlobaldummyData:', GlobaldummyData); + console.log('TakeawayData:', TakeawayData); + console.log('DineInData:', DineInData); + console.log('PageSize:', PageSize); // Allow up to 10 items per page const chunkSize = - table2Data?.OrderType !== "E" + table2Data?.OrderType !== 'E' ? isMobile ? 7 - : PageSize == "A5" + : PageSize == 'A5' ? 9 : 8 : isMobile ? 10 - : PageSize == "A5" + : PageSize == 'A5' ? 12 : 11; let dataSource = []; @@ -263,12 +268,12 @@ const TaxInvoice = ({ } console.log( - "Final DataSource:", + 'Final DataSource:', dataSource, - "Length:", + 'Length:', dataSource.length, - "ChunkSize:", - chunkSize, + 'ChunkSize:', + chunkSize ); const paginatedChunks = []; @@ -296,24 +301,24 @@ const TaxInvoice = ({ paginatedChunks.push([]); // Empty chunk for footer-only page } console.log( - "Paginated Chunks:", + 'Paginated Chunks:', paginatedChunks.length, - "Chunks:", - paginatedChunks.map((chunk, i) => `Chunk ${i}: ${chunk.length} items`), + 'Chunks:', + paginatedChunks.map((chunk, i) => `Chunk ${i}: ${chunk.length} items`) ); - console.log("Should footer be on new page:", shouldFooterBeOnNewPage); + console.log('Should footer be on new page:', shouldFooterBeOnNewPage); return (
    {paginatedChunks?.map((dataChunk, chunkIndex) => ( @@ -322,16 +327,16 @@ const TaxInvoice = ({ className={ isMobile ? `invoice-wrapper container pdf-page` - : `invoice-wrapper container print-chunk${chunkIndex > 0 ? " print-page-break" : ""}` + : `invoice-wrapper container print-chunk${chunkIndex > 0 ? ' print-page-break' : ''}` } style={{ - display: "flex", - flexDirection: "column", + display: 'flex', + flexDirection: 'column', // justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) ? "space-between" : "", - height: isMobile ? "275mm" : PageSize == "A5" ? "130mm" : "245mm", - marginBottom: "0", + height: isMobile ? '275mm' : PageSize == 'A5' ? '130mm' : '245mm', + marginBottom: '0', pageBreakAfter: - chunkIndex < paginatedChunks.length - 1 ? "always" : "auto", + chunkIndex < paginatedChunks.length - 1 ? 'always' : 'auto', }} > {renderInvoiceContent(dataChunk, chunkIndex)} @@ -343,7 +348,7 @@ const TaxInvoice = ({ function renderInvoiceContent(dataChunk, chunkIndex) { console.log( `Rendering page ${chunkIndex + 1}, chunk has ${dataChunk.length} items:`, - dataChunk, + dataChunk ); const isFirstPage = chunkIndex === 0; @@ -355,7 +360,7 @@ const TaxInvoice = ({ paginatedChunks.length - 1 - (shouldFooterBeOnNewPage ? 1 : 0); const shouldShowTaxDetails = isLastDataChunk && dataChunk.length > 0; console.log( - `Page ${chunkIndex + 1}: isFirstPage=${isFirstPage}, isLastPage=${isLastPage}, isFooterOnlyPage=${isFooterOnlyPage},datachunkslength=${dataChunk.length}`, + `Page ${chunkIndex + 1}: isFirstPage=${isFirstPage}, isLastPage=${isLastPage}, isFooterOnlyPage=${isFooterOnlyPage},datachunkslength=${dataChunk.length}` ); return ( @@ -365,26 +370,26 @@ const TaxInvoice = ({ <>
    -

    - {table2Data?.OrderType === "E" - ? "Estimate" +

    + {table2Data?.OrderType === 'E' + ? 'Estimate' : BillName ? BillName - : "TAX INVOICE"} + : 'TAX INVOICE'}

    -
    - {ReprintType == "Duplicate" - ? "(DUPLICATE FOR RECIPIENT)" - : "(ORIGINAL FOR RECIPIENT)"} +
    + {ReprintType == 'Duplicate' + ? '(DUPLICATE FOR RECIPIENT)' + : '(ORIGINAL FOR RECIPIENT)'}
    @@ -392,54 +397,54 @@ const TaxInvoice = ({ )} {/* Main Container - Always show */} -
    +
    {/* Top Section - Company and Invoice Details - Only on first page */} {isFirstPage && ( -
    +
    {/* Left - Company Details */}
    - {!estimatePrintHeader && table2Data?.OrderType === "E" ? ( - "" + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' ) : (
    {invoiceData.companyName}
    -
    +
    {invoiceData.companyspecname}
    {invoiceData.companyAddress.address1}
    {invoiceData.companyAddress.address2}
    - {invoiceData.companyAddress.city}{" "} + {invoiceData.companyAddress.city}{' '} {invoiceData.companyAddress.zip ? ` - ${invoiceData.companyAddress.zip}` - : ""} + : ''}
    {invoiceData.companyAddress.state}
    {invoiceData.companyGSTIN && ( -
    +
    GSTIN/UIN: {invoiceData.companyGSTIN}
    )} @@ -452,7 +457,7 @@ const TaxInvoice = ({ Mobile: +91 {invoiceData.companyMobile} {invoiceData.companyMobile2 ? `, ${invoiceData.companyMobile2}` - : ""} + : ''}
    )}
    @@ -460,16 +465,16 @@ const TaxInvoice = ({ {/* Buyer Details */}
    -
    Buyer (Bill to)
    -
    +
    Buyer (Bill to)
    +
    {invoiceData.customerName}
    {invoiceData.customerAddress.address1 && ( @@ -482,8 +487,8 @@ const TaxInvoice = ({
    Mobile: {invoiceData.customerMobile}
    )} {invoiceData.customerGSTIN && - table2Data?.OrderType !== "E" && ( -
    + table2Data?.OrderType !== 'E' && ( +
    GSTIN/UIN: {invoiceData.customerGSTIN}
    )} @@ -494,29 +499,29 @@ const TaxInvoice = ({
    {/* Right - Invoice Details */} -
    +
    {/* Invoice No and Date */}
    -
    Invoice No.
    -
    +
    Invoice No.
    +
    {invoiceData.invoiceNo}
    Dated
    -
    +
    {invoiceData.invoiceDate}
    @@ -525,31 +530,31 @@ const TaxInvoice = ({ {/* Delivery Note and Payment Terms */}
    -
    Delivery Note
    +
    Delivery Note
    -
    Mode/Terms of Payment
    +
    Mode/Terms of Payment
    @@ -557,31 +562,31 @@ const TaxInvoice = ({ {/* Reference and Other References */}
    -
    Reference No. & Date
    +
    Reference No. & Date
    -
    Other References
    +
    Other References
    @@ -589,60 +594,60 @@ const TaxInvoice = ({ {/* Buyer's Order */}
    -
    Buyer's Order No.
    +
    Buyer's Order No.
    -
    Dated
    +
    Dated
    {/* Dispatch Details */}
    -
    Dispatch Doc No.
    +
    Dispatch Doc No.
    -
    Delivery Note Date
    +
    Delivery Note Date
    @@ -650,26 +655,26 @@ const TaxInvoice = ({ {/* Dispatched through and Destination */}
    -
    Dispatched through
    +
    Dispatched through
    -
    +
    Destination
    @@ -679,12 +684,12 @@ const TaxInvoice = ({ {/* Terms of Delivery */}
    -
    Terms of Delivery
    +
    Terms of Delivery
    @@ -695,15 +700,15 @@ const TaxInvoice = ({ {!isFirstPage && (
    -

    - {isFooterOnlyPage ? "Tax Invoice" : "Tax Invoice "} +

    + {isFooterOnlyPage ? 'Tax Invoice' : 'Tax Invoice '}

    -
    +
    Invoice No: {invoiceData.invoiceNo}
    @@ -714,67 +719,67 @@ const TaxInvoice = ({
    {/* Table Header */}
    SL.No
    Description of Goods
    HSN/SAC
    Quantity
    Rate
    {/*
    per
    */} -
    +
    Amount
    @@ -786,102 +791,102 @@ const TaxInvoice = ({
    {chunkIndex * chunkSize + index + 1}
    - {item.ProdName || "Product Name"} + {item.ProdName || 'Product Name'}
    {item.BrandName && (
    - {item.BrandName}{" "} + {item.BrandName}{' '}
    )} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( (items) => - items.SerialNumber && items.SerialNumber !== "", + items.SerialNumber && items.SerialNumber !== '' )?.map((a, i) => (
    {a.SerialNumber}
    )) - : ""} + : ''} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (id) => id.IMEI1 !== "" || id.IMEI2 !== "", + (id) => id.IMEI1 !== '' || id.IMEI2 !== '' )?.map((id, i) => { - const imei1 = id.IMEI1 || ""; - const imei2 = id.IMEI2 || ""; + const imei1 = id.IMEI1 || ''; + const imei2 = id.IMEI2 || ''; return (
    - {[imei1, imei2].filter(Boolean).join(",")} + {[imei1, imei2].filter(Boolean).join(',')}
    ); }) - : ""} + : ''}
    - {item.HSN || ""} + {item.HSN || ''}
    - {item.SalesQty || 1} {item.UomName || "NOS"} + {item.SalesQty || 1} {item.UomName || 'NOS'}
    {Number( - table2Data?.OrderType !== "E" + table2Data?.OrderType !== 'E' ? item.Rate - item.ProdTaxAmt - : item.Rate || 0, - ).toLocaleString("en-IN", { + : item.Rate || 0 + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, })} @@ -889,17 +894,17 @@ const TaxInvoice = ({ {/*
    {item.UomName || 'NOS'}
    */}
    {Number( - table2Data?.OrderType !== "E" + table2Data?.OrderType !== 'E' ? item.WithoutTaxRate - : item.TotalAmt || 0, - ).toLocaleString("en-IN", { + : item.TotalAmt || 0 + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, })} @@ -912,150 +917,150 @@ const TaxInvoice = ({ {/* Total without tax amount */}
    -
    +
    -
    -
    -
    +
    +
    +
    {/*
    */}
    - ₹{" "} + ₹{' '} {Number( - table2Data?.OrderType !== "E" + table2Data?.OrderType !== 'E' ? invoiceData?.totalBillAmount - : invoiceData?.grandTotal, - ).toLocaleString("en-IN", { + : invoiceData?.grandTotal + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, })}
    - {table2Data?.OrderType !== "E" && ( + {table2Data?.OrderType !== 'E' && ( <> {/* CGST */} {OrderDetailGST && OrderDetailGST.length > 0 && ( <>
    CGST
    {/*
    */}
    {OrderDetailGST && OrderDetailGST.length > 0 ? Number( OrderDetailGST?.reduce( (sum, item) => sum + (item.CGST || 0), - 0, - ), - ).toLocaleString("en-IN", { + 0 + ) + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : "0.00"} + : '0.00'}
    {/* SGST */}
    SGST
    {/*
    */}
    {OrderDetailGST && OrderDetailGST.length > 0 ? Number( OrderDetailGST?.reduce( (sum, item) => sum + (item.SGST || 0), - 0, - ), - ).toLocaleString("en-IN", { + 0 + ) + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : "0.00"} + : '0.00'}
    @@ -1064,54 +1069,54 @@ const TaxInvoice = ({ {OrderDetailIGST && OrderDetailIGST.length > 0 && (
    IGST
    {/*
    */}
    {OrderDetailIGST && OrderDetailIGST.length > 0 ? Number( OrderDetailIGST?.reduce( (sum, item) => sum + (item.TaxAmt || 0), - 0, - ), - ).toLocaleString("en-IN", { + 0 + ) + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : "0.00"} + : '0.00'}
    )} @@ -1120,34 +1125,34 @@ const TaxInvoice = ({ {/* Rounding Off */}
    -
    +
    ROUNDING OFF
    -
    -
    -
    +
    +
    +
    {/*
    */} -
    +
    {RoundOffFun( - table2Data?.OrderType !== "E" + table2Data?.OrderType !== 'E' ? roundOffValue - : roundOffEstimateValue, + : roundOffEstimateValue )}
    @@ -1157,61 +1162,61 @@ const TaxInvoice = ({
     
     
     
     
     
    {/*
     
    */}
     
    @@ -1220,60 +1225,60 @@ const TaxInvoice = ({ {/* Total */}
    -
    +
    Total
    -
    +
    {totalQuantity || invoiceData.productDetails?.reduce( (sum, item) => sum + (item.SalesQty || 0), - 0, + 0 ) || - 0}{" "} + 0}{' '} NOS
    -
    +
    {/*
    */}
    - ₹{" "} + ₹{' '} {Number(invoiceData.grandTotal).toLocaleString( - "en-IN", + 'en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, - }, + } )}
    @@ -1284,71 +1289,71 @@ const TaxInvoice = ({ // Show empty row when no data
    -
    No items to display
    -
    -
    -
    -
    -
    +
    -
    @@ -1363,83 +1368,83 @@ const TaxInvoice = ({ {/* Amount in Words */}
    -
    +
    Amount Chargeable (in words)
    -
    +
    INR {numberToWords(Math.floor(invoiceData.grandTotal))} Only

    E. & O.E

    - {table2Data?.OrderType !== "E" && ( + {table2Data?.OrderType !== 'E' && ( <> {/* Tax Breakdown Table */} -
    +
    {OrderDetailGST && OrderDetailGST.length > 0 ? ( <> {/* Tax Table Header - Main Headers */}
    HSN/SAC
    Taxable Value
    CGST
    SGST/UTGST
    Tax Amount
    @@ -1448,64 +1453,64 @@ const TaxInvoice = ({ {/* Tax Table Sub-Headers */}
    Rate
    Amount
    Rate
    Amount
    @@ -1514,94 +1519,94 @@ const TaxInvoice = ({
    - {taxItem.HSN || ""} + {taxItem.HSN || ''}
    {Number( - taxItem.WithOutTaxAmount || 0, - ).toLocaleString("en-IN", { + taxItem.WithOutTaxAmount || 0 + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, })}
    {taxItem.TaxPercentage - ? taxItem.TaxPercentage / 2 + "%" - : "0%"} + ? taxItem.TaxPercentage / 2 + '%' + : '0%'}
    {Number(taxItem.CGST || 0).toLocaleString( - "en-IN", + 'en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, - }, + } )}
    {taxItem.TaxPercentage - ? taxItem.TaxPercentage / 2 + "%" - : "0%"} + ? taxItem.TaxPercentage / 2 + '%' + : '0%'}
    {Number(taxItem.SGST || 0).toLocaleString( - "en-IN", + 'en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, - }, + } )}
    -
    +
    {Number( - (taxItem.CGST || 0) + (taxItem.SGST || 0), - ).toLocaleString("en-IN", { + (taxItem.CGST || 0) + (taxItem.SGST || 0) + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, })} @@ -1610,27 +1615,27 @@ const TaxInvoice = ({ ))}
    Total
    {OrderDetailGST && OrderDetailGST.length > 0 @@ -1638,81 +1643,81 @@ const TaxInvoice = ({ OrderDetailGST?.reduce( (sum, item) => sum + (item.WithOutTaxAmount || 0), - 0, - ), - ).toLocaleString("en-IN", { + 0 + ) + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : "0.00"} + : '0.00'}
    {OrderDetailGST && OrderDetailGST.length > 0 ? Number( OrderDetailGST?.reduce( (sum, item) => sum + (item.CGST || 0), - 0, - ), - ).toLocaleString("en-IN", { + 0 + ) + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : "0.00"} + : '0.00'}
    {OrderDetailGST && OrderDetailGST.length > 0 ? Number( OrderDetailGST?.reduce( (sum, item) => sum + (item.SGST || 0), - 0, - ), - ).toLocaleString("en-IN", { + 0 + ) + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : "0.00"} + : '0.00'}
    {OrderDetailGST && OrderDetailGST.length > 0 ? Number( OrderDetailGST?.reduce( (sum, item) => sum + (item.CGST || 0) + (item.SGST || 0), - 0, - ), - ).toLocaleString("en-IN", { + 0 + ) + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : "0.00"} + : '0.00'}
    @@ -1721,41 +1726,41 @@ const TaxInvoice = ({ {/* Tax Table Header - Main Headers */}
    HSN/SAC
    Taxable Value
    IGST
    Tax Amount
    @@ -1763,47 +1768,47 @@ const TaxInvoice = ({ {/* Tax Table Sub-Headers */}
    Rate
    Amount
    {/* Tax Table Rows - Dynamic from OrderDetailGST */} @@ -1811,97 +1816,97 @@ const TaxInvoice = ({
    - {taxItem.HSN || ""} + {taxItem.HSN || ''}
    {Number( - taxItem.WithOutTaxAmount || 0, - ).toLocaleString("en-IN", { + taxItem.WithOutTaxAmount || 0 + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, })}
    {taxItem.TaxPercentage - ? taxItem.TaxPercentage + "%" - : "0%"} + ? taxItem.TaxPercentage + '%' + : '0%'}
    {Number(taxItem.TaxAmt || 0).toLocaleString( - "en-IN", + 'en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, - }, + } )}
    -
    +
    {Number(taxItem.TaxAmt || 0).toLocaleString( - "en-IN", + 'en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, - }, + } )}
    - ))}{" "} + ))}{' '}
    Total
    {OrderDetailIGST && OrderDetailIGST.length > 0 @@ -1909,55 +1914,55 @@ const TaxInvoice = ({ OrderDetailIGST?.reduce( (sum, item) => sum + (item.WithOutTaxAmount || 0), - 0, - ), - ).toLocaleString("en-IN", { + 0 + ) + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : "0.00"} + : '0.00'}
    {OrderDetailIGST && OrderDetailIGST.length > 0 ? Number( OrderDetailIGST?.reduce( (sum, item) => sum + (item.TaxAmt || 0), - 0, - ), - ).toLocaleString("en-IN", { + 0 + ) + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : "0.00"} + : '0.00'}
    {OrderDetailIGST && OrderDetailIGST.length > 0 ? Number( OrderDetailIGST?.reduce( (sum, item) => sum + (item.TaxAmt || 0), - 0, - ), - ).toLocaleString("en-IN", { + 0 + ) + ).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2, }) - : "0.00"} + : '0.00'}
    @@ -1966,50 +1971,50 @@ const TaxInvoice = ({ {/* Tax Table Header - Main Headers */}
    HSN/SAC
    Taxable Value
    CGST
    SGST/UTGST
    Tax Amount
    @@ -2018,199 +2023,199 @@ const TaxInvoice = ({ {/* Tax Table Sub-Headers */}
    Rate
    Amount
    Rate
    Amount
    -
    0.00
    0%
    0.00
    0%
    0.00
    -
    +
    0.00
    {/* Tax Table Total */}
    Total
    - {"0.00"} + {'0.00'}
    - {"0.00"} + {'0.00'}
    - {"0.00"} + {'0.00'}
    - {"0.00"} + {'0.00'}
    @@ -2220,31 +2225,31 @@ const TaxInvoice = ({ {/* Tax Amount in Words */}
    - Tax Amount (in words):{" "} - - INR{" "} + Tax Amount (in words):{' '} + + INR{' '} {numberToWords( Math.floor( invoiceData.taxAmount || OrderDetailGST?.reduce( (sum, item) => sum + (item.CGST || 0) + (item.SGST || 0), - 0, + 0 ) || Number( OrderDetailIGST?.reduce( (sum, item) => sum + (item.TaxAmt || 0), - 0, - ), + 0 + ) ) || - 0, - ), - )}{" "} + 0 + ) + )}{' '} Only
    @@ -2253,33 +2258,29 @@ const TaxInvoice = ({ )} {/* Bank Details and Signature */}
    + {/* Declaration */}
    Declaration @@ -2291,73 +2292,73 @@ const TaxInvoice = ({
    + {/* Signature Section */}
    {/* Bank Details */}
    - {!estimatePrintHeader && table2Data?.OrderType === "E" ? ( - "" + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' ) : ( -
    +
    Company's Bank Details
    )} - {!estimatePrintHeader && table2Data?.OrderType === "E" ? ( - "" + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' ) : (
    A/c Holder's Name: - - {" "} + + {' '} {invoiceData.companyName}
    Bank Name: - - {" "} - {invoiceData.bankDetails?.BankName || ""} + + {' '} + {invoiceData.bankDetails?.BankName || ''}
    - A/c No.:{" "} - - {invoiceData.bankDetails?.AccountNo || ""} + A/c No.:{' '} + + {invoiceData.bankDetails?.AccountNo || ''}
    - Branch & IFS Code:{" "} - - {invoiceData.bankDetails?.BankBranch || ""} &{" "} - {invoiceData.bankDetails?.IFSCCode || ""} + Branch & IFS Code:{' '} + + {invoiceData.bankDetails?.BankBranch || ''} &{' '} + {invoiceData.bankDetails?.IFSCCode || ''}
    {invoiceData.bankDetails?.SWIFTCode && (
    - + SWIFT Code: - - {" "} - {invoiceData.bankDetails?.SWIFTCode || ""} + + {' '} + {invoiceData.bankDetails?.SWIFTCode || ''}
    )} @@ -2366,21 +2367,21 @@ const TaxInvoice = ({
    - {!estimatePrintHeader && table2Data?.OrderType === "E" ? ( - "" + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' ) : (
    for {invoiceData.companyName} @@ -2388,28 +2389,28 @@ const TaxInvoice = ({ )}
    {/*
    DD
    @@ -2417,7 +2418,7 @@ const TaxInvoice = ({
    ELECTRONICS
    */}
    -
    +
    Authorised Signatory
    @@ -2432,9 +2433,9 @@ const TaxInvoice = ({ {isLastPage && (
    This is a Computer Generated Invoice
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.jsx index 7c42ea0..16af439 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.jsx @@ -30,6 +30,7 @@ import { GlobalprintLogo, GlobalprintCredit, GlobalprintTax, + GlobalSelectedPrintHeaderColor, } from '../../../../Features/ThemeChange/ThemeChange'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.scss'; import QRCode from 'react-qr-code'; @@ -95,6 +96,7 @@ const PrintStyle1 = ({ const GlobalCashierName = useSelector(GlobalprintCashierName); const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); const GlobalSignatureImages = useSelector(GlobalSignatureImage); @@ -225,9 +227,12 @@ const PrintStyle1 = ({ } }); const hasMappedOffer = offers.some((offer) => - ['ItemWiseOffers', 'BundleOffers', 'QuantityWiseOffers', 'MemberShip'].includes( - offer.TableName - ) + [ + 'ItemWiseOffers', + 'BundleOffers', + 'QuantityWiseOffers', + 'MemberShip', + ].includes(offer.TableName) ); if (hasMappedOffer) { @@ -436,6 +441,7 @@ const PrintStyle1 = ({ style={{ fontSize: 'clamp(2rem, 2.5vw, 2rem)', fontWeight: '600', + color: SelectedHeaderColor, }} > {' '} @@ -3562,6 +3568,7 @@ const PrintStyle1 = ({ style={{ fontSize: 'clamp(2rem, 2.5vw, 2rem)', fontWeight: '600', + color: SelectedHeaderColor, }} > {' '} diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx index 79de332..1672df1 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx @@ -27,6 +27,7 @@ import { GlobalprintLogo, GlobalprintCredit, GlobalprintTax, + GlobalSelectedPrintHeaderColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint, @@ -121,6 +122,7 @@ const PrintStyle10 = ({ const paymentTypeUPI = PaymentStatus?.find( (ps) => ps.PaymentTypeName === 'UPI' ); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); let TermsAndConditions = printDatas?.TermsandConditions; let SignatureImg = printDatas?.Signature; @@ -407,7 +409,13 @@ const PrintStyle10 = ({
    -
    +
    {GlobaldummyData ? 'ABC Shop' : table2Data?.BrName}{' '} @@ -2926,7 +2934,10 @@ const PrintStyle10 = ({
    -
    +
    {GlobaldummyData ? 'ABC Shop' : table2Data?.BrName}{' '}
    {GlobaldummyData diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx index a4cd8fa..8416fac 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx @@ -1,8 +1,11 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import QRcode from '../../../../Images/QRcode.png'; -import Logo from '../../../../Images/Logo.jpg' -import { extractLastNumber, extractLastNumberOrderId } from '../../../../Services/Others'; +import Logo from '../../../../Images/Logo.jpg'; +import { + extractLastNumber, + extractLastNumberOrderId, +} from '../../../../Services/Others'; import { GlobalprintSlNo, GlobalprintItem, @@ -26,139 +29,272 @@ import { GlobalprintLogo, GlobalprintCredit, GlobalprintTax, + GlobalSelectedPrintHeaderColor, } from '../../../../Features/ThemeChange/ThemeChange'; -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; -import "../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.scss"; +import { + GlobalUpiIDprint, + PreferenceData, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.scss'; import QRCode from 'react-qr-code'; -import signature from "../../../../Images/signatureimage.jpg" +import signature from '../../../../Images/signatureimage.jpg'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; import { isMobile } from 'react-device-detect'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; - -const PrintStyle11 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, totalQuantityFilter, BranchCity, BranchZip, CashierName, totalQuantity, - OrderDetailGST, OrderDetailIGST, OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, printDatas, isPdf, SalesModePref, sportsAppPreference, - MembershipApplied = null }) => { - +const PrintStyle11 = ({ + index, + ExtraChargeTotal, + Date1, + base64Image, + PrintLogo, + totalQuantityFilter, + BranchCity, + BranchZip, + CashierName, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + OrderDetailVAT, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + isPdf, + SalesModePref, + sportsAppPreference, + MembershipApplied = null, +}) => { const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint) + 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 SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Tax = FieldDetails?.['Tax']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const CashierNameField = FieldDetails?.['CashierName']; + const LogoField = FieldDetails?.['Logo']; + const CreditDetails = FieldDetails?.['Credit details']; const WeightasKg = FieldDetails?.['Weight']; - const 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 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 GlobalthemeFormatr = useSelector(GlobalthemeFormat); + const GlobalBilltext = useSelector(GlobalBillName); const appPreferences = useSelector(ApplicationPreferences); const SettingData = useSelector(PreferenceData); const GlobalCashierName = useSelector(GlobalprintCashierName); const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); - const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.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") + const estimatePrintHeader = + SettingData?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' + )?.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' + ); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); - 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 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']; const PackageDetails = table2Data?.PackageDtl; const keysLength = Object.keys(table2Data ?? {}).length; - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } - const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") - const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") + const TakeawayData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' + ); + const DineInData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' + ); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); const DineInTotal = DineInData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); - const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); + 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; - } + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } - return acc; - }, {}); + return acc; + }, + {} + ); const productsData = table2Data?.productDetails || []; const offers = table2Data?.OrderOfferDetails || []; let TotalOfferAmount = 0; // Calculate SalesWiseOffers total amount - offers.forEach(offer => { + offers.forEach((offer) => { if (offer.TableName === 'SalesWiseOffers') { TotalOfferAmount += offer.OfferAmount; } }); - const hasMappedOffer = offers.some(offer => - ["ItemWiseOffers", "BundleOffers", "QuantityWiseOffers"].includes(offer.TableName) + 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); + 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); + 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.00, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 18, + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 40, + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, ]; - const chunkSize = PageSize == "A5" ? 8 : 11; + const chunkSize = PageSize == 'A5' ? 8 : 11; let dataSource = []; if (GlobaldummyData || TakeawayData?.length > 0) { @@ -172,1313 +308,4005 @@ const PrintStyle11 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 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); + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 10); 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}> - - + className={ + isMobile + ? `invoice-wrapper container pdf-page` + : `invoice-wrapper container print-chunk${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") ? '' :
    -
    - {(GlobalLogo && GlobaldummyData) ? image : null} - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    -
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    - {/*
    +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {GlobalLogo && GlobaldummyData ? ( + image + ) : null} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    + {/*
    Save green | Save nature
    */} +
    +
    +
    +
    +
    + {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 NO :{table2Data?.BrMobile} +
    +
    +
    +
    + {GlobaldummyData + ? 'CASH' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`} +
    +
    + Bill No :{' '} + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    -
    -
    -
    - {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 NO :{table2Data?.BrMobile}
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`}
    -
    -
    {GlobaldummyData ? 'CASH' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""} {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`}
    -
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`}
    } + )}
    - -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference &&
    Take Away
    } + {takeAwayPreference && ( +
    + Take Away +
    + )}
    GST Rate + GST Rate + Taxable Amount + {' '} {Number(item.SGST).toFixed(2)} + {' '} {Number(item.TotalAmt).toFixed(2)}
    - {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 && } + {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 && ( + + )} {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 && } + {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 && ( + + )} - ) + ); })}
    S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmtS.NS.NItemItem + Qty + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + HSN + + HSN + + MRP + + MRP + + Dis{' '} + + Dis{' '} + + Tax %{' '} + + Tax %{' '} + + Rate + + Rate + + Amt + + Amt +
    {index + 1}{chunkIndex * chunkSize + index + 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?.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?.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?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}{index + 1} + {chunkIndex * chunkSize + index + 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?.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?.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?.SalesQty} + + {item?.SalesQty} + + {item?.HSN} + + {item?.HSN} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item.ProdTaxPercentage} + + {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 && dinePreference) && + )} + {DineInData?.length > 0 && dinePreference && ( <> -
    Dine In
    +
    + Dine In +
    - {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 && } + {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 && ( + + )} {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 && } + {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 && ( + + )} - ) + ); })}
    S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmtS.NS.NItemItem + Qty + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + HSN + + HSN + + MRP + + MRP + + Dis{' '} + + Dis{' '} + + Tax %{' '} + + Tax %{' '} + + Rate + + Rate + + Amt + + Amt +
    {index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    ({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 || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}{index + 1} + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} +
    {item?.ProdName}
    +
    + ({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 || 0 + : item?.OfferValue || 0} + + {item.ProdTaxPercentage} + + {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 && - <> -
    -
    -
    -
    -
    -
    Qty
    -
    Items
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    Off
    - } - {/*
    SUB TOTAL
    + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> +
    +
    +
    +
    +
    +
    + Qty +
    +
    + Items +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + Off +
    + )} + {/*
    SUB TOTAL
    ROUND OFF
    */} +
    +
    +
    {GlobaldummyData ? '9' : totalQuantity}
    +
    + {GlobaldummyData + ? '8' + : totalQuantityFilter?.length} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + {GlobaldummyData + ? '8' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} + {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} + {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */} +
    -
    -
    {GlobaldummyData ? '9' : totalQuantity}
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    {GlobaldummyData ? '8' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    - } - {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} - {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + TakeAway :{Number(TakeawayTotal).toFixed(2)}/- +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + DineIn :{Number(DineInTotal).toFixed(2)}/- +
    + )} +
    + Amount : + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} + /-
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    TakeAway :{Number(TakeawayTotal).toFixed(2)}/-
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    DineIn :{Number(DineInTotal).toFixed(2)}/-
    - } -
    Amount :{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}/-
    -
    -
    - {(table2Data?.OrderType === "E") ? '' : -
    -
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    +
    +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    +
    +

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

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + )} -
    -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    -
    -

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

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - + {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 && ( + <> +
    + + + + + - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    + Taxable Amount + + VAT +
    - - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } + + Total Amount + + + {OrderDetailVAT?.map((item) => ( + + + {item?.TaxPercentage || 0}% + + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + + {Number( + item.TaxAmt + ).toFixed(2)} + - {(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)}
    - - } - -
    -
    - - } + + {Number( + item.TotalAmt + ).toFixed(2)} + + + ))} + + + )} +
    +
    + + )} +
    -
    - } -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    + )} +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '}
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    +
    + {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} + + )} - {/* 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)}

    + {/* 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} - +
    )} - {/* 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} -
    - ) - )} - -
    - -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    +
    + {PaymentStatusSuccess?.length > 1 && ( + <> + {/*

    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 && 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 + } +
    + )} + +
    + {Date1}
    - } - - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} +
    + YOUR ORDER NO:{' '} + {table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)}
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - -
    {Date1}
    -
    YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    - {GlobaldummyData ? GlobalQrcodet &&
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    +
    + +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

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

    + {Notestext} +

    + +
    +
    + )} + +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not + exchangeable or refundable. +
    2. +
    3. + Please check the product before leaving the + counter. +
    4. +
    +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )} +
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    -
    - - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

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

    {Notestext}

    - -
    -
    ) - } - - -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (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

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

    Signature

    - -
    )} - -
    -
    - - {PrintGreeting?.SettingValue === "Y" && -
    -
    Thank You Visit Again
    -
    - } - - - } + {PrintGreeting?.SettingValue === 'Y' && ( +
    +
    + Thank You Visit Again +
    +
    + )} + + )}
    ))} - {shouldFooterBeOnNewPage && FormatTheme && + {shouldFooterBeOnNewPage && FormatTheme && (
    -
    <>
    -
    +
    -
    -
    -
    Qty
    -
    Items
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    Off
    - } +
    +
    +
    + Qty +
    +
    + Items +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + Off +
    + )} {/*
    SUB TOTAL
    ROUND OFF
    */}
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    {GlobaldummyData ? '8' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    - } +
    + {GlobaldummyData + ? '8' + : totalQuantityFilter?.length} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + {GlobaldummyData + ? '8' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */}
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    TakeAway :{Number(TakeawayTotal).toFixed(2)}/-
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    DineIn :{Number(DineInTotal).toFixed(2)}/-
    - } -
    Amount :{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}/-
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + TakeAway :{Number(TakeawayTotal).toFixed(2)}/- +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + DineIn :{Number(DineInTotal).toFixed(2)}/- +
    + )} +
    + Amount : + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} + /- +

    - {(table2Data?.OrderType === "E") ? '' : -
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    - -
    +
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    -
    -

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

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - {OrderDetailIGST?.map((item) => + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    +
    +

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

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    - Taxable Amount - - IGST - - Total Amount -
    - - - + - - ) - } -
    - {item?.TaxPercentage || 0}% + + Taxable Amount - {Number(item.WithOutTaxAmount).toFixed(2)} + + CGST - {Number(item.TaxAmt).toFixed(2)} + + SGST + + Total Amount {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + )} - - - - - Taxable Amount - - - VAT - - - Total Amount - - - {OrderDetailVAT?.map((item) => - - - {item?.TaxPercentage || 0}% - - - {Number(item.WithOutTaxAmount).toFixed(2)} - - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} - - ) - } - - - } - -
    -
    - - } + {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)} +
    + + )} +
    +
    + + )}
    - } -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - {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} -
    - ) )} -
    +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + {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} + + )} -
    - {PaymentStatusSuccess?.length > 1 && + {/* 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} +
    + )} +
    +
    + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} + {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 && 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} + {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} +
    + )} - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - -
    {Date1}
    -
    YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    +
    + {Date1} +
    +
    + YOUR ORDER NO:{' '} + {table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    - {GlobaldummyData ? GlobalQrcodet &&
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    -
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}

    - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

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

    {Notestext}

    - -
    -
    ) - } - - -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions + {GlobaldummyData + ? GlobalIsnotes && ( +

    +

    + Notes : 10 days Return policy

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

    Signature

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

    Signature

    - -
    )} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Notestext && ( +
    +

    + {Notestext} +

    +
    +
    + )} + +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not exchangeable + or refundable. +
    2. +
    3. + Please check the product before leaving the + counter. +
    4. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && -
    -
    Thank You Visit Again
    + {PrintGreeting?.SettingValue === 'Y' && ( +
    +
    + Thank You Visit Again +
    - } - + )}
    - } -
    - : -
    + ) : ( +
    - - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - -
    - {(GlobalLogo && GlobaldummyData) ? image : null} - {base64Image && (base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    -
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    - {/*
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {GlobalLogo && GlobaldummyData ? ( + image + ) : null} + {base64Image && + base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    + {/*
    Save green | Save nature
    */} +
    +
    +
    +
    +
    + {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 NO :{table2Data?.BrMobile} +
    +
    +
    +
    + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`} +
    +
    + Bill No :{' '} + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    -
    -
    -
    - {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 NO :{table2Data?.BrMobile}
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`}
    -
    -
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`}
    -
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`}
    } + )}
    - {(TakeawayData?.length > 0 || GlobaldummyData) && + {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference &&
    Take Away
    } + {takeAwayPreference && ( +
    + Take Away +
    + )} - +
    - {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 && } + {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 && ( + + )} - {(GlobaldummyData ? products : TakeawayData)?.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 && } - - ) - })} + {(GlobaldummyData ? products : TakeawayData)?.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 && ( + + )} + + ); + } + )}
    S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmtS.NS.NItemItem + Qty + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + HSN + + HSN + + MRP + + MRP + + Dis{' '} + + Dis{' '} + + Tax %{' '} + + Tax %{' '} + + Rate + + Rate + + Amt + + Amt +
    {index + 1}{index + 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?.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?.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?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    {index + 1}{index + 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?.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?.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?.SalesQty} + + {item?.SalesQty} + + {item?.HSN} + + {item?.HSN} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item.ProdTaxPercentage} + + {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 && dinePreference) && + )} + {DineInData?.length > 0 && dinePreference && ( <> -
    Dine In
    +
    + Dine In +
    - {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 && } + {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 && ( + + )} - {(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 && 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 && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )}
    S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmtS.NS.NItemItem + Qty + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + HSN + + HSN + + MRP + + MRP + + Dis{' '} + + Dis{' '} + + Tax %{' '} + + Tax %{' '} + + Rate + + Rate + + Amt + + Amt +
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    ({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 || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    +
    + ({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 || 0 + : item?.OfferValue || 0} + + {item.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.Rate} + + {item?.Rate} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    - } - - - + )}
    -
    +
    -
    -
    -
    Qty
    -
    Items
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    Off
    - } +
    +
    +
    + Qty +
    +
    + Items +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    + Off +
    + )} {/*
    SUB TOTAL
    ROUND OFF
    */}
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    {GlobaldummyData ? '8' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    - } +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    + {GlobaldummyData + ? '8' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */}
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    TakeAway :{Number(TakeawayTotal).toFixed(2)}/-
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    DineIn :{Number(DineInTotal).toFixed(2)}/-
    - } -
    Amount :{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}/-
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + TakeAway :{Number(TakeawayTotal).toFixed(2)}/- +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + DineIn :{Number(DineInTotal).toFixed(2)}/- +
    + )} +
    + Amount : + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} + /- +

    - {(table2Data?.OrderType === "E") ? '' : -
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    - -
    +
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    -
    -

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

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    +
    +

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

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    - - Taxable Amount - - IGST - - Total Amount -
    - + - - + - - ) - } -
    - {item?.TaxPercentage || 0}% + + Taxable Amount - {Number(item.WithOutTaxAmount).toFixed(2)} + + CGST - {Number(item.TaxAmt).toFixed(2)} + + SGST + + Total Amount {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} - - - Taxable Amount - - - VAT - - - Total Amount - - - {OrderDetailVAT?.map((item) => - - - {item?.TaxPercentage || 0}% - - - {Number(item.WithOutTaxAmount).toFixed(2)} - - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} - - ) - } - - - } - -
    -
    - - } + {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)} +
    + + )} +
    +
    + + )}
    - } -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    + )} +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} -
    +
    {/*
    CARD : *********12
    CARD HOLDER : CARD HOLDER NAME
    TOTAL SAVING : 0.00
    */} -
    - {PaymentStatusSuccess?.length > 1 && +
    + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)}
    ))} - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} + )} + {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} + {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} +
    + )} - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - -
    {Date1}
    -
    YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    +
    + {Date1} +
    +
    + YOUR ORDER NO:{' '} + {table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    - {GlobaldummyData ? GlobalQrcodet &&
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    -
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}

    - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

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

    {Notestext}

    - -
    -
    ) - } - - -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions + {GlobaldummyData + ? GlobalIsnotes && ( +

    +

    + Notes : 10 days Return policy

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

    Signature

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

    Signature

    - -
    )} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Notestext && ( +
    +

    {Notestext}

    +
    +
    + )} + +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not exchangeable or + refundable. +
    2. +
    3. + Please check the product before leaving the counter. +
    4. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && -
    + {PrintGreeting?.SettingValue === 'Y' && ( +
    {/*
    Terms & Condition
    Xxxx Yyyy Xxxx Yyyy Xxxx Yyyy Xxxx Yyyy
    */} -
    Thank You Visit Again
    +
    + Thank You Visit Again +
    - } - + )}
    - - - -
    - } - +
    + )} ); }; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx index 48226a3..d44e0c9 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx @@ -1,8 +1,12 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import QrImage from '../../../../Images/qrcode.jpg'; -import Logo from '../../../../Images/Logo.jpg' -import { extractLastNumber, extractLastNumberOrderId, printDiv } from '../../../../Services/Others'; +import Logo from '../../../../Images/Logo.jpg'; +import { + extractLastNumber, + extractLastNumberOrderId, + printDiv, +} from '../../../../Services/Others'; import { GlobalprintSlNo, GlobalprintItem, @@ -26,145 +30,276 @@ import { GlobalprintLogo, GlobalprintCredit, GlobalprintTax, -} from '../../../../Features/ThemeChange/ThemeChange' -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; -import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.scss' + GlobalSelectedPrintHeaderColor, +} from '../../../../Features/ThemeChange/ThemeChange'; +import { + GlobalUpiIDprint, + PreferenceData, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.scss'; import QRCode from 'react-qr-code'; -import signature from "../../../../Images/signatureimage.jpg" +import signature from '../../../../Images/signatureimage.jpg'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; import { isMobile } from 'react-device-detect'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; - - -const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, totalQuantityFilter, CashierName, totalQuantity, OrderDetailGST, OrderDetailIGST, - OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, printDatas, isPdf, sportsAppPreference, SalesModePref, - MembershipApplied = null }) => { - +const Printstyle12 = ({ + index, + ExtraChargeTotal, + Date1, + base64Image, + PrintLogo, + totalQuantityFilter, + CashierName, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + OrderDetailVAT, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + isPdf, + sportsAppPreference, + SalesModePref, + MembershipApplied = null, +}) => { const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint) + 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 SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Tax = FieldDetails?.['Tax']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const CashierNameField = FieldDetails?.['CashierName']; + const LogoField = FieldDetails?.['Logo']; + const CreditDetails = FieldDetails?.['Credit details']; const WeightasKg = FieldDetails?.['Weight']; - const 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 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 GlobalthemeFormatr = useSelector(GlobalthemeFormat); + const GlobalBilltext = useSelector(GlobalBillName); const appPreferences = useSelector(ApplicationPreferences); 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 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") + const estimatePrintHeader = + SettingData?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' + )?.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 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"]; + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + + 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']; const PackageDetails = table2Data?.PackageDtl; const keysLength = Object.keys(table2Data ?? {}).length; - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); const printDocument = () => { window.print(); - } + }; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } - const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") - const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") + const TakeawayData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' + ); + const DineInData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' + ); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); const DineInTotal = DineInData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); - const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); + 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; - } + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } - return acc; - }, {}); + return acc; + }, + {} + ); const productsData = table2Data?.productDetails || []; const offers = table2Data?.OrderOfferDetails || []; let TotalOfferAmount = 0; // Calculate SalesWiseOffers total amount - offers.forEach(offer => { + offers.forEach((offer) => { if (offer.TableName === 'SalesWiseOffers') { TotalOfferAmount += offer.OfferAmount; } }); - const hasMappedOffer = offers.some(offer => - ["ItemWiseOffers", "BundleOffers", "QuantityWiseOffers"].includes(offer.TableName) + 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); + 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); + 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.00, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 18, + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 40, + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, ]; - const chunkSize = PageSize == "A5" ? 8 : 11; + const chunkSize = PageSize == 'A5' ? 8 : 11; let dataSource = []; if (GlobaldummyData || TakeawayData?.length > 0) { @@ -178,8 +313,11 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 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); + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 10); const style12 = ``; const PrintA4 = async () => { - - await printDiv("PrintStyle12", style12, 'FontApply'); + await printDiv('PrintStyle12', style12, 'FontApply'); }; - return ( <> - {FormatTheme ? -
    - + {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}> - - + className={ + isMobile + ? `invoice-wrapper container pdf-page` + : `invoice-wrapper container print-chunk${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") ? '' :
    -
    -
    +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    +
    -
    {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 : '')} +
    + {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 + : '')} +
    +
    + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + + ' Bill' + : ''} +
    +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} +
    + {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} +
    + )} + {table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} +
    + )}
    -
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""}
    -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    - {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} -
    } - {table2Data?.OrderType === "E" &&
    Estimate
    } + {GlobalLogo && GlobaldummyData && ( +
    + {' '} + image +
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( +
    + {' '} + image +
    + ) : null} +
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} +
    + )} +
    +
    + Bill No :{' '} + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    + {Date1}
    - {(GlobalLogo && GlobaldummyData) &&
    image
    } - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : (base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ?
    image
    : null} - -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate
    } -
    -
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {Date1}
    -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference &&
    Take Away
    } + {takeAwayPreference && ( +
    + Take Away +
    + )}
    - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} {dataChunk?.map((item, index) => { return ( - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - ) + ); })}
    S.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateHSNHSN(%)(%) + Tax (%) + + Tax (%) + AmtAmt
    {index + 1}{chunkIndex * chunkSize + index + 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?.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?.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?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{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}{index + 1} + {chunkIndex * chunkSize + index + 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?.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?.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?.SalesQty} + + {item?.SalesQty} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item?.Rate} + + {item?.Rate} + + {item?.HSN} + + {item?.HSN} + + {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} +
    - } - {(DineInData?.length > 0 && dinePreference) && + )} + {DineInData?.length > 0 && dinePreference && ( <> -
    Dine In
    +
    + Dine In +
    - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} {dataChunk?.map((item, index) => { return ( - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - ) + ); })}
    S.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateHSNHSN(%)(%) + Tax (%) + + Tax (%) + AmtAmt
    {index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    -
    {item?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{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}{index + 1} + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    +
    + {item?.SalesQty} + + {item?.SalesQty} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item?.Rate} + + {item?.Rate} + + {item?.HSN} + + {item?.HSN} + + {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} +
    - } + )}
    - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - <> - -
    -
    -
    -
    -
    - Items -
    -
    :
    -
    - {GlobaldummyData ? '8' : totalQuantityFilter?.length} -
    -
    -
    -
    - Qty -
    -
    :
    -
    - {GlobaldummyData ? '9' : totalQuantity} -
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    - Off -
    + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> +
    +
    +
    +
    +
    Items
    :
    -
    - {GlobaldummyData ? '9' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)} +
    + {GlobaldummyData + ? '8' + : totalQuantityFilter?.length}
    - } - {/*
    +
    +
    Qty
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '9' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    +
    + )} + {/*
    Extra Charges
    @@ -533,188 +1309,445 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo,
    */} -
    - - {(DineInData?.length > 0 && TakeawayData?.length > 0) && - <> - {takeAwayPreference &&
    -
    - TakeAway -
    -
    :
    -
    - {Number(TakeawayTotal).toFixed(2)} -
    -
    } - {dinePreference &&
    -
    - Dine In -
    -
    :
    -
    - {Number(DineInTotal).toFixed(2)} -
    -
    } - - } -
    -
    - Amount -
    -
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} -
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - {(table2Data?.OrderType === "E") ? '' : -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && - <> -
    -

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

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(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)}
    - - } +
    + {DineInData?.length > 0 && TakeawayData?.length > 0 && ( + <> + {takeAwayPreference && ( +
    +
    + TakeAway +
    +
    :
    +
    + {Number(TakeawayTotal).toFixed(2)} +
    - - } + )} + {dinePreference && ( +
    +
    + Dine In +
    +
    :
    +
    + {Number(DineInTotal).toFixed(2)} +
    +
    + )} + + )} +
    +
    + Amount +
    +
    :
    +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    - } -
    + {PaymentStatusSuccess?.length > 1 && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} + + )} + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( + <> +
    +

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

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} -
    -
    - {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}   Payment + {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 + )} +
    + + )} +
    + + )} +
    + )} +
    + +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +   Payment +
    +
    :
    +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    -
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} -
    -
    - {/*
    + {/*
    Recived Amt
    @@ -732,193 +1765,465 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 0.00
    */} - -
    -
    - - {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)}

    + {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} - +
    )} +
    - {/* 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} -
    - ) - )} -
    - -
    - -
    -
    Your Order No: {GlobaldummyData ? '53' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - -
    - - {GlobaldummyData ? GlobalQrcodet && -
    - image -
    Scan to Pay:
    -
    - ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    +
    +
    + Your Order No:{' '} + {GlobaldummyData + ? '53' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)}
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && - -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } - -
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

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

    {Notestext}

    - -
    -
    ) - } - -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (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

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

    Signature

    - -
    )} + {GlobaldummyData + ? GlobalQrcodet && ( +
    + image +
    + {' '} + Scan to Pay:{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    -
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} - {PrintGreeting?.SettingValue === "Y" && -
    - Thank You Visit Again +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

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

    + {Notestext} +

    + +
    +
    + )} + +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not + exchangeable or refundable. +
    2. +
    3. + Please check the product before leaving the + counter. +
    4. +
    +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )} +
    - } - - } + {PrintGreeting?.SettingValue === 'Y' && ( +
    + Thank You Visit Again +
    + )} + + )}
    ))} - - {shouldFooterBeOnNewPage && FormatTheme && + {shouldFooterBeOnNewPage && FormatTheme && (
    -
    <> -
    -
    -
    -
    -
    - Items -
    +
    +
    +
    +
    Items
    :
    -
    +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    - Qty -
    +
    +
    Qty
    :
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    - Off -
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    +
    Off
    :
    -
    - {GlobaldummyData ? '9' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)} +
    + {GlobaldummyData + ? '9' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    - } + )} {/*
    Extra Charges @@ -929,185 +2234,434 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo,
    */} -
    +
    - {(DineInData?.length > 0 && TakeawayData?.length > 0) && + {DineInData?.length > 0 && TakeawayData?.length > 0 && ( <> - {takeAwayPreference &&
    -
    - TakeAway + {takeAwayPreference && ( +
    +
    + TakeAway +
    +
    :
    +
    + {Number(TakeawayTotal).toFixed(2)} +
    -
    :
    -
    - {Number(TakeawayTotal).toFixed(2)} + )} + {dinePreference && ( +
    +
    + Dine In +
    +
    :
    +
    + {Number(DineInTotal).toFixed(2)} +
    -
    } - {dinePreference &&
    -
    - Dine In -
    -
    :
    -
    - {Number(DineInTotal).toFixed(2)} -
    -
    } + )} - } -
    -
    + )} +
    +
    Amount
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    - {PaymentStatusSuccess?.length > 1 && + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} - } - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : (
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( <>
    -

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

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => +

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

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    - - Taxable Amount - - CGST - - SGST - - Total Amount -
    - - - - - - - ) - } -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - + - - + - {OrderDetailIGST?.map((item) => + {OrderDetailGST?.map((item) => ( - - - + + - - ) - } + ))}
    - + Taxable Amount - IGST + + CGST + + SGST + Total Amount
    + {item?.TaxPercentage || 0}% - {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} - {Number(item.TaxAmt).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - + )} - - - - - - - {OrderDetailVAT?.map((item) => + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    +
    - - Taxable Amount - - VAT - - Total Amount -
    - + - - - - ) - } -
    - {item?.TaxPercentage || 0}% + + Taxable Amount - {Number(item.WithOutTaxAmount).toFixed(2)} + + IGST - {Number(item.TaxAmt).toFixed(2)} + + Total Amount {Number(item.TotalAmt).toFixed(2)}
    - - } - + {OrderDetailIGST?.map((item) => ( + + + {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)} +
    + + )}
    - } + )}
    - } -
    + )} +
    -
    -
    - {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}   Payment +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +   Payment
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    {/*
    @@ -1128,339 +2682,1073 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 0.00
    */} -
    - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    + {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} + + )} - {/* 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} -
    - ) - )} + {/* 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} +
    + )}
    -
    - -
    -
    Your Order No: {GlobaldummyData ? '53' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - +
    +
    +
    + Your Order No:{' '} + {GlobaldummyData + ? '53' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    - {GlobaldummyData ? GlobalQrcodet && -
    - image -
    Scan to Pay:
    -
    - ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} -
    -
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && - -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } - + {GlobaldummyData + ? GlobalQrcodet && ( +
    + image +
    + {' '} + Scan to Pay:{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

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

    {Notestext}

    - -
    -
    ) - } - -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions + {GlobaldummyData + ? GlobalIsnotes && ( +

    +

    + Notes : 10 days Return policy

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

    Signature

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

    Signature

    - -
    )} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Notestext && ( +
    +

    + {Notestext} +

    +
    +
    + )} + +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not exchangeable + or refundable. +
    2. +
    3. + Please check the product before leaving the + counter. +
    4. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && -
    + {PrintGreeting?.SettingValue === 'Y' && ( +
    Thank You Visit Again
    - } + )}
    - } - + )}
    + ) : ( +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {/*

    {table2Data?.BrName}

    */} +
    +
    +
    + {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 && GlobalCashierName && ( +

    + {' '} + Cashier : Cashier Name +

    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} - : -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} - {/*

    {table2Data?.BrName}

    */} -
    -
    - -
    {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 : '')} + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + {table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} +
    + )}
    -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    - {GlobaldummyData && GlobalCashierName && -

    Cashier : Cashier Name

    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} + {GlobalLogo && GlobaldummyData && ( +
    + {' '} + image
    - } - - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} + )} + {base64Image && (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( +
    + {' '} + image
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - {table2Data?.OrderType === "E" &&
    Estimate
    } + ) : null}
    - {(GlobalLogo && GlobaldummyData) &&
    image
    } - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ?
    image
    : null} -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate
    } + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} +
    + )} {/*

    {table2Data?.PaymentTypeName}  Payment :  {Number(table2Data?.NetAmount).toFixed(2)}/-

    */} -
    -
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {Date1}
    +
    +
    + Bill No :{' '} + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    + {Date1} +
    {/*
    */} - {(TakeawayData?.length > 0 || GlobaldummyData) && + {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference &&
    Take Away
    } + {takeAwayPreference && ( +
    + Take Away +
    + )}
    - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && } + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && } - {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} + {(GlobaldummyData ? products : TakeawayData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )}
    S.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmt
    {index + 1}{index + 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?.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?.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?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{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}
    {index + 1}{index + 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?.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?.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?.SalesQty} + + {item?.SalesQty} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item?.Rate} + + {item?.Rate} + + {item?.HSN} + + {item?.HSN} + + {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} +
    - } - {(DineInData?.length > 0 && dinePreference) && + )} + {DineInData?.length > 0 && dinePreference && ( <> -
    Dine In
    +
    + Dine In +
    - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && } + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && } - {(GlobaldummyData ? products : DineInData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} + {(GlobaldummyData ? products : DineInData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )}
    S.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    -
    {item?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{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}
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    +
    + {item?.SalesQty} + + {item?.SalesQty} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item?.Rate} + + {item?.Rate} + + {item?.HSN} + + {item?.HSN} + + {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 -
    +
    +
    +
    +
    Items
    :
    -
    +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    - Qty -
    +
    +
    Qty
    :
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    - Off -
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    +
    Off
    :
    -
    - {GlobaldummyData ? '9' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)} +
    + {GlobaldummyData + ? '9' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    - } + )} {/*
    Extra Charges @@ -1471,187 +3759,411 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo,
    */} -
    +
    - {(DineInData?.length > 0 && TakeawayData?.length > 0) && + {DineInData?.length > 0 && TakeawayData?.length > 0 && ( <> - {takeAwayPreference &&
    -
    - TakeAway + {takeAwayPreference && ( +
    +
    + TakeAway +
    +
    :
    +
    + {Number(TakeawayTotal).toFixed(2)} +
    -
    :
    -
    - {Number(TakeawayTotal).toFixed(2)} + )} + {dinePreference && ( +
    +
    + Dine In +
    +
    :
    +
    + {Number(DineInTotal).toFixed(2)} +
    -
    } - {dinePreference &&
    -
    - Dine In -
    -
    :
    -
    - {Number(DineInTotal).toFixed(2)} -
    -
    } + )} - } -
    -
    - Amount -
    + )} +
    +
    Amount
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    - {PaymentStatusSuccess?.length > 1 && + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)}
    ))} - } - {(table2Data?.OrderType === "E") ? '' : + )} + {table2Data?.OrderType === 'E' ? ( + '' + ) : (
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( <>
    -

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

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => +

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

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - - - - - - - ) - } -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - + - - + - {OrderDetailIGST?.map((item) => + {OrderDetailGST?.map((item) => ( - - - + + - - - ) - } + ))}
    - + Taxable Amount - IGST + + CGST + + SGST + Total Amount
    + {item?.TaxPercentage || 0}% + {Number(item.WithOutTaxAmount).toFixed(2)} - {Number(item.TaxAmt).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - + )} - - - - - - - {OrderDetailVAT?.map((item) => + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    +
    - - Taxable Amount - - VAT - - Total Amount -
    - + - - - - ) - } -
    - {item?.TaxPercentage || 0}% + + Taxable Amount - {Number(item.WithOutTaxAmount).toFixed(2)} + + IGST - {Number(item.TaxAmt).toFixed(2)} + + Total Amount {Number(item.TotalAmt).toFixed(2)}
    - - } + {OrderDetailIGST?.map((item) => ( + + + {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)} +
    + + )}
    - } + )}
    - } -
    + )} +
    -
    -
    - {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}   Payment +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +   Payment
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    {/*
    @@ -1672,7 +4184,6 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 0.00
    */} -
    @@ -1692,137 +4203,346 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo,
    */} - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    + {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} + + )} - {/* 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} -
    - ) - )} + {/* 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} +
    + )}
    -
    - -
    -
    Your Order No: {GlobaldummyData ? '53' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - +
    +
    +
    + Your Order No:{' '} + {GlobaldummyData + ? '53' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    - {GlobaldummyData ? GlobalQrcodet && -
    - image -
    Scan to Pay:
    -
    - ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} -
    -
    - : - (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && - -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } - + {GlobaldummyData + ? GlobalQrcodet && ( +
    + image +
    + {' '} + Scan to Pay:{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

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

    {Notestext}

    - -
    -
    ) - } - -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions + {GlobaldummyData + ? GlobalIsnotes && ( +

    +

    + Notes : 10 days Return policy

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

    Signature

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

    Signature

    - -
    )} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Notestext && ( +
    +

    {Notestext}

    +
    +
    + )} + +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not exchangeable or + refundable. +
    2. +
    3. + Please check the product before leaving the counter. +
    4. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && -
    - Thank You Visit Again -
    - } + {PrintGreeting?.SettingValue === 'Y' && ( +
    Thank You Visit Again
    + )} {/*
    print
    */}
    - } - + )} - ) -} + ); +}; -export default Printstyle12 +export default Printstyle12; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx index be9e6c8..91e728f 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx @@ -28,6 +28,7 @@ import { GlobalprintLogo, GlobalprintCredit, GlobalprintTax, + GlobalSelectedPrintHeaderColor, } from '../../../../Features/ThemeChange/ThemeChange'; import Logo from '../../../../Images/Logo.jpg'; import QRCode from 'react-qr-code'; @@ -93,6 +94,7 @@ const Printstyle2 = ({ const paymentTypeUPI = PaymentStatus?.find( (ps) => ps.PaymentTypeName === 'UPI' ); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); console.log(Qrcodet, 'Qrcodet', paymentTypeUPI); const GlobalSignature = useSelector(GlobalprintSignature); const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); @@ -399,7 +401,13 @@ const Printstyle2 = ({ fontWeight: '600', }} > -
    +
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    @@ -2937,7 +2945,13 @@ const Printstyle2 = ({ fontWeight: '600', }} > -
    +
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx index c124a12..b5fcd03 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx @@ -1,7 +1,10 @@ -import React from "react"; -import { useDispatch, useSelector } from "react-redux"; -import QRcode from "../../../../Images/qrcode.png"; -import { extractLastNumber, extractLastNumberOrderId } from "../../../../Services/Others"; +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, @@ -25,37 +28,56 @@ import { GlobalprintLogo, GlobalprintCredit, GlobalprintTax, + GlobalSelectedPrintHeaderColor, } from '../../../../Features/ThemeChange/ThemeChange'; -import Logo from '../../../../Images/Logo.jpg' -import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.scss' +import Logo from '../../../../Images/Logo.jpg'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.scss'; import QRCode from 'react-qr-code'; -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; -import signature from "../../../../Images/signatureimage.jpg" -import { ApplicationPreferences } from "../../../../Features/BrachLogin/BranchLogin"; -import { isMobile } from "react-device-detect"; -import { settingDataSelector } from "../../../../Features/PreferenceMaster/PreferenceMaster"; - -const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuantity, OrderDetailGST, OrderDetailIGST, OrderDetailVAT, - table2Data, PaymentStatus, PrintGreeting, printDatas, PrintLogo, base64Image, isPdf, sportsAppPreference, SalesModePref, - MembershipApplied = null }) => { - +import { + GlobalUpiIDprint, + PreferenceData, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; +import signature from '../../../../Images/signatureimage.jpg'; +import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; +import { isMobile } from 'react-device-detect'; +import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; +const PrintStyle3 = ({ + index, + totalQuantityFilter, + Date1, + CashierName, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + OrderDetailVAT, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + PrintLogo, + base64Image, + isPdf, + sportsAppPreference, + SalesModePref, + MembershipApplied = null, +}) => { const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint) + 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 Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; const Tax = FieldDetails?.['Tax']; - 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 Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const CashierNameField = FieldDetails?.['CashierName']; + const LogoField = FieldDetails?.['Logo']; + const CreditDetails = FieldDetails?.['Credit details']; const WeightasKg = FieldDetails?.['Weight']; const GlobalSlNo = useSelector(GlobalprintSlNo); const GlobalItem = useSelector(GlobalprintItem); @@ -68,110 +90,221 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan const GlobalHsnCode = useSelector(GlobalprintHsnCode); const GlobalQrcodet = useSelector(GlobalprintQrcodet); const GlobaldummyData = useSelector(GlobalPritdummyData); - console.log(GlobaldummyData, "GlobaldummyData print3"); + console.log(GlobaldummyData, 'GlobaldummyData print3'); 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 GlobalthemeFormatr = useSelector(GlobalthemeFormat); + const GlobalBilltext = useSelector(GlobalBillName); const appPreferences = useSelector(ApplicationPreferences); 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 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") - console.log(printDatas, "GlobalthemeFormatr"); + const estimatePrintHeader = + SettingData?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' + )?.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' + ); + console.log(printDatas, 'GlobalthemeFormatr'); - let TermsAndConditions = printDatas?.TermsandConditions - let SignatureImg = printDatas?.Signature - let Notestext = printDatas?.Notes - let BillName = printDatas?.PrintHdrName - let FormatTheme = printDatas?.PrintType == "S" ? true : false - let PageSize = printDatas?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); - const PackageDetails = table2Data?.PackageDtl + 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(PackageDetails, 'PackageDetailsPackageDetails',); + const PackageDetails = table2Data?.PackageDtl; - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") + console.log(PackageDetails, 'PackageDetailsPackageDetails'); + + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); const keysLength = Object.keys(table2Data ?? {}).length; 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 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") + const TakeawayData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' + ); + const DineInData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' + ); - console.log(TakeawayData, "TakeawayData", table2Data) + console.log(TakeawayData, 'TakeawayData', table2Data); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); const DineInTotal = DineInData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); - const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); + 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; - } + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } - return acc; - }, {}); + return acc; + }, + {} + ); const productsData = table2Data?.productDetails || []; const offers = table2Data?.OrderOfferDetails || []; let TotalOfferAmount = 0; // Calculate SalesWiseOffers total amount - offers.forEach(offer => { + offers.forEach((offer) => { if (offer.TableName === 'SalesWiseOffers') { TotalOfferAmount += offer.OfferAmount; } }); - const hasMappedOffer = offers.some(offer => - ["ItemWiseOffers", "BundleOffers", "QuantityWiseOffers"].includes(offer.TableName) + 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); + 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); + 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.00, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', ProdTaxPercentage: 18 }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', ProdTaxPercentage: 40 }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', ProdTaxPercentage: 3 }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', ProdTaxPercentage: 0 }, + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + ProdTaxPercentage: 18, + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + ProdTaxPercentage: 40, + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + ProdTaxPercentage: 3, + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + ProdTaxPercentage: 0, + }, ]; - const chunkSize = PageSize == "A5" ? 11 : 16; + const chunkSize = PageSize == 'A5' ? 11 : 16; let dataSource = []; @@ -186,1330 +319,4722 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan 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); - + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 10); return ( <> - {FormatTheme ? -
    + {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}> - +
    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}
    +
    + {!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 + : '')} + {table2Data?.BrGSTIN && ( +
    + GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : table2Data?.BrGSTIN} + , +
    + )} +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} +
    + {table2Data?.OrderType === 'E' && ( +
    + Estimate Bill{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? 'Cash Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}{' '} +
    + )} +
    -
    {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 : '')} + )} - {table2Data?.BrGSTIN &&
    GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : table2Data?.BrGSTIN},
    } -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    - {table2Data?.OrderType === "E" &&
    Estimate Bill {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? 'Cash Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate Bill{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    - -
    )} - - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate Bill {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } + )}
    -
    BILL NO :{GlobaldummyData ? '51' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {GlobaldummyData ? formattedDate : Date1}
    +
    + {' '} + BILL NO : + {GlobaldummyData + ? '51' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}{' '} +
    +
    + {' '} + {GlobaldummyData ? formattedDate : Date1} +

    -
    -
    +
    - {(TakeawayData?.length > 0 || GlobaldummyData) && -
    - {takeAwayPreference &&
    TakeAway
    } -
    - {GlobaldummyData ? GlobalSlNo &&
    S.No
    : SLNO &&
    S.No
    } - {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } - {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } - {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } - {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } - {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } - {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} - {GlobaldummyData ? GlobalAmount &&
    AMT
    : Amount &&
    AMT
    } -
    - -
    - {dataChunk?.map((item, index) => ( -
    - {GlobaldummyData ? GlobalSlNo &&
    {index + 1}
    : SLNO &&
    {chunkIndex * chunkSize + index + 1}
    } - {GlobaldummyData ? GlobalItem &&
    {item?.ProdName}
    : Item && -
    -
    {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(",")}
    ); - } - ) : ""} -
    -
    } - {GlobaldummyData ? GlobalHsnCode &&
    {item?.HSN}
    : HsnCode &&
    {item?.HSN}
    } - {GlobaldummyData ? GlobalMRP &&
    {item?.MRP}
    : MRP &&
    {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}
    } - {GlobaldummyData ? GlobalQuantity &&
    {item?.SalesQty}
    : Quantity &&
    {item?.SalesQty}
    } - {GlobaldummyData ? GlobalRate &&
    {item?.Rate}
    : Rate &&
    {item?.Rate}
    } - {GlobaldummyData ? GlobalDiscount &&
    {item?.discount}
    : Discount &&
    {item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}
    } - {GlobaldummyData ? GlobalTax &&
    {item?.ProdTaxPercentage || 0}
    : (Tax == true && table2Data?.OrderType !== 'E') && (
    {item?.ProdTaxPercentage || 0}
    )} - {GlobaldummyData ? GlobalAmount &&
    {item?.TotalAmt}
    : Amount &&
    {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    } -
    - ))} -
    -
    - } - {(DineInData?.length > 0 && dinePreference) && -
    -
    Dine In
    -
    - {GlobaldummyData ? GlobalSlNo &&
    S.No
    : SLNO &&
    S.No
    } - {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } - {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } - {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } - {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } - {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } - {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} - {GlobaldummyData ? GlobalAmount &&
    AMT
    : Amount &&
    AMT
    } -
    - -
    - {dataChunk?.map((item, index) => ( -
    - {GlobaldummyData ? GlobalSlNo &&
    {index + 1}
    : SLNO &&
    {chunkIndex * chunkSize + index + 1}
    } - {GlobaldummyData ? GlobalItem &&
    {item?.ProdName}
    : Item && -
    -
    {item?.ProdName}
    -
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    -
    } - {GlobaldummyData ? GlobalHsnCode &&
    {item?.HSN}
    : HsnCode &&
    {item?.HSN}
    } - {GlobaldummyData ? GlobalMRP &&
    {item?.MRP}
    : MRP &&
    {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}
    } - {GlobaldummyData ? GlobalQuantity &&
    {item?.SalesQty}
    : Quantity &&
    {item?.SalesQty}
    } - {GlobaldummyData ? GlobalRate &&
    {item?.Rate}
    : Rate &&
    {item?.Rate}
    } - {GlobaldummyData ? GlobalDiscount &&
    {item?.discount}
    : Discount &&
    {item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}
    } - {GlobaldummyData ? GlobalTax &&
    {item?.ProdTaxPercentage || 0}
    : (Tax == true && table2Data?.OrderType !== 'E') && (
    {item?.ProdTaxPercentage || 0}
    )} - {GlobaldummyData ? GlobalAmount &&
    {item?.TotalAmt}
    : Amount &&
    {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    } -
    - ))} -
    -
    - } -
    - -
    - {(DineInData?.length > 0 && TakeawayData?.length > 0) && -
    - {takeAwayPreference &&
    Takeaway: {Number(TakeawayTotal).toFixed(2)}
    } - {dinePreference &&
    Dine In: {Number(DineInTotal).toFixed(2)}
    } -
    -
    - } - -
    - - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - - <> -
    -
    -
    Items :
    -
    Qty :
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off:
    } -
    Amount :
    -
    -
    -
    {GlobaldummyData ? '7' : totalQuantityFilter?.length}
    -
    {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    {GlobaldummyData ? '100' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } -
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    -
    - - {(table2Data?.OrderType === "E") ? '' : (
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    -
    - --------- GST Breakup Details -----------
    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - Taxable Amount - - CGST - - SGST - - - Total Amount -
    {item?.TaxPercentage || 0}% - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(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)}
    - - } - + {(TakeawayData?.length > 0 || GlobaldummyData) && ( +
    + {takeAwayPreference && ( +
    + TakeAway
    - - } - -
    )} - {/*
    */} - - {/*
    */} - - -
    -
    {GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - -
    - -
    -
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    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" && dinePreference) && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - -
    - - - - {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) => ( -

    + {GlobaldummyData + ? GlobalSlNo && ( +

    - {i.label} - : - {i.value} -

    - )); - })()} + S.No +
    + ) + : SLNO && ( +
    + S.No +
    + )} + {GlobaldummyData + ? GlobalItem && ( +
    + ITEM +
    + ) + : Item && ( +
    + ITEM +
    + )} + {GlobaldummyData + ? GlobalHsnCode && ( +
    + HSN +
    + ) + : HsnCode && ( +
    + HSN +
    + )} + {GlobaldummyData + ? GlobalMRP && ( +
    + MRP +
    + ) + : MRP && ( +
    + MRP +
    + )} + {GlobaldummyData + ? GlobalQuantity && ( +
    + QTY +
    + ) + : Quantity && ( +
    + {' '} + {WeightasKg ? 'QTY/KG' : 'QTY'} +
    + )} + {GlobaldummyData + ? GlobalRate && ( +
    + RATE +
    + ) + : Rate && ( +
    + RATE +
    + )} + {GlobaldummyData + ? GlobalDiscount && ( +
    + DIS{' '} +
    + ) + : Discount && ( +
    + DIS{' '} +
    + )} + {GlobaldummyData + ? GlobalTax && ( +
    + TAX % +
    + ) + : Tax == true && + table2Data?.OrderType !== 'E' && ( +
    + TAX % +
    + )} + {GlobaldummyData + ? GlobalAmount && ( +
    + AMT +
    + ) + : Amount && ( +
    + AMT +
    + )} +
    -
    - ) - )} - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : (
    - {
    - {GlobaldummyData ? GlobalQrcodet &&
    -
    - Pngwing com +
    + {dataChunk?.map((item, index) => ( +
    + {GlobaldummyData + ? GlobalSlNo && ( +
    + {index + 1} +
    + ) + : SLNO && ( +
    + {chunkIndex * chunkSize + index + 1} +
    + )} + {GlobaldummyData + ? GlobalItem && ( +
    + {item?.ProdName} +
    + ) + : Item && ( +
    +
    {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(',')} +
    + ); + }) + : ''} +
    +
    + )} + {GlobaldummyData + ? GlobalHsnCode && ( +
    + {item?.HSN} +
    + ) + : HsnCode && ( +
    + {item?.HSN} +
    + )} + {GlobaldummyData + ? GlobalMRP && ( +
    + {item?.MRP} +
    + ) + : MRP && ( +
    + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} +
    + )} + {GlobaldummyData + ? GlobalQuantity && ( +
    + {item?.SalesQty} +
    + ) + : Quantity && ( +
    + {item?.SalesQty} +
    + )} + {GlobaldummyData + ? GlobalRate && ( +
    + {item?.Rate} +
    + ) + : Rate && ( +
    + {item?.Rate} +
    + )} + {GlobaldummyData + ? GlobalDiscount && ( +
    + {item?.discount} +
    + ) + : Discount && ( +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} + {GlobaldummyData + ? GlobalTax && ( +
    + {item?.ProdTaxPercentage || 0} +
    + ) + : Tax == true && + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} + {GlobaldummyData + ? GlobalAmount && ( +
    + {item?.TotalAmt} +
    + ) + : Amount && ( +
    + {' '} + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    + )}
    -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    : - (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    } -
    )} + ))} +
    +
    + )} + {DineInData?.length > 0 && dinePreference && ( +
    +
    + Dine In +
    +
    + {GlobaldummyData + ? GlobalSlNo && ( +
    + S.No +
    + ) + : SLNO && ( +
    + S.No +
    + )} + {GlobaldummyData + ? GlobalItem && ( +
    + ITEM +
    + ) + : Item && ( +
    + ITEM +
    + )} + {GlobaldummyData + ? GlobalHsnCode && ( +
    + HSN +
    + ) + : HsnCode && ( +
    + HSN +
    + )} + {GlobaldummyData + ? GlobalMRP && ( +
    + MRP +
    + ) + : MRP && ( +
    + MRP +
    + )} + {GlobaldummyData + ? GlobalQuantity && ( +
    + QTY +
    + ) + : Quantity && ( +
    + {' '} + {WeightasKg ? 'QTY/KG' : 'QTY'} +
    + )} + {GlobaldummyData + ? GlobalRate && ( +
    + RATE +
    + ) + : Rate && ( +
    + RATE +
    + )} + {GlobaldummyData + ? GlobalDiscount && ( +
    + DIS{' '} +
    + ) + : Discount && ( +
    + DIS{' '} +
    + )} + {GlobaldummyData + ? GlobalTax && ( +
    + TAX % +
    + ) + : Tax == true && + table2Data?.OrderType !== 'E' && ( +
    + TAX % +
    + )} + {GlobaldummyData + ? GlobalAmount && ( +
    + AMT +
    + ) + : Amount && ( +
    + AMT +
    + )} +
    + +
    + {dataChunk?.map((item, index) => ( +
    + {GlobaldummyData + ? GlobalSlNo && ( +
    + {index + 1} +
    + ) + : SLNO && ( +
    + {chunkIndex * chunkSize + index + 1} +
    + )} + {GlobaldummyData + ? GlobalItem && ( +
    + {item?.ProdName} +
    + ) + : Item && ( +
    +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    +
    + )} + {GlobaldummyData + ? GlobalHsnCode && ( +
    + {item?.HSN} +
    + ) + : HsnCode && ( +
    + {item?.HSN} +
    + )} + {GlobaldummyData + ? GlobalMRP && ( +
    + {item?.MRP} +
    + ) + : MRP && ( +
    + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} +
    + )} + {GlobaldummyData + ? GlobalQuantity && ( +
    + {item?.SalesQty} +
    + ) + : Quantity && ( +
    + {item?.SalesQty} +
    + )} + {GlobaldummyData + ? GlobalRate && ( +
    + {item?.Rate} +
    + ) + : Rate && ( +
    + {item?.Rate} +
    + )} + {GlobaldummyData + ? GlobalDiscount && ( +
    + {item?.discount} +
    + ) + : Discount && ( +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} + {GlobaldummyData + ? GlobalTax && ( +
    + {item?.ProdTaxPercentage || 0} +
    + ) + : Tax == true && + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} + {GlobaldummyData + ? GlobalAmount && ( +
    + {item?.TotalAmt} +
    + ) + : Amount && ( +
    + {' '} + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    + )} +
    + ))} +
    +
    + )} +
    + +
    + {DineInData?.length > 0 && TakeawayData?.length > 0 && ( +
    + {takeAwayPreference && ( +
    + Takeaway: {Number(TakeawayTotal).toFixed(2)} +
    + )} + {dinePreference && ( +
    Dine In: {Number(DineInTotal).toFixed(2)}
    + )} +
    -
    + )} +
    - {/*
    */} + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> +
    +
    +
    Items :
    +
    Qty :
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    Off:
    + )} +
    Amount :
    +
    +
    +
    + {GlobaldummyData + ? '7' + : totalQuantityFilter?.length}{' '} +
    +
    + {GlobaldummyData ? '9' : totalQuantity}{' '} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + {GlobaldummyData + ? '100' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}{' '} +
    + )} +
    + {' '} + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)}{' '} +
    +
    +
    -
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    +
    + --------- GST Breakup Details ----------- +
    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} -
    -
    ) : - Notestext && (
    -

    {Notestext}

    + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + -
    - ) - }} + + + {OrderDetailIGST?.map((item) => ( + + + + - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : (
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

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

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    ) - } +
    + + ))} +
    + 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 && ( + <> +
    + + + + + - {GlobaldummyData ? GlobalSignature && (
    -

    Signature

    - -
    ) : Signature == true && (
    -

    Signature

    - -
    )} + + + {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)} +
    + + )} +
    + + )} +
    + )} + {/*
    */} -
    + {/*
    */} +
    +
    + {GlobaldummyData + ? 'Cash' + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : ''} + Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    - {PrintGreeting?.SettingValue === "Y" && - <> - {/*
    */} +
    +
    +
    + Your Order No : + {GlobaldummyData + ? '01' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    + {PaymentStatusSuccess?.length > 1 && ( + <> + {/*

    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} +
    + )} -
    Thank You Visit Again
    - - } + {table2Data?.BookingTypeName === 'Dine In' && + dinePreference && + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName && ( +
    + Captain :{' '} + { + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName + } +
    + )} + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} +
    - - } + {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 && ( +
    +
    + Pngwing com +
    +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number( + table2Data?.NetAmount + ).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number( + table2Data?.NetAmount + ).toFixed(2)} +
    +
    + )} +
    + } +
    + )} +
    +
    + + {/*
    */} + +
    + {!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. +
    3. + Please check the product before leaving + the counter. +
    4. +
    +
    + ) + : 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 && + {shouldFooterBeOnNewPage && FormatTheme && (
    -
    <>
    -
    Items :
    -
    Qty :
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off:
    } +
    Items :
    +
    Qty :
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    Off:
    + )}
    Amount :
    -
    {GlobaldummyData ? '7' : totalQuantityFilter?.length}
    -
    {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    {GlobaldummyData ? '100' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } -
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    + {GlobaldummyData + ? '7' + : totalQuantityFilter?.length}{' '} +
    +
    + {GlobaldummyData ? '9' : totalQuantity}{' '} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + {GlobaldummyData + ? '100' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}{' '} +
    + )} +
    + {' '} + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)}{' '} +
    - {(table2Data?.OrderType === "E") ? '' : (
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    -
    - --------- GST Breakup Details -----------
    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    +
    + --------- GST Breakup Details ----------- +
    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} - - - - Taxable Amount - - - CGST - - - SGST - - + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + - Total Amount - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    + Taxable Amount + + IGST +
    {item?.TaxPercentage || 0}% - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } + + Total Amount + + + {OrderDetailIGST?.map((item) => ( + + + {item?.TaxPercentage || 0}% + + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + + {Number(item.TaxAmt).toFixed(2)} + - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - + + + ))} +
    + {Number(item.TotalAmt).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - - ) - } -
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} +
    - 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)}
    - - } - -
    - - } - -
    + + {Number(item.TotalAmt).toFixed(2)} + + + ))} + + + )} +
    + + )} +
    )}
    {/*
    */} - -
    -
    {GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    +
    +
    + {GlobaldummyData + ? 'Cash' + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : ''} + Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    -
    - -
    -
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && +
    +
    +
    + Your Order No : + {GlobaldummyData + ? '01' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    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" && dinePreference) && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } -
    - - - {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} -

    - )); - })()} - + {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' && + dinePreference && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} +
    + + {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 && ( +
    +
    + Pngwing com +
    +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + )} +
    + {/*
    */} + +
    + +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : Notestext && ( +
    +

    + {Notestext} +

    + +
    +
    + )} +
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : (
    - {GlobaldummyData ? GlobalQrcodet &&
    -
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not + exchangeable or refundable. +
    2. +
    3. + Please check the product before leaving the + counter. +
    4. +
    +
    + ) + : 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 + : '')} + {table2Data?.BrGSTIN && ( +
    + GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : table2Data?.BrGSTIN} + , +
    + )} +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} +
    + {table2Data?.OrderType === 'E' && ( +
    + Estimate Bill{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    +
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate Bill{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    +
    +
    +
    + {' '} + BILL NO : + {GlobaldummyData + ? '51' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}{' '} +
    +
    + {' '} + {GlobaldummyData ? formattedDate : Date1} +
    +
    +
    +
    +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( +
    + {takeAwayPreference && ( +
    + TakeAway +
    + )} +
    + {GlobaldummyData + ? GlobalSlNo && ( +
    + S.No +
    + ) + : SLNO && ( +
    + S.No +
    + )} + {GlobaldummyData + ? GlobalItem && ( +
    + ITEM +
    + ) + : Item && ( +
    + ITEM +
    + )} + {GlobaldummyData + ? GlobalHsnCode && ( +
    + HSN +
    + ) + : HsnCode && ( +
    + HSN +
    + )} + {GlobaldummyData + ? GlobalMRP && ( +
    + MRP +
    + ) + : MRP && ( +
    + MRP +
    + )} + {GlobaldummyData + ? GlobalQuantity && ( +
    + QTY +
    + ) + : Quantity && ( +
    + {' '} + {WeightasKg ? 'QTY/KG' : 'QTY'} +
    + )} + {GlobaldummyData + ? GlobalRate && ( +
    + RATE +
    + ) + : Rate && ( +
    + RATE +
    + )} + {GlobaldummyData + ? GlobalDiscount && ( +
    + DIS{' '} +
    + ) + : Discount && ( +
    + DIS{' '} +
    + )} + {GlobaldummyData + ? GlobalTax && ( +
    + TAX % +
    + ) + : Tax == true && + table2Data?.OrderType !== 'E' && ( +
    + TAX % +
    + )} + {GlobaldummyData + ? GlobalAmount && ( +
    + AMT +
    + ) + : Amount && ( +
    + AMT +
    + )} +
    + +
    + {(GlobaldummyData ? products : TakeawayData)?.map( + (item, index) => ( +
    + {GlobaldummyData + ? GlobalSlNo && ( +
    + {index + 1} +
    + ) + : SLNO && ( +
    + {index + 1} +
    + )} + {GlobaldummyData + ? GlobalItem && ( +
    + {item?.ProdName} +
    + ) + : Item && ( +
    +
    {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(',')} +
    + ); + }) + : ''} +
    +
    + )} + {GlobaldummyData + ? GlobalHsnCode && ( +
    + {item?.HSN} +
    + ) + : HsnCode && ( +
    + {item?.HSN} +
    + )} + {GlobaldummyData + ? GlobalMRP && ( +
    + {item?.MRP} +
    + ) + : MRP && ( +
    + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} +
    + )} + {GlobaldummyData + ? GlobalQuantity && ( +
    + {item?.SalesQty} +
    + ) + : Quantity && ( +
    + {item?.SalesQty} +
    + )} + {GlobaldummyData + ? GlobalRate && ( +
    + {item?.Rate} +
    + ) + : Rate && ( +
    + {item?.Rate} +
    + )} + {GlobaldummyData + ? GlobalDiscount && ( +
    + {item?.discount} +
    + ) + : Discount && ( +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} + {GlobaldummyData + ? GlobalTax && ( +
    + {item?.ProdTaxPercentage || 0} +
    + ) + : Tax == true && + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} + {GlobaldummyData + ? GlobalAmount && ( +
    + {item?.TotalAmt} +
    + ) + : Amount && ( +
    + {' '} + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    + )} +
    + ) + )} +
    +
    + )} + {DineInData?.length > 0 && dinePreference && ( +
    +
    + Dine In +
    +
    + {GlobaldummyData + ? GlobalSlNo && ( +
    + S.No +
    + ) + : SLNO && ( +
    + S.No +
    + )} + {GlobaldummyData + ? GlobalItem && ( +
    + ITEM +
    + ) + : Item && ( +
    + ITEM +
    + )} + {GlobaldummyData + ? GlobalHsnCode && ( +
    + HSN +
    + ) + : HsnCode && ( +
    + HSN +
    + )} + {GlobaldummyData + ? GlobalMRP && ( +
    + MRP +
    + ) + : MRP && ( +
    + MRP +
    + )} + {GlobaldummyData + ? GlobalQuantity && ( +
    + QTY +
    + ) + : Quantity && ( +
    + {WeightasKg ? 'QTY/KG' : 'QTY'} +
    + )} + {GlobaldummyData + ? GlobalRate && ( +
    + RATE +
    + ) + : Rate && ( +
    + RATE +
    + )} + {GlobaldummyData + ? GlobalDiscount && ( +
    + DIS{' '} +
    + ) + : Discount && ( +
    + DIS{' '} +
    + )} + {GlobaldummyData + ? GlobalTax && ( +
    + TAX % +
    + ) + : Tax == true && + table2Data?.OrderType !== 'E' && ( +
    + TAX % +
    + )} + {GlobaldummyData + ? GlobalAmount && ( +
    + AMT +
    + ) + : Amount && ( +
    + AMT +
    + )} +
    + +
    + {(GlobaldummyData ? products : DineInData)?.map( + (item, index) => ( +
    + {GlobaldummyData + ? GlobalSlNo && ( +
    + {index + 1} +
    + ) + : SLNO && ( +
    + {index + 1} +
    + )} + {GlobaldummyData + ? GlobalItem && ( +
    + {item?.ProdName} +
    + ) + : Item && ( +
    +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    +
    + )} + {GlobaldummyData + ? GlobalHsnCode && ( +
    + {item?.HSN} +
    + ) + : HsnCode && ( +
    + {item?.HSN} +
    + )} + {GlobaldummyData + ? GlobalMRP && ( +
    + {item?.MRP} +
    + ) + : MRP && ( +
    + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} +
    + )} + {GlobaldummyData + ? GlobalQuantity && ( +
    + {item?.SalesQty} +
    + ) + : Quantity && ( +
    + {item?.SalesQty} +
    + )} + {GlobaldummyData + ? GlobalRate && ( +
    + {item?.Rate} +
    + ) + : Rate && ( +
    + {item?.Rate} +
    + )} + {GlobaldummyData + ? GlobalDiscount && ( +
    + {item?.discount} +
    + ) + : Discount && ( +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} + {GlobaldummyData + ? GlobalTax && ( +
    + {item?.ProdTaxPercentage || 0} +
    + ) + : Tax == true && + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} + {GlobaldummyData + ? GlobalAmount && ( +
    + {item?.TotalAmt} +
    + ) + : Amount && ( +
    + {' '} + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    + )} +
    + ) + )} +
    +
    + )} +
    + +
    + {DineInData?.length > 0 && TakeawayData?.length > 0 && ( +
    + {takeAwayPreference && ( +
    Takeaway: {Number(TakeawayTotal).toFixed(2)}
    + )} + {dinePreference && ( +
    Dine In: {Number(DineInTotal).toFixed(2)}
    + )} +
    +
    + )} + {/*
    */} +
    +
    +
    Items :
    +
    Qty :
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    Off:
    + )} +
    Amount :
    +
    +
    +
    + {GlobaldummyData ? '7' : totalQuantityFilter?.length}{' '} +
    +
    + {GlobaldummyData ? '9' : totalQuantity}{' '} +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    + {GlobaldummyData + ? '100' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}{' '} +
    + )} +
    + {' '} + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)}{' '} +
    +
    +
    + + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    +
    + --------- GST Breakup Details ----------- +
    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {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)} +
    + + )} +
    + + )} +
    + )} +
    + + {/*
    */} + +
    +
    + {GlobaldummyData + ? 'Cash' + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : ''} + Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).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} +

    + )); + })()} +
    + )} +
    +
    +
    + Your Order No : + {GlobaldummyData + ? '01' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    + {PaymentStatusSuccess?.length > 1 && ( + <> + {/*

    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' && dinePreference && ( +
    + Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    +
    Pngwing com
    -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    : - (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    )} -
    - {/*
    */} - -
    - -
    - {(!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. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (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
    - - } - - +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    -
    - } -
    - - : -
    - - {((!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 : '')} - - {table2Data?.BrGSTIN &&
    GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : table2Data?.BrGSTIN},
    } -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    - {table2Data?.OrderType === "E" &&
    Estimate Bill {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    -
    )} - - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate Bill {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    -
    -
    -
    BILL NO :{GlobaldummyData ? '51' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    -
    -
    -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && -
    - {takeAwayPreference &&
    TakeAway
    } -
    - {GlobaldummyData ? GlobalSlNo &&
    S.No
    : SLNO &&
    S.No
    } - {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } - {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } - {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } - {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } - {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } - {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} - {GlobaldummyData ? GlobalAmount &&
    AMT
    : Amount &&
    AMT
    } -
    - -
    - {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => ( -
    - {GlobaldummyData ? GlobalSlNo &&
    {index + 1}
    : SLNO &&
    {index + 1}
    } - {GlobaldummyData ? GlobalItem &&
    {item?.ProdName}
    : Item && -
    -
    {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(",")}
    ); - } - ) : ""} -
    -
    } - {GlobaldummyData ? GlobalHsnCode &&
    {item?.HSN}
    : HsnCode &&
    {item?.HSN}
    } - {GlobaldummyData ? GlobalMRP &&
    {item?.MRP}
    : MRP &&
    {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}
    } - {GlobaldummyData ? GlobalQuantity &&
    {item?.SalesQty}
    : Quantity &&
    {item?.SalesQty}
    } - {GlobaldummyData ? GlobalRate &&
    {item?.Rate}
    : Rate &&
    {item?.Rate}
    } - {GlobaldummyData ? GlobalDiscount &&
    {item?.discount}
    : Discount &&
    {item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}
    } - {GlobaldummyData ? GlobalTax &&
    {item?.ProdTaxPercentage || 0}
    : (Tax == true && table2Data?.OrderType !== 'E') && (
    {item?.ProdTaxPercentage || 0}
    )} - {GlobaldummyData ? GlobalAmount &&
    {item?.TotalAmt}
    : Amount &&
    {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    } -
    - ))} -
    -
    - } - {(DineInData?.length > 0 && dinePreference) && -
    -
    Dine In
    -
    - {GlobaldummyData ? GlobalSlNo &&
    S.No
    : SLNO &&
    S.No
    } - {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } - {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } - {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } - {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } - {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } - {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} - {GlobaldummyData ? GlobalAmount &&
    AMT
    : Amount &&
    AMT
    } -
    - -
    - {(GlobaldummyData ? products : DineInData)?.map((item, index) => ( -
    - {GlobaldummyData ? GlobalSlNo &&
    {index + 1}
    : SLNO &&
    {index + 1}
    } - {GlobaldummyData ? GlobalItem &&
    {item?.ProdName}
    : Item && -
    -
    {item?.ProdName}
    -
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    -
    } - {GlobaldummyData ? GlobalHsnCode &&
    {item?.HSN}
    : HsnCode &&
    {item?.HSN}
    } - {GlobaldummyData ? GlobalMRP &&
    {item?.MRP}
    : MRP &&
    {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}
    } - {GlobaldummyData ? GlobalQuantity &&
    {item?.SalesQty}
    : Quantity &&
    {item?.SalesQty}
    } - {GlobaldummyData ? GlobalRate &&
    {item?.Rate}
    : Rate &&
    {item?.Rate}
    } - {GlobaldummyData ? GlobalDiscount &&
    {item?.discount}
    : Discount &&
    {item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}
    } - {GlobaldummyData ? GlobalTax &&
    {item?.ProdTaxPercentage || 0}
    : (Tax == true && table2Data?.OrderType !== 'E') && (
    {item?.ProdTaxPercentage || 0}
    )} - {GlobaldummyData ? GlobalAmount &&
    {item?.TotalAmt}
    : Amount &&
    {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    } -
    - ))} -
    -
    - } -
    - -
    - {(DineInData?.length > 0 && TakeawayData?.length > 0) && -
    - {takeAwayPreference &&
    Takeaway: {Number(TakeawayTotal).toFixed(2)}
    } - {dinePreference &&
    Dine In: {Number(DineInTotal).toFixed(2)}
    } -
    -
    - } - {/*
    */} -
    -
    -
    Items :
    -
    Qty :
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off:
    } -
    Amount :
    -
    -
    -
    {GlobaldummyData ? '7' : totalQuantityFilter?.length}
    -
    {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    {GlobaldummyData ? '100' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } -
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    -
    - - {(table2Data?.OrderType === "E") ? '' : (
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    -
    - --------- GST Breakup Details -----------
    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - Taxable Amount - - CGST - - SGST - - - Total Amount -
    {item?.TaxPercentage || 0}% - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(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)}
    - - } - -
    - - } - -
    - )} -
    - - {/*
    */} - - -
    -
    {GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).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} -

    - )); - })()} - -
    - ) - )} -
    - -
    -
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    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" && dinePreference) && -
    Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet &&
    -
    - Pngwing com -
    -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    : - (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    )} + )}
    {/*
    */}
    -
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    -
    -
    ) : - Notestext && (
    -

    {Notestext}

    +
    +
    + ) + : Notestext && ( +
    +

    {Notestext}

    -
    -
    ) - }
    } +
    +
    + )} +
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

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

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    + )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : (
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (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

    - -
    )} - -
    )} + {GlobaldummyData + ? GlobalSignature && ( +
    +

    + Signature +

    + +
    + ) + : Signature == true && ( +
    +

    + Signature +

    + +
    + )} +
    + )}
    - - {PrintGreeting?.SettingValue === "Y" && + {PrintGreeting?.SettingValue === 'Y' && ( <> {/*
    */} -
    Thank You Visit Again
    +
    + Thank You Visit Again +
    - } + )} {/*
    print
    */} -
    } +
    + )} ); -} +}; -export default PrintStyle3; \ No newline at end of file +export default PrintStyle3; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx index 43b0472..2aaebc9 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx @@ -28,9 +28,13 @@ import { GlobalprintLogo, GlobalprintCredit, GlobalprintTax, + GlobalSelectedPrintHeaderColor, } from '../../../../Features/ThemeChange/ThemeChange'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.scss'; -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; +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'; @@ -131,6 +135,7 @@ const Printstyle4 = ({ const paymentTypeUPI = PaymentStatus?.find( (ps) => ps.PaymentTypeName === 'UPI' ); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); console.log(GlobalDiscount, Discount, 'Discount'); @@ -244,7 +249,7 @@ const Printstyle4 = ({ TotalAmt: 176, discount: 0, HSN: '01', - }, + }, { ProdName: 'ITEM 2', Rate: 300.0, @@ -253,7 +258,7 @@ const Printstyle4 = ({ TotalAmt: 300, discount: 0, HSN: '02', - }, + }, { ProdName: 'ITEM 3', Rate: 200.0, @@ -412,6 +417,7 @@ const Printstyle4 = ({ fontWeight: '600', width: '100%', textAlign: 'center', + color: SelectedHeaderColor, }} > {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}{' '} @@ -559,7 +565,7 @@ const Printstyle4 = ({ textAlign: 'right', }} > - {WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx index ee2bed5..8dc92f9 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx @@ -28,6 +28,7 @@ import { GlobalprintLogo, GlobalprintCredit, GlobalprintTax, + GlobalSelectedPrintHeaderColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint, @@ -124,6 +125,8 @@ const PrintStyle5 = ({ (ps) => ps.PaymentTypeName === 'UPI' ); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + console.log(GlobalDiscount, Discount, 'Discount'); let TermsAndConditions = printDatas?.TermsandConditions; @@ -383,6 +386,7 @@ const PrintStyle5 = ({ style={{ fontSize: 'clamp(2rem, 2.5vw, 2rem)', fontWeight: '600', + color: SelectedHeaderColor, }} > {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} @@ -2595,6 +2599,7 @@ const PrintStyle5 = ({ style={{ fontSize: 'clamp(2rem, 2.5vw, 2rem)', fontWeight: '600', + color: SelectedHeaderColor, }} > {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} From 6f5710a3fc57c5d3339795a0f13897c14402d778 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Feb 2026 13:50:42 +0530 Subject: [PATCH 12/20] price change render fixed 2 --- .../Components/UtillComponents/ProductPriceChange.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Pages/BookingScreen/Components/UtillComponents/ProductPriceChange.jsx b/src/Pages/BookingScreen/Components/UtillComponents/ProductPriceChange.jsx index d55a9eb..2e20526 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/ProductPriceChange.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/ProductPriceChange.jsx @@ -227,11 +227,11 @@ const ProductPriceChange = ({ console.log(cardData, 'noSubcatCardDatanoSubcatCardData', ItemCard); useEffect(() => { - + if (priceChangeModal || productPriceChange) { const extractStockDtls = (data) => { if (data?.length === 0 || !data) return []; - let stockDtls = [];git + let stockDtls = []; data?.forEach((item) => { let products = item?.ProductDetail?.flatMap((product) => product); @@ -266,7 +266,8 @@ const ProductPriceChange = ({ }; setTableData(extractStockDtls(priceChangeProduct || cardData || [])); setCurrentPage(1); - }, [cardData, priceChangeProduct]); + } + }, [cardData, priceChangeProduct, priceChangeModal, productPriceChange]); const handleNewMRPChange = (value, index) => { const updatedTableData = [...tableData]; From 7617a934318691446db9806c8affe946dedde3d5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 3 Feb 2026 13:52:53 +0530 Subject: [PATCH 13/20] sales page Setting modal Design --- .../UtillComponents/AllSalesPageSettings.jsx | 4 +- .../UtillComponents/AllSalesPageSettings.scss | 35 +- .../UtillComponents/TableHeadersetting.jsx | 829 +++++++++--------- 3 files changed, 458 insertions(+), 410 deletions(-) diff --git a/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.jsx b/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.jsx index 43f933e..04d54df 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.jsx @@ -66,7 +66,9 @@ const AllSalesPageSettings = () => {
    )} - {selectedComponent === 'Table' && } + {selectedComponent === 'Table' && ( + + )}
    diff --git a/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.scss b/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.scss index 4c41b2f..06f24ca 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.scss +++ b/src/Pages/BookingScreen/Components/UtillComponents/AllSalesPageSettings.scss @@ -92,11 +92,14 @@ scrollbar-width: thin; padding-right: 10px; overflow: auto; - .option-maindiv{ - display: flex; - align-items: flex-start; - flex-wrap: wrap; - } + .option-maindiv { + display: flex; + align-items: flex-start; + flex-wrap: wrap; + } + .ant-checkbox-wrapper { + padding: 8px !important; + } } .SettingsListSwitchBTN { @@ -157,3 +160,25 @@ font-size: 16px; } } + +// Table Header Setting CSS start here||| + +.SelectionComponentSubHeading { + color: #333; + font-size: 12px; + font-weight: 500; + font-family: "Poppins", sans-serif; +} + +.selctfontBackInputMain { + display: flex; + align-items: flex-start; + gap: 8px; + flex-wrap: wrap; + margin-top: 10px; +} +.selctfontBackInput { + display: flex; + flex-direction: column; + gap: 4px; +} diff --git a/src/Pages/BookingScreen/Components/UtillComponents/TableHeadersetting.jsx b/src/Pages/BookingScreen/Components/UtillComponents/TableHeadersetting.jsx index 5c9c47b..5ba7045 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/TableHeadersetting.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/TableHeadersetting.jsx @@ -20,8 +20,9 @@ import { import { useDispatch } from 'react-redux'; import Buttons from '../../../../Components/Forms/Buttons'; import { Messages } from '../../../../Components/Notifications/Messages'; +import './AllSalesPageSettings.scss'; -const TableHeadersetting = ({setModalOpen}) => { +const TableHeadersetting = ({ setModalOpen }) => { const dispatch = useDispatch(); const SessionData = useSelector(StoredSessionData); const AppId = SessionData?.AppId; @@ -45,7 +46,7 @@ const TableHeadersetting = ({setModalOpen}) => { const [SelectedTableColor, setSelectedTableColor] = useState(null); const [Tableform] = Form.useForm(); const [billingSettings, setBillingSettings] = useState(); - console.log(billingSettings,"billingSettingsbillingSettings") + console.log(billingSettings, 'billingSettingsbillingSettings'); const [SelectedBillTableCheckValues, setSelectedBillTableCheckValues] = useState([]); const backgroundOptionId = billingSettings?.ComponentOptionsDetails?.find( @@ -63,9 +64,9 @@ const TableHeadersetting = ({setModalOpen}) => { OverallbackgroundOptionId ); // Hold and addcustomer OptionsDetails - const [HoldButton, setHoldButton] = useState(false); - const [AddCustomerButton, setAddCustomerButton] = useState(false); - const [DineInChecked,setDineInChecked] = useState(false) + const [HoldButton, setHoldButton] = useState(false); + const [AddCustomerButton, setAddCustomerButton] = useState(false); + const [DineInChecked, setDineInChecked] = useState(false); console.log(billingSettings, 'billingSettingsbillingSettings'); const [TableBackgroundColorData, setTableBackgroundColorData] = useState([ { @@ -152,7 +153,7 @@ const TableHeadersetting = ({setModalOpen}) => { let selectedBilling = AllDetails?.Templates?.[0]?.ComponentDetails?.find( (item) => item?.SessionName === 'BookingBilling' ); - let selectedNavbar =AllDetails?.Templates?.[0]?.ComponentDetails?.find( + let selectedNavbar = AllDetails?.Templates?.[0]?.ComponentDetails?.find( (item) => item?.SessionName === 'BookingNavbar' ); let AllBillingdetails = AllDetails?.Components?.find( @@ -164,43 +165,55 @@ const TableHeadersetting = ({setModalOpen}) => { (item) => item?.OptionId ); setSelectedBillTableCheckValues(optionIds); - - let Allfontdata = AllDetails?.Fonts?.filter(item => item.SessionId === selectedBilling?.SessionId) - setTableFontData(Allfontdata) - let selectedFont = AllDetails?.Templates?.[0]?.FontDetail?.find(item=>item?.SessionId === selectedBilling?.SessionId) - setSelectedTableFont(selectedFont?.FontId) + let Allfontdata = AllDetails?.Fonts?.filter( + (item) => item.SessionId === selectedBilling?.SessionId + ); + setTableFontData(Allfontdata); + let selectedFont = AllDetails?.Templates?.[0]?.FontDetail?.find( + (item) => item?.SessionId === selectedBilling?.SessionId + ); + + setSelectedTableFont(selectedFont?.FontId); const hasHold = selectedNavbar?.FieldDetails?.some( - item => item.OptionName === "Hold" + (item) => item.OptionName === 'Hold' ); - const hasAddcustomer = selectedNavbar?.FieldDetails?.some( - item => item.OptionName === "AddCustomer" + const hasAddcustomer = selectedNavbar?.FieldDetails?.some( + (item) => item.OptionName === 'AddCustomer' ); - const hasDinein = selectedNavbar?.FieldDetails?.some( - item => item.OptionName === "DineIn" + const hasDinein = selectedNavbar?.FieldDetails?.some( + (item) => item.OptionName === 'DineIn' + ); + setHoldButton(hasHold); + setAddCustomerButton(hasAddcustomer); + setDineInChecked(hasDinein); + let allcolordata = AllDetails?.Colors?.filter( + (item) => + item.SessionId === selectedBilling?.SessionId && + item.OptionName === 'OverallBackground' + ); + setBillingOverallColorsList(allcolordata); + let allBackcolordata = AllDetails?.Colors?.filter( + (item) => + item.SessionId === selectedBilling?.SessionId && + item.OptionName === 'Background' ); - setHoldButton(hasHold) - setAddCustomerButton(hasAddcustomer) - setDineInChecked(hasDinein) - let allcolordata = AllDetails?.Colors?.filter(item => item.SessionId === selectedBilling?.SessionId && item.OptionName === "OverallBackground") - setBillingOverallColorsList(allcolordata) - let allBackcolordata = AllDetails?.Colors?.filter(item => item.SessionId === selectedBilling?.SessionId && item.OptionName === "Background") - setTableBackgroundColorData(allBackcolordata) - let selectedcolors = AllDetails?.Templates?.[0]?.ColorDetail?.filter(item=>item?.SessionName === 'BookingBilling') - console.log(selectedcolors, 'selectedOverallBackgroudcolor') - selectedcolors?.forEach((item) => { - if (item?.['BackgroundColor']) { - setSelectedTableColor(item?.['ColorId']); - } else if (item?.['OverallBackgroundColor']) { - - setdropdownBillingOverallColor(item?.['ColorId']); - - } - }); + setTableBackgroundColorData(allBackcolordata); + let selectedcolors = AllDetails?.Templates?.[0]?.ColorDetail?.filter( + (item) => item?.SessionName === 'BookingBilling' + ); + console.log(selectedcolors, 'selectedOverallBackgroudcolor'); + selectedcolors?.forEach((item) => { + if (item?.['BackgroundColor']) { + setSelectedTableColor(item?.['ColorId']); + } else if (item?.['OverallBackgroundColor']) { + setdropdownBillingOverallColor(item?.['ColorId']); + } + }); // await setdropdownBillingOverallColor(selectedOverallBackgroudcolor); // formRef.current?.setFieldsValue({ BillingOverallColor: value }); - + // setTableBackgroundColorData console.log(Allfontdata, 'All table colors'); // BookingBilling templateData?.['BookingBilling']?.[0] @@ -241,49 +254,49 @@ const TableHeadersetting = ({setModalOpen}) => { setTableFontHex(color?.hex?.replace('#', '').trim()); } }; - - const handleBackgroundColorSubmit= async () => { - if (TablebackgroundColor !== TablefontColor) { - let response; - try { - let postData = { - BackgroundColor: TablebackgroundColor, - FontColor: TablefontColor, - CreatedBy: UserId, - SessionId: billingSettings?.SessionId, - OptionId: backgroundOptionId, + + const handleBackgroundColorSubmit = async () => { + if (TablebackgroundColor !== TablefontColor) { + let response; + try { + let postData = { + BackgroundColor: TablebackgroundColor, + FontColor: TablefontColor, + CreatedBy: UserId, + SessionId: billingSettings?.SessionId, + OptionId: backgroundOptionId, + }; + response = await dispatch(postColorData(postData)).unwrap(); + } catch (err) { + if (err['message'] == 'Request failed with status code 422') { + response = { + data: { + statusCode: 0, + response: 'Color Not Added', + data: [], + }, }; - response = await dispatch(postColorData(postData)).unwrap(); - } catch (err) { - if (err['message'] == 'Request failed with status code 422') { - response = { - data: { - statusCode: 0, - response: 'Color Not Added', - data: [], - }, - }; - } } - if (response?.data?.statusCode == 1) { - if (response?.data?.response == 'Color Already Exists') { - setMessageType('warning'); - setMessageData(response?.data?.response); - } else { - setMessageType('success'); - setMessageData(response?.data?.response); - // BillsetUploadColor(false); - } - GetTemplatedetails() - setBillUploadColor(false) - } else { - setMessageData(response?.data?.response); - setMessageType('error'); - } - } else { - setMessageData('Please select different color for background and font'); - setMessageType('warning'); } + if (response?.data?.statusCode == 1) { + if (response?.data?.response == 'Color Already Exists') { + setMessageType('warning'); + setMessageData(response?.data?.response); + } else { + setMessageType('success'); + setMessageData(response?.data?.response); + // BillsetUploadColor(false); + } + GetTemplatedetails(); + setBillUploadColor(false); + } else { + setMessageData(response?.data?.response); + setMessageType('error'); + } + } else { + setMessageData('Please select different color for background and font'); + setMessageType('warning'); + } }; const TableonCancel4 = () => { setBillUploadColor(false); @@ -317,47 +330,46 @@ const TableHeadersetting = ({setModalOpen}) => { }; const handleBillingOverallColorSubmit = async () => { let response; - - try { - let postData = { - BackgroundColor: BillingOverallColor, - FontColor: '#000000', - CreatedBy:UserId, - SessionId: billingSettings?.SessionId, - OptionId: OverallbackgroundOptionId, + + try { + let postData = { + BackgroundColor: BillingOverallColor, + FontColor: '#000000', + CreatedBy: UserId, + SessionId: billingSettings?.SessionId, + OptionId: OverallbackgroundOptionId, + }; + response = await dispatch(postColorData(postData)).unwrap(); + } catch (err) { + if (err['message'] == 'Request failed with status code 422') { + response = { + data: { + statusCode: 0, + response: 'Color Not Added', + data: [], + }, }; - response = await dispatch(postColorData(postData)).unwrap(); - } catch (err) { - if (err['message'] == 'Request failed with status code 422') { - response = { - data: { - statusCode: 0, - response: 'Color Not Added', - data: [], - }, - }; - } } - if (response?.data?.statusCode == 1) { - if (response?.data?.response == 'Color Already Exists') { - setMessageType('warning'); - setMessageData(response?.data?.response); - } else { - setMessageType('success'); - setMessageData(response?.data?.response); - setBillingUploadOverallColor(false); - } - GetTemplatedetails() - BillingUploadOverallColor(false) - } else { + } + if (response?.data?.statusCode == 1) { + if (response?.data?.response == 'Color Already Exists') { + setMessageType('warning'); setMessageData(response?.data?.response); - setMessageType('error'); + } else { + setMessageType('success'); + setMessageData(response?.data?.response); + setBillingUploadOverallColor(false); } + GetTemplatedetails(); + BillingUploadOverallColor(false); + } else { + setMessageData(response?.data?.response); + setMessageType('error'); + } }; const selectBillingOverallColor = async (value) => { await setdropdownBillingOverallColor(value); // formRef.current?.setFieldsValue({ BillingOverallColor: value }); - }; const openColour4 = (value) => { setTableColorType(value); @@ -371,18 +383,17 @@ const TableHeadersetting = ({setModalOpen}) => { validateFontsTable(values); }; const validateFontsTable = async (values) => { - console.log(values,"valuesvalues") + console.log(values, 'valuesvalues'); const apiUrl = `https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyDP1HqNkLI53iIAH-SB9_mt_24QdkUZ_24`; - fetch(apiUrl) + fetch(apiUrl) .then((response) => response.json()) .then(async (data) => { const fontNames = data?.items?.map((item) => item.family); - + if (fontNames.includes(formatFontName(values['TableFont']))) { let response; try { - - let postData = { + let postData = { SessionFont: formatFontName(values['TableFont']), CreatedBy: UserId, SessionId: billingSettings?.SessionId, @@ -409,16 +420,15 @@ const TableHeadersetting = ({setModalOpen}) => { } dispatch(getTableFonts(BillingTableData?.[0]?.SessionId)).unwrap; - GetTemplatedetails() + GetTemplatedetails(); Tableform.resetFields(); } else { setMessageData(response?.data?.response); setMessageType('error'); } } else { - setMessageType('warning'); + setMessageType('warning'); setMessageData('Please give the Correct google fonts Name!'); - } }) .catch((error) => { @@ -439,17 +449,17 @@ const TableHeadersetting = ({setModalOpen}) => { CompId: CompId, UserId: UserId, BranchId: BranchId, - ColorId: [ - ...(TemplateDetails?.[0]?.ColorDetail - ?.filter(c => c.SessionName !== "BookingBilling") - ?.map(c => c.ColorId) || []), + ColorId: [ + ...(TemplateDetails?.[0]?.ColorDetail?.filter( + (c) => c.SessionName !== 'BookingBilling' + )?.map((c) => c.ColorId) || []), - SelectedTableColor, - dropdownBillingOverallColor, -], - FontId: TemplateDetails?.[0]?.FontDetail?.map(f => - f.SessionName === "BookingBilling" ? selectedTableFont : f.FontId - ), + SelectedTableColor, + dropdownBillingOverallColor, + ], + FontId: TemplateDetails?.[0]?.FontDetail?.map((f) => + f.SessionName === 'BookingBilling' ? selectedTableFont : f.FontId + ), CreatedBy: UserId, TemplateDetails: TemplateDetails?.[0]?.ComponentDetails.map((comp) => ({ ComponentId: comp.ComponentId, // ✅ dynamic @@ -457,42 +467,40 @@ const TableHeadersetting = ({setModalOpen}) => { comp.SessionName === 'BookingBilling' ? SelectedBillTableCheckValues?.map((id) => ({ OptionId: id })) // ✅ NEW checked list : comp.FieldDetails.map((field) => ({ OptionId: field.OptionId })), // existing - })), + })), }; console.log(result, 'final result to submit'); var response = await dispatch(putSelectionComponentData(result)).unwrap(); - if (response?.data?.statusCode == 1) { - if ( - response?.data?.response === 'Application Template Already Exists' - ) { - setMessageType('warning'); - setMessageData('Application Template Already Exists'); - setFirstOnClick(false); - } else { - setMessageType('success'); - setMessageData('Template Details Added Successfully'); - setFirstOnClick(false); - } - await dispatch(getTemplate({ CompId, BranchId, AppId })).unwrap(); - setModalOpen(false) - } else { - setMessageType('error'); - setMessageData(response?.data?.response); - setFirstOnClick(false); - } + if (response?.data?.statusCode == 1) { + if (response?.data?.response === 'Application Template Already Exists') { + setMessageType('warning'); + setMessageData('Application Template Already Exists'); + setFirstOnClick(false); + } else { + setMessageType('success'); + setMessageData('Template Details Added Successfully'); + setFirstOnClick(false); + } + await dispatch(getTemplate({ CompId, BranchId, AppId })).unwrap(); + setModalOpen(false); + } else { + setMessageType('error'); + setMessageData(response?.data?.response); + setFirstOnClick(false); + } }; - const onComplete = useCallback(() => { - setMessageData(null); - setMessageType(null); - }, []); + const onComplete = useCallback(() => { + setMessageData(null); + setMessageType(null); + }, []); return ( <> - +
    { // onClick={() => Navholdoption(value.OptionName)} key={value?.OptionId} disabled={ - value.OptionName === 'Hold' && HoldButton - ? true - : value.OptionName === 'AddCustomer' && - AddCustomerButton - ? true - : value.OptionName === 'Item' - ? true - : value.OptionName === 'UnpaidBill' && - !DineInChecked - ? true - : false - } + value.OptionName === 'Hold' && HoldButton + ? true + : value.OptionName === 'AddCustomer' && AddCustomerButton + ? true + : value.OptionName === 'Item' + ? true + : value.OptionName === 'UnpaidBill' && !DineInChecked + ? true + : false + } > {value.OptionName} @@ -545,28 +551,259 @@ const TableHeadersetting = ({setModalOpen}) => {
    ))} */}
    -
    -

    BillTable Font

    - ({ - value: option.FontId, - label: option.SessionFont, - }))} - label="Font" - onChangeFunction={selectFont3} - className="settingsales-DropDown-Selection" - isOnchanges={!!selectedTableFont} - valueData={selectedTableFont} - /> -
    - Add - +
    +
    +

    BillTable Font

    +
    + ({ + value: option.FontId, + label: option.SessionFont, + }))} + label="Font" + onChangeFunction={selectFont3} + className="settingsales-DropDown-Selection" + isOnchanges={!!selectedTableFont} + valueData={selectedTableFont} + /> +
    + Add + +
    +
    + + {hasBackground ? ( +
    +
    +
    + +

    + BillTable Background Color +

    + ({ + value: option.ColorId, + label: ( +
    +
    + +     + +
    +
    {option.ThemeName}
    +
    + ), + }))} + labelChange={true} + label="Color" + className="field-DropDown-Selection" + onChangeFunction={selectTableColor} + isOnchanges={SelectedTableColor ? true : false} + valueData={SelectedTableColor} + /> +
    +
    +
    + Add + +
    +
    +
    + ) : null} + + {hasOverallBackground ? ( +
    + { + setBillingUploadOverallColor(false); + }} + /> + } + width={400} + footer={null} + > +
    +
    +

    + Selected Color:{' '} +

    +
    +
    +
    + +
    +
    + + + +
    + +
    +
    +
    +
    + +

    + BillTable Overall-Background +

    + ({ + value: option.ColorId, + label: ( +
    +
    + +     + +
    +
    {option.ThemeName}
    +
    + ), + }))} + labelChange={true} + label={ +

    Overall Background

    + } + className="field-DropDown-Selection" + onChangeFunction={selectBillingOverallColor} + isOnchanges={dropdownBillingOverallColor ? true : false} + valueData={dropdownBillingOverallColor} + /> +
    +
    +
    + Add + +
    +
    +
    + ) : null}
    { handleSubmit={TablehandleSubmit} buttonText="SAVE" /> - {hasBackground ? ( -
    -
    -
    - -

    - BillTable Background Color -

    - ({ - value: option.ColorId, - label: ( -
    -
    - -     - -
    -
    {option.ThemeName}
    -
    - ), - }))} - labelChange={true} - label="Color" - className="field-DropDown-Selection" - onChangeFunction={selectTableColor} - isOnchanges={SelectedTableColor ? true : false} - valueData={SelectedTableColor} - /> -
    -
    -
    - Add - -
    -
    -
    - ) : null} - {hasOverallBackground ? ( -
    - { - setBillingUploadOverallColor(false); - }} - /> - } - width={400} - footer={null} - > -
    -
    -

    - Selected Color:{' '} -

    -
    -
    -
    - -
    -
    - - -
    - -
    -
    -
    -
    - -

    - BillTable Overall-Background -

    - ({ - value: option.ColorId, - label: ( -
    -
    - -     - -
    -
    {option.ThemeName}
    -
    - ), - }))} - labelChange={true} - label={

    Overall Background

    } - className="field-DropDown-Selection" - onChangeFunction={selectBillingOverallColor} - isOnchanges={dropdownBillingOverallColor ? true : false} - valueData={dropdownBillingOverallColor} - /> -
    -
    -
    - Add - -
    -
    -
    - ) : null} { icon={} htmlType={true} handleSubmit={HandleSubmit} - />
    From f1761326709f4d80e9ee464ccbeb2a22404d9e5d Mon Sep 17 00:00:00 2001 From: karthikalakshmi Date: Tue, 3 Feb 2026 13:55:24 +0530 Subject: [PATCH 14/20] FIX #60 Print Header Integrated code missing --- .../ThermalPrinter/PrintStyle6.jsx | 10 +- .../ThermalPrinter/PrintStyle7.jsx | 5468 +++++++++++---- .../ThermalPrinter/PrintStyle8.jsx | 5979 +++++++++++++---- .../ThermalPrinter/PrintStyle9.jsx | 2987 ++++---- src/Pages/Preference/PreferenceList.jsx | 13 +- src/Pages/StockMaster/StockForm.jsx | 1659 ++--- .../BSBillingEditQuantity.scss | 43 +- .../BSBillingTables/BSPacking/BSPacking.scss | 22 +- src/Styles/PurchaseReturn/purchasereturn.scss | 12 +- 9 files changed, 11019 insertions(+), 5174 deletions(-) diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx index 2f03b14..145eb88 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx @@ -29,6 +29,7 @@ import { GlobalprintLogo, GlobalprintCredit, GlobalprintTax, + GlobalSelectedPrintHeaderColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint, @@ -123,6 +124,7 @@ const Printstyle6 = ({ const paymentTypeUPI = PaymentStatus?.find( (ps) => ps.PaymentTypeName === 'UPI' ); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); console.log(GlobalDiscount, Discount, 'Discount'); @@ -400,7 +402,9 @@ const Printstyle6 = ({ /> ) : null}
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    @@ -3170,7 +3174,9 @@ const Printstyle6 = ({ /> ) : null}
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx index 6ef6187..b47d70c 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx @@ -1,1433 +1,4099 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import QRcode from '../../../../Images/QRcode.png' +import QRcode from '../../../../Images/QRcode.png'; import { extractLastNumberOrderId } from '../../../../Services/Others'; import { - GlobalprintSlNo, - GlobalprintItem, - GlobalprintMRP, - GlobalprintDiscount, - GlobalprintQuantity, - GlobalprintRate, - GlobalprintAmount, - GlobalprintHsnCode, - GlobalprintQrcodet, - GlobalPritdummyData, - GloabalFieldDetails, - changeReprintDataFound, - GlobalprintSignature, - GlobalprinttermsAndConditions, - GlobalSignatureImage, - Globalnotes, - GlobalthemeFormat, - GlobalBillName, - GlobalprintCashierName, - GlobalprintLogo, - GlobalprintCredit, - GlobalprintTax, + GlobalprintSlNo, + GlobalprintItem, + GlobalprintMRP, + GlobalprintDiscount, + GlobalprintQuantity, + GlobalprintRate, + GlobalprintAmount, + GlobalprintHsnCode, + GlobalprintQrcodet, + GlobalPritdummyData, + GloabalFieldDetails, + changeReprintDataFound, + GlobalprintSignature, + GlobalprinttermsAndConditions, + GlobalSignatureImage, + Globalnotes, + GlobalthemeFormat, + GlobalBillName, + GlobalprintCashierName, + GlobalprintLogo, + GlobalprintCredit, + GlobalprintTax, + GlobalSelectedPrintHeaderColor, } from '../../../../Features/ThemeChange/ThemeChange'; -import Logo from '../../../../Images/Logo.jpg' -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; -import "../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.scss" +import Logo from '../../../../Images/Logo.jpg'; +import { + GlobalUpiIDprint, + PreferenceData, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.scss'; import QRCode from 'react-qr-code'; -import signature from "../../../../Images/signatureimage.jpg" +import signature from '../../../../Images/signatureimage.jpg'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; import { isMobile } from 'react-device-detect'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; -const PrintStyle7 = ({ index, ExtraChargeTotal, Date1, totalQuantityFilter, CashierName, totalQuantity, OrderDetailGST, - OrderDetailIGST, OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, base64Image, PrintLogo, printDatas, isPdf, sportsAppPreference, SalesModePref, - MembershipApplied = null +const PrintStyle7 = ({ + index, + ExtraChargeTotal, + Date1, + totalQuantityFilter, + CashierName, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + OrderDetailVAT, + table2Data, + PaymentStatus, + PrintGreeting, + base64Image, + PrintLogo, + printDatas, + isPdf, + sportsAppPreference, + SalesModePref, + MembershipApplied = null, }) => { + const dispatch = useDispatch(); + const GlobalUpiID = useSelector(GlobalUpiIDprint); + const FieldDetails = useSelector(GloabalFieldDetails); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Tax = FieldDetails?.['Tax']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const CashierNameField = FieldDetails?.['CashierName']; + const LogoField = FieldDetails?.['Logo']; + const CreditDetails = FieldDetails?.['Credit details']; + const WeightasKg = FieldDetails?.['Weight']; + const 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 appPreferences = useSelector(ApplicationPreferences); + 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 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' + ); + console.log(GlobalDiscount, Discount, 'Discount'); + console.log(printDatas, 'printDatasjk'); + 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']; + const PackageDetails = table2Data?.PackageDtl; + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); - const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint) - const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Tax = FieldDetails?.["Tax"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const CashierNameField = FieldDetails?.["CashierName"]; - const LogoField = FieldDetails?.["Logo"]; - const CreditDetails = FieldDetails?.["Credit details"]; - const WeightasKg = FieldDetails?.['Weight']; - const 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 appPreferences = useSelector(ApplicationPreferences); - 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 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") - console.log(GlobalDiscount, Discount, "Discount"); - console.log(printDatas, "printDatasjk") - 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"]; - const PackageDetails = table2Data?.PackageDtl; + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); + const keysLength = Object.keys(table2Data ?? {}).length; + 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); - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") - const keysLength = Object.keys(table2Data ?? {}).length; - if (keysLength > 0) { - dispatch(changeReprintDataFound(true)); + 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' + ); + + 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 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 hasMappedOffer = offers.some((offer) => + ['ItemWiseOffers', 'BundleOffers', 'QuantityWiseOffers'].includes( + offer.TableName + ) + ); - 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") - - const TakeawayTotal = TakeawayData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + if (hasMappedOffer) { + const productTotal = productsData?.reduce( + (acc, item) => + acc + (item?.Type != 'C' ? item.OfferAmt : item.OfferValue || 0), + 0 ); - const DineInTotal = DineInData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + TotalOfferAmount += productTotal; + } else { + const Combothere = productsData?.filter((item) => item?.Type == 'C'); + const CombothereTotal = Combothere?.reduce( + (acc, item) => acc + (item.OfferValue || 0), + 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.00, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - ]; - - const chunkSize = PageSize == "A5" ? 8 : 11; - let dataSource = []; - - if (GlobaldummyData || TakeawayData?.length > 0) { - dataSource = GlobaldummyData ? products : TakeawayData; - } else if (DineInData?.length > 0) { - dataSource = DineInData; - } - - // Paginate the data - const paginatedChunks = []; - for (let i = 0; i < dataSource.length; i += chunkSize) { - paginatedChunks.push(dataSource.slice(i, i + chunkSize)); - } - const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; - const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == "A5" ? 5 : 10); - - 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 ? 'XYZ Shop' : table2Data?.BrName}
    */} -
    - {(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 : '')} -
    - {table2Data?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? 'Cash' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    - -
    -
    -
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    -
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    -
    - -
    -
    - -
    -
    - - {(TakeawayData?.length > 0 || GlobaldummyData) && - <> - {takeAwayPreference &&
    TakeAway
    } -
    - - - - - - {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 == 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 && } - - ))} - -
    SSItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {index + 1}{chunkIndex * chunkSize + index + 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?.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}
    -
    - } - {(DineInData?.length > 0 && dinePreference) && - <> -
    Dine In
    - -
    - - - - {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 == 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.NOItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {index + 1}{chunkIndex * chunkSize + index + 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}
    -
    - } -
    -
    - - - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - <> -
    -
    -
    Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    Qty : {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off : {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } -
    -
    - {(table2Data?.OrderType === "E") ? '' :
    - - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -
    - --------- GST Breakup Details -----------
    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(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)}
    - - } - -
    -
    - - - } -
    } -
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    Take Away : ₹{Number(TakeawayTotal).toFixed(2)}
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    Dine In: ₹{Number(DineInTotal).toFixed(2)}
    - } -
    Amount : ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - -
    -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].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} -
    - ) - )} - {(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 ? GlobalQrcodet && -
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - : (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    } - -
    - {(!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. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (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 && -
    -
    - <> -
    -
    -
    Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    Qty : {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off : {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } -
    -
    - {(table2Data?.OrderType === "E") ? '' :
    - - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -
    - --------- GST Breakup Details -----------
    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(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)}
    - - } - -
    -
    - - - } -
    } -
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    Take Away : ₹{Number(TakeawayTotal).toFixed(2)}
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    Dine In: ₹{Number(DineInTotal).toFixed(2)}
    - } -
    Amount : ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - -
    -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].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} -
    - ) - )} - {(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 ? GlobalQrcodet && -
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - : (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    } - -
    - {(!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. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (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 : '')} -
    - {table2Data?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    - -
    -
    -
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    -
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    -
    - -
    - -
    - - - - {(TakeawayData?.length > 0 || GlobaldummyData) && - <> - {takeAwayPreference &&
    TakeAway
    } -
    - - - - - - {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 : TakeawayData)?.map((item, index) => ( - - {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.NoItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {index + 1}{index + 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?.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}
    -
    - } - {(DineInData?.length > 0 && dinePreference) && - <> -
    Dine In
    - -
    - - - - {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 : DineInData)?.map((item, index) => ( - - {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 && } - - ))} - -
    SSItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {index + 1}{index + 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 ? '8' : totalQuantityFilter?.length}
    -
    Qty : {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off : {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } -
    -
    - {(table2Data?.OrderType === "E") ? '' :
    - - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -
    - --------- GST Breakup Details -----------
    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(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)}
    - - } - -
    -
    - - - } -
    } -
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    Take Away : ₹{Number(TakeawayTotal).toFixed(2)}
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    Dine In: ₹{Number(DineInTotal).toFixed(2)}
    - } -
    Amount : ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - -
    -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].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} -
    - ) - )} - {(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 ? GlobalQrcodet && -
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - : (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    } - -
    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 > (PageSize == 'A5' ? 5 : 10); + + 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 ? 'XYZ Shop' : table2Data?.BrName}
    */} +
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    + {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 + : '')} +
    + {table2Data?.OrderType === 'E' && ( +
    + {' '} + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? 'Cash' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + {' '} + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    -
    -
    ) : - Notestext && (
    -

    {Notestext}

    +
    +
    +
    + Bill No : + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    +
    +
    + {GlobaldummyData ? formattedDate : Date1} +
    +
    +
    -
    -
    ) - } -
    } +
    +
    +
    +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( + <> + {takeAwayPreference && ( +
    + TakeAway +
    + )} +
    + + + + {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 == 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 && ( + + )} + + ))} + +
    SSItemItemHSNHSNQty + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateDis Dis Tax % Tax % + Amt + + Amt +
    + {index + 1} + + {chunkIndex * chunkSize + index + 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?.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} +
    +
    + + )} + {DineInData?.length > 0 && dinePreference && ( + <> +
    + Dine In +
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (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 + ? 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 == 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.NOItemItemHSNHSNQty + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateDis Dis Tax % Tax % + Amt + + Amt +
    + {index + 1} + + {chunkIndex * chunkSize + index + 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} +
    +
    + + )} +
    +
    - {GlobaldummyData ? GlobalSignature && (
    -

    Signature

    - -
    ) : Signature == true && (
    -

    Signature

    - -
    )} + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> +
    +
    +
    + Items :{' '} + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    + Qty : {GlobaldummyData ? '9' : totalQuantity} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + Off :{' '} + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} +
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    -
    } +
    +
    + --------- GST Breakup Details ----------- +
    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + )} + + {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)} +
    + + )} +
    +
    + + )} +
    + )} +
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + Take Away : ₹{Number(TakeawayTotal).toFixed(2)} +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + Dine In: ₹{Number(DineInTotal).toFixed(2)} +
    + )} +
    + Amount : ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    + {PaymentStatusSuccess?.length > 1 && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].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} + + )} - {PrintGreeting?.SettingValue === "Y" && - <> -
    Thank You Visit Again
    -
    - - } + {/* 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} +
    + )} + {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 + ? GlobalQrcodet && ( +
    + QRcode +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + )} + +
    + {!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. +
    3. + Please check the product before leaving + the counter. +
    4. +
    +
    + ) + : 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 && ( +
    +
    + <> +
    +
    +
    + Items :{' '} + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    + Qty : {GlobaldummyData ? '9' : totalQuantity} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + Off :{' '} + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} +
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +
    + --------- GST Breakup Details ----------- +
    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {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 + )} +
    + + )} +
    +
    + + )} +
    + )} +
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + Take Away : ₹{Number(TakeawayTotal).toFixed(2)} +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + Dine In: ₹{Number(DineInTotal).toFixed(2)} +
    + )} +
    + Amount : ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + +
    +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    + {PaymentStatusSuccess?.length > 1 && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].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} +
    + )} + {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 + ? GlobalQrcodet && ( +
    + QRcode +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + )} + +
    + {!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. +
    3. + Please check the product before leaving the + counter. +
    4. +
    +
    + ) + : 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 + : '')} +
    + {table2Data?.OrderType === 'E' && ( +
    + {' '} + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + {' '} + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    + +
    +
    +
    + Bill No : + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    +
    +
    + {GlobaldummyData ? formattedDate : Date1} +
    +
    +
    + +
    + +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( + <> + {takeAwayPreference && ( +
    + TakeAway +
    + )} +
    + + + + {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 : TakeawayData)?.map( + (item, index) => ( + + {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.No + Item + ItemHSNHSNQty + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateDis Dis Tax % Tax % Amt + Amt +
    + {index + 1} + + {index + 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?.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} +
    +
    + + )} + {DineInData?.length > 0 && dinePreference && ( + <> +
    + Dine In +
    + +
    + + + + {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 : DineInData)?.map( + (item, index) => ( + + {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 && ( + + )} + + ) + )} + +
    SSItemItemHSNHSNQty + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateDis Dis Tax % Tax % + Amt + + Amt +
    + {index + 1} + + {index + 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 ? '8' : totalQuantityFilter?.length} +
    +
    + Qty : {GlobaldummyData ? '9' : totalQuantity} +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    + Off :{' '} + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} +
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +
    + --------- GST Breakup Details ----------- +
    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {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)} +
    + + )} +
    +
    + + )} +
    + )} +
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + Take Away : ₹{Number(TakeawayTotal).toFixed(2)} +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + Dine In: ₹{Number(DineInTotal).toFixed(2)} +
    + )} +
    + Amount : ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + +
    +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    + {PaymentStatusSuccess?.length > 1 && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}: {aggregatedPayments[paymentType].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} +
    + )} + {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 + ? GlobalQrcodet && ( +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + )} + +
    + {!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. +
    3. + Please check the product before leaving the counter. +
    4. +
    +
    + ) + : 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 PrintStyle7; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx index 1838949..fa9cb3a 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx @@ -1,1517 +1,4542 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import QrImage 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, + 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, } from '../../../../Features/ThemeChange/ThemeChange'; -import Logo from '../../../../Images/Logo.jpg' -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import Logo from '../../../../Images/Logo.jpg'; +import { + GlobalUpiIDprint, + PreferenceData, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.scss'; import QRCode from 'react-qr-code'; -import signature from "../../../../Images/signatureimage.jpg" +import signature from '../../../../Images/signatureimage.jpg'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; import { isMobile } from 'react-device-detect'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; -const Printstyle8 = ({ index, ExtraChargeTotal, Date1, totalQuantityFilter, BranchAddress, BranchCity, BranchZip, CashierName, totalQuantity, OrderDetailGST, OrderDetailIGST, - OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, base64Image, PrintLogo, printDatas, isPdf, sportsAppPreference, SalesModePref, MembershipApplied = null }) => { +const Printstyle8 = ({ + index, + ExtraChargeTotal, + Date1, + totalQuantityFilter, + BranchAddress, + BranchCity, + BranchZip, + CashierName, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + OrderDetailVAT, + table2Data, + PaymentStatus, + PrintGreeting, + base64Image, + PrintLogo, + printDatas, + isPdf, + sportsAppPreference, + SalesModePref, + MembershipApplied = null, +}) => { + const dispatch = useDispatch(); + const GlobalUpiID = useSelector(GlobalUpiIDprint); + const FieldDetails = useSelector(GloabalFieldDetails); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Tax = FieldDetails?.['Tax']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const CashierNameField = FieldDetails?.['CashierName']; + const LogoField = FieldDetails?.['Logo']; + const CreditDetails = FieldDetails?.['Credit details']; + const WeightasKg = FieldDetails?.['Weight']; + const 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 appPreferences = useSelector(ApplicationPreferences); + 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 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' + ); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); - const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint) - const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Tax = FieldDetails?.["Tax"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const CashierNameField = FieldDetails?.["CashierName"]; - const LogoField = FieldDetails?.["Logo"]; - const CreditDetails = FieldDetails?.["Credit details"]; - const WeightasKg = FieldDetails?.['Weight']; - const 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 appPreferences = useSelector(ApplicationPreferences); - 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 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") + console.log(GlobalDiscount, Discount, 'Discount'); - console.log(GlobalDiscount, Discount, "Discount"); + 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 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 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); - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") - const keysLength = Object.keys(table2Data ?? {}).length; - if (keysLength > 0) { - dispatch(changeReprintDataFound(true)); + 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' + ); + + 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 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 hasMappedOffer = offers.some((offer) => + ['ItemWiseOffers', 'BundleOffers', 'QuantityWiseOffers'].includes( + offer.TableName + ) + ); - 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") - - const TakeawayTotal = TakeawayData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + if (hasMappedOffer) { + const productTotal = productsData?.reduce( + (acc, item) => + acc + (item?.Type != 'C' ? item.OfferAmt : item.OfferValue || 0), + 0 ); - const DineInTotal = DineInData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + TotalOfferAmount += productTotal; + } else { + const Combothere = productsData?.filter((item) => item?.Type == 'C'); + const CombothereTotal = Combothere?.reduce( + (acc, item) => acc + (item.OfferValue || 0), + 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.00, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - ]; - - console.log(printDatas, "printDatasjk") - const chunkSize = PageSize == "A5" ? 10 : 16; - 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 > (PageSize == "A5" ? 5 : 13); - - 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") ? '' :
    - {/*

    {table2Data?.BrName}

    */} - -
    - {(GlobalLogo && GlobaldummyData) ? image : null} - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    - - -
    - {GlobaldummyData ? - 'BranchAddress, Town- 635XXX City - State' : - (BranchAddress || '') + (BranchCity ? (BranchAddress && BranchCity ? '-' : '') + BranchCity : '') + (BranchZip ? (BranchCity && BranchZip ? '-' : '') + BranchZip : '')} -
    -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    -
    )} - {table2Data?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? 'Cash' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - -
    -
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    - -
    -
    -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && - <> - {takeAwayPreference &&
    TakeAway
    } - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - - - {dataChunk?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} - -
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {chunkIndex * chunkSize + index + 1}{chunkIndex * chunkSize + index + 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?.HSN}{item?.HSN}{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?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - - } - {(DineInData?.length > 0 && dinePreference) && - <> -
    Dine In
    - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - - - {dataChunk?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} - -
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {index + 1}{chunkIndex * chunkSize + index + 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?.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?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - - } -
    - - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - - <> -
    -
    -
    -
    Items
    -
    :
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    -
    Qty
    -
    :
    -
    {GlobaldummyData ? '9' : totalQuantity}
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    Off
    -
    :
    -
    {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    -
    Take Away
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(TakeawayTotal).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    -
    Dine In
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)}
    -
    - } -
    -
    Amount
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    -
    - -
    - - {(table2Data?.OrderType === "E") ? '' :
    -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -

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

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(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)}
    - - } - -
    -
    - - - } -
    -
    } - -
    - -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).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} -
    - ) - )} -
    - -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    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" && dinePreference) && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) &&
    Captain: {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } -
    - - {(!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)}
    -
    } -
    } -
    - -
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(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. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (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 && -
    -
    - <> -
    -
    -
    -
    Items
    -
    :
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    -
    Qty
    -
    :
    -
    {GlobaldummyData ? '9' : totalQuantity}
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    Off
    -
    :
    -
    {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    -
    Take Away
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(TakeawayTotal).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    -
    Dine In
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)}
    -
    - } -
    -
    Amount
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    -
    - -
    - - {(table2Data?.OrderType === "E") ? '' :
    -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -

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

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(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)}
    - - } - -
    -
    - - - } -
    -
    } - -
    - -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).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} -
    - ) - )} -
    - -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    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" && dinePreference) && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) &&
    Captain: {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } -
    - - {(!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)}
    -
    } -
    } -
    - -
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(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. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (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 -
    - } - -
    -
    - } - + TotalOfferAmount += CombothereTotal; + } + const products = [ + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 18, + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 40, + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + ]; + + console.log(printDatas, 'printDatasjk'); + const chunkSize = PageSize == 'A5' ? 10 : 16; + 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 > (PageSize == 'A5' ? 5 : 13); + + 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' ? ( + '' + ) : ( +
    + {/*

    {table2Data?.BrName}

    */} + +
    + {GlobalLogo && GlobaldummyData ? ( + image + ) : null} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    +
    + +
    + {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +
    +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} +
    +
    + )} + {table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? 'Cash' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + +
    +
    + Bill No : + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    + {GlobaldummyData ? formattedDate : Date1} +
    - : -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {/*

    {table2Data?.BrName}

    */} -
    - {(GlobalLogo && GlobaldummyData) ? image : null} - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    -
    - {GlobaldummyData ? - 'BranchAddress, Town- 635XXX City - State' : - (BranchAddress || '') + (BranchCity ? (BranchAddress && BranchCity ? '-' : '') + BranchCity : '') + (BranchZip ? (BranchCity && BranchZip ? '-' : '') + BranchZip : '')} -
    -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    -
    )} - {table2Data?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - -
    -
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    - -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && - <> - {takeAwayPreference &&
    TakeAway
    } - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - - - {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} - -
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {index + 1}{index + 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?.HSN}{item?.HSN}{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?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - - } - {(DineInData?.length > 0 && dinePreference) && - <> -
    Dine In
    - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - - - {(GlobaldummyData ? products : DineInData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} - -
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {index + 1}{index + 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?.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?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - - } -
    -
    -
    -
    Items
    -
    :
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    -
    Qty
    -
    :
    -
    {GlobaldummyData ? '9' : totalQuantity}
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    Off
    -
    :
    -
    {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    -
    Take Away
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(TakeawayTotal).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    -
    Dine In
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)}
    -
    - } -
    -
    Amount
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    -
    - -
    - - {(table2Data?.OrderType === "E") ? '' :
    -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -

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

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(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)}
    - - } - -
    -
    - - - } -
    -
    } - -
    - -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).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} -
    - ) +
    +
    +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( + <> + {takeAwayPreference && ( +
    + TakeAway +
    )} -
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + + + {dataChunk?.map((item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode && } + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + })} + +
    + S.No + + S.No + DisDes + HSN + + HSN + + MRP + + MRP + + Rate + + Rt + + (%) + + (%) + + Tax % + + Tax % + + Qty + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + Amt + + Amt +
    + {chunkIndex * chunkSize + index + 1} + + {chunkIndex * chunkSize + index + 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?.HSN}{item?.HSN} + {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?.SalesQty} + + {item?.SalesQty} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    +
    + + )} + {DineInData?.length > 0 && dinePreference && ( + <> +
    + Dine In +
    + +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + + + {dataChunk?.map((item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode && } + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + })} + +
    + S.No + + S.No + DisDes + HSN + + HSN + + MRP + + MRP + + Rate + + Rt + + (%) + + (%) + + Tax % + + Tax % + + Qty + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + Amt + + Amt +
    + {index + 1} + + {chunkIndex * chunkSize + index + 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(',')} +
    + ); + }) + : ''}
    - ))} - - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    +
    {item?.HSN}{item?.HSN} + {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?.SalesQty} + + {item?.SalesQty} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    +
    + + )} +
    - } - {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" && dinePreference && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) &&
    Captain: {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> +
    +
    +
    +
    Items
    +
    :
    +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    +
    +
    +
    Qty
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    +
    Take Away
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(TakeawayTotal).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    +
    Dine In
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(DineInTotal).toFixed(2)} +
    +
    + )} +
    +
    Amount
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    +
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet &&
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +

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

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + )} + + {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)} +
    + + )} +
    +
    + + )} +
    +
    + )} +
    + +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).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} +
    + )} +
    +
    + {PaymentStatusSuccess?.length > 1 && ( + <> + {/*

    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' && + dinePreference && + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName && ( +
    + Captain:{' '} + { + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName + } +
    + )} +
    + + {!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 + )} +
    +
    + )} +
    + )} +
    + +
    + Your Order No : + {GlobaldummyData + ? '01' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && (
    - image +

    + 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. +
    3. + Please check the product before leaving + the counter. +
    4. +
    +
    + ) + : 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 && ( +
    +
    + <> +
    +
    +
    +
    Items
    +
    :
    +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    +
    +
    Qty
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    +
    Take Away
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(TakeawayTotal).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    +
    Dine In
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(DineInTotal).toFixed(2)} +
    +
    + )} +
    +
    Amount
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    +
    + +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +

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

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {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 + )} +
    + + )} +
    +
    + + )} +
    +
    + )} +
    + +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).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} +
    + )} +
    +
    + {PaymentStatusSuccess?.length > 1 && ( + <> + {/*

    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' && + dinePreference && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain:{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} +
    + + {!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)}
    -
    } -
    } -
    +
    + {' '} + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + )} +
    -
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } +
    + Your Order No : + {GlobaldummyData + ? '01' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    + {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' ? ( + '' + ) : ( +
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    + > + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

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

    + Terms & Conditions +

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

    {Notestext}

    + {GlobaldummyData + ? GlobalSignature && ( +
    +

    + Signature +

    + +
    + ) + : Signature == true && ( +
    +

    + Signature +

    + +
    + )} +
    + )} +
    -
    -
    ) - } -
    } - - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (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
    - - - {PrintGreeting?.SettingValue === "Y" && -
    - Thank You Visit Again -
    - } - {/*
    print
    */} + )} + +
    +
    + )} +
    + ) : ( +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {/*

    {table2Data?.BrName}

    */} +
    + {GlobalLogo && GlobaldummyData ? ( + image + ) : null} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    - } +
    - - ) -} +
    + {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +
    +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} +
    +
    + )} + {table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} -export default Printstyle8 + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + +
    +
    + Bill No : + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    + {GlobaldummyData ? formattedDate : Date1} +
    +
    + +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( + <> + {takeAwayPreference && ( +
    + TakeAway +
    + )} + +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + + + {(GlobaldummyData ? products : TakeawayData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode && } + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )} + +
    + S.No + + S.No + DisDes + HSN + + HSN + + MRP + + MRP + + Rate + + Rt + + (%) + + (%) + + Tax % + + Tax % + + Qty + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + Amt + + Amt +
    + {index + 1} + + {index + 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?.HSN}{item?.HSN} + {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?.SalesQty} + + {item?.SalesQty} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    +
    + + )} + {DineInData?.length > 0 && dinePreference && ( + <> +
    + Dine In +
    + +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + + + {(GlobaldummyData ? products : DineInData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode && } + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )} + +
    + S.No + + S.No + DisDes + HSN + + HSN + + MRP + + MRP + + Rate + + Rt + + (%) + + (%) + + Tax % + + Tax % + + Qty + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + Amt + + Amt +
    + {index + 1} + + {index + 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?.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?.SalesQty} + + {item?.SalesQty} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    +
    + + )} +
    +
    +
    +
    Items
    +
    :
    +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    +
    +
    Qty
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    +
    Take Away
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(TakeawayTotal).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    +
    Dine In
    +
    :
    +
    + {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)} +
    +
    + )} +
    +
    Amount
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    +
    + +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +

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

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {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)} +
    + + )} +
    +
    + + )} +
    +
    + )} +
    + +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).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} +
    + )} +
    +
    + {PaymentStatusSuccess?.length > 1 && ( + <> + {/*

    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' && + dinePreference && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain:{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} +
    + + {!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)} +
    +
    + )} +
    + )} +
    + +
    + Your Order No : + {GlobaldummyData + ? '01' + : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)} +
    + {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. +
    3. + Please check the product before leaving the counter. +
    4. +
    +
    + ) + : 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
    + )} + {/*
    print
    */} +
    + )} + + ); +}; + +export default Printstyle8; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx index 67d49e8..8ccf08b 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx @@ -28,9 +28,13 @@ import { GlobalprintLogo, GlobalprintCredit, GlobalprintTax, + GlobalSelectedPrintHeaderColor, } from '../../../../Features/ThemeChange/ThemeChange'; import Logo from '../../../../Images/Logo.jpg'; -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import { + GlobalUpiIDprint, + PreferenceData, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.scss'; import QRCode from 'react-qr-code'; import signature from '../../../../Images/signatureimage.jpg'; @@ -119,6 +123,7 @@ const PrintStyle9 = ({ const paymentTypeUPI = PaymentStatus?.find( (ps) => ps.PaymentTypeName === 'UPI' ); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); let TermsAndConditions = printDatas?.TermsandConditions; let SignatureImg = printDatas?.Signature; let Notestext = printDatas?.Notes; @@ -230,7 +235,7 @@ const PrintStyle9 = ({ HSN: '01', Size: 250, UomName: 'g', - ProdTaxPercentage: 5 + ProdTaxPercentage: 5, }, { ProdName: 'ITEM 2', @@ -242,7 +247,7 @@ const PrintStyle9 = ({ HSN: '02', Size: 250, UomName: 'g', - ProdTaxPercentage: 5 + ProdTaxPercentage: 5, }, { ProdName: 'ITEM 3', @@ -254,7 +259,7 @@ const PrintStyle9 = ({ HSN: '03', Size: 250, UomName: 'g', - ProdTaxPercentage: 0 + ProdTaxPercentage: 0, }, { ProdName: 'ITEM 4', @@ -266,7 +271,7 @@ const PrintStyle9 = ({ HSN: '04', Size: 250, UomName: 'g', - ProdTaxPercentage: 18 + ProdTaxPercentage: 18, }, { ProdName: 'ITEM 5', @@ -278,7 +283,7 @@ const PrintStyle9 = ({ HSN: '05', Size: 250, UomName: 'g', - ProdTaxPercentage: 40 + ProdTaxPercentage: 40, }, { ProdName: 'ITEM 6', @@ -290,7 +295,7 @@ const PrintStyle9 = ({ HSN: '06', Size: 250, UomName: 'g', - ProdTaxPercentage: 0 + ProdTaxPercentage: 0, }, { ProdName: 'ITEM 7', @@ -302,7 +307,7 @@ const PrintStyle9 = ({ HSN: '08', Size: 250, UomName: 'g', - ProdTaxPercentage: 5 + ProdTaxPercentage: 5, }, ]; @@ -351,8 +356,8 @@ const PrintStyle9 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -399,7 +404,7 @@ const PrintStyle9 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( @@ -432,18 +438,18 @@ const PrintStyle9 = ({ {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 - : '')} + (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 + : '')}
    @@ -495,10 +501,10 @@ const PrintStyle9 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    {' '} @@ -551,114 +557,120 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && ( - Item - ) + Item + ) : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - { WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData ? - GlobalTax && - - Tax % - : - (Tax && table2Data?.OrderType !== 'E') && - - Tax % - - } + + Dis{' '} + + )} + {GlobaldummyData + ? GlobalTax && ( + + Tax % + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -668,205 +680,207 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {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?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > + +
    {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?.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 > + ? 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?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > + ? 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?.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 > + ? 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?.ProductIdentifierDtls.filter( + (item1) => + item1.IMEI1 !== '' || + item1.IMEI2 !== '' + )?.map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) + : ''} +
    + )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && - - {item?.ProdTaxPercentage} - : - (Tax && table2Data?.OrderType !== 'E') && - - {item?.ProdTaxPercentage || 0} - - } + ? GlobalTax && ( + + {item?.ProdTaxPercentage} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || - 0} - - )} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} + + )} ); })} @@ -893,114 +907,120 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && ( - Item - ) + Item + ) : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - { WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData ? - GlobalTax && - - Tax % - : - (Tax && table2Data?.OrderType !== 'E') && - - Tax % - - } + + Dis{' '} + + )} + {GlobaldummyData + ? GlobalTax && ( + + Tax % + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -1010,114 +1030,116 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && - - {item?.ProdTaxPercentage} - : - (Tax && table2Data?.OrderType !== 'E') && - - {item?.ProdTaxPercentage || 0} - - } + ? GlobalTax && ( + + {item?.ProdTaxPercentage} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || - 0} - - )} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} + + )} ); })} @@ -1162,25 +1184,25 @@ const PrintStyle9 = ({ )} {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off : -
    - {GlobaldummyData - ? '1,066' - : Number( +
    + Off : +
    + {GlobaldummyData + ? '1,066' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )}
    {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -1621,26 +1649,26 @@ const PrintStyle9 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* 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} -
    - )} +

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

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

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

    + ) : null} +
    + )}
    {PaymentStatusSuccess?.length > 1 && ( <> @@ -1747,54 +1775,54 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} +
    + QRcode +
    + Scan to Pay{' '} +
    +
    + ₹{' '} + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed( + 2 + )} +
    -
    - ₹{' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} -
    -
    - ) + ) : Qrcodet && - paymentTypeUPI && ( -
    - -
    - Scan to Pay{' '} + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed( + 2 + )} +
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} -
    -
    - )} + )}
    )}
    @@ -1804,7 +1832,7 @@ const PrintStyle9 = ({ {GlobaldummyData ? '01' : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} + extractLastNumber(table2Data?.SalesId)}
    @@ -1833,23 +1861,23 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : Notestext && ( -
    -

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -1869,137 +1897,137 @@ const PrintStyle9 = ({ > {GlobaldummyData ? GlobaltermsAndConditions && ( -
    -

    - Terms & Conditions -

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

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} +

      + Terms & Conditions +

      +
        +
      1. + Once goods are sold, they are not + exchangeable or refundable.
      2. - ))} - {/*
      3. Please check the product before leaving the counter.
      4. */} -
      -
    - )} +
  • + 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 +

    + +
    + ) : Signature == true && ( -
    -

    - Signature -

    - -
    - )} +

    + Signature +

    + +
    + )}
    )}
    @@ -2097,8 +2125,8 @@ const PrintStyle9 = ({ {GlobaldummyData ? '1,066' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -2237,7 +2265,9 @@ const PrintStyle9 = ({ fontSize: '11px', textAlign: 'right', }} - >{item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -2530,26 +2564,26 @@ const PrintStyle9 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* 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} -
    - )} +

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

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

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

    + ) : null} +
    + )}
    {PaymentStatusSuccess?.length > 1 && ( <> @@ -2650,50 +2684,50 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} +
    + QRcode +
    + Scan to Pay{' '} +
    +
    + ₹{' '} + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    -
    - ₹{' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - ) + ) : Qrcodet && - paymentTypeUPI && ( -
    - -
    - Scan to Pay{' '} + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} + )}
    )}
    @@ -2703,7 +2737,7 @@ const PrintStyle9 = ({ {GlobaldummyData ? '01' : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} + extractLastNumber(table2Data?.SalesId)}
    @@ -2732,23 +2766,23 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : Notestext && ( -
    -

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2768,137 +2802,137 @@ const PrintStyle9 = ({ > {GlobaldummyData ? GlobaltermsAndConditions && ( -
    -

    - Terms & Conditions -

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

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} +

      + Terms & Conditions +

      +
        +
      1. + Once goods are sold, they are not + exchangeable or refundable.
      2. - ))} - {/*
      3. Please check the product before leaving the counter.
      4. */} -
      -
    - )} +
  • + 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 +

    + +
    + ) : Signature == true && ( -
    -

    - Signature -

    - -
    - )} +

    + Signature +

    + +
    + )}
    )}
    @@ -2955,7 +2989,7 @@ const PrintStyle9 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( @@ -2989,18 +3024,18 @@ const PrintStyle9 = ({ {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 - : '')} + (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 + : '')}
    @@ -3060,10 +3095,10 @@ const PrintStyle9 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    {' '} @@ -3112,90 +3147,92 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && ( - - S.No - - ) + + S.No + + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - { WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData ? - GlobalTax && - - Tax % - : - (Tax && table2Data?.OrderType !== 'E') && - - Tax % - - } + + Dis{' '} + + )} + {GlobaldummyData + ? GlobalTax && ( + + Tax % + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3209,138 +3246,140 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {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?.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(',')} +
    + ); + }) + : ''} +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && - - {item?.ProdTaxPercentage} - : - (Tax && table2Data?.OrderType !== 'E') && - - {item?.ProdTaxPercentage || 0} - - } + ? GlobalTax && ( + + {item?.ProdTaxPercentage} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} + + )} ); } @@ -3374,80 +3413,82 @@ const PrintStyle9 = ({ : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - { WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData ? - GlobalTax && - - Tax % - : - (Tax && table2Data?.OrderType !== 'E') && - - Tax % - - } + + Dis{' '} + + )} + {GlobaldummyData + ? GlobalTax && ( + + Tax % + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3461,106 +3502,108 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && - - {item?.ProdTaxPercentage} - : - (Tax && table2Data?.OrderType !== 'E') && - - {item?.ProdTaxPercentage || 0} - - } + ? GlobalTax && ( + + {item?.ProdTaxPercentage} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} + + )} ); } @@ -3613,8 +3656,8 @@ const PrintStyle9 = ({ {GlobaldummyData ? '1,066' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -3754,7 +3797,9 @@ const PrintStyle9 = ({ fontSize: '11px', textAlign: 'right', }} - >{item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > 0 ? (

    @@ -4040,24 +4089,24 @@ const PrintStyle9 = ({ )} - {/* 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} -
    - )} + {/* 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} +
    + )}
    {PaymentStatusSuccess?.length > 1 && ( <> @@ -4146,46 +4195,46 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹{' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} +
    + QRcode +
    Scan to Pay
    +
    + ₹{' '} + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    -
    - ) + ) : Qrcodet && - paymentTypeUPI && ( -
    - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} + paymentTypeUPI && ( +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    -
    - )} + )}
    )}
    @@ -4229,26 +4278,26 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : Notestext && ( -
    -

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -4268,137 +4317,137 @@ const PrintStyle9 = ({ > {GlobaldummyData ? GlobaltermsAndConditions && ( -
    -

    - Terms & Conditions -

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

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} +

      + Terms & Conditions +

      +
        +
      1. + Once goods are sold, they are not exchangeable or + refundable.
      2. - ))} - {/*
      3. Please check the product before leaving the counter.
      4. */} -
      -
    - )} +
  • + 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 +

    + +
    + ) : Signature == true && ( -
    -

    - Signature -

    - -
    - )} +

    + Signature +

    + +
    + )}
    )}
    diff --git a/src/Pages/Preference/PreferenceList.jsx b/src/Pages/Preference/PreferenceList.jsx index 06142d0..7d3fea8 100644 --- a/src/Pages/Preference/PreferenceList.jsx +++ b/src/Pages/Preference/PreferenceList.jsx @@ -749,16 +749,6 @@ const PreferenceList = () => { {renderCheckbox('scanlayout', 'Do you Want Scan Layout Page?')}
    - - -
    -
    { icon={} />
    -
    + +
    ); diff --git a/src/Pages/StockMaster/StockForm.jsx b/src/Pages/StockMaster/StockForm.jsx index e4b86f9..cd2d1c6 100644 --- a/src/Pages/StockMaster/StockForm.jsx +++ b/src/Pages/StockMaster/StockForm.jsx @@ -83,13 +83,17 @@ import { postConfiguration } from '../../Features/ConfigMasterPage/ConfigMasterP import SupplierProductMappingForm from '../SupplierProductMapping/SuplierProductMappingForm.jsx'; import { getPurchaseSupplierAndWareHouseData } from '../../Features/PurchaseOrder/PurchaseOrder.js'; import FloatLabel from '../../Components/Forms/FloatLabel/index.jsx'; -import { FaLink, FaEye, FaUpload } from 'react-icons/fa'; +import { FaLink, FaEye } from 'react-icons/fa'; +import { TbUpload } from 'react-icons/tb'; import { getSupplaierIdBasedProducts, getSupplaierIdwithTypeBasedProducts, postSupplaierProducts, } from '../../Features/SupplierProductMapping/SupplierProductMapping.js'; -import { ApplicationPreferences, getCommonAppPreference } from '../../Features/BrachLogin/BranchLogin.js'; +import { + ApplicationPreferences, + getCommonAppPreference, +} from '../../Features/BrachLogin/BranchLogin.js'; import { getConfigType, getPaymentOptionFeatureApi, @@ -161,12 +165,12 @@ const EditableCell = ({ margin: 0, }} name={dataIndex} - // rules={[ - // (dataIndex == "imei1" || dataIndex == "imei2") && { - // pattern: /^[0-9]{15}$/, - // message: 'IMEI must be a 15-digit number' - // } - // ]} + // rules={[ + // (dataIndex == "imei1" || dataIndex == "imei2") && { + // pattern: /^[0-9]{15}$/, + // message: 'IMEI must be a 15-digit number' + // } + // ]} > - { const BrandData = useSelector(brandDataSelector); const UomData = useSelector(uomDataSelector); const ProductTypeData = useSelector(productTypeDataSelector); - const appPreferences = useSelector(ApplicationPreferences) + const appPreferences = useSelector(ApplicationPreferences); const [applicationRestrictedFields, setApplicationRestrictedFields] = useState({ DatesAndExpiry: false, @@ -247,7 +249,7 @@ const StockForm = ({ formType }) => { AmountPerPieceDetail: false, }); const [selectedAdditionalColumn, setSelectedAdditionalColumn] = useState([]); - console.log(selectedAdditionalColumn, "selectedAdditionalColumn") + console.log(selectedAdditionalColumn, 'selectedAdditionalColumn'); const [showColumnModal, setShowColumnModal] = useState(false); const [tempSelectedColumns, setTempSelectedColumns] = useState([]); const [tableFieldPreferences, setTableFieldPreferences] = useState([]); @@ -282,7 +284,7 @@ const StockForm = ({ formType }) => { const [imageSubCategoryUrl, setSubCategoryImageUrl] = useState(''); const [imageBrandUrl, setBrandImageUrl] = useState(''); const [PurchaseData, setPurchaseData] = useState([]); - console.log(PurchaseData, "PurchaseData") + console.log(PurchaseData, 'PurchaseData'); const [additionalInfoModal, setAdditionalInfoModal] = useState(false); const [selectedRowIndex, setSelectedRowIndex] = useState(null); const [selectedRowRecord, setSelectedRowRecord] = useState({}); @@ -357,7 +359,7 @@ const StockForm = ({ formType }) => { if (searchValue?.trim()) { const search = searchValue.toLowerCase(); - const filtered = PurchaseData.filter(item => + const filtered = PurchaseData.filter((item) => item?.ProdName?.toLowerCase().includes(search) ); @@ -367,7 +369,6 @@ const StockForm = ({ formType }) => { } }, [PurchaseData, searchValue]); - const items = [ { name: 'Home', @@ -384,7 +385,7 @@ const StockForm = ({ formType }) => { }, ]; const categoryId = appPreferences?.find( - p => p?.PreferredCatName?.toLowerCase() === "purchase entry" + (p) => p?.PreferredCatName?.toLowerCase() === 'purchase entry' )?.PreferredCatId; useEffect(() => { dispatch(changeBreadCrumb({ items: items })); @@ -552,8 +553,7 @@ const StockForm = ({ formType }) => { return acc + Number(item?.Amount || 0); }, 0); - const invoiceAmount = - !isNaN(total) && total !== 0 ? total : null; + const invoiceAmount = !isNaN(total) && total !== 0 ? total : null; setSelInvoiceAmount(invoiceAmount); @@ -568,7 +568,6 @@ const StockForm = ({ formType }) => { setTotalTaxAmount(totalTax); }, [PurchaseData]); - const getPurchaseOrders = async () => { const { data: res } = await dispatch( PendingOrdersPE({ CompId, AppId, BranchId }) @@ -614,19 +613,31 @@ const StockForm = ({ formType }) => { }; useEffect(() => { getFieldSetup(); - }, [categoryId]) + }, [categoryId]); const getFieldSetup = async () => { try { - const response = await dispatch(getFieldSetupData({ AppId, CompId, BranchId, categoryId, Type: "PE" })).unwrap(); + const response = await dispatch( + getFieldSetupData({ AppId, CompId, BranchId, categoryId, Type: 'PE' }) + ).unwrap(); if (response?.data?.statusCode === 1) { - console.log(response?.data?.data?.[0]?.ConfigDtl, "Field Setup Data"); - setSelectedFields(response?.data?.data?.[0]?.ConfigDtl?.filter(c => c.ConfigId && c.Access === 'Y')?.map(c => c.ConfigId) || []); - setSelectedAdditionalColumn(response?.data?.data?.[0]?.ConfigDtl?.filter(c => c.ConfigId && c.Access === 'Y')?.map(c => c.ConfigName) || []) - setTableFieldPreferences(response?.data?.data?.[0]?.ConfigDtl?.map(c => ({ - value: c.ConfigId, - label: c.ConfigName, - access: c.Access - })) || []); + console.log(response?.data?.data?.[0]?.ConfigDtl, 'Field Setup Data'); + setSelectedFields( + response?.data?.data?.[0]?.ConfigDtl?.filter( + (c) => c.ConfigId && c.Access === 'Y' + )?.map((c) => c.ConfigId) || [] + ); + setSelectedAdditionalColumn( + response?.data?.data?.[0]?.ConfigDtl?.filter( + (c) => c.ConfigId && c.Access === 'Y' + )?.map((c) => c.ConfigName) || [] + ); + setTableFieldPreferences( + response?.data?.data?.[0]?.ConfigDtl?.map((c) => ({ + value: c.ConfigId, + label: c.ConfigName, + access: c.Access, + })) || [] + ); } } catch (error) { console.error('Error fetching field setup:', error); @@ -743,8 +754,8 @@ const StockForm = ({ formType }) => { const allSupplierProducts = response?.data?.data || []; const matchingProdIds = []; - const NewImageProducts = [] - console.log(unmatchedProducts, "unmatchedProductsunmatchedProducts") + const NewImageProducts = []; + console.log(unmatchedProducts, 'unmatchedProductsunmatchedProducts'); // check if the unmatched products exists in our products list unmatchedProducts.forEach((item) => { const match = allSupplierProducts?.[0]?.ProductDetails.find( @@ -754,55 +765,54 @@ const StockForm = ({ formType }) => { ); if (match) { matchingProdIds.push(match.ProdId); - } - else { + } else { NewImageProducts.push(item?.parsedData); } }); - console.log(NewImageProducts, "NewImageProductsNewImageProducts") + console.log(NewImageProducts, 'NewImageProductsNewImageProducts'); // Bulk upload new image products if (NewImageProducts.length > 0) { - const newProductsData = NewImageProducts.map(product => ({ + const newProductsData = NewImageProducts.map((product) => ({ AppId: AppId || 0, - CompId: CompId || "", - BranchId: BranchId || "", + CompId: CompId || '', + BranchId: BranchId || '', CreatedBy: UserId || 0, - ProdName: product.description?.trim() || "", - ProdVariantName: "", - Size: 1 || "", - UOM: product.unit || "", + ProdName: product.description?.trim() || '', + ProdVariantName: '', + Size: 1 || '', + UOM: product.unit || '', MRP: parseFloat(product.rate) || 0, WhSalePrice: 0, SellPrice: parseFloat(product.rate) || 0, - ProdCat: "General", - ProdSubCat: "", - Brand: "", - AutoGenerateQr: "", - QRCode: "", + ProdCat: 'General', + ProdSubCat: '', + Brand: '', + AutoGenerateQr: '', + QRCode: '', StockAvailable: 'No', - TaxId: "", - HSNCode: "", - PartNumber: "", + TaxId: '', + HSNCode: '', + PartNumber: '', Rack: 0, - ManufDate: "", - ExpDate: "", - AvailableFrom: "", - AvailableTo: "", - ProdLogo: "", - OnePcsAvailable: "No", + ManufDate: '', + ExpDate: '', + AvailableFrom: '', + AvailableTo: '', + ProdLogo: '', + OnePcsAvailable: 'No', AutoGenerateSingleQr: 'No', TaxId: 'NIL - 0%', - OnePcQR: "", + OnePcQR: '', TokenAvailable: 'No', OpeningQty: 0, - QtyBasedPrice: "", - InwardDate: "", - SuppId: suppId || "", - Reference: "", + QtyBasedPrice: '', + InwardDate: '', + SuppId: suppId || '', + Reference: '', ReceivedQty: 0, AcceptedQty: 0, RejectedQty: 0, - RejectionReason: "", + RejectionReason: '', IssuedQty: 0, BalanceQty: 0, InwardPrice: 0, @@ -811,23 +821,32 @@ const StockForm = ({ formType }) => { Cess: 0, })); - const bulkResponse = await dispatch(bulkpostdata({ ProdDetails: newProductsData })).unwrap(); + const bulkResponse = await dispatch( + bulkpostdata({ ProdDetails: newProductsData }) + ).unwrap(); if (bulkResponse?.data?.statusCode === 1) { // After successful bulk upload, check the condition again const updatedResponse = await dispatch( - getSupplaierIdBasedProducts({ CompId, AppId, BranchId, SuppId: suppId }) + getSupplaierIdBasedProducts({ + CompId, + AppId, + BranchId, + SuppId: suppId, + }) ).unwrap(); if (updatedResponse?.data?.statusCode === 1) { - const updatedAllSupplierProducts = updatedResponse?.data?.data || []; + const updatedAllSupplierProducts = + updatedResponse?.data?.data || []; const updatedMatchingProdIds = []; unmatchedProducts.forEach((item) => { - const match = updatedAllSupplierProducts?.[0]?.ProductDetails.find( - (supp) => - supp?.ProdName?.toLowerCase() === - item?.parsedData?.description?.toLowerCase() - ); + const match = + updatedAllSupplierProducts?.[0]?.ProductDetails.find( + (supp) => + supp?.ProdName?.toLowerCase() === + item?.parsedData?.description?.toLowerCase() + ); if (match) { updatedMatchingProdIds.push(match.ProdId); } @@ -970,7 +989,6 @@ const StockForm = ({ formType }) => { for (const item of matchedProducts) { if (item.matchFound) { const newProduct = await ProductDropDownChange( - item?.selectedProduct?.ProdVariantName, item.selectedProdId, { label: item.selectedProduct.ProdName }, @@ -1147,7 +1165,7 @@ const StockForm = ({ formType }) => { const handleSuppInvoiceNoChange = (e) => { const value = e.target.value; formRef.current?.setFieldsValue({ SuppInvoiceNo: value }); - setExtractorData(prev => prev ? { ...prev, invoiceNo: value } : null); + setExtractorData((prev) => (prev ? { ...prev, invoiceNo: value } : null)); }; const handleInvoiceTypeChange = (value) => { @@ -1176,7 +1194,10 @@ const StockForm = ({ formType }) => { formRef?.current?.getFieldsValue(), 'formRefformRefformRefformRef' ); - if (extractorData?.invoiceNo !== null && extractorData?.invoiceNo !== "") { + if ( + extractorData?.invoiceNo !== null && + extractorData?.invoiceNo !== '' + ) { formRef?.current?.setFieldsValue({ SuppInvoiceNo: extractorData?.invoiceNo, }); @@ -1185,7 +1206,7 @@ const StockForm = ({ formType }) => { formRef?.current?.setFieldsValue({ PaymentAmount: extractorData?.TotalAmtData, }); - setPaymentAmount((extractorData?.TotalAmtData)); + setPaymentAmount(extractorData?.TotalAmtData); onSuppInvoiceDateChange( extractorData?.date, extractorData?.date?.format('DD-MM-YYYY') || '' @@ -1272,7 +1293,6 @@ const StockForm = ({ formType }) => { extractedItem, existingProducts ) => { - setProductSearchText(''); setSelectedProductName(option?.label ? option?.label : ''); formRef?.current?.resetFields(['VarProdId']); @@ -1282,7 +1302,10 @@ const StockForm = ({ formType }) => { // let x = (productsList || productData)?.find( // (e) => e.ProdId == ProdId // )?.ProdName; - let OnePcsAvailable = (productsList || productData)?.find((e) => e.ProdId == ProdId && e?.ProdVariantName == VariantName)?.OnePcsAvailable == 'Y'; + let OnePcsAvailable = + (productsList || productData)?.find( + (e) => e.ProdId == ProdId && e?.ProdVariantName == VariantName + )?.OnePcsAvailable == 'Y'; // let variantValues1 = await dispatch( // getProdvaraiantdata({ // CompId: SupplierCompId, @@ -1305,7 +1328,8 @@ const StockForm = ({ formType }) => { // })) // ); - if (true + if ( + true // cc?.[0]?.ProdVariantDetails?.length < 2 || // (extractedProduct ? cc?.[0]?.ProdVariantDetails?.length > 0 : false) ) { @@ -1314,14 +1338,20 @@ const StockForm = ({ formType }) => { formRef.current?.setFieldsValue({ ProdId: ProdId }); await setSelectedProductData(ProdId); // await setSelectedSupplierData(getSuppId?.[0]?.["SuppId"]) ,CustSuppId:getSuppId?.[0]?.["SuppId"] - if ((existingProducts || PurchaseData)?.some((e) => e.ProdId == ProdId && e?.ProdVariantName == VariantName)) { - const existingProduct = (existingProducts || PurchaseData)?.find((e) => e.ProdId == ProdId && e?.ProdVariantName == VariantName); + if ( + (existingProducts || PurchaseData)?.some( + (e) => e.ProdId == ProdId && e?.ProdVariantName == VariantName + ) + ) { + const existingProduct = (existingProducts || PurchaseData)?.find( + (e) => e.ProdId == ProdId && e?.ProdVariantName == VariantName + ); setMessageType('error'); - setMessageData(`Product "${existingProduct?.ProdName} - ${existingProduct?.ProdVariantName}" already exists`); + setMessageData( + `Product "${existingProduct?.ProdName} - ${existingProduct?.ProdVariantName}" already exists` + ); return null; - } - else { - + } else { let ProductData1 = (productsList || productData)?.find( (e) => e.ProdId == ProdId && e?.ProdVariantName == VariantName ); @@ -1788,11 +1818,8 @@ const StockForm = ({ formType }) => { [`splSalePrice${localId}`]: record?.SpecialPrice, [`OnePcsPrice${localId}`]: record?.OnePcsPrice, [`NoOfPcs${localId}`]: record?.NoOfPcs, - - }); - if (applicationRestrictedFields.BatchAndModelDetails) { form.setFieldsValue({ [`BatchRef${localId}`]: record?.BatchRef, @@ -1817,9 +1844,7 @@ const StockForm = ({ formType }) => { setPurchaseData((prev) => prev.map((item) => - item.localId === localId - ? { ...item, ...modifiedObject } - : item + item.localId === localId ? { ...item, ...modifiedObject } : item ) ); @@ -1829,7 +1854,6 @@ const StockForm = ({ formType }) => { } }; - const handleKeyPress = async (e, record) => { if (e.key === 'Enter') { try { @@ -1841,13 +1865,11 @@ const StockForm = ({ formType }) => { } }; - const formatDateForDisplay = (dateString) => { if (!dateString) return ''; return moment(dateString).format('DD-MMM-YY'); }; - const updateRowValues = (localId, updates) => { setPurchaseData((prev) => prev.map((item) => @@ -1872,7 +1894,7 @@ const StockForm = ({ formType }) => { form.setFieldsValue({ [`${key}${localId}`]: value, }); - } + }; const columns = [ { @@ -1889,9 +1911,7 @@ const StockForm = ({ formType }) => { key: 'ProdName', align: 'left', render: (text, record, index) => ( - - {record?.ProdName} - + {record?.ProdName} ), }, { @@ -1900,9 +1920,7 @@ const StockForm = ({ formType }) => { key: 'ProdVariantName', align: 'left', render: (text, record, index) => ( - - {record?.ProdVariantName} - + {record?.ProdVariantName} ), }, { @@ -2108,43 +2126,45 @@ const StockForm = ({ formType }) => { key: 'Amount', editable: true, }, - ...(selectedAdditionalColumn.includes("Mrp") ? [ - { - title: 'MRP', - dataIndex: 'MRP', - key: 'MRP', - editable: true, - // width: 150, - render: (text, record) => { - const localId = record.localId; + ...(selectedAdditionalColumn.includes('Mrp') + ? [ + { + title: 'MRP', + dataIndex: 'MRP', + key: 'MRP', + editable: true, + // width: 150, + render: (text, record) => { + const localId = record.localId; - return isEditing(record) ? ( - - { - const value = e.target.value; + return isEditing(record) ? ( + + { + const value = e.target.value; - if (!/^\d*\.?\d*$/.test(value)) { - setMessageType('error'); - setMessageData('Only numeric values are allowed'); - return; - } + if (!/^\d*\.?\d*$/.test(value)) { + setMessageType('error'); + setMessageData('Only numeric values are allowed'); + return; + } - updateRowValues(record.localId, { - MRP: value, - SellPrice: value, - }); - }} - onPressEnter={(e) => handleKeyPress(e, record)} - /> - - - ) : ( - text - ) - } - }] : []), + updateRowValues(record.localId, { + MRP: value, + SellPrice: value, + }); + }} + onPressEnter={(e) => handleKeyPress(e, record)} + /> + + ) : ( + text + ); + }, + }, + ] + : []), { title: ( @@ -2189,424 +2209,480 @@ const StockForm = ({ formType }) => { }, }, - ...(selectedAdditionalColumn.includes("Amount Per Piece") ? [ - { - title: "Amount per piece", - dataIndex: 'OnePcsPrice', - key: 'OnePcsPrice', - width: 70, - editable: true, - render: (text, record, index) => { - return isEditing(record, index) ? ( - - handleKeyPress(e, record)} - onChange={(e) => { - const newData = PurchaseData.map((item) => - item.localId === record?.localId ? { ...item, OnePcsPrice: e.target.value } : item - ); - setPurchaseData(newData); - }} - placeholder="OnePcsPrice" - /> - - ) : ( - text - ); - }, - }] : []), - ...(selectedAdditionalColumn.includes("Amount Per Piece") ? [ - { - title: "Number of piece", - dataIndex: 'NoOfPcs', - key: 'NoOfPcs', - width: 70, - editable: true, - render: (text, record, index) => { - return isEditing(record, index) ? ( - - handleKeyPress(e, record)} - onChange={(e) => { - const newData = PurchaseData.map((item) => - item.localId === record?.localId ? { ...item, NoOfPcs: e.target.value } : item - ); - setPurchaseData(newData); - }} - placeholder="NoOfPcs" - /> - - ) : ( - text - ); - }, - }] : []), - ...(selectedAdditionalColumn.includes("Wholesale Price") ? [ - { - title: "Wholesale price", - dataIndex: 'WhSalePrice', - key: 'WhSalePrice', - width: 70, - editable: true, - render: (text, record) => { - return isEditing(record) ? ( - - handleKeyPress(e, record)} - onChange={(e) => { - const value = e.target.value; - - // 🚫 block non-numeric - if (!/^\d*\.?\d*$/.test(value)) return; - - updateRowValue(record.localId, 'WhSalePrice', value); - }} - /> - - ) : ( - text - ); - }, - } - ] : []), - - ...(selectedAdditionalColumn.includes("Manufacture Date") ? [ - { - title: 'Manuf.Date', - dataIndex: 'ManufDate', - key: 'ManufDate', - editable: true, - render: (text, record, index) => { - return isEditing(record, index) ? ( - - { - const formattedDate = dateString === '' ? undefined : moment(dateString, ['DD-MM-YYYY']).format('YYYY-MM-DDTHH:mm:ss'); - const newData = PurchaseData.map((item) => - item.localId === record?.localId ? { ...item, ManufDate: formattedDate } : item - ); - setPurchaseData(newData); - form.setFieldsValue({ - [`ManufDate${record?.localId}`]: formattedDate - }); - }} - valueData={record?.ManufDate} - cancelFuture={true} - /> - - ) : ( - formatDateForDisplay(text) - ); - }, - }] : []), - ...(selectedAdditionalColumn.includes("Expiry Date") ? [ - { - title: 'Exp.Date', - dataIndex: 'ExpDate', - key: 'ExpDate', - editable: true, - render: (text, record, index) => { - return isEditing(record, index) ? ( - - { - const formattedDate = dateString === '' ? undefined : moment(dateString, ['DD-MM-YYYY']).format('YYYY-MM-DDTHH:mm:ss'); - const newData = PurchaseData.map((item) => - item.localId === record?.localId ? { ...item, ExpDate: formattedDate } : item - ); - setPurchaseData(newData); - form.setFieldsValue({ - [`ExpDate${record?.localId}`]: formattedDate - }); - }} - valueData={record?.ExpDate} - cancelFuture={false} - /> - - ) : ( - formatDateForDisplay(text) - ); - }, - }] : []), - - ...(selectedAdditionalColumn.includes("Hsn") ? [ - { - title: 'Hsn', - dataIndex: 'Hsn', - key: 'Hsn', - editable: true, - // width: 130, - render: (text, record, index) => { - return isEditing(record, index) ? ( - - handleKeyPress(e, record)} - onChange={(e) => { - const newData = PurchaseData.map((item) => - item.localId === record?.localId ? { ...item, PurchaseHSNCode: e.target.value } : item - ); - setPurchaseData(newData); - }} - placeholder="HSN code" - /> - - ) : ( - text - ); - }, - }] : []), - ...(selectedAdditionalColumn.includes("Model No") ? [ - { - title: 'Model', - dataIndex: 'Model', - key: 'Model', - editable: true, - render: (text, record, index) => { - return isEditing(record, index) ? ( - - handleKeyPress(e, record, index)} - onChange={(e) => { - const newData = PurchaseData.map((item) => - item.localId === record?.localId ? { ...item, ModelNumber: e.target.value } : item - ); - setPurchaseData(newData); - }} - placeholder="Model No" - /> - - ) : ( - text - ); - }, - }] : []), - ...(selectedAdditionalColumn.includes("Batch No") ? [ - { - title: 'Batch', - dataIndex: 'Batch', - key: 'Batch', - editable: true, - render: (text, record, index) => { - return isEditing(record, index) ? ( - - handleKeyPress(e, record, index)} - onChange={(e) => { - const newData = PurchaseData.map((item) => - item.localId === record?.localId ? { ...item, BatchRef: e.target.value } : item - ); - setPurchaseData(newData); - }} - placeholder="Batch No" - /> - - ) : ( - text - ); - }, - }] : []), - - ...(selectedAdditionalColumn.includes("Rejected Qty") ? - [ - { - title: 'Rejected Qty', - dataIndex: 'RejectedQty', - key: 'RejectedQty', - editable: true, - render: (text, record, index) => { - return isEditing(record, index) ? ( - - handleKeyPress(e, record, index)} - onChange={(e) => { - const inputValue = e.target.value; - const rejectedQty = parseFloat(inputValue) || 0; - const receivedQty = parseFloat(record.ReceivedQty) || 0; - - if (inputValue !== '' && rejectedQty >= receivedQty) { - setMessageType('error'); - setMessageData('Rejected Qty cannot be greater than or Equal to Received Qty'); - form.setFieldsValue({ - [`RejectedQty${record?.localId}`]: record.RejectedQty || 0 - }); - return; - } - - const acceptedQty = receivedQty - rejectedQty; - const totalAmount = acceptedQty * (parseFloat(record.InwardPrice) || 0); - - const newData = PurchaseData.map((item) => - item.localId === record?.localId ? { - ...item, - RejectedQty: parseFloat(inputValue) || 0, - AcceptedQty: acceptedQty, - Amount: totalAmount - } : item - ); - setPurchaseData(newData); - }} - placeholder="Rejected Qty" - /> - - ) : ( - text - ); + ...(selectedAdditionalColumn.includes('Amount Per Piece') + ? [ + { + title: 'Amount per piece', + dataIndex: 'OnePcsPrice', + key: 'OnePcsPrice', + width: 70, + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + handleKeyPress(e, record)} + onChange={(e) => { + const newData = PurchaseData.map((item) => + item.localId === record?.localId + ? { ...item, OnePcsPrice: e.target.value } + : item + ); + setPurchaseData(newData); + }} + placeholder="OnePcsPrice" + /> + + ) : ( + text + ); + }, }, - }] : []), + ] + : []), + ...(selectedAdditionalColumn.includes('Amount Per Piece') + ? [ + { + title: 'Number of piece', + dataIndex: 'NoOfPcs', + key: 'NoOfPcs', + width: 70, + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + handleKeyPress(e, record)} + onChange={(e) => { + const newData = PurchaseData.map((item) => + item.localId === record?.localId + ? { ...item, NoOfPcs: e.target.value } + : item + ); + setPurchaseData(newData); + }} + placeholder="NoOfPcs" + /> + + ) : ( + text + ); + }, + }, + ] + : []), + ...(selectedAdditionalColumn.includes('Wholesale Price') + ? [ + { + title: 'Wholesale price', + dataIndex: 'WhSalePrice', + key: 'WhSalePrice', + width: 70, + editable: true, + render: (text, record) => { + return isEditing(record) ? ( + + handleKeyPress(e, record)} + onChange={(e) => { + const value = e.target.value; + // 🚫 block non-numeric + if (!/^\d*\.?\d*$/.test(value)) return; + updateRowValue(record.localId, 'WhSalePrice', value); + }} + /> + + ) : ( + text + ); + }, + }, + ] + : []), + ...(selectedAdditionalColumn.includes('Manufacture Date') + ? [ + { + title: 'Manuf.Date', + dataIndex: 'ManufDate', + key: 'ManufDate', + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + { + const formattedDate = + dateString === '' + ? undefined + : moment(dateString, ['DD-MM-YYYY']).format( + 'YYYY-MM-DDTHH:mm:ss' + ); + const newData = PurchaseData.map((item) => + item.localId === record?.localId + ? { ...item, ManufDate: formattedDate } + : item + ); + setPurchaseData(newData); + form.setFieldsValue({ + [`ManufDate${record?.localId}`]: formattedDate, + }); + }} + valueData={record?.ManufDate} + cancelFuture={true} + /> + + ) : ( + formatDateForDisplay(text) + ); + }, + }, + ] + : []), + ...(selectedAdditionalColumn.includes('Expiry Date') + ? [ + { + title: 'Exp.Date', + dataIndex: 'ExpDate', + key: 'ExpDate', + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + { + const formattedDate = + dateString === '' + ? undefined + : moment(dateString, ['DD-MM-YYYY']).format( + 'YYYY-MM-DDTHH:mm:ss' + ); + const newData = PurchaseData.map((item) => + item.localId === record?.localId + ? { ...item, ExpDate: formattedDate } + : item + ); + setPurchaseData(newData); + form.setFieldsValue({ + [`ExpDate${record?.localId}`]: formattedDate, + }); + }} + valueData={record?.ExpDate} + cancelFuture={false} + /> + + ) : ( + formatDateForDisplay(text) + ); + }, + }, + ] + : []), - ...(selectedAdditionalColumn.includes("Free Qty") ? [ - { - title: 'Free Qty', - dataIndex: 'Freeqty', - key: 'Freeqty', - editable: true, - render: (text, record) => { - return isEditing(record) ? ( - - handleKeyPress(e, record)} - onChange={(e) => { - const value = e.target.value; + ...(selectedAdditionalColumn.includes('Hsn') + ? [ + { + title: 'Hsn', + dataIndex: 'Hsn', + key: 'Hsn', + editable: true, + // width: 130, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + handleKeyPress(e, record)} + onChange={(e) => { + const newData = PurchaseData.map((item) => + item.localId === record?.localId + ? { ...item, PurchaseHSNCode: e.target.value } + : item + ); + setPurchaseData(newData); + }} + placeholder="HSN code" + /> + + ) : ( + text + ); + }, + }, + ] + : []), + ...(selectedAdditionalColumn.includes('Model No') + ? [ + { + title: 'Model', + dataIndex: 'Model', + key: 'Model', + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + handleKeyPress(e, record, index)} + onChange={(e) => { + const newData = PurchaseData.map((item) => + item.localId === record?.localId + ? { ...item, ModelNumber: e.target.value } + : item + ); + setPurchaseData(newData); + }} + placeholder="Model No" + /> + + ) : ( + text + ); + }, + }, + ] + : []), + ...(selectedAdditionalColumn.includes('Batch No') + ? [ + { + title: 'Batch', + dataIndex: 'Batch', + key: 'Batch', + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + handleKeyPress(e, record, index)} + onChange={(e) => { + const newData = PurchaseData.map((item) => + item.localId === record?.localId + ? { ...item, BatchRef: e.target.value } + : item + ); + setPurchaseData(newData); + }} + placeholder="Batch No" + /> + + ) : ( + text + ); + }, + }, + ] + : []), - // 🚫 block non-numeric - if (!/^\d*$/.test(value)) return; + ...(selectedAdditionalColumn.includes('Rejected Qty') + ? [ + { + title: 'Rejected Qty', + dataIndex: 'RejectedQty', + key: 'RejectedQty', + editable: true, + render: (text, record, index) => { + return isEditing(record, index) ? ( + + handleKeyPress(e, record, index)} + onChange={(e) => { + const inputValue = e.target.value; + const rejectedQty = parseFloat(inputValue) || 0; + const receivedQty = parseFloat(record.ReceivedQty) || 0; - updateRowValue(record.localId, 'Freeqty', value); - }} - /> - - ) : ( - text - ); - }, - }, - ] : []), + if (inputValue !== '' && rejectedQty >= receivedQty) { + setMessageType('error'); + setMessageData( + 'Rejected Qty cannot be greater than or Equal to Received Qty' + ); + form.setFieldsValue({ + [`RejectedQty${record?.localId}`]: + record.RejectedQty || 0, + }); + return; + } - ...(selectedAdditionalColumn.includes("IMEI") ? [ - { - title: 'IMEI', - dataIndex: 'AdditionalInfo', - key: 'AdditionalInfo', - width: 120, - align: 'center', - render: (text, record, index) => { - const hasQty = record?.ReceivedQty && parseFloat(record.ReceivedQty) > 0; - return ( - <> - {' '} - { - if (hasQty) { + const acceptedQty = receivedQty - rejectedQty; + const totalAmount = + acceptedQty * (parseFloat(record.InwardPrice) || 0); - setSelectedRowIndex(index); - handleModelDataOpen(record); + const newData = PurchaseData.map((item) => + item.localId === record?.localId + ? { + ...item, + RejectedQty: parseFloat(inputValue) || 0, + AcceptedQty: acceptedQty, + Amount: totalAmount, + } + : item + ); + setPurchaseData(newData); + }} + placeholder="Rejected Qty" + /> + + ) : ( + text + ); + }, + }, + ] + : []), - } else { - setMessageType('error'); - setMessageData('Please Enter Qty'); - } - }} - className="shape-preview" - /> - - ); - }, - }] : []), + ...(selectedAdditionalColumn.includes('Free Qty') + ? [ + { + title: 'Free Qty', + dataIndex: 'Freeqty', + key: 'Freeqty', + editable: true, + render: (text, record) => { + return isEditing(record) ? ( + + handleKeyPress(e, record)} + onChange={(e) => { + const value = e.target.value; + + // 🚫 block non-numeric + if (!/^\d*$/.test(value)) return; + + updateRowValue(record.localId, 'Freeqty', value); + }} + /> + + ) : ( + text + ); + }, + }, + ] + : []), + + ...(selectedAdditionalColumn.includes('IMEI') + ? [ + { + title: 'IMEI', + dataIndex: 'AdditionalInfo', + key: 'AdditionalInfo', + width: 120, + align: 'center', + render: (text, record, index) => { + const hasQty = + record?.ReceivedQty && parseFloat(record.ReceivedQty) > 0; + return ( + <> + {' '} + { + if (hasQty) { + setSelectedRowIndex(index); + handleModelDataOpen(record); + } else { + setMessageType('error'); + setMessageData('Please Enter Qty'); + } + }} + className="shape-preview" + /> + + ); + }, + }, + ] + : []), { title: 'Action', dataIndex: 'Action', @@ -2629,14 +2705,11 @@ const StockForm = ({ formType }) => { }, ]; - const statusFormatters = (record) => { const localId = record?.localId; // Remove row using localId (not index) - const data = PurchaseData.filter( - (item) => item?.localId !== localId - ); + const data = PurchaseData.filter((item) => item?.localId !== localId); setDelete(true); @@ -2671,17 +2744,12 @@ const StockForm = ({ formType }) => { }); }; - - - const handleQtyChange = (e, record) => { const { localId } = record; const sourceData = PurchaseData; - const findIndex = sourceData.findIndex( - (item) => item?.localId === localId - ); + const findIndex = sourceData.findIndex((item) => item?.localId === localId); if (findIndex === -1) return; @@ -2727,8 +2795,6 @@ const StockForm = ({ formType }) => { }); }; - - const handlePurrateChange = (e, record) => { const { localId, PurcDisc, PurcDiscType } = record; const PurcRate = e.target.value; @@ -2801,7 +2867,6 @@ const StockForm = ({ formType }) => { }); }; - const handleSellPriceChange = (e, record) => { const { localId } = record; const value = e?.target?.value; @@ -2872,8 +2937,6 @@ const StockForm = ({ formType }) => { }); }; - - const purchaseStatusChange = (value) => { setPurchaseStatus(value); }; @@ -3000,8 +3063,6 @@ const StockForm = ({ formType }) => { }, []); }; - - const onFinish = async ({ PaymentType, PaymentAmount = 0, ...values }) => { try { // =============================== @@ -3016,7 +3077,9 @@ const StockForm = ({ formType }) => { if (invalidTaxItems.length > 0) { setMessageType('error'); - setMessageData('Please enter valid tax percentage (0–99%) for all items'); + setMessageData( + 'Please enter valid tax percentage (0–99%) for all items' + ); return; } @@ -3214,8 +3277,6 @@ const StockForm = ({ formType }) => { } }; - - const onComplete = useCallback(() => { setMessageData(null); setMessageType(null); @@ -3545,13 +3606,6 @@ const StockForm = ({ formType }) => { // command - - - ; - - - - const validateSellPrice = (record) => (_, value) => { if (!value) { return Promise.reject('Selling Price is required'); @@ -3623,7 +3677,6 @@ const StockForm = ({ formType }) => { }; const handleModelDataSumbitOrClose = () => { - setimeiSerialOpen(false); const productIdentifierDtls = dataSource ?.filter( @@ -3637,40 +3690,41 @@ const StockForm = ({ formType }) => { })); const newData = PurchaseData.map((item, index) => - index === selectedRowIndex ? { ...item, ProductIdentifierDtls: productIdentifierDtls } : item + index === selectedRowIndex + ? { ...item, ProductIdentifierDtls: productIdentifierDtls } + : item ); setPurchaseData(newData); }; const handleFieldSetupSubmit = async () => { - const postData = { - "AppId": AppId, - "CompId": CompId, - "BranchId": BranchId, - "Type": "PE", - "FormType": "Purchase Entry", - "TypeId": categoryId, - "ConfigDtl": selectedFields?.map((field) => ({ - "ConfigId": field, - "Access": 'Y', + AppId: AppId, + CompId: CompId, + BranchId: BranchId, + Type: 'PE', + FormType: 'Purchase Entry', + TypeId: categoryId, + ConfigDtl: selectedFields?.map((field) => ({ + ConfigId: field, + Access: 'Y', })), - "CreatedBy": UserId - } + CreatedBy: UserId, + }; const response = await dispatch(postFieldSetup(postData))?.unwrap(); if (response?.data?.statusCode === 1) { setSelectedAdditionalColumn([...tempSelectedColumns]); setShowColumnModal(false); - setTempSelectedColumns([]) - setMessageType("success"); + setTempSelectedColumns([]); + setMessageType('success'); setMessageData(response?.data?.response); await getFieldSetup(); } else { - setMessageType("error"); - setMessageData("Failed to set up fields"); + setMessageType('error'); + setMessageData('Failed to set up fields'); } - } + }; const handleModalSubmited = () => { setIsModalOpen(false); }; @@ -3778,7 +3832,7 @@ const StockForm = ({ formType }) => {
    )}
    -
    +
    { className="pruchaseCatBTN scan-receipt-btn" onClick={() => setExtractorModalVisible(true)} > -

    Scan Receipt (Auto-Fill)

    + {' '} +

    Scan Receipt (Auto-Fill)

    {
    -
    + { options={ SupplierData ? SupplierData.filter( - (obj, index, self) => - index === - self.findIndex( - (t) => t.SuppId === obj.SuppId - ) // remove dup SuppId - ).map((option) => ({ - key: `${option.SuppId}-${option.Type}`, // 👈 unique key - value: option.SuppId, - label: - option.Type === 'Branch' - ? `${option.SuppName} (${option.Type}) [${option.SuppId}]` - : `${option.SuppName} (${option.Type})`, - })) + (obj, index, self) => + index === + self.findIndex( + (t) => t.SuppId === obj.SuppId + ) // remove dup SuppId + ).map((option) => ({ + key: `${option.SuppId}-${option.Type}`, // 👈 unique key + value: option.SuppId, + label: + option.Type === 'Branch' + ? `${option.SuppName} (${option.Type}) [${option.SuppId}]` + : `${option.SuppName} (${option.Type})`, + })) : [] } label={} @@ -4098,88 +4153,88 @@ const StockForm = ({ formType }) => { item.ConfigId === SelectedPurchaseType && item.ConfigName === 'Cash' ) && ( - <> - - ({ - value: mode.ModeId, - label: mode.ModeName, - }))} - label={ - - } - className="field-DropDown" - onChangeFunction={handlePaymentModeChange} - valueData={selectedPaymentMode} - /> - - { - if ( - value === undefined || - value === null || - value === '' - ) { - return Promise.resolve(); - } - if (Number(value) === 0) { - return Promise.reject( - 'Payment Amount cannot be 0' - ); - } - if ( - isNaN(value) || - Number(value) < 0 - ) { - return Promise.reject( - 'Payment Amount cannot be less than 0' - ); - } + <> + + ({ + value: mode.ModeId, + label: mode.ModeName, + }))} + label={ + + } + className="field-DropDown" + onChangeFunction={handlePaymentModeChange} + valueData={selectedPaymentMode} + /> + + { + if ( + value === undefined || + value === null || + value === '' + ) { return Promise.resolve(); - }, + } + if (Number(value) === 0) { + return Promise.reject( + 'Payment Amount cannot be 0' + ); + } + if ( + isNaN(value) || + Number(value) < 0 + ) { + return Promise.reject( + 'Payment Amount cannot be less than 0' + ); + } + return Promise.resolve(); }, - ]} - > - - Payment Amount - - } - inputMode="decimal" - disable={!payAmountDisable} - isOnChange={paymentAmount ? true : false} - min={0} - type="number" - value={paymentAmount} - onChange={(e) => { - formRef?.current?.setFieldsValue({ - PaymentAmount: e?.target?.value, - }); - setPaymentAmount(e?.target?.value); - }} - /> - - - )} + }, + ]} + > + + Payment Amount + + } + inputMode="decimal" + disable={!payAmountDisable} + isOnChange={paymentAmount ? true : false} + min={0} + type="number" + value={paymentAmount} + onChange={(e) => { + formRef?.current?.setFieldsValue({ + PaymentAmount: e?.target?.value, + }); + setPaymentAmount(e?.target?.value); + }} + /> + + + )}
    @@ -4207,9 +4262,13 @@ const StockForm = ({ formType }) => { className="field-DropDown" value={selectedProductName} filterOption={(input, option) => { - const [prodId, variantName] = option.value.split('_'); + const [prodId, variantName] = + option.value.split('_'); const product = productData.find( - (p) => p.ProdId === prodId && (p.ProdVariantName || 'Variant1') === variantName + (p) => + p.ProdId === prodId && + (p.ProdVariantName || 'Variant1') === + variantName ); const nameMatch = option.label ?.toLowerCase() @@ -4222,16 +4281,18 @@ const StockForm = ({ formType }) => { options={ !scanner ? productData?.map((option) => ({ - - value: `${option.ProdId}_${option.ProdVariantName}`, - label: `${option.ProdName} (${option.Size} ${option.UomName})${option?.BrandName ? ` - ${option?.BrandName}` : ''} - ${option.ProdVariantName}`, - - })) + value: `${option.ProdId}_${option.ProdVariantName}`, + label: `${option.ProdName} (${option.Size} ${option.UomName})${option?.BrandName ? ` - ${option?.BrandName}` : ''} - ${option.ProdVariantName}`, + })) : [] } onSelect={async (value, option) => { const [prodId, variantName] = value.split('_'); - const product = productData.find(p => p.ProdId === prodId && (p.ProdVariantName) === variantName); + const product = productData.find( + (p) => + p.ProdId === prodId && + p.ProdVariantName === variantName + ); const newProduct = await ProductDropDownChange( product?.ProdVariantName, prodId, @@ -4274,56 +4335,64 @@ const StockForm = ({ formType }) => {
    - - setIsModalOpen(true)} size={18} /> + setIsModalOpen(true)} + size={18} + /> - + - {isModalOpen && ( @@ -4343,19 +4412,28 @@ const StockForm = ({ formType }) => { /> )} -
    - -
    +
    { - setTempSelectedColumns([...selectedAdditionalColumn]); + setTempSelectedColumns([ + ...selectedAdditionalColumn, + ]); setShowColumnModal(true); - }}> + }} + > @@ -4372,8 +4450,6 @@ const StockForm = ({ formType }) => { />
    - -
    { maxwidth: '500px', overflowX: 'auto', scrollbarWidth: 'thin', - maxHeight: "50vh" + maxHeight: '50vh', }} > {/*
    @@ -4403,7 +4479,9 @@ const StockForm = ({ formType }) => { ({ @@ -4413,18 +4491,16 @@ const StockForm = ({ formType }) => { })} pagination={false} locale={{ - emptyText: isSearching ? 'No matching products found' : 'No data', + emptyText: isSearching + ? 'No matching products found' + : 'No data', }} /> - - - - { color="901D77" icon={} /> - { autoComplete="off" label="GST No" autocapitalize="on" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> @@ -4594,10 +4669,10 @@ const StockForm = ({ formType }) => { // isOnChange={formType == 'edit' ? true : false} inputMode="numeric" onInput={(e) => - (e.target.value = e.target.value.replace( - /[^0-9]/g, - '' - )) + (e.target.value = e.target.value.replace( + /[^0-9]/g, + '' + )) } /> @@ -4609,7 +4684,7 @@ const StockForm = ({ formType }) => { MailId} autocomplete="off" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> @@ -4636,7 +4711,7 @@ const StockForm = ({ formType }) => { Point of Contact} autocomplete="off" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> @@ -4658,7 +4733,7 @@ const StockForm = ({ formType }) => { label={} autocomplete="off" maxLength="10" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> @@ -4669,7 +4744,7 @@ const StockForm = ({ formType }) => { POC MailId} autocomplete="off" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> @@ -4952,18 +5027,18 @@ const StockForm = ({ formType }) => { Sales Price} - // isOnChange={(editstate?.SellPrice || QrcodeExistsData?.[0]?.SellPrice)? true : false} + // isOnChange={(editstate?.SellPrice || QrcodeExistsData?.[0]?.SellPrice)? true : false} /> ({ @@ -5023,7 +5098,7 @@ const StockForm = ({ formType }) => { // isOnchanges={(editstate?.Brand || SelectedBrand)?true:false} onChangeFunction={handleBrandDropDownChange} valueData={SelectedBrand} - // disabled={editstate?.Brand ? true : false} + // disabled={editstate?.Brand ? true : false} /> { onSelectFuntion={(e) => openAmountPerPieceAvailable(e) } - // disabled={editstate?.QRCode ? true : false} + // disabled={editstate?.QRCode ? true : false} /> {(QrcodeAuto == 'N' || editstate?.QRCode) && ( @@ -5162,38 +5237,38 @@ const StockForm = ({ formType }) => { {(QrcodeAutoSingle == 'N' || editstate?.OnePcQR) && ( -
    - - { - await validateSafeInput(value); // To block HTML tags & SQL keywords - return Promise.resolve(); - }, +
    + + { + await validateSafeInput(value); // To block HTML tags & SQL keywords + return Promise.resolve(); }, - ]} - > - + - {QrcodeSingleExistsVal && - QrcodeSingleExistsVal} - -
    - )} + /> + {QrcodeSingleExistsVal && + QrcodeSingleExistsVal} +
    +
    + )} )} @@ -5218,7 +5293,7 @@ const StockForm = ({ formType }) => {
    )} @@ -5681,7 +5756,7 @@ const StockForm = ({ formType }) => { width={600} buttonText="Submit" children={ -
    +
    'editable-row'} @@ -5705,30 +5780,36 @@ const StockForm = ({ formType }) => { handleSubmit={handleFieldSetupSubmit} handleCancel={() => { setShowColumnModal(false); - setSelectedFields([...selectedAdditionalColumn.map(col => - tableFieldPreferences?.find(pref => pref.label === col)?.value - ).filter(Boolean)]); + setSelectedFields([ + ...selectedAdditionalColumn + .map( + (col) => + tableFieldPreferences?.find((pref) => pref.label === col) + ?.value + ) + .filter(Boolean), + ]); setTempSelectedColumns([...selectedAdditionalColumn]); }} >
    {tableFieldPreferences?.map((option) => ( -
    +
    )} + + {/* Customer Orders */} + {GetCustId && ( + + {' '} +
    { + if ( + CheckBookingStatus !== 'Close' && + !addnewAccess && + !(OrderCardDetail?.length > 0) + ) { + setCustomerPreviesOrders(true); + } + }} + style={{ + cursor: OrderCardDetail?.length > 0 && 'not-allowed', + color: + OrderCardDetail?.length > 0 || + (OrderCardDetail?.length > 0 && + GetCustId?.CustMobile === undefined) + ? 'gray' + : 'rgb(18, 146, 238)', + fontSize: '25px', + display: 'flex', + alignItems: 'center', + height: '2.46rem', + width: '1.5rem', + }} + > + +
    +
    + )} {tabledata?.length > 0 && (
    {tableOptions @@ -3840,61 +3842,61 @@ const BSBilling4Payment = () => { <> {unpaidFlow == false ? item?.OptionName == 'Hold' && - BookingType !== 'Dine In' && - !BookingTypeBoth && - OrderCardDetail?.length != 0 && - CheckOrderType?.length === 0 && - OrderType != 'Failed' && - paybtns?.length > 0 && - CheckBookingStatus != 'Close' && - !addnewAccess && ( - - {' '} - AddBookingDetails('Hold')} - style={{ - fontSize: '30px', - cursor: 'pointer', - color: '' ? '#52c41a' : '#1292EE', - }} - /> - - ) + BookingType !== 'Dine In' && + !BookingTypeBoth && + OrderCardDetail?.length != 0 && + CheckOrderType?.length === 0 && + OrderType != 'Failed' && + paybtns?.length > 0 && + CheckBookingStatus != 'Close' && + !addnewAccess && ( + + {' '} + AddBookingDetails('Hold')} + style={{ + fontSize: '30px', + cursor: 'pointer', + color: '' ? '#52c41a' : '#1292EE', + }} + /> + + ) : ''} {unpaidFlow == false ? item?.OptionName == 'Hold' && - BookingType !== 'Dine In' && - !BookingTypeBoth && - Holddata?.length > 0 && - OrderCardDetail?.length == 0 && - paybtns?.length > 0 && - CheckBookingStatus != 'Close' && - !addnewAccess && ( - - {' '} - 0 && + OrderCardDetail?.length == 0 && + paybtns?.length > 0 && + CheckBookingStatus != 'Close' && + !addnewAccess && ( + - HandleholdModelOpen()} - style={{ - fontSize: '28px', - cursor: 'pointer', - color: Holddata ? '#52c41a' : 'default', - pointerEvents: - OrderType === 'Failed' ? 'none' : 'auto', - }} - /> - - - ) + {' '} + + HandleholdModelOpen()} + style={{ + fontSize: '28px', + cursor: 'pointer', + color: Holddata ? '#52c41a' : 'default', + pointerEvents: + OrderType === 'Failed' ? 'none' : 'auto', + }} + /> + + + ) : ''} ))} @@ -3920,16 +3922,16 @@ const BSBilling4Payment = () => { (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 'none' : 'auto', opacity: (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 0.5 : 1, }} @@ -3940,10 +3942,10 @@ const BSBilling4Payment = () => {
    + {FeatureAddonData?.FeatureDtls?.find( + (item) => + item?.FeatureAddonName?.toLowerCase() === 'kiosk sales' + ) &&
    { {/* */} Kiosk Printer
    + }