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

This commit is contained in:
karthikalakshmi 2026-03-03 09:51:12 +05:30
parent 3d2275a904
commit e5c2577237
1 changed files with 227 additions and 180 deletions

View File

@ -63,7 +63,7 @@ const Printstyle6 = ({
sportsAppPreference, sportsAppPreference,
MembershipApplied = null, MembershipApplied = null,
}) => { }) => {
console.log(table2Data, 'table2Data'); console.log(table2Data, 'table2Data22222222222222');
const dispatch = useDispatch(); const dispatch = useDispatch();
const GlobalUpiID = useSelector(GlobalUpiIDprint); const GlobalUpiID = useSelector(GlobalUpiIDprint);
const FieldDetails = useSelector(GloabalFieldDetails); const FieldDetails = useSelector(GloabalFieldDetails);
@ -458,8 +458,8 @@ const Printstyle6 = ({
}} }}
> >
Estimate{' '} Estimate{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
</div> </div>
)} )}
@ -480,8 +480,8 @@ const Printstyle6 = ({
: PaymentStatus?.length === 1 : PaymentStatus?.length === 1
? PaymentStatus?.[0]?.PaymentTypeName ? PaymentStatus?.[0]?.PaymentTypeName
: ''}{' '} : ''}{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}{' '} `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}{' '} */}
</div> </div>
)} )}
</div> </div>
@ -496,8 +496,8 @@ const Printstyle6 = ({
}} }}
> >
Estimate{' '} Estimate{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
</div> </div>
)} )}
<div <div
@ -517,6 +517,10 @@ const Printstyle6 = ({
table2Data?.FYStatus table2Data?.FYStatus
)} )}
</div> </div>
{SalesModePref?.SettingValue == 'Y' && <div style={{ fontSize: '14px', fontWeight: 600 }}>
{' '}
Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '}
</div>}
<div style={{ fontSize: '12px' }}>{Date1}</div> <div style={{ fontSize: '12px' }}>{Date1}</div>
<hr className="PrintStyle6-HrLine" /> <hr className="PrintStyle6-HrLine" />
@ -768,35 +772,63 @@ const Printstyle6 = ({
<> <>
{Item && ( {Item && (
<> <>
{item?.ProdName} {/* 🏷 Product Name */}
{PackageDetails?.filter( <div>{item?.ProdName}</div>
(pkg) =>
pkg.ProdId === item.ProdId {/* 📦 Package OR Size */}
).length > 0 ? ( {(() => {
PackageDetails?.filter( const packageList = (PackageDetails ?? []).filter(
(pkg) => pkg => pkg.ProdId === item.ProdId
pkg.ProdId === item.ProdId );
)?.map((pkg, index) => (
if (packageList.length > 0) {
return packageList.map((pkg, index) => (
<div key={index}> <div key={index}>
{pkg.ParcelCount} PCS{' '} {pkg.ParcelCount} PCS {pkg.ParcelQty} PACK ({pkg.ParcelType})
{pkg.ParcelQty} PACK ( </div>
{pkg.ParcelType}) ));
}
return (
UomPrint?.SettingValue === 'Y' && (
<div>
({item?.Size || "1"}) {item?.SinglePc === "Y" ? "PCS" : item?.Type !== "C" ? item?.UomName : "COMBO"}
</div> </div>
))
) : (
UomPrint?.SettingValue === 'Y' &&
<span>
({item?.Size ? item?.Size : '1'}
{item?.SinglePc === 'Y'
? 'PCS'
: item?.Type !== 'C'
? item?.UomName
: 'COMBO'}
) )
</span> );
)} })()}
{' - '}
{Quantity && item?.SalesQty} {/* 🔢 Serial Numbers */}
{(item?.ProductIdentifierDtls ?? [])
.filter(d => d.SerialNumber)
.map((d, i) => (
<div key={`serial-${i}`}>
{d.SerialNumber}
</div>
))}
{/* 📱 IMEI Numbers */}
{(item?.ProductIdentifierDtls ?? [])
.filter(d => d.IMEI1 || d.IMEI2)
.map((d, i) => (
<div key={`imei-${i}`}>
{[d.IMEI1, d.IMEI2].filter(Boolean).join(", ")}
</div>
))}
{/* 📝 Description (Always New Line) */}
{(item?.ProductIdentifierDtls ?? [])
.filter(d => d.SerialNumber || d.IMEI1 || d.IMEI2 || d.Description)
.map((d, i) => (
<div key={`description-${i}`}>
{d.Description}
</div>
))}
{/* 🔢 Quantity */}
<div>
- {Quantity && item?.SalesQty}
</div>
</> </>
)} )}
</> </>
@ -1119,55 +1151,52 @@ const Printstyle6 = ({
) : ( ) : (
<td <td
className="Re-print-body-Rate" className="Re-print-body-Rate"
style={{ textAlign: 'left' }} style={{ textAlign: "left" }}
> >
{(GlobaldummyData {/* 🏷 Product Name + Size */}
? GlobalItem &&
item?.ProdName +
`(${item?.Size + item?.UomName})`
: Item &&
item?.ProdName +
UomPrint?.SettingValue === 'Y' ? `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})` : '' ) +
item?.BrandName !==
null
? item?.BrandName
: '' +
item?.ProductIdentifierDtls
?.length >
0
? item?.ProductIdentifierDtls?.filter(
(items) =>
!(
items.SerialNumber == '' ||
items.SerialNumber == null
)
)?.map((a) => {
return <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> <div>
{[imei1, imei2] {GlobaldummyData
.filter(Boolean) ? GlobalItem && item?.ProdName
.join(',')} : Item && item?.ProdName
}
</div> </div>
); {UomPrint?.SettingValue === 'Y' && (
}) <div>
: '' + ({item?.Size || "1"}) {item?.SinglePc === "Y" ? "PCS" : item?.Type !== "C" ? item?.UomName : "COMBO"}
'-' + </div>
(GlobaldummyData )}
{/* 🏷 Brand */}
{item?.BrandName && <div>{item.BrandName}</div>}
{/* 🔢 Serial Numbers */}
{(item?.ProductIdentifierDtls ?? [])
.filter(d => d.SerialNumber)
.map((d, i) => (
<div key={`serial-${i}`}>{d.SerialNumber}</div>
))}
{/* 📱 IMEI Numbers */}
{(item?.ProductIdentifierDtls ?? [])
.filter(d => d.IMEI1 || d.IMEI2)
.map((d, i) => (
<div key={`imei-${i}`}>
{[d.IMEI1, d.IMEI2].filter(Boolean).join(", ")}
</div>
))}
{(item?.ProductIdentifierDtls ?? [])
.filter(d => d.IMEI1 || d.IMEI2 || d.SerialNumber)
.map((d, i) => (
<div key={`description-${i}`}>{d.Description}</div>
))}
{/* 🔢 Quantity */}
<div>
-
{GlobaldummyData
? GlobalQuantity && item?.SalesQty ? GlobalQuantity && item?.SalesQty
: Quantity && item?.SalesQty)} : Quantity && item?.SalesQty}
</div>
</td> </td>
)} )}
{GlobaldummyData {GlobaldummyData
@ -3319,8 +3348,8 @@ const Printstyle6 = ({
}} }}
> >
Estimate{' '} Estimate{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
</div> </div>
)} )}
@ -3343,8 +3372,8 @@ const Printstyle6 = ({
: PaymentStatusSuccess?.length === 1 : PaymentStatusSuccess?.length === 1
? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill'
: ''}{' '} : ''}{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
</div> </div>
)} )}
</div> </div>
@ -3360,8 +3389,8 @@ const Printstyle6 = ({
}} }}
> >
Estimate{' '} Estimate{' '}
{SalesModePref?.SettingValue == 'Y' && {/* {SalesModePref?.SettingValue == 'Y' &&
`(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
</div> </div>
)} )}
<div <div
@ -3381,6 +3410,10 @@ const Printstyle6 = ({
table2Data?.FYStatus table2Data?.FYStatus
)} )}
</div> </div>
{SalesModePref?.SettingValue == 'Y' && <div style={{ fontSize: '10px', fontWeight: 600 }}>
{' '}
Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '}
</div>}
<div style={{ fontSize: '12px' }}>{Date1}</div> <div style={{ fontSize: '12px' }}>{Date1}</div>
<hr className="PrintStyle6-HrLine" /> <hr className="PrintStyle6-HrLine" />
@ -3569,16 +3602,11 @@ const Printstyle6 = ({
</div> </div>
)) ))
) : ( ) : (
UomPrint?.SettingValue === 'Y' && UomPrint?.SettingValue === 'Y' && (
<span> <span>
({item?.Size ? item?.Size : '1'} ({item?.Size || '1'}) {item?.SinglePc === 'Y' ? 'PCS' : item?.Type !== 'C' ? item?.UomName : 'COMBO'}
{item?.SinglePc === 'Y'
? 'PCS'
: item?.Type !== 'C'
? item?.UomName
: 'COMBO'}
)
</span> </span>
)
)} )}
{' - '} {' - '}
{Quantity && item?.SalesQty} {Quantity && item?.SalesQty}
@ -3835,50 +3863,69 @@ const Printstyle6 = ({
) : ( ) : (
<td <td
className="Re-print-body-Rate" className="Re-print-body-Rate"
style={{ textAlign: 'left' }} style={{ textAlign: "left" }}
> >
{(GlobaldummyData {(() => {
? GlobalItem && const identifiers = item?.ProductIdentifierDtls ?? [];
item?.ProdName +
`(${item?.Size + item?.UomName})` const sizeText = GlobaldummyData
: Item && ? GlobalItem && item?.ProdName
item?.ProdName + : Item && item?.ProdName;
UomPrint?.SettingValue === 'Y' ? `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})` : '' ) +
item?.BrandName !==
null
? item?.BrandName
: '' + item?.ProductIdentifierDtls?.length > 0
? item?.ProductIdentifierDtls?.filter(
(items) =>
!(
items.SerialNumber == '' ||
items.SerialNumber == null
)
)?.map((a) => {
return <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 ( return (
<>
{/* 🏷 Product Name */}
<div>{sizeText}</div>
{/* 📦 Size + UOM */}
{UomPrint?.SettingValue === 'Y' && (
<div> <div>
{[imei1, imei2] ({item?.Size || "1"}) {item?.SinglePc === "Y" ? "PCS" : item?.Type !== "C" ? item?.UomName : "COMBO"}
.filter(Boolean)
.join(',')}
</div> </div>
); )}
})
: '' + {/* 🏷 Brand */}
'-' + {item?.BrandName && <div>{item.BrandName}</div>}
(GlobaldummyData
{/* 🔢 Serial Numbers */}
{identifiers
.filter(d => d.SerialNumber)
.map((d, i) => (
<div key={`serial-${i}`}>
{d.SerialNumber}
</div>
))}
{/* 📱 IMEI Numbers */}
{identifiers
.filter(d => d.IMEI1 || d.IMEI2)
.map((d, i) => (
<div key={`imei-${i}`}>
{[d.IMEI1, d.IMEI2].filter(Boolean).join(", ")}
</div>
))}
{/* 📝 Description (only if Serial or IMEI exists) */}
{identifiers
.filter(d => d.SerialNumber || d.IMEI1 || d.IMEI2 || d.Description)
.map((d, i) =>
d.Description ? (
<div key={`description-${i}`}>
{d.Description}
</div>
) : null
)}
{/* 🔢 Quantity */}
<div>
-
{GlobaldummyData
? GlobalQuantity && item?.SalesQty ? GlobalQuantity && item?.SalesQty
: Quantity && item?.SalesQty)} : Quantity && item?.SalesQty}
</div>
</>
);
})()}
</td> </td>
)} )}
{GlobaldummyData {GlobaldummyData