Android_Retail/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx

2449 lines
94 KiB
React
Raw Normal View History

2026-01-30 16:11:37 +05:30
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";
2026-01-27 18:27:29 +05:30
const TaxInvoice = ({
index,
table2Data,
Date1,
CashierName,
totalQuantity,
OrderDetailGST,
OrderDetailIGST,
OrderDetailVAT,
PaymentStatus,
ReprintType,
printDatas,
}) => {
const GlobaldummyData = useSelector(GlobalPritdummyData);
const SettingData = useSelector(PreferenceData);
const estimatePrintHeader =
SettingData?.[0]?.SettingDtlDetails?.find(
(setting) =>
2026-01-30 16:11:37 +05:30
setting?.SettingIdName?.toLowerCase() === "estimateprintheader",
)?.SettingValue === "Y";
2026-01-27 18:27:29 +05:30
let BillName = printDatas?.PrintHdrName;
2026-01-30 16:11:37 +05:30
let companyColour = printDatas?.PrintHdrColor ?? "#00000";
2026-01-27 18:27:29 +05:30
// Function to convert number to words
const numberToWords = (num) => {
const a = [
2026-01-30 16:11:37 +05:30
"",
"One",
"Two",
"Three",
"Four",
"Five",
"Six",
"Seven",
"Eight",
"Nine",
"Ten",
"Eleven",
"Twelve",
"Thirteen",
"Fourteen",
"Fifteen",
"Sixteen",
"Seventeen",
"Eighteen",
"Nineteen",
2026-01-27 18:27:29 +05:30
];
const b = [
2026-01-30 16:11:37 +05:30
"",
"",
"Twenty",
"Thirty",
"Forty",
"Fifty",
"Sixty",
"Seventy",
"Eighty",
"Ninety",
2026-01-27 18:27:29 +05:30
];
2026-01-30 16:11:37 +05:30
if (num === 0) return "Zero";
2026-01-27 18:27:29 +05:30
if (num < 20) return a[num];
if (num < 100)
2026-01-30 16:11:37 +05:30
return b[Math.floor(num / 10)] + (num % 10 ? " " + a[num % 10] : "");
2026-01-27 18:27:29 +05:30
if (num < 1000)
return (
a[Math.floor(num / 100)] +
2026-01-30 16:11:37 +05:30
" Hundred" +
(num % 100 ? " and " + numberToWords(num % 100) : "")
2026-01-27 18:27:29 +05:30
);
if (num < 100000)
return (
numberToWords(Math.floor(num / 1000)) +
2026-01-30 16:11:37 +05:30
" Thousand" +
(num % 1000 ? " " + numberToWords(num % 1000) : "")
2026-01-27 18:27:29 +05:30
);
if (num < 10000000)
return (
numberToWords(Math.floor(num / 100000)) +
2026-01-30 16:11:37 +05:30
" Lakh" +
(num % 100000 ? " " + numberToWords(num % 100000) : "")
2026-01-27 18:27:29 +05:30
);
if (num < 1000000000)
return (
numberToWords(Math.floor(num / 10000000)) +
2026-01-30 16:11:37 +05:30
" Crore" +
(num % 10000000 ? " " + numberToWords(num % 10000000) : "")
2026-01-27 18:27:29 +05:30
);
2026-01-30 16:11:37 +05:30
return "Number too large";
2026-01-27 18:27:29 +05:30
};
// Helper to format date as 7-Aug-2025
function formatDateToDDMMMYYYY(dateStr) {
2026-01-30 16:11:37 +05:30
console.log(dateStr, "dateStrdateStr");
if (!dateStr) return "";
2026-01-27 18:27:29 +05:30
const date = new Date(dateStr);
if (isNaN(date)) return dateStr; // fallback if invalid date
const day = date.getDate();
2026-01-30 16:11:37 +05:30
const month = date.toLocaleString("en-US", { month: "short" });
2026-01-27 18:27:29 +05:30
const year = date.getFullYear();
return `${day}-${month}-${year}`;
}
function removeTimeFromDate(dateStr) {
2026-01-30 16:11:37 +05:30
if (!dateStr) return "";
2026-01-27 18:27:29 +05:30
// Split on ":" — first part will be "DD-MM-YYYY"
2026-01-30 16:11:37 +05:30
const parts = dateStr.split(":");
2026-01-27 18:27:29 +05:30
return parts[0] || dateStr;
}
console.log(
Date1,
2026-01-30 16:11:37 +05:30
moment(Date1).format("DD-MMM-YYYY"),
"datadatadatadatadatadata",
2026-01-27 18:27:29 +05:30
);
// Extract data from table2Data - mapping from A4Standard structure
const invoiceData = {
// Company Details - mapped from A4Standard
2026-01-30 16:11:37 +05:30
companyName: table2Data?.CompName || table2Data?.BrName || "",
companyspecname: table2Data?.AppSpecificName || "",
2026-01-27 18:27:29 +05:30
companyAddress: {
2026-01-30 16:11:37 +05:30
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 || "",
2026-01-27 18:27:29 +05:30
},
2026-01-30 16:11:37 +05:30
companyGSTIN: table2Data?.CompGSTIN || table2Data?.BrGSTIN || "",
companyEmail: table2Data?.CompanyEmail || table2Data?.BrEmail || "",
companyMobile: table2Data?.BrMobile || "",
companyMobile2: table2Data?.BrMobile2 || "",
2026-01-27 18:27:29 +05:30
// Invoice Details - mapped from A4Standard
invoiceNo: table2Data?.OrderId
? extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)
2026-01-30 16:11:37 +05:30
: "",
invoiceDate: moment(Date1).format("DD-MMM-YYYY"),
2026-01-27 18:27:29 +05:30
// Customer Details - mapped from A4Standard CustomerDetails array
customerName:
table2Data?.CustomerDetails?.[0]?.CustSuppName ||
table2Data?.CustSuppName ||
2026-01-30 16:11:37 +05:30
"",
2026-01-27 18:27:29 +05:30
customerMobile:
2026-01-30 16:11:37 +05:30
table2Data?.CustomerDetails?.[0]?.MobileNo || table2Data?.MobileNo || "",
2026-01-27 18:27:29 +05:30
customerGSTIN:
table2Data?.CustomerDetails?.[0]?.CustGSTNo ||
table2Data?.CustGSTIN ||
2026-01-30 16:11:37 +05:30
"",
2026-01-27 18:27:29 +05:30
customerAddress: {
2026-01-30 16:11:37 +05:30
address1: table2Data?.CustomerDetails?.[0]?.Address1 || "",
address2: table2Data?.CustomerDetails?.[0]?.Address2 || "",
state: table2Data?.CustomerDetails?.[0]?.State || "",
2026-01-27 18:27:29 +05:30
},
// Product Details - mapped from A4Standard productDetails
productDetails: table2Data?.productDetails || [],
// Totals - mapped from A4Standard
totalAmount: Number(table2Data?.BillAmount || table2Data?.TotalAmt),
taxAmount: Number(OrderDetailGST),
grandTotal: Number(table2Data?.NetAmount || table2Data?.GrandTotal),
totalBillAmount: Number(
2026-01-30 16:11:37 +05:30
table2Data?.BillAmount || table2Data?.NetAmount || 0,
2026-01-27 18:27:29 +05:30
),
// Bank Details - mapped from A4Standard
bankDetails: table2Data?.BankDetails?.[0] || null,
};
let PageSize = printDatas?.PageSize;
const TakeawayData = table2Data?.productDetails?.filter(
2026-01-30 16:11:37 +05:30
(item) => item.BookingTypeName?.toLowerCase() === "takeaway",
2026-01-27 18:27:29 +05:30
);
const DineInData = table2Data?.productDetails?.filter(
2026-01-30 16:11:37 +05:30
(item) => item.BookingTypeName?.toLowerCase() === "dine in",
2026-01-27 18:27:29 +05:30
);
let PaymentStatusSuccess = PaymentStatus?.filter(
2026-01-30 16:11:37 +05:30
(ps) => ps.PaymentStatus === "S",
2026-01-27 18:27:29 +05:30
);
// Calculate GST/IGST totals
const cgstTotal =
OrderDetailGST && OrderDetailGST.length > 0
? Number(
2026-01-30 16:11:37 +05:30
OrderDetailGST?.reduce((sum, item) => sum + (item.CGST || 0), 0),
2026-01-27 18:27:29 +05:30
)?.toFixed(2)
: 0;
const sgstTotal =
OrderDetailGST && OrderDetailGST.length > 0
? Number(
2026-01-30 16:11:37 +05:30
OrderDetailGST?.reduce((sum, item) => sum + (item.SGST || 0), 0),
2026-01-27 18:27:29 +05:30
)?.toFixed(2)
: 0;
const igstTotal =
OrderDetailIGST && OrderDetailIGST.length > 0
? Number(
2026-01-30 16:11:37 +05:30
OrderDetailIGST?.reduce((sum, item) => sum + (item.TaxAmt || 0), 0),
2026-01-27 18:27:29 +05:30
)?.toFixed(2)
: 0;
// Calculate round off value
const roundOffValue =
Number(invoiceData.grandTotal) -
(Number(invoiceData.totalBillAmount) +
Number(cgstTotal) +
Number(sgstTotal) +
Number(igstTotal));
const roundOffEstimateValue = Number(invoiceData.grandTotal);
console.log(
Number(invoiceData.totalBillAmount),
cgstTotal,
sgstTotal,
igstTotal,
2026-01-30 16:11:37 +05:30
"roundoff vaules",
2026-01-27 18:27:29 +05:30
);
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(
2026-01-30 16:11:37 +05:30
"Rounded Amount:",
2026-01-27 18:27:29 +05:30
roundedAmount,
2026-01-30 16:11:37 +05:30
"Round Off Value:",
roundOffValue,
2026-01-27 18:27:29 +05:30
);
return `${roundOffValue.toFixed(2)}`;
}
2026-01-30 16:11:37 +05:30
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);
2026-01-27 18:27:29 +05:30
// Allow up to 10 items per page
const chunkSize =
2026-01-30 16:11:37 +05:30
table2Data?.OrderType !== "E"
2026-01-27 18:27:29 +05:30
? isMobile
? 7
2026-01-30 16:11:37 +05:30
: PageSize == "A5"
2026-01-27 18:27:29 +05:30
? 9
: 8
: isMobile
? 10
2026-01-30 16:11:37 +05:30
: PageSize == "A5"
2026-01-27 18:27:29 +05:30
? 12
: 11;
let dataSource = [];
// Simplified data source logic - always use all product details
dataSource = table2Data?.productDetails || [];
// Ensure dataSource is always an array
if (!Array.isArray(dataSource)) {
dataSource = [];
}
console.log(
2026-01-30 16:11:37 +05:30
"Final DataSource:",
2026-01-27 18:27:29 +05:30
dataSource,
2026-01-30 16:11:37 +05:30
"Length:",
2026-01-27 18:27:29 +05:30
dataSource.length,
2026-01-30 16:11:37 +05:30
"ChunkSize:",
chunkSize,
2026-01-27 18:27:29 +05:30
);
const paginatedChunks = [];
// Always create at least one chunk, even if empty
if (dataSource.length === 0) {
paginatedChunks.push([]);
} else {
// Split data into chunks
for (let i = 0; i < dataSource.length; i += chunkSize) {
const chunk = dataSource.slice(i, i + chunkSize);
paginatedChunks.push(chunk);
}
}
const lastChunkRows =
paginatedChunks.length > 0
? paginatedChunks[paginatedChunks.length - 1].length
: 0;
// If last page has more than 6 items, move footer to new page
const shouldFooterBeOnNewPage = lastChunkRows === chunkSize;
// If footer should be on new page, add an empty chunk for footer-only page
if (shouldFooterBeOnNewPage && paginatedChunks.length > 0) {
paginatedChunks.push([]); // Empty chunk for footer-only page
}
console.log(
2026-01-30 16:11:37 +05:30
"Paginated Chunks:",
2026-01-27 18:27:29 +05:30
paginatedChunks.length,
2026-01-30 16:11:37 +05:30
"Chunks:",
paginatedChunks.map((chunk, i) => `Chunk ${i}: ${chunk.length} items`),
2026-01-27 18:27:29 +05:30
);
2026-01-30 16:11:37 +05:30
console.log("Should footer be on new page:", shouldFooterBeOnNewPage);
2026-01-27 18:27:29 +05:30
return (
<div
id={`TaxInvoice-${index}`}
style={{
2026-01-30 16:11:37 +05:30
fontFamily: "Arial, sans-serif",
fontSize: "12px",
lineHeight: "1.2",
color: "#000",
maxWidth: "210mm",
margin: "0 auto",
padding: "10mm",
backgroundColor: "white",
2026-01-27 18:27:29 +05:30
}}
>
{paginatedChunks?.map((dataChunk, chunkIndex) => (
<div
key={chunkIndex}
className={
isMobile
? `invoice-wrapper container pdf-page`
2026-01-30 16:11:37 +05:30
: `invoice-wrapper container print-chunk${chunkIndex > 0 ? " print-page-break" : ""}`
2026-01-27 18:27:29 +05:30
}
style={{
2026-01-30 16:11:37 +05:30
display: "flex",
flexDirection: "column",
2026-01-27 18:27:29 +05:30
// justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) ? "space-between" : "",
2026-01-30 16:11:37 +05:30
height: isMobile ? "275mm" : PageSize == "A5" ? "130mm" : "245mm",
marginBottom: "0",
2026-01-27 18:27:29 +05:30
pageBreakAfter:
2026-01-30 16:11:37 +05:30
chunkIndex < paginatedChunks.length - 1 ? "always" : "auto",
2026-01-27 18:27:29 +05:30
}}
>
{renderInvoiceContent(dataChunk, chunkIndex)}
</div>
))}
</div>
);
function renderInvoiceContent(dataChunk, chunkIndex) {
console.log(
`Rendering page ${chunkIndex + 1}, chunk has ${dataChunk.length} items:`,
2026-01-30 16:11:37 +05:30
dataChunk,
2026-01-27 18:27:29 +05:30
);
const isFirstPage = chunkIndex === 0;
const isLastPage = chunkIndex === paginatedChunks.length - 1;
const isFooterOnlyPage =
isLastPage && dataChunk.length === 0 && shouldFooterBeOnNewPage;
const isLastDataChunk =
chunkIndex ===
paginatedChunks.length - 1 - (shouldFooterBeOnNewPage ? 1 : 0);
const shouldShowTaxDetails = isLastDataChunk && dataChunk.length > 0;
console.log(
2026-01-30 16:11:37 +05:30
`Page ${chunkIndex + 1}: isFirstPage=${isFirstPage}, isLastPage=${isLastPage}, isFooterOnlyPage=${isFooterOnlyPage},datachunkslength=${dataChunk.length}`,
2026-01-27 18:27:29 +05:30
);
return (
<>
{/* Header - Only on first page */}
{isFirstPage && (
<>
<div
style={{
2026-01-30 16:11:37 +05:30
textAlign: "center",
marginBottom: "10px",
display: "flex",
justifyContent: "space-between",
alignItems: "center",
2026-01-27 18:27:29 +05:30
}}
>
<div></div>
2026-01-30 16:11:37 +05:30
<h2 style={{ margin: "0", fontSize: "20px", fontWeight: "700" }}>
{table2Data?.OrderType === "E"
? "Estimate"
2026-01-27 18:27:29 +05:30
: BillName
? BillName
2026-01-30 16:11:37 +05:30
: "TAX INVOICE"}
2026-01-27 18:27:29 +05:30
</h2>
<div>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "10px", marginTop: "2px" }}>
{ReprintType == "Duplicate"
? "(DUPLICATE FOR RECIPIENT)"
: "(ORIGINAL FOR RECIPIENT)"}
2026-01-27 18:27:29 +05:30
</div>
</div>
</div>
</>
)}
{/* Main Container - Always show */}
2026-01-30 16:11:37 +05:30
<div style={{ border: "1px solid #000", height:"100%"}}>
2026-01-27 18:27:29 +05:30
{/* Top Section - Company and Invoice Details - Only on first page */}
{isFirstPage && (
2026-01-30 16:11:37 +05:30
<div style={{ display: "flex", width: "100%" }}>
2026-01-27 18:27:29 +05:30
{/* Left - Company Details */}
<div
style={{
2026-01-30 16:11:37 +05:30
width: "50%",
borderRight: "1px solid #000",
display: "flex",
flexDirection: "column",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{!estimatePrintHeader && table2Data?.OrderType === "E" ? (
""
2026-01-27 18:27:29 +05:30
) : (
<div
style={{
// flex: '1',
2026-01-30 16:11:37 +05:30
padding: "10px",
2026-01-27 18:27:29 +05:30
2026-01-30 16:11:37 +05:30
fontSize: "11px",
textAlign: "left",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
fontWeight: "700",
fontSize: "15px",
2026-01-27 18:27:29 +05:30
color: companyColour,
}}
>
{invoiceData.companyName}
</div>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "12px" }}>
2026-01-27 18:27:29 +05:30
{invoiceData.companyspecname}
</div>
<div>{invoiceData.companyAddress.address1}</div>
<div>{invoiceData.companyAddress.address2}</div>
<div>
2026-01-30 16:11:37 +05:30
{invoiceData.companyAddress.city}{" "}
2026-01-27 18:27:29 +05:30
{invoiceData.companyAddress.zip
? ` - ${invoiceData.companyAddress.zip}`
2026-01-30 16:11:37 +05:30
: ""}
2026-01-27 18:27:29 +05:30
</div>
<div>{invoiceData.companyAddress.state}</div>
{invoiceData.companyGSTIN && (
2026-01-30 16:11:37 +05:30
<div style={{ fontWeight: "700", fontSize: "12px" }}>
2026-01-27 18:27:29 +05:30
GSTIN/UIN: {invoiceData.companyGSTIN}
</div>
)}
{/* <div>State Name: Tamil Nadu, Code: 33</div> */}
{invoiceData.companyEmail && (
<div>E-Mail: {invoiceData.companyEmail}</div>
)}
{invoiceData.companyMobile && (
<div>
Mobile: +91 {invoiceData.companyMobile}
{invoiceData.companyMobile2
? `, ${invoiceData.companyMobile2}`
2026-01-30 16:11:37 +05:30
: ""}
2026-01-27 18:27:29 +05:30
</div>
)}
</div>
)}
{/* Buyer Details */}
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "10px",
borderTop: "1px solid #000",
2026-01-27 18:27:29 +05:30
2026-01-30 16:11:37 +05:30
fontSize: "11px",
minHeight: "60px",
textAlign: "left",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ marginBottom: "5px" }}>Buyer (Bill to)</div>
<div style={{ fontWeight: "700", fontSize: "15px" }}>
2026-01-27 18:27:29 +05:30
{invoiceData.customerName}
</div>
{invoiceData.customerAddress.address1 && (
<div>{invoiceData.customerAddress.address1}</div>
)}
{invoiceData.customerAddress.address2 && (
<div>{invoiceData.customerAddress.address2}</div>
)}
{invoiceData.customerMobile && (
<div>Mobile: {invoiceData.customerMobile}</div>
)}
2026-01-30 16:11:37 +05:30
{invoiceData.customerGSTIN &&
table2Data?.OrderType !== "E" && (
<div style={{ fontWeight: "700", fontSize: "15px" }}>
GSTIN/UIN: {invoiceData.customerGSTIN}
</div>
)}
2026-01-27 18:27:29 +05:30
{invoiceData.customerAddress.state && (
<div>State Name: {invoiceData.customerAddress.state}</div>
)}
</div>
</div>
{/* Right - Invoice Details */}
2026-01-30 16:11:37 +05:30
<div style={{ flex: "1", fontSize: "10px" }}>
2026-01-27 18:27:29 +05:30
{/* Invoice No and Date */}
<div
2026-01-30 16:11:37 +05:30
style={{ display: "flex", borderBottom: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
>
<div
style={{
2026-01-30 16:11:37 +05:30
flex: "1",
paddingLeft: "3px",
borderRight: "1px solid #000",
textAlign: "left",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "9px" }}>Invoice No.</div>
<div style={{ fontWeight: "700", fontSize: "15px" }}>
2026-01-27 18:27:29 +05:30
{invoiceData.invoiceNo}
</div>
</div>
<div
2026-01-30 16:11:37 +05:30
style={{ flex: "1", paddingLeft: "3px", textAlign: "left" }}
2026-01-27 18:27:29 +05:30
>
<div>Dated</div>
2026-01-30 16:11:37 +05:30
<div style={{ fontWeight: "700", fontSize: "15px" }}>
2026-01-27 18:27:29 +05:30
{invoiceData.invoiceDate}
</div>
</div>
</div>
{/* Delivery Note and Payment Terms */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "flex",
borderBottom: "1px solid #000",
textAlign: "left",
minHeight: "25px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
flex: "1",
paddingLeft: "3px",
borderRight: "1px solid #000",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "9px" }}>Delivery Note</div>
2026-01-27 18:27:29 +05:30
<div></div>
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
flex: "1",
paddingLeft: "3px",
textAlign: "left",
minHeight: "25px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "9px" }}>Mode/Terms of Payment</div>
2026-01-27 18:27:29 +05:30
<div></div>
</div>
</div>
{/* Reference and Other References */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "flex",
borderBottom: "1px solid #000",
textAlign: "left",
minHeight: "25px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
flex: "1",
paddingLeft: "3px",
borderRight: "1px solid #000",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "9px" }}>Reference No. & Date</div>
2026-01-27 18:27:29 +05:30
<div></div>
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
flex: "1",
paddingLeft: "3px",
textAlign: "left",
minHeight: "25px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "9px" }}>Other References</div>
2026-01-27 18:27:29 +05:30
<div></div>
</div>
</div>
{/* Buyer's Order */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "flex",
borderBottom: "1px solid #000",
textAlign: "left",
minHeight: "25px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
flex: "1",
paddingLeft: "3px",
borderRight: "1px solid #000",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "9px" }}>Buyer's Order No.</div>
2026-01-27 18:27:29 +05:30
<div></div>
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
flex: "1",
paddingLeft: "3px",
textAlign: "left",
minHeight: "25px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "9px" }}>Dated</div>
2026-01-27 18:27:29 +05:30
<div></div>
</div>
</div>
{/* Dispatch Details */}
<div
2026-01-30 16:11:37 +05:30
style={{ display: "flex", borderBottom: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
>
<div
style={{
2026-01-30 16:11:37 +05:30
flex: "1",
paddingLeft: "3px",
borderRight: "1px solid #000",
textAlign: "left",
minHeight: "25px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "9px" }}>Dispatch Doc No.</div>
2026-01-27 18:27:29 +05:30
<div></div>
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
flex: "1",
paddingLeft: "3px",
textAlign: "left",
minHeight: "25px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "9px" }}>Delivery Note Date</div>
2026-01-27 18:27:29 +05:30
<div></div>
</div>
</div>
{/* Dispatched through and Destination */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "flex",
borderBottom: "1px solid #000",
minHeight: "25px",
2026-01-27 18:27:29 +05:30
}}
>
<div
2026-01-30 16:11:37 +05:30
style={{ flex: "1", paddingLeft: "3px", textAlign: "left" }}
2026-01-27 18:27:29 +05:30
>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "9px" }}>Dispatched through</div>
2026-01-27 18:27:29 +05:30
<div></div>
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
flex: "1",
paddingLeft: "3px",
borderLeft: "1px solid #000",
minHeight: "25px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "9px", textAlign: "left" }}>
2026-01-27 18:27:29 +05:30
Destination
</div>
<div></div>
</div>
</div>
{/* Terms of Delivery */}
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 6px",
textAlign: "left",
minHeight: "35px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "9px" }}>Terms of Delivery</div>
2026-01-27 18:27:29 +05:30
<div></div>
</div>
</div>
</div>
)}
{/* Continuation header for non-first pages */}
{!isFirstPage && (
<div
style={{
2026-01-30 16:11:37 +05:30
textAlign: "center",
marginBottom: "10px",
padding: "5px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<h3 style={{ margin: "0", fontSize: "16px", fontWeight: "700" }}>
{isFooterOnlyPage ? "Tax Invoice" : "Tax Invoice "}
2026-01-27 18:27:29 +05:30
</h3>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "10px" }}>
2026-01-27 18:27:29 +05:30
Invoice No: {invoiceData.invoiceNo}
</div>
</div>
)}
{/* Items Table - Show only if there are items or not a footer-only page */}
{(dataChunk.length > 0 || !isFooterOnlyPage) && (
<div
style={{
// borderBottom: isLastPage ? '1px solid #000' : 'none',
2026-01-30 16:11:37 +05:30
minHeight: table2Data?.OrderType !== "E" ? "250px" : "350px",
2026-01-27 18:27:29 +05:30
}}
>
{/* Table Header */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "5% 40% 12% 11% 16% 8% 16%",
fontSize: "10px",
2026-01-27 18:27:29 +05:30
// borderRight: '1px solid #000',
2026-01-30 16:11:37 +05:30
borderBottom: "1px solid #000",
borderTop: "1px solid #000",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
SL.No
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Description of Goods
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
HSN/SAC
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Quantity
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Rate
</div>
{/* <div style={{ padding: '8px 4px', borderRight: '1px solid #000', textAlign: 'center' }}>per</div> */}
2026-01-30 16:11:37 +05:30
<div style={{ padding: "8px 4px", textAlign: "center" }}>
2026-01-27 18:27:29 +05:30
Amount
</div>
</div>
{/* Table Rows - Dynamic data from dataChunk */}
{dataChunk && dataChunk.length > 0 ? (
<>
{dataChunk?.map((item, index) => (
<div
key={index}
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "5% 40% 12% 11% 16% 16%",
2026-01-27 18:27:29 +05:30
// borderRight: '1px solid #000',
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 4px",
borderRight: "1px solid #000",
textAlign: "center",
fontWeight: "700",
2026-01-27 18:27:29 +05:30
}}
>
{chunkIndex * chunkSize + index + 1}
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 4px",
borderRight: "1px solid #000",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
fontWeight: "700",
marginBottom: "2px",
textAlign: "left",
fontSize: "15px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{item.ProdName || "Product Name"}
2026-01-27 18:27:29 +05:30
</div>
{item.BrandName && (
<div
style={{
2026-01-30 16:11:37 +05:30
fontSize: "12px",
fontWeight: "700",
textAlign: "left",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{item.BrandName}{" "}
2026-01-27 18:27:29 +05:30
</div>
)}
{item?.ProductIdentifierDtls?.length > 0
? item?.ProductIdentifierDtls.filter(
(items) =>
2026-01-30 16:11:37 +05:30
items.SerialNumber && items.SerialNumber !== "",
2026-01-27 18:27:29 +05:30
)?.map((a, i) => (
<div key={i}>{a.SerialNumber}</div>
))
2026-01-30 16:11:37 +05:30
: ""}
2026-01-27 18:27:29 +05:30
{item?.ProductIdentifierDtls?.length > 0
? item?.ProductIdentifierDtls.filter(
2026-01-30 16:11:37 +05:30
(id) => id.IMEI1 !== "" || id.IMEI2 !== "",
2026-01-27 18:27:29 +05:30
)?.map((id, i) => {
2026-01-30 16:11:37 +05:30
const imei1 = id.IMEI1 || "";
const imei2 = id.IMEI2 || "";
2026-01-27 18:27:29 +05:30
return (
<div key={i}>
2026-01-30 16:11:37 +05:30
{[imei1, imei2].filter(Boolean).join(",")}
2026-01-27 18:27:29 +05:30
</div>
);
})
2026-01-30 16:11:37 +05:30
: ""}
2026-01-27 18:27:29 +05:30
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{item.HSN || ""}
2026-01-27 18:27:29 +05:30
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 4px",
borderRight: "1px solid #000",
textAlign: "center",
fontWeight: "700",
fontSize: "15px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{item.SalesQty || 1} {item.UomName || "NOS"}
2026-01-27 18:27:29 +05:30
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{Number(
2026-01-30 16:11:37 +05:30
table2Data?.OrderType !== "E"
2026-01-27 18:27:29 +05:30
? item.Rate - item.ProdTaxAmt
2026-01-30 16:11:37 +05:30
: item.Rate || 0,
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
</div>
{/* <div style={{ padding: '8px 4px', borderRight: '1px solid #000', textAlign: 'center' }}>{item.UomName || 'NOS'}</div> */}
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 4px",
textAlign: "right",
fontWeight: "700",
fontSize: "15px",
2026-01-27 18:27:29 +05:30
}}
>
{Number(
2026-01-30 16:11:37 +05:30
table2Data?.OrderType !== "E"
2026-01-27 18:27:29 +05:30
? item.WithoutTaxRate
2026-01-30 16:11:37 +05:30
: item.TotalAmt || 0,
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
</div>
</div>
))}
{/* Tax summary */}
{shouldShowTaxDetails && (
<>
{/* Total without tax amount */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "5% 40% 12% 11% 16% 16%",
2026-01-27 18:27:29 +05:30
// borderRight: '1px solid #000',
2026-01-30 16:11:37 +05:30
fontSize: "15px",
minHeight: "22px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ borderRight: "1px solid #000" }}></div>
2026-01-27 18:27:29 +05:30
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 6px",
textAlign: "right",
borderRight: "1px solid #000",
2026-01-27 18:27:29 +05:30
}}
></div>
2026-01-30 16:11:37 +05:30
<div style={{ borderRight: "1px solid #000" }}></div>
<div style={{ borderRight: "1px solid #000" }}></div>
<div style={{ borderRight: "1px solid #000" }}></div>
2026-01-27 18:27:29 +05:30
{/* <div style={{ borderRight: '1px solid #000'}}></div> */}
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 6px",
textAlign: "right",
borderTop: "1px solid #000",
fontSize: "15px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{" "}
2026-01-27 18:27:29 +05:30
{Number(
2026-01-30 16:11:37 +05:30
table2Data?.OrderType !== "E"
2026-01-27 18:27:29 +05:30
? invoiceData?.totalBillAmount
2026-01-30 16:11:37 +05:30
: invoiceData?.grandTotal,
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
</div>
</div>
2026-01-30 16:11:37 +05:30
{table2Data?.OrderType !== "E" && (
2026-01-27 18:27:29 +05:30
<>
{/* CGST */}
{OrderDetailGST && OrderDetailGST.length > 0 && (
<>
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "5% 40% 12% 11% 16% 16%",
2026-01-27 18:27:29 +05:30
// borderRight: '1px solid #000',
2026-01-30 16:11:37 +05:30
fontSize: "11px",
fontWeight: "700",
minHeight: "22px",
2026-01-27 18:27:29 +05:30
}}
>
<div
2026-01-30 16:11:37 +05:30
style={{ borderRight: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 6px",
textAlign: "right",
borderRight: "1px solid #000",
2026-01-27 18:27:29 +05:30
}}
>
CGST
</div>
<div
2026-01-30 16:11:37 +05:30
style={{ borderRight: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
></div>
<div
2026-01-30 16:11:37 +05:30
style={{ borderRight: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
></div>
<div
2026-01-30 16:11:37 +05:30
style={{ borderRight: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
></div>
{/* <div style={{ borderRight: '1px solid #000'}}></div> */}
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 6px",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{OrderDetailGST && OrderDetailGST.length > 0
? Number(
OrderDetailGST?.reduce(
(sum, item) => sum + (item.CGST || 0),
2026-01-30 16:11:37 +05:30
0,
),
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
2026-01-30 16:11:37 +05:30
: "0.00"}
2026-01-27 18:27:29 +05:30
</div>
</div>
{/* SGST */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "5% 40% 12% 11% 16% 16%",
2026-01-27 18:27:29 +05:30
// borderRight: '1px solid #000',
2026-01-30 16:11:37 +05:30
fontSize: "11px",
fontWeight: "700",
minHeight: "22px",
2026-01-27 18:27:29 +05:30
}}
>
<div
2026-01-30 16:11:37 +05:30
style={{ borderRight: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 6px",
textAlign: "right",
borderRight: "1px solid #000",
2026-01-27 18:27:29 +05:30
}}
>
SGST
</div>
<div
2026-01-30 16:11:37 +05:30
style={{ borderRight: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
></div>
<div
2026-01-30 16:11:37 +05:30
style={{ borderRight: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
></div>
<div
2026-01-30 16:11:37 +05:30
style={{ borderRight: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
></div>
{/* <div style={{ borderRight: '1px solid #000'}}></div> */}
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 6px",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{OrderDetailGST && OrderDetailGST.length > 0
? Number(
OrderDetailGST?.reduce(
(sum, item) => sum + (item.SGST || 0),
2026-01-30 16:11:37 +05:30
0,
),
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
2026-01-30 16:11:37 +05:30
: "0.00"}
2026-01-27 18:27:29 +05:30
</div>
</div>
</>
)}
{/* IGST */}
{OrderDetailIGST && OrderDetailIGST.length > 0 && (
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "5% 40% 12% 11% 16% 16%",
2026-01-27 18:27:29 +05:30
// borderRight: '1px solid #000',
2026-01-30 16:11:37 +05:30
fontSize: "11px",
fontWeight: "700",
minHeight: "22px",
2026-01-27 18:27:29 +05:30
}}
>
<div
2026-01-30 16:11:37 +05:30
style={{ borderRight: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 6px",
textAlign: "right",
borderRight: "1px solid #000",
2026-01-27 18:27:29 +05:30
}}
>
IGST
</div>
<div
2026-01-30 16:11:37 +05:30
style={{ borderRight: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
></div>
<div
2026-01-30 16:11:37 +05:30
style={{ borderRight: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
></div>
<div
2026-01-30 16:11:37 +05:30
style={{ borderRight: "1px solid #000" }}
2026-01-27 18:27:29 +05:30
></div>
{/* <div style={{ borderRight: '1px solid #000'}}></div> */}
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 6px",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{OrderDetailIGST && OrderDetailIGST.length > 0
? Number(
OrderDetailIGST?.reduce(
(sum, item) => sum + (item.TaxAmt || 0),
2026-01-30 16:11:37 +05:30
0,
),
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
2026-01-30 16:11:37 +05:30
: "0.00"}
2026-01-27 18:27:29 +05:30
</div>
</div>
)}
</>
)}
{/* Rounding Off */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "5% 40% 12% 11% 16% 16%",
2026-01-27 18:27:29 +05:30
// borderRight: '1px solid #000',
// borderBottom: '1px solid #000',
2026-01-30 16:11:37 +05:30
fontSize: "11px",
fontWeight: "700",
minHeight: "22px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ borderRight: "1px solid #000" }}></div>
2026-01-27 18:27:29 +05:30
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 6px",
textAlign: "right",
borderRight: "1px solid #000",
2026-01-27 18:27:29 +05:30
}}
>
ROUNDING OFF
</div>
2026-01-30 16:11:37 +05:30
<div style={{ borderRight: "1px solid #000" }}></div>
<div style={{ borderRight: "1px solid #000" }}></div>
<div style={{ borderRight: "1px solid #000" }}></div>
2026-01-27 18:27:29 +05:30
{/* <div style={{ borderRight: '1px solid #000'}}></div> */}
2026-01-30 16:11:37 +05:30
<div style={{ padding: "6px 6px", textAlign: "right" }}>
2026-01-27 18:27:29 +05:30
{RoundOffFun(
2026-01-30 16:11:37 +05:30
table2Data?.OrderType !== "E"
2026-01-27 18:27:29 +05:30
? roundOffValue
2026-01-30 16:11:37 +05:30
: roundOffEstimateValue,
2026-01-27 18:27:29 +05:30
)}
</div>
</div>
{Array.from({
length: chunkSize - dataChunk.length,
})?.map((_, idx) => (
<div
key={`empty-${idx}`}
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "5% 40% 12% 11% 16% 16%",
2026-01-27 18:27:29 +05:30
// borderRight: '1px solid #000',
2026-01-30 16:11:37 +05:30
minHeight: "32px", // Adjust height as needed for your design
fontSize: "10px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
&nbsp;
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 4px",
borderRight: "1px solid #000",
2026-01-27 18:27:29 +05:30
}}
>
&nbsp;
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
&nbsp;
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
&nbsp;
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
&nbsp;
</div>
{/* <div style={{ padding: '8px 4px', borderRight: '1px solid #000', textAlign: 'center' }}>&nbsp;</div> */}
<div
2026-01-30 16:11:37 +05:30
style={{ padding: "4px 4px", textAlign: "right" }}
2026-01-27 18:27:29 +05:30
>
&nbsp;
</div>
</div>
))}
{/* Total */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "5% 40% 12% 11% 16% 16%",
2026-01-27 18:27:29 +05:30
// borderRight: '1px solid #000',
2026-01-30 16:11:37 +05:30
borderBottom: "1px solid #000",
borderTop: "1px solid #000",
2026-01-27 18:27:29 +05:30
2026-01-30 16:11:37 +05:30
minHeight: "30px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ borderRight: "1px solid #000" }}></div>
2026-01-27 18:27:29 +05:30
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 6px",
textAlign: "right",
fontSize: "12px",
borderRight: "1px solid #000",
2026-01-27 18:27:29 +05:30
}}
>
Total
</div>
2026-01-30 16:11:37 +05:30
<div style={{ borderRight: "1px solid #000" }}></div>
2026-01-27 18:27:29 +05:30
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 3px",
textAlign: "center",
borderRight: "1px solid #000",
fontWeight: "700",
2026-01-27 18:27:29 +05:30
}}
>
{totalQuantity ||
invoiceData.productDetails?.reduce(
(sum, item) => sum + (item.SalesQty || 0),
2026-01-30 16:11:37 +05:30
0,
2026-01-27 18:27:29 +05:30
) ||
2026-01-30 16:11:37 +05:30
0}{" "}
2026-01-27 18:27:29 +05:30
NOS
</div>
2026-01-30 16:11:37 +05:30
<div style={{ borderRight: "1px solid #000" }}></div>
2026-01-27 18:27:29 +05:30
{/* <div style={{ borderRight: '1px solid #000'}}></div> */}
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 6px",
textAlign: "right",
fontWeight: "700",
fontSize: "15px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{" "}
2026-01-27 18:27:29 +05:30
{Number(invoiceData.grandTotal).toLocaleString(
2026-01-30 16:11:37 +05:30
"en-IN",
2026-01-27 18:27:29 +05:30
{
minimumFractionDigits: 2,
maximumFractionDigits: 2,
2026-01-30 16:11:37 +05:30
},
2026-01-27 18:27:29 +05:30
)}
</div>
</div>
</>
)}
</>
) : (
// Show empty row when no data
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "5% 40% 12% 10% 12% 8% 13%",
2026-01-27 18:27:29 +05:30
// borderBottom: '1px solid #000',
2026-01-30 16:11:37 +05:30
borderLeft: "1px solid #000",
borderRight: "1px solid #000",
fontSize: "10px",
minHeight: "40px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 4px",
borderRight: "1px solid #000",
textAlign: "center",
fontWeight: "700",
2026-01-27 18:27:29 +05:30
}}
>
-
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
No items to display
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
-
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
-
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
-
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
-
</div>
2026-01-30 16:11:37 +05:30
<div style={{ padding: "8px 4px", textAlign: "center" }}>
2026-01-27 18:27:29 +05:30
-
</div>
</div>
)}
</div>
)}
{/* Tax summary - Only on last page */}
{/* Footer content - Only on last page */}
{isLastPage && (
<>
{/* Amount in Words */}
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 10px",
borderBottom: "1px solid #000",
fontSize: "11px",
display: "flex",
justifyContent: "space-between",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
display: "flex",
justifyContent: "flex-start",
flexDirection: "column",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
<div style={{ marginBottom: "3px" }}>
2026-01-27 18:27:29 +05:30
Amount Chargeable (in words)
</div>
2026-01-30 16:11:37 +05:30
<div style={{ fontWeight: "700", fontSize: "16px" }}>
2026-01-27 18:27:29 +05:30
INR {numberToWords(Math.floor(invoiceData.grandTotal))} Only
</div>
</div>
<p>E. & O.E</p>
</div>
2026-01-30 16:11:37 +05:30
{table2Data?.OrderType !== "E" && (
2026-01-27 18:27:29 +05:30
<>
{/* Tax Breakdown Table */}
2026-01-30 16:11:37 +05:30
<div style={{ borderBottom: "1px solid #000" }}>
2026-01-27 18:27:29 +05:30
{OrderDetailGST && OrderDetailGST.length > 0 ? (
<>
{/* Tax Table Header - Main Headers */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "12% 15% 18% 18% 15% 22%",
borderBottom: "1px solid #000",
fontSize: "9px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
HSN/SAC
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Taxable Value
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
CGST
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
SGST/UTGST
</div>
<div
2026-01-30 16:11:37 +05:30
style={{ padding: "6px 4px", textAlign: "center" }}
2026-01-27 18:27:29 +05:30
>
Tax Amount
</div>
</div>
{/* Tax Table Sub-Headers */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "12% 15% 9% 9% 9% 9% 15% 22%",
borderBottom: "1px solid #000",
fontSize: "8px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Rate
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Amount
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Rate
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Amount
</div>
<div
2026-01-30 16:11:37 +05:30
style={{ padding: "4px 2px", textAlign: "center" }}
2026-01-27 18:27:29 +05:30
></div>
</div>
{/* Tax Table Rows - Dynamic from OrderDetailGST */}
{OrderDetailGST?.map((taxItem, index) => (
<div
key={index}
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
2026-01-27 18:27:29 +05:30
gridTemplateColumns:
2026-01-30 16:11:37 +05:30
"12% 15% 9% 9% 9% 9% 15% 22%",
borderBottom: "1px solid #000",
fontSize: "9px",
minHeight: "20px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "center",
fontWeight: "700",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{taxItem.HSN || ""}
2026-01-27 18:27:29 +05:30
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{Number(
2026-01-30 16:11:37 +05:30
taxItem.WithOutTaxAmount || 0,
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
{taxItem.TaxPercentage
2026-01-30 16:11:37 +05:30
? taxItem.TaxPercentage / 2 + "%"
: "0%"}
2026-01-27 18:27:29 +05:30
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{Number(taxItem.CGST || 0).toLocaleString(
2026-01-30 16:11:37 +05:30
"en-IN",
2026-01-27 18:27:29 +05:30
{
minimumFractionDigits: 2,
maximumFractionDigits: 2,
2026-01-30 16:11:37 +05:30
},
2026-01-27 18:27:29 +05:30
)}
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
{taxItem.TaxPercentage
2026-01-30 16:11:37 +05:30
? taxItem.TaxPercentage / 2 + "%"
: "0%"}
2026-01-27 18:27:29 +05:30
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{Number(taxItem.SGST || 0).toLocaleString(
2026-01-30 16:11:37 +05:30
"en-IN",
2026-01-27 18:27:29 +05:30
{
minimumFractionDigits: 2,
maximumFractionDigits: 2,
2026-01-30 16:11:37 +05:30
},
2026-01-27 18:27:29 +05:30
)}
</div>
2026-01-30 16:11:37 +05:30
<div style={{ padding: "4px", textAlign: "right" }}>
2026-01-27 18:27:29 +05:30
{Number(
2026-01-30 16:11:37 +05:30
(taxItem.CGST || 0) + (taxItem.SGST || 0),
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
</div>
</div>
))}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "12% 15% 9% 9% 9% 9% 15% 22%",
fontSize: "9px",
fontWeight: "700",
minHeight: "22px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Total
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{OrderDetailGST && OrderDetailGST.length > 0
? Number(
OrderDetailGST?.reduce(
(sum, item) =>
sum + (item.WithOutTaxAmount || 0),
2026-01-30 16:11:37 +05:30
0,
),
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
2026-01-30 16:11:37 +05:30
: "0.00"}
2026-01-27 18:27:29 +05:30
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{OrderDetailGST && OrderDetailGST.length > 0
? Number(
OrderDetailGST?.reduce(
(sum, item) => sum + (item.CGST || 0),
2026-01-30 16:11:37 +05:30
0,
),
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
2026-01-30 16:11:37 +05:30
: "0.00"}
2026-01-27 18:27:29 +05:30
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{OrderDetailGST && OrderDetailGST.length > 0
? Number(
OrderDetailGST?.reduce(
(sum, item) => sum + (item.SGST || 0),
2026-01-30 16:11:37 +05:30
0,
),
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
2026-01-30 16:11:37 +05:30
: "0.00"}
2026-01-27 18:27:29 +05:30
</div>
<div
2026-01-30 16:11:37 +05:30
style={{ padding: "6px 4px", textAlign: "right" }}
2026-01-27 18:27:29 +05:30
>
{OrderDetailGST && OrderDetailGST.length > 0
? Number(
OrderDetailGST?.reduce(
(sum, item) =>
sum + (item.CGST || 0) + (item.SGST || 0),
2026-01-30 16:11:37 +05:30
0,
),
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
2026-01-30 16:11:37 +05:30
: "0.00"}
2026-01-27 18:27:29 +05:30
</div>
</div>
</>
) : OrderDetailIGST && OrderDetailIGST.length > 0 ? (
<>
{/* Tax Table Header - Main Headers */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "22% 21% 18% 21% 18%",
borderBottom: "1px solid #000",
fontSize: "9px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
HSN/SAC
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Taxable Value
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
IGST
</div>
<div
2026-01-30 16:11:37 +05:30
style={{ padding: "6px 4px", textAlign: "center" }}
2026-01-27 18:27:29 +05:30
>
Tax Amount
</div>
</div>
{/* Tax Table Sub-Headers */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "22% 21% 9% 9% 21% 18%",
borderBottom: "1px solid #000",
fontSize: "8px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Rate
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Amount
</div>
<div
2026-01-30 16:11:37 +05:30
style={{ padding: "4px 2px", textAlign: "center" }}
2026-01-27 18:27:29 +05:30
></div>
</div>
{/* Tax Table Rows - Dynamic from OrderDetailGST */}
{OrderDetailIGST?.map((taxItem, index) => (
<div
key={index}
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "22% 21% 9% 9% 21% 18%",
borderBottom: "1px solid #000",
fontSize: "9px",
minHeight: "20px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "center",
fontWeight: "700",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{taxItem.HSN || ""}
2026-01-27 18:27:29 +05:30
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{Number(
2026-01-30 16:11:37 +05:30
taxItem.WithOutTaxAmount || 0,
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
{taxItem.TaxPercentage
2026-01-30 16:11:37 +05:30
? taxItem.TaxPercentage + "%"
: "0%"}
2026-01-27 18:27:29 +05:30
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{Number(taxItem.TaxAmt || 0).toLocaleString(
2026-01-30 16:11:37 +05:30
"en-IN",
2026-01-27 18:27:29 +05:30
{
minimumFractionDigits: 2,
maximumFractionDigits: 2,
2026-01-30 16:11:37 +05:30
},
2026-01-27 18:27:29 +05:30
)}
</div>
2026-01-30 16:11:37 +05:30
<div style={{ padding: "4px", textAlign: "right" }}>
2026-01-27 18:27:29 +05:30
{Number(taxItem.TaxAmt || 0).toLocaleString(
2026-01-30 16:11:37 +05:30
"en-IN",
2026-01-27 18:27:29 +05:30
{
minimumFractionDigits: 2,
maximumFractionDigits: 2,
2026-01-30 16:11:37 +05:30
},
2026-01-27 18:27:29 +05:30
)}
</div>
</div>
2026-01-30 16:11:37 +05:30
))}{" "}
2026-01-27 18:27:29 +05:30
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "22% 21% 9% 9% 21% 18%",
fontSize: "9px",
fontWeight: "700",
minHeight: "22px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Total
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{OrderDetailIGST && OrderDetailIGST.length > 0
? Number(
OrderDetailIGST?.reduce(
(sum, item) =>
sum + (item.WithOutTaxAmount || 0),
2026-01-30 16:11:37 +05:30
0,
),
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
2026-01-30 16:11:37 +05:30
: "0.00"}
2026-01-27 18:27:29 +05:30
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
{OrderDetailIGST && OrderDetailIGST.length > 0
? Number(
OrderDetailIGST?.reduce(
(sum, item) => sum + (item.TaxAmt || 0),
2026-01-30 16:11:37 +05:30
0,
),
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
2026-01-30 16:11:37 +05:30
: "0.00"}
2026-01-27 18:27:29 +05:30
</div>
<div
2026-01-30 16:11:37 +05:30
style={{ padding: "6px 4px", textAlign: "right" }}
2026-01-27 18:27:29 +05:30
>
{OrderDetailIGST && OrderDetailIGST.length > 0
? Number(
OrderDetailIGST?.reduce(
(sum, item) => sum + (item.TaxAmt || 0),
2026-01-30 16:11:37 +05:30
0,
),
).toLocaleString("en-IN", {
2026-01-27 18:27:29 +05:30
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
2026-01-30 16:11:37 +05:30
: "0.00"}
2026-01-27 18:27:29 +05:30
</div>
</div>
</>
) : (
<>
{/* Tax Table Header - Main Headers */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "12% 15% 18% 18% 15% 22%",
borderBottom: "1px solid #000",
fontSize: "9px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
HSN/SAC
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Taxable Value
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
CGST
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
SGST/UTGST
</div>
<div
2026-01-30 16:11:37 +05:30
style={{ padding: "6px 4px", textAlign: "center" }}
2026-01-27 18:27:29 +05:30
>
Tax Amount
</div>
</div>
{/* Tax Table Sub-Headers */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "12% 15% 9% 9% 9% 9% 15% 22%",
borderBottom: "1px solid #000",
fontSize: "8px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Rate
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Amount
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Rate
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px 2px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Amount
</div>
<div
2026-01-30 16:11:37 +05:30
style={{ padding: "4px 2px", textAlign: "center" }}
2026-01-27 18:27:29 +05:30
></div>
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "12% 15% 9% 9% 9% 9% 15% 22%",
borderBottom: "1px solid #000",
fontSize: "9px",
minHeight: "20px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "center",
fontWeight: "700",
2026-01-27 18:27:29 +05:30
}}
>
-
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
0.00
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
0%
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
0.00
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
0%
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
0.00
</div>
2026-01-30 16:11:37 +05:30
<div style={{ padding: "4px", textAlign: "right" }}>
2026-01-27 18:27:29 +05:30
0.00
</div>
</div>
{/* Tax Table Total */}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "grid",
gridTemplateColumns: "12% 15% 9% 9% 9% 9% 15% 22%",
fontSize: "9px",
fontWeight: "700",
minHeight: "22px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
>
Total
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{"0.00"}
2026-01-27 18:27:29 +05:30
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{"0.00"}
2026-01-27 18:27:29 +05:30
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "center",
2026-01-27 18:27:29 +05:30
}}
></div>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "6px 4px",
borderRight: "1px solid #000",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{"0.00"}
2026-01-27 18:27:29 +05:30
</div>
<div
2026-01-30 16:11:37 +05:30
style={{ padding: "6px 4px", textAlign: "right" }}
2026-01-27 18:27:29 +05:30
>
2026-01-30 16:11:37 +05:30
{"0.00"}
2026-01-27 18:27:29 +05:30
</div>
</div>
</>
)}
</div>
{/* Tax Amount in Words */}
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "3px 5px",
fontSize: "11px",
2026-01-27 18:27:29 +05:30
}}
>
<div>
2026-01-30 16:11:37 +05:30
Tax Amount (in words):{" "}
<span style={{ fontWeight: "700" }}>
INR{" "}
2026-01-27 18:27:29 +05:30
{numberToWords(
Math.floor(
invoiceData.taxAmount ||
OrderDetailGST?.reduce(
(sum, item) =>
sum + (item.CGST || 0) + (item.SGST || 0),
2026-01-30 16:11:37 +05:30
0,
2026-01-27 18:27:29 +05:30
) ||
Number(
OrderDetailIGST?.reduce(
(sum, item) => sum + (item.TaxAmt || 0),
2026-01-30 16:11:37 +05:30
0,
),
2026-01-27 18:27:29 +05:30
) ||
2026-01-30 16:11:37 +05:30
0,
),
)}{" "}
2026-01-27 18:27:29 +05:30
Only
</span>
</div>
</div>
</>
)}
{/* Bank Details and Signature */}
<div
2026-01-30 16:11:37 +05:30
style={{
display: "flex",
width: "100%",
justifyContent: "space-between",
}}
2026-01-27 18:27:29 +05:30
>
<div
style={{
2026-01-30 16:11:37 +05:30
display: "flex",
flexDirection: "column",
justifyContent: "flex-end",
width: "50%",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
padding: "8px 10px",
fontSize: "11px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
marginBottom: "3px",
fontSize: "12px",
borderBottom: "1px solid #000",
width: "max-content",
2026-01-27 18:27:29 +05:30
}}
>
Declaration
</div>
<div>
We declare that this invoice shows the actual price of the
goods described and that all particulars are true and
correct.
</div>
</div>
</div>
{/* Signature Section */}
<div
style={{
2026-01-30 16:11:37 +05:30
flex: "1",
display: "flex",
flexDirection: "column",
justifyContent: "space-between",
alignItems: "flex-end",
width: "50%",
}}
2026-01-27 18:27:29 +05:30
>
{/* Bank Details */}
<div
style={{
2026-01-30 16:11:37 +05:30
flex: "1",
padding: "5px",
fontSize: "11px",
textAlign: "left",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{!estimatePrintHeader && table2Data?.OrderType === "E" ? (
""
2026-01-27 18:27:29 +05:30
) : (
2026-01-30 16:11:37 +05:30
<div style={{ marginBottom: "3px", fontSize: "12px" }}>
2026-01-27 18:27:29 +05:30
Company's Bank Details
</div>
)}
2026-01-30 16:11:37 +05:30
{!estimatePrintHeader && table2Data?.OrderType === "E" ? (
""
2026-01-27 18:27:29 +05:30
) : (
<div>
<div>
<span>A/c Holder's Name:</span>
2026-01-30 16:11:37 +05:30
<span style={{ fontWeight: "700" }}>
{" "}
2026-01-27 18:27:29 +05:30
{invoiceData.companyName}
</span>
</div>
<div>
<span>Bank Name:</span>
2026-01-30 16:11:37 +05:30
<span style={{ fontWeight: "700" }}>
{" "}
{invoiceData.bankDetails?.BankName || ""}
2026-01-27 18:27:29 +05:30
</span>
</div>
<div>
2026-01-30 16:11:37 +05:30
<span>A/c No.:</span>{" "}
<span style={{ fontWeight: "700" }}>
{invoiceData.bankDetails?.AccountNo || ""}
2026-01-27 18:27:29 +05:30
</span>
</div>
<div>
2026-01-30 16:11:37 +05:30
<span>Branch & IFS Code:</span>{" "}
<span style={{ fontWeight: "700" }}>
{invoiceData.bankDetails?.BankBranch || ""} &{" "}
{invoiceData.bankDetails?.IFSCCode || ""}
2026-01-27 18:27:29 +05:30
</span>
</div>
{invoiceData.bankDetails?.SWIFTCode && (
<div>
2026-01-30 16:11:37 +05:30
<span style={{ fontWeight: "700" }}>
2026-01-27 18:27:29 +05:30
SWIFT Code:
</span>
2026-01-30 16:11:37 +05:30
<span style={{ fontWeight: "600" }}>
{" "}
{invoiceData.bankDetails?.SWIFTCode || ""}
2026-01-27 18:27:29 +05:30
</span>
</div>
)}
</div>
)}
</div>
<div
style={{
2026-01-30 16:11:37 +05:30
borderTop: "1px solid #000",
borderLeft: "1px solid #000",
2026-01-27 18:27:29 +05:30
width: isMobile ? '100%' : '92%',
2026-01-30 16:11:37 +05:30
padding: "15px",
2026-01-27 18:27:29 +05:30
}}
>
2026-01-30 16:11:37 +05:30
{!estimatePrintHeader && table2Data?.OrderType === "E" ? (
""
2026-01-27 18:27:29 +05:30
) : (
<div
style={{
2026-01-30 16:11:37 +05:30
fontSize: "11px",
fontWeight: "700",
marginBottom: "10px",
textAlign: "right",
2026-01-27 18:27:29 +05:30
}}
>
for {invoiceData.companyName}
</div>
)}
<div
style={{
2026-01-30 16:11:37 +05:30
display: "flex",
flexDirection: "column",
alignItems: "right",
marginBottom: "10px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
width: "70px",
height: "30px",
display: "flex",
alignItems: "center",
justifyContent: "center",
marginBottom: "5px",
2026-01-27 18:27:29 +05:30
}}
>
<div
style={{
2026-01-30 16:11:37 +05:30
fontSize: "8px",
textAlign: "center",
fontWeight: "700",
lineHeight: "1.1",
2026-01-27 18:27:29 +05:30
}}
>
{/* <div>DD</div>
<div>TECHNOLOGIES</div>
<div>ELECTRONICS</div> */}
</div>
</div>
2026-01-30 16:11:37 +05:30
<div style={{ fontSize: "10px", textAlign: "right" }}>
2026-01-27 18:27:29 +05:30
Authorised Signatory
</div>
</div>
</div>
</div>
</div>
</>
)}
</div>
{/* Footer - Only on last page */}
{isLastPage && (
<div
style={{
2026-01-30 16:11:37 +05:30
textAlign: "center",
fontSize: "10px",
padding: "8px",
2026-01-27 18:27:29 +05:30
}}
>
<div>This is a Computer Generated Invoice</div>
</div>
)}
</>
);
}
};
export default TaxInvoice;