Update src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx

This commit is contained in:
karthikalakshmi 2026-03-03 10:12:11 +05:30
parent 1869b0afb7
commit 4ae0a294dc
1 changed files with 1609 additions and 1690 deletions

View File

@ -111,7 +111,8 @@ const PrintStyle10 = ({
)?.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 bookingTypePreference = appPreferences?.find( const bookingTypePreference = appPreferences?.find(
(preference) => preference?.PreferredCatName === 'Booking Type' (preference) => preference?.PreferredCatName === 'Booking Type'
@ -463,8 +464,8 @@ const PrintStyle10 = ({
{table2Data?.OrderType === 'E' && estimateTitle && ( {table2Data?.OrderType === 'E' && estimateTitle && (
<div style={{ textTransform: 'uppercase' }}> <div style={{ textTransform: 'uppercase' }}>
Estimate{' '} Estimate{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
</div> </div>
)} )}
@ -479,8 +480,8 @@ const PrintStyle10 = ({
: PaymentStatusSuccess?.length === 1 : PaymentStatusSuccess?.length === 1
? PaymentStatusSuccess?.[0]?.PaymentTypeName ? PaymentStatusSuccess?.[0]?.PaymentTypeName
: ''}{' '} : ''}{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
</div> </div>
)} )}
</div> </div>
@ -488,18 +489,13 @@ const PrintStyle10 = ({
</div> </div>
)} )}
{!estimatePrintHeader && {!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && (
table2Data?.OrderType === 'E' &&
estimateTitle && (
<div <div
style={{ style={{ textTransform: 'uppercase', textAlign: 'center' }}
textTransform: 'uppercase',
textAlign: 'center',
}}
> >
Estimate{' '} Estimate{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
</div> </div>
)} )}
<div <div
@ -512,6 +508,10 @@ const PrintStyle10 = ({
{' '} {' '}
{GlobaldummyData ? formattedDate : Date1}{' '} {GlobaldummyData ? formattedDate : Date1}{' '}
</div> </div>
{SalesModePref?.SettingValue == 'Y' && <div style={{ fontSize: '13px', fontWeight: 600, textAlign: 'right' }}>
{' '}
Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '}
</div>}
<hr class="straightline" /> <hr class="straightline" />
</div> </div>
@ -690,8 +690,8 @@ const PrintStyle10 = ({
textAlign: 'left', textAlign: 'left',
}} }}
> >
{item?.ProdName}( {item?.ProdName}
{item?.Size + item?.UomName}) {UomPrint?.SettingValue === 'Y' && `(${item?.Size + item?.UomName})`}
</td> </td>
) )
: Item && ( : Item && (
@ -722,86 +722,36 @@ const PrintStyle10 = ({
? item?.BrandName ? item?.BrandName
: ''} : ''}
&nbsp; &nbsp;
{item?.ProductIdentifierDtls?.length > <div style={{ display: 'flex', flexDirection: 'column', gap: '3px' }}>
0 {item?.ProductIdentifierDtls?.map((id, i) => (
? item?.ProductIdentifierDtls?.filter( <div key={i} style={{ display: 'flex', flexDirection: 'column', gap: '2px' }}>
(items) => {id.SerialNumber && <div>{id.SerialNumber}</div>}
!( {(id.IMEI1 || id.IMEI2) && (
items.SerialNumber == '' || <div>{[id.IMEI1, id.IMEI2].filter(Boolean).join(', ')}</div>
items.SerialNumber == null )}
) {id.Description && <div>{id.Description}</div>}
)?.map((a) => { </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>
);
})
: ''}
</div> </div>
) : ( ) : (
<div style={{ display: 'flex', flexDirection: 'column', gap: '5px' }}>
{/* Product size + brand */}
<div> <div>
{UomPrint?.SettingValue === 'Y' {UomPrint?.SettingValue === 'Y' && `(${item?.Size || '1'} ${item?.SinglePc === 'Y' ? 'PCS' : item?.Type !== 'C' ? item?.UomName : 'COMBO'})`}
? `${item?.Size || '1'} ${ {item?.BrandName && ` ${item?.BrandName}`}
item?.SinglePc === 'Y'
? 'PCS'
: item?.Type !== 'C'
? item?.UomName
: 'COMBO'
}`
: ''}
{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(',')}
</div> </div>
);
}) {/* Product identifiers */}
: ''} {item?.ProductIdentifierDtls?.map((id, i) => (
<div key={i} style={{ display: 'flex', flexDirection: 'column', gap: '2px' }}>
{id.SerialNumber && <div>{id.SerialNumber}</div>}
{(id.IMEI1 || id.IMEI2) && (
<div>{[id.IMEI1, id.IMEI2].filter(Boolean).join(', ')}</div>
)}
{id.Description && <div>{id.Description}</div>}
</div>
))}
</div> </div>
)} )}
</td> </td>
@ -1067,8 +1017,8 @@ const PrintStyle10 = ({
textAlign: 'left', textAlign: 'left',
}} }}
> >
{item?.ProdName}( {item?.ProdName}
{item?.Size + item?.UomName}) {UomPrint?.SettingValue === 'Y' && `(${item?.Size + item?.UomName})`}
</td> </td>
) )
: Item && ( : Item && (
@ -1877,10 +1827,8 @@ const PrintStyle10 = ({
{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
@ -2829,10 +2777,8 @@ const PrintStyle10 = ({
{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
@ -3136,8 +3082,8 @@ const PrintStyle10 = ({
{table2Data?.OrderType === 'E' && estimateTitle && ( {table2Data?.OrderType === 'E' && estimateTitle && (
<div style={{ textTransform: 'uppercase' }}> <div style={{ textTransform: 'uppercase' }}>
Estimate{' '} Estimate{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
</div> </div>
)} )}
@ -3152,21 +3098,19 @@ const PrintStyle10 = ({
: PaymentStatusSuccess?.length === 1 : PaymentStatusSuccess?.length === 1
? PaymentStatusSuccess?.[0]?.PaymentTypeName ? PaymentStatusSuccess?.[0]?.PaymentTypeName
: ''}{' '} : ''}{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
</div> </div>
)} )}
</div> </div>
</div> </div>
</div> </div>
)} )}
{!estimatePrintHeader && {!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && (
table2Data?.OrderType === 'E' &&
estimateTitle && (
<div style={{ textTransform: 'uppercase' }}> <div style={{ textTransform: 'uppercase' }}>
Estimate{' '} Estimate{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
</div> </div>
)} )}
<div <div
@ -3314,7 +3258,8 @@ const PrintStyle10 = ({
<td <td
style={{ width: '10px', textAlign: 'left' }} style={{ width: '10px', textAlign: 'left' }}
> >
{item?.ProdName}({item?.Size + item?.UomName}) {item?.ProdName}
{UomPrint?.SettingValue === 'Y' && `(${item?.Size + item?.UomName})`}
</td> </td>
) )
: Item && ( : Item && (
@ -3328,68 +3273,32 @@ const PrintStyle10 = ({
{PackageDetails?.filter( {PackageDetails?.filter(
(pkg) => pkg.ProdId === item.ProdId (pkg) => pkg.ProdId === item.ProdId
).length > 0 ? ( ).length > 0 ? (
<div> <div style={{ display: 'flex', flexDirection: 'column', gap: '5px' }}>
{PackageDetails?.filter( {/* Package Details */}
(pkg) => pkg.ProdId === item.ProdId {PackageDetails?.filter(pkg => pkg.ProdId === item.ProdId).map((pkg, index) => (
)?.map((item, index) => ( <div key={index}>
<span {pkg.ParcelCount} PCS {pkg.ParcelQty} PACK ({pkg.ParcelType})
key={index}
style={{ display: 'block' }}
>
{item.ParcelCount} PCS{' '}
{item.ParcelQty} PACK (
{item.ParcelType})
</span>
))}
{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(',')}
</div> </div>
); ))}
})
: ''} {/* Brand */}
{item?.BrandName && <div>{item.BrandName}</div>}
{/* Product Identifiers */}
{item?.ProductIdentifierDtls?.map((id, i) => (
<div key={i} style={{ display: 'flex', flexDirection: 'column', gap: '2px' }}>
{id.SerialNumber && <div>{id.SerialNumber}</div>}
{(id.IMEI1 || id.IMEI2) && <div>{[id.IMEI1, id.IMEI2].filter(Boolean).join(', ')}</div>}
{id.Description && <div>{id.Description}</div>}
</div>
))}
</div> </div>
) : ( ) : (
<div> <div>
{UomPrint?.SettingValue === 'Y' {UomPrint?.SettingValue === 'Y' && `(${item?.Size ? item?.Size : '1'} ${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})`}
? `${item?.Size || '1'} ${ {item?.BrandName && ` ${item?.BrandName}`}
item?.SinglePc === 'Y'
? 'PCS'
: item?.Type !== 'C'
? item?.UomName
: 'COMBO'
}`
: ''}
{item?.BrandName !== null
? item?.BrandName
: ''}
&nbsp; &nbsp;
{item?.ProductIdentifierDtls?.length > 0 {/* {item?.ProductIdentifierDtls?.length > 0
? item?.ProductIdentifierDtls?.filter( ? item?.ProductIdentifierDtls?.filter(
(items) => (items) =>
!( !(
@ -3416,7 +3325,18 @@ const PrintStyle10 = ({
</div> </div>
); );
}) })
: ''} : ''} */}
<div style={{ display: 'flex', flexDirection: 'column', gap: "3px" }}>
{item?.ProductIdentifierDtls?.map((id, i) => (
<div key={i} style={{ display: 'flex', flexDirection: 'column', gap: "2px" }}>
{id.SerialNumber && <div>{id.SerialNumber}</div>}
{(id.IMEI1 || id.IMEI2) && (
<div>{[id.IMEI1, id.IMEI2].filter(Boolean).join(', ')}</div>
)}
{id.Description && <div>{id.Description}</div>}
</div>
))}
</div>
</div> </div>
)} )}
</td> </td>
@ -3642,7 +3562,8 @@ const PrintStyle10 = ({
<td <td
style={{ width: '10px', textAlign: 'left' }} style={{ width: '10px', textAlign: 'left' }}
> >
{item?.ProdName}({item?.Size + item?.UomName}) {item?.ProdName}
{UomPrint?.SettingValue === 'Y' && `(${item?.Size + item?.UomName})`}
</td> </td>
) )
: Item && ( : Item && (
@ -4388,10 +4309,8 @@ const PrintStyle10 = ({
<span>{'Adjustment Amount'}</span> <span>{'Adjustment Amount'}</span>
<span> <span>
{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