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