Update src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx

This commit is contained in:
karthikalakshmi 2026-03-03 10:02:21 +05:30
parent 423a82c646
commit acd9e74185
1 changed files with 918 additions and 936 deletions

View File

@ -57,6 +57,7 @@ const InvoiceTemplate = ({
isPdf,
sportsAppPreference,
MembershipApplied = null,
SalesModePref,
}) => {
const dispatch = useDispatch();
const GlobalUpiID = useSelector(GlobalUpiIDprint);
@ -104,7 +105,8 @@ const InvoiceTemplate = ({
)?.SettingValue === 'Y';
const estimateTitle =
SettingData?.[0]?.SettingDtlDetails?.find(
(setting) => setting?.SettingIdName?.toLowerCase() === 'estimatetitle'
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'estimatetitle'
)?.SettingValue === 'Y';
const keysLength = Object.keys(table2Data ?? {}).length;
console.log(GlobalDiscount, Discount, 'Discount');
@ -156,7 +158,7 @@ const InvoiceTemplate = ({
let PaymentStatusSuccess = PaymentStatus?.filter(
(ps) => ps.PaymentStatus === 'S'
);
const isEditedBill = PaymentStatus?.some((payment) => {
const isEditedBill = PaymentStatus?.some(payment => {
const type = payment?.AdjustmentType?.toLowerCase();
return (
(type === 'extra' || type === 'refund') &&
@ -166,15 +168,15 @@ const InvoiceTemplate = ({
});
const lastTransaction = PaymentStatus?.find(
(ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y'
);
)
const TakeawayTotal = TakeawayData?.reduce(
(accumulator, currentValue) => accumulator + currentValue.TotalAmt,
0
0,
);
const PackageDetails = table2Data?.PackageDtl;
const DineInTotal = DineInData?.reduce(
(accumulator, currentValue) => accumulator + currentValue.TotalAmt,
0
0,
);
const aggregatedPayments = PaymentStatusSuccess?.reduce(
(acc, paymentdata) => {
@ -189,7 +191,7 @@ const InvoiceTemplate = ({
return acc;
},
{}
{},
);
const productsData = table2Data?.productDetails || [];
const offers = table2Data?.OrderOfferDetails || [];
@ -946,6 +948,10 @@ const InvoiceTemplate = ({
table2Data?.FYStatus
)}
</div>
{SalesModePref?.SettingValue == 'Y' && <div style={{ fontSize: '13px', margin: '0rem 0rem', fontWeight: '600' }}>
{' '}
Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '}
</div>}
</div>
)}
@ -1263,78 +1269,68 @@ const InvoiceTemplate = ({
<td
className="table-header-cell"
style={{
display: 'flex',
flexDirection: 'column',
fontFamily: 'sans-serif',
display: "flex",
flexDirection: "column",
fontFamily: "sans-serif",
}}
>
{/* Product Name */}
<div>{item?.ProdName}</div>
{PackageDetails?.filter(
(pkg) => pkg.ProdId === item.ProdId
).length > 0 ? (
{(() => {
const packages =
PackageDetails?.filter(pkg => pkg.ProdId === item.ProdId) || [];
const identifiers = item?.ProductIdentifierDtls || [];
return (
<>
{/* Package OR Size */}
{packages.length > 0 ? (
<div>
{PackageDetails?.filter(
(pkg) =>
pkg.ProdId === item.ProdId
)?.map((item, index) => (
<span
key={index}
style={{ display: 'block' }}
>
{item.ParcelCount} PCS{' '}
{item.ParcelQty} PACK (
{item.ParcelType})
{packages.map((pkg, index) => (
<span key={index} style={{ display: "block" }}>
{pkg.ParcelCount} PCS {pkg.ParcelQty} PACK ({pkg.ParcelType})
</span>
))}
</div>
) : (
UomPrint?.SettingValue === 'Y' && (
<div>
({item?.Size ? item?.Size : '1'}{' '}
{item?.SinglePc == 'Y'
? 'PCS'
: item?.Type != 'C'
({item?.Size || "1"}{" "}
{item?.SinglePc === "Y"
? "PCS"
: item?.Type !== "C"
? item?.UomName
: 'COMBO'}
: "COMBO"}
)
</div>
)
)}
&nbsp;{' '}
{item?.BrandName !== null
? item?.BrandName
: ''}
&nbsp;
{item?.ProductIdentifierDtls?.length > 0
? item?.ProductIdentifierDtls?.filter(
(items) =>
!(
items.SerialNumber == '' ||
items.SerialNumber == null
)
)?.map((a) => {
return (
<div>{a.SerialNumber}</div>
);
})
: ''}{' '}
{item?.ProductIdentifierDtls?.length > 0
? item?.ProductIdentifierDtls.filter(
(item1) =>
item1.IMEI1 !== '' ||
item1.IMEI2 !== ''
)?.map((item2) => {
const imei1 = item2.IMEI1 || '';
const imei2 = item2.IMEI2 || '';
return (
<div>
{[imei1, imei2]
.filter(Boolean)
.join(',')}
{/* Brand */}
{item?.BrandName && <div>{item.BrandName}</div>}
{/* Identifiers */}
{identifiers.map((id, i) => (
<div key={i} style={{ display: 'flex', flexDirection: 'column', gap: '2px' }}>
{/* Serial + IMEIs in one line */}
{(id?.SerialNumber || id?.IMEI1 || id?.IMEI2) && (
<div style={{ display: 'flex', gap: '3px' }}>
{id?.SerialNumber && <div>{id.SerialNumber}</div>}
{(id?.IMEI1 || id?.IMEI2) && (
<div>{[id.IMEI1, id.IMEI2].filter(Boolean).join(", ")}</div>
)}
</div>
)}
{/* Description on new line */}
{id?.Description && <div>{id.Description}</div>}
</div>
))}
</>
);
})
: ''}
})()}
</td>
)}
{GlobaldummyData
@ -1808,7 +1804,7 @@ const InvoiceTemplate = ({
{Number(
GlobaldummyData
? 736
: table2Data?.NetAmount
: table2Data?.NetAmount,
)?.toFixed(2)}
</div>
</div>
@ -2386,7 +2382,7 @@ const InvoiceTemplate = ({
</div>
<div className="total-amount">
{Number(
GlobaldummyData ? 736 : table2Data?.NetAmount
GlobaldummyData ? 736 : table2Data?.NetAmount,
)?.toFixed(2)}
</div>
{isEditedBill && lastTransaction && (
@ -2443,10 +2439,8 @@ const InvoiceTemplate = ({
'REFUND'
? '-'
: '+'}
{Math.abs(
(lastTransaction?.BeforeAdjustment ?? 0) -
(lastTransaction?.AfterAdjustment ?? 0)
).toFixed(2)}
{Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
</span>
</div>
<div
@ -3000,56 +2994,46 @@ const InvoiceTemplate = ({
: Item == true && (
<td
className="table-header-cell"
style={{
display: 'flex',
flexDirection: 'column',
}}
style={{ display: "flex", flexDirection: "column" }}
>
{/* Product Name */}
<div>{item?.ProdName}</div>
{/* Size + UOM */}
{UomPrint?.SettingValue === 'Y' && (
<div>
{UomPrint?.SettingValue === 'Y'
? `${item?.Size || '1'} ${
item?.SinglePc === 'Y'
? 'PCS'
: item?.Type !== 'C'
({item?.Size || "1"}{" "}
{item?.SinglePc === "Y"
? "PCS"
: item?.Type !== "C"
? item?.UomName
: 'COMBO'
}`
: ''}{' '}
</div>
&nbsp;{' '}
{item?.BrandName !== null
? item?.BrandName
: ''}
&nbsp;
{item?.ProductIdentifierDtls?.length > 0
? item?.ProductIdentifierDtls?.filter(
(items) =>
!(
items.SerialNumber == '' ||
items.SerialNumber == null
: "COMBO"}
)
)?.map((a) => {
return <div>{a.SerialNumber}</div>;
})
: ''}{' '}
{item?.ProductIdentifierDtls?.length > 0
? item?.ProductIdentifierDtls.filter(
(item1) =>
item1.IMEI1 !== '' ||
item1.IMEI2 !== ''
)?.map((item2) => {
const imei1 = item2.IMEI1 || '';
const imei2 = item2.IMEI2 || '';
return (
<div>
{[imei1, imei2]
.filter(Boolean)
.join(',')}
</div>
);
})
: ''}
)}
{/* Brand */}
{item?.BrandName && <div>{item.BrandName}</div>}
{/* Identifiers */}
{item?.ProductIdentifierDtls?.map((id, index) => (
<div key={index} style={{ display: 'flex', flexDirection: 'column', gap: '2px' }}>
{/* Serial + IMEIs in one row */}
{(id?.SerialNumber || id?.IMEI1 || id?.IMEI2) && (
<div style={{ display: 'flex', gap: '4px' }}>
{id?.SerialNumber && <div>{id.SerialNumber}</div>}
{(id?.IMEI1 || id?.IMEI2) && (
<div>{[id.IMEI1, id.IMEI2].filter(Boolean).join(", ")}</div>
)}
</div>
)}
{/* Description on new line */}
{id?.Description && <div>{id.Description}</div>}
</div>
))}
</td>
)}
{GlobaldummyData
@ -3177,7 +3161,7 @@ const InvoiceTemplate = ({
</td>
)}
</tr>
)
),
)}
</tbody>
</table>
@ -3360,13 +3344,13 @@ const InvoiceTemplate = ({
<span>Total Amount Payable</span>
<span>
{Number(
GlobaldummyData ? 736 : table2Data?.NetAmount
GlobaldummyData ? 736 : table2Data?.NetAmount,
)?.toFixed(2)}
</span>
</div>
<div className="total-amount">
{Number(
GlobaldummyData ? 736 : table2Data?.NetAmount
GlobaldummyData ? 736 : table2Data?.NetAmount,
)?.toFixed(2)}
</div>
{isEditedBill && lastTransaction && (
@ -3399,7 +3383,7 @@ const InvoiceTemplate = ({
</span>
<strong>
{(lastTransaction?.BeforeAdjustment || 0).toFixed(
2
2,
)}
</strong>
</div>
@ -3419,10 +3403,8 @@ const InvoiceTemplate = ({
{lastTransaction?.AdjustmentType === 'REFUND'
? '-'
: '+'}
{Math.abs(
(lastTransaction?.BeforeAdjustment ?? 0) -
(lastTransaction?.AfterAdjustment ?? 0)
).toFixed(2)}
{Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
</span>
</div>
<div
@ -3437,7 +3419,7 @@ const InvoiceTemplate = ({
</span>
<strong>
{(lastTransaction?.AfterAdjustment || 0).toFixed(
2
2,
)}
</strong>
</div>