diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx index fb3da9a..352007d 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx @@ -103,9 +103,9 @@ const PrintStyle5 = ({ const GlobalCashierName = useSelector(GlobalprintCashierName); const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); - const UomPrint = SettingData?.[0]?.SettingDtlDetails?.filter( + const UomPrint = SettingData?.[0]?.SettingDtlDetails?.filter( (i) => i.SettingIdName === 'PrintUom' - )?.[0]; + )?.[0]; const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find( (setting) => @@ -440,8 +440,8 @@ const PrintStyle5 = ({ {table2Data?.OrderType === 'E' && estimateTitle && (
Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} + {/* {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
)} {table2Data?.OrderType === 'E' ? ( @@ -455,8 +455,8 @@ const PrintStyle5 = ({ : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ''}{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} + {/* {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */} )} @@ -468,8 +468,8 @@ const PrintStyle5 = ({ style={{ textTransform: 'uppercase', textAlign: 'center' }} > Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} + {/* {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */} )} @@ -482,7 +482,13 @@ const PrintStyle5 = ({ }} > {' '} -
{GlobaldummyData ? formattedDate : Date1}
{' '} +
{GlobaldummyData ? formattedDate : Date1} + {SalesModePref?.SettingValue == 'Y' &&
+ {' '} + Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '} +
} + +
{' '}
{' '} Bill No : @@ -676,15 +682,15 @@ const PrintStyle5 = ({ ) : ( <>
{item?.ProdName}
- { UomPrint?.SettingValue === 'Y' && -
- {item?.Size + - item?.UomName + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : item?.SalesQty)} -
} + {UomPrint?.SettingValue === 'Y' && +
+ {item?.Size + + item?.UomName + + '-' + + (GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : item?.SalesQty)} +
} )}
@@ -700,85 +706,107 @@ const PrintStyle5 = ({ ) ) : ( <> -
{item?.ProdName}
- {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
- {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty}{' '} - PACK ({item.ParcelType}) - - ))} - {(item?.ProductIdentifierDtls?.filter( - (items) => - items.SerialNumber && - items.SerialNumber !== '' - )?.map((a, index) => ( -
- {a.SerialNumber} -
- )) || '') + - (item?.ProductIdentifierDtls?.filter( - (item1) => item1.IMEI1 || item1.IMEI2 - )?.map((item2, index) => { - const imei1 = item2.IMEI1 || ''; - const imei2 = item2.IMEI2 || ''; - return ( -
- {[imei1, imei2] - .filter(Boolean) - .join(',')} + {(() => { + const identifiers = item?.ProductIdentifierDtls ?? []; + + const packageList = (PackageDetails ?? []).filter( + pkg => pkg.ProdId === item.ProdId + ); + + return ( + <> + {/* ๐Ÿท Product Name */} +
{item?.ProdName}
+ + {packageList.length > 0 ? ( + // ================= PACKAGE EXISTS ================= +
+ + {/* ๐Ÿ“ฆ Package Details */} + {packageList.map((pkg, index) => ( +
+ {pkg.ParcelCount} PCS {pkg.ParcelQty} PACK ({pkg.ParcelType}) +
+ ))} + + {/* ๐Ÿ”ข Identifiers (Serial / IMEI / Description) */} + {identifiers.map((d, i) => { + const serial = d.SerialNumber; + const imei = [d.IMEI1, d.IMEI2].filter(Boolean).join(", "); + const description = d.Description; + + if (!serial && !imei && !description) return null; + + return ( +
+ {serial &&
{serial}
} + {imei &&
{imei}
} + {description &&
{description}
} +
+ ); + })} + + {/* ๐Ÿ”ข Quantity */} +
+ {GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : item?.SalesQty}
- ); - }) || '') + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : item?.SalesQty)} -
- ) : ( -
- {UomPrint?.SettingValue === 'Y' ?((item?.Size || '1') + - (item?.SinglePc === 'Y' - ? 'PCS' - : item?.Type !== 'C' - ? item?.UomName - : 'COMBO')) :"" + - (item?.BrandName || '') + - (item?.ProductIdentifierDtls?.filter( - (items) => - items.SerialNumber && - items.SerialNumber !== '' - )?.map((a, index) => ( -
- {a.SerialNumber} +
- )) || '') + - (item?.ProductIdentifierDtls?.filter( - (item1) => item1.IMEI1 || item1.IMEI2 - )?.map((item2, index) => { - const imei1 = item2.IMEI1 || ''; - const imei2 = item2.IMEI2 || ''; - return ( -
- {[imei1, imei2] - .filter(Boolean) - .join(',')} + ) : ( + // ================= NO PACKAGE ================= +
+ + {/* ๐Ÿ“ Size + UOM */} +
+ {UomPrint?.SettingValue === 'Y' && ( + <> + {(item?.Size || "1")}{" "} + {item?.SinglePc === "Y" + ? "PCS" + : item?.Type !== "C" + ? item?.UomName + : "COMBO"} + + )}
- ); - }) || '') + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : item?.SalesQty)} -
- )} + + {/* ๐Ÿท Brand */} + {item?.BrandName && ( +
{item.BrandName}
+ )} + + {/* ๐Ÿ”ข Identifiers (Serial / IMEI / Description) */} + {identifiers.map((d, i) => { + const serial = d.SerialNumber; + const imei = [d.IMEI1, d.IMEI2].filter(Boolean).join(", "); + const description = d.Description; + + if (!serial && !imei && !description) return null; + + return ( +
+ {serial &&
{serial}
} + {imei &&
{imei}
} + {description &&
{description}
} +
+ ); + })} + + {/* ๐Ÿ”ข Quantity */} +
+ - + {GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : item?.SalesQty} +
+ +
+ )} + + ); + })()} )}
@@ -1056,16 +1084,16 @@ const PrintStyle5 = ({ ) : ( <>
{item?.ProdName}
- { UomPrint?.SettingValue === 'Y' && -
- {item?.Size + - item?.UomName + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : item?.SalesQty)} -
- } + {UomPrint?.SettingValue === 'Y' && +
+ {item?.Size + + item?.UomName + + '-' + + (GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : item?.SalesQty)} +
+ } )}
@@ -1083,19 +1111,19 @@ const PrintStyle5 = ({ <>
{item?.ProdName}
{UomPrint?.SettingValue === 'Y' && -
- {(item?.Size ? item?.Size : '1') + - (item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO') + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : item?.SalesQty)} -
- } +
+ {(item?.Size ? item?.Size : '1') + + (item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO') + + '-' + + (GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : item?.SalesQty)} +
+ } )}
@@ -2737,8 +2765,8 @@ const PrintStyle5 = ({ {table2Data?.OrderType === 'E' && estimateTitle && (
Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} + {/* {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
)} {table2Data?.OrderType === 'E' ? ( @@ -2754,8 +2782,8 @@ const PrintStyle5 = ({ : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ''}{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} + {/* {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */} )} @@ -2765,8 +2793,8 @@ const PrintStyle5 = ({ {!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && (
Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} + {/* {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} */}
)} @@ -2780,7 +2808,12 @@ const PrintStyle5 = ({ }} > {' '} -
{GlobaldummyData ? formattedDate : Date1}
{' '} +
{GlobaldummyData ? formattedDate : Date1} + {SalesModePref?.SettingValue == 'Y' &&
+ {' '} + Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '} +
} +
{' '}
{' '} Bill No : @@ -2964,15 +2997,15 @@ const PrintStyle5 = ({ <>
{item?.ProdName}
{UomPrint?.SettingValue === 'Y' && ( -
- {item?.Size + - item?.UomName + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : item?.SalesQty)} -
-)} +
+ {item?.Size + + item?.UomName + + '-' + + (GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : item?.SalesQty)} +
+ )} )}
@@ -2988,88 +3021,110 @@ const PrintStyle5 = ({ ) ) : ( <> + {/* ๐Ÿท Product Name */}
{item?.ProdName}
- {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
- {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty}{' '} - PACK ({item.ParcelType}) - - ))} - {(item?.BrandName || '') + - (item?.ProductIdentifierDtls?.filter( - (items) => - items.SerialNumber && - items.SerialNumber !== '' - )?.map((a, index) => ( -
- {a.SerialNumber} -
- )) || '') + - (item?.ProductIdentifierDtls?.filter( - (item1) => item1.IMEI1 || item1.IMEI2 - )?.map((item2, index) => { - const imei1 = item2.IMEI1 || ''; - const imei2 = item2.IMEI2 || ''; + {(() => { + const packages = + (PackageDetails ?? []).filter(pkg => pkg.ProdId === item.ProdId); + + const identifiers = item?.ProductIdentifierDtls ?? []; + + return packages.length > 0 ? ( + // ================= PACKAGE EXISTS ================= +
+ {/* ๐Ÿ“ฆ Package Details */} + {packages.map((pkg, index) => ( + + {pkg.ParcelCount} PCS {pkg.ParcelQty} PACK ({pkg.ParcelType}) + + ))} + + {/* ๐Ÿท Brand */} + {item?.BrandName &&
{item.BrandName}
} + + {/* ๐Ÿ”ข Serial / IMEI / Description */} + {identifiers.map((d, i) => { + const values = [ + d.SerialNumber, + d.IMEI1, + d.IMEI2, + d.Description + ].filter(Boolean); + + if (values.length === 0) return null; + return ( -
- {[imei1, imei2] - .filter(Boolean) - .join(',')} +
+ {values.join(", ")}
); - }) || '') + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : item?.SalesQty)} -
- ) : ( -
- {UomPrint?.SettingValue === 'Y' ?((item?.Size || '1') + - (item?.SinglePc === 'Y' - ? 'PCS' - : item?.Type !== 'C' - ? item?.UomName - : 'COMBO')):"" + - (item?.BrandName || '') + - (item?.ProductIdentifierDtls?.filter( - (items) => - items.SerialNumber && - items.SerialNumber !== '' - )?.map((a, index) => ( -
- {a.SerialNumber} + })} + + {/* ๐Ÿงช Debug / Extra Text */} +
ssd3
+ + {/* ๐Ÿ”ข Quantity */} +
+ - + {GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : item?.SalesQty} +
+
+ ) : ( + // ================= NO PACKAGE ================= +
+ {/* ๐Ÿ“ Size + UOM */} +
+ + {UomPrint?.SettingValue === 'Y' && ( + <> + {item?.Size || "1"}{" "} + {item?.SinglePc === "Y" + ? "PCS" + : item?.Type !== "C" + ? item?.UomName + : "COMBO"} + + )}
- )) || '') + - (item?.ProductIdentifierDtls?.filter( - (item1) => item1.IMEI1 || item1.IMEI2 - )?.map((item2, index) => { - const imei1 = item2.IMEI1 || ''; - const imei2 = item2.IMEI2 || ''; + + + {/* ๐Ÿท Brand */} + {item?.BrandName &&
{item.BrandName}
} + + {/* ๐Ÿ”ข Serial / IMEI / Description */} + {identifiers.map((d, i) => { + const values = [ + d.SerialNumber, + d.IMEI1, + d.IMEI2, + d.Description + ].filter(Boolean); + + if (values.length === 0) return null; + return ( -
- {[imei1, imei2] - .filter(Boolean) - .join(',')} +
+ {values.join(", ")}
); - }) || '') + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : item?.SalesQty)} -
- )} + })} + + {/* ๐Ÿงช Debug / Extra Text */} +
ssd4
+ + {/* ๐Ÿ”ข Quantity */} +
+ - + {GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : item?.SalesQty} +
+
+ ); + })()} )}
@@ -3317,16 +3372,16 @@ const PrintStyle5 = ({ ) : ( <>
{item?.ProdName}
- {UomPrint?.SettingValue === 'Y'&& -
- {item?.Size + - item?.UomName + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : item?.SalesQty)} -
-} + {UomPrint?.SettingValue === 'Y' && +
+ {item?.Size + + item?.UomName + + '-' + + (GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : item?.SalesQty)} +
+ } )}
@@ -3344,16 +3399,16 @@ const PrintStyle5 = ({ <>
{item?.ProdName}
- {UomPrint?.SettingValue === 'Y'? ((item?.Size ? item?.Size : '1') + + {UomPrint?.SettingValue === 'Y' ? ((item?.Size ? item?.Size : '1') + (item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName - : 'COMBO') ):""+ - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : item?.SalesQty)} + : 'COMBO')) : "" + + '-' + + (GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : item?.SalesQty)}
)}