diff --git a/src/Features/ThemeChange/ThemeChange.js b/src/Features/ThemeChange/ThemeChange.js index 2acb6a0..44bc209 100644 --- a/src/Features/ThemeChange/ThemeChange.js +++ b/src/Features/ThemeChange/ThemeChange.js @@ -2607,6 +2607,7 @@ const ThemeSlice = createSlice({ 'UnpaidBill', 'OverallBackground', 'CreditCustomer', + 'PreviousBillFetch' ]; const bookingBillingOptionsArray = tempDic['BookingBilling'][1]; const sortedBillingOptions = desiredOrder diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx index 9e5df58..6a86902 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx @@ -12,6 +12,9 @@ import { GlobalReorderProductDetails, PreferenceData, getConfigType, + changefocusStatusCust, + changeCombofocus, + GlobalfocusStatusCust, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import { ArrowRightOutlined } from '@ant-design/icons'; import { Messages } from '../../../../../Components/Notifications/Messages'; @@ -50,7 +53,7 @@ const BSBillingEditQuantity = (props) => { const priceChangeInputRef = useRef(null); const reductionInputRef = useRef(null); - const { setIndex = () => { } } = props; + const { setIndex = () => {} } = props; const [disableSubmitButton, setDisableSubmitButton] = useState(false); const SessionData = useSelector(StoredSessionData); @@ -66,13 +69,24 @@ const BSBillingEditQuantity = (props) => { shallowEqual ); - const overAllLimitPreferenece = - preferenceDatas?.[0]?.['SettingDtlDetails']?.find( - (item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y'); - const itemWiseLimitPreferenece = - preferenceDatas?.[0]?.['SettingDtlDetails']?.find( - (item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y'); - const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null; + const overAllLimitPreferenece = preferenceDatas?.[0]?.[ + 'SettingDtlDetails' + ]?.find( + (item) => + item.SettingIdName?.toLowerCase() === 'overalllimit' && + item?.SettingValue === 'Y' + ); + const itemWiseLimitPreferenece = preferenceDatas?.[0]?.[ + 'SettingDtlDetails' + ]?.find( + (item) => + item.SettingIdName?.toLowerCase() === 'itemwiselimit' && + item?.SettingValue === 'Y' + ); + const maxQtyLimit = + itemWiseLimitPreferenece?.SettingCount || + overAllLimitPreferenece?.SettingCount || + null; const preferenceOffer = preferenceDatas?.[0]?.['SettingDtlDetails']?.find( (item) => item.SettingIdName === 'Offer' @@ -86,7 +100,7 @@ const BSBillingEditQuantity = (props) => { ); console.log(preferenceshortcutkey, 'preferenceshortcutkey'); const [PriceChangeaccess, setPriceChangeaccess] = useState(true); - + const selectStatuscust = useSelector(GlobalfocusStatusCust); const [ConfigDataList, setConfigDataList] = useState([]); const [messageType, setMessageType] = useState(null); const [messageData, setMessageData] = useState(null); @@ -115,7 +129,7 @@ const BSBillingEditQuantity = (props) => { price: 'Price', quantity: 'qty', Parcel: 'Parcel', - weightAmount: 'weightAmount' + weightAmount: 'weightAmount', }; const [RadioBtnSelection, setRadioBtnSelection] = useState(() => { if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) { @@ -343,7 +357,6 @@ const BSBillingEditQuantity = (props) => { }; const calculateOverAllQty = (item, filterItems) => { - if (!item) return 0; const totalUsedQty = @@ -446,11 +459,18 @@ const BSBillingEditQuantity = (props) => { ); const editedProduct = CartOrderDetails[editedProductIndex]; - if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) { + if ( + (overAllLimitPreferenece || itemWiseLimitPreferenece) && + maxQtyLimit + ) { if (overAllLimitPreferenece) { - const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails?.filter((_, index) => index !== editedProductIndex)); - if ((calculatedOverAllQty + editedQty) > maxQtyLimit) { - setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`); + const calculatedOverAllQty = calculateOverAllQtyLimit( + CartOrderDetails?.filter((_, index) => index !== editedProductIndex) + ); + if (calculatedOverAllQty + editedQty > maxQtyLimit) { + setMessageData( + `Overall Quantity Limit Exceeds than ${maxQtyLimit}` + ); setMessageType('warning'); return; } @@ -722,11 +742,12 @@ const BSBillingEditQuantity = (props) => { newPrice, overrideQty = null ) => { - const editedQty = overrideQty !== null - ? overrideQty - : props?.Productdata?.ScaleType !== 'weight' - ? parseInt(Quantity) - : props.Productdata.OrderQty; + const editedQty = + overrideQty !== null + ? overrideQty + : props?.Productdata?.ScaleType !== 'weight' + ? parseInt(Quantity) + : props.Productdata.OrderQty; const addFirst = BillOrderPre === 'Y'; const isExistsInFreeProdList = FreeProdList?.find( (product) => @@ -750,7 +771,7 @@ const BSBillingEditQuantity = (props) => { return ( cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OfferMessage?.[0]?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && cartItem?.OfferMode === editedProduct?.OfferMode && cartItem?.BookingTypeName !== editedProduct?.BookingTypeName ); @@ -884,7 +905,7 @@ const BSBillingEditQuantity = (props) => { cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OrderRate === editedProduct?.OrderRate && cartItem?.BookingTypeName !== - editedProduct?.BookingTypeName && + editedProduct?.BookingTypeName && !cartItem?.OfferMode && cartItem?.Offer === 0 ); @@ -898,7 +919,7 @@ const BSBillingEditQuantity = (props) => { cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OrderRate === editedProduct?.OrderRate && cartItem?.BookingTypeName !== - editedProduct?.BookingTypeName && + editedProduct?.BookingTypeName && cartItem?.OfferMode === editedProduct?.OfferMode && cartItem?.Offer > 0 ); @@ -1031,7 +1052,7 @@ const BSBillingEditQuantity = (props) => { ) ) && product?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && product?.OfferMode === editedProduct?.OfferMode ) { const freeQty = @@ -1064,7 +1085,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1147,7 +1168,7 @@ const BSBillingEditQuantity = (props) => { ) ) && product?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && product?.OfferMode === editedProduct?.OfferMode ) { return { @@ -1177,7 +1198,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1364,7 +1385,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1466,7 +1487,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1620,7 +1641,7 @@ const BSBillingEditQuantity = (props) => { ) && cartItem?.Offer && isFreeProductApplicable?.OfferId === - cartItem?.OfferMessage?.[0]?.OfferId + cartItem?.OfferMessage?.[0]?.OfferId ); } ); @@ -1909,11 +1930,11 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && product?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode) + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode) ) { return { ...product, @@ -1947,11 +1968,11 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode); + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -2092,7 +2113,7 @@ const BSBillingEditQuantity = (props) => { cartItem?.Offer > 0 && isFreeProductApplicable?.OfferMode === cartItem?.OfferMode && isFreeProductApplicable?.OfferId === - cartItem?.OfferMessage?.[0]?.OfferId + cartItem?.OfferMessage?.[0]?.OfferId ); } ); @@ -2195,11 +2216,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2270,12 +2291,12 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && product?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode) + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode) ) { return { ...product, @@ -2309,13 +2330,13 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode); + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -2397,11 +2418,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.InwardDtlId === - sameBookingTypeProduct.InwardDtlId && + sameBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - sameBookingTypeProduct.BookingTypeName && + sameBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - sameBookingTypeProduct.OrderRate && + sameBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2454,11 +2475,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.InwardDtlId === - sameBookingTypeProduct.InwardDtlId && + sameBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - sameBookingTypeProduct.BookingTypeName && + sameBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - sameBookingTypeProduct.OrderRate && + sameBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2547,11 +2568,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem?.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem?.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem?.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem?.OfferMode && cartItem?.Offer > 0 ) { @@ -2580,11 +2601,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2614,11 +2635,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2717,12 +2738,12 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && product?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode) + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode) ) { return { ...product, @@ -2756,12 +2777,12 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0] + ?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode); + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -2840,11 +2861,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.InwardDtlId === - sameBookingTypeProduct.InwardDtlId && + sameBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - sameBookingTypeProduct.BookingTypeName && + sameBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - sameBookingTypeProduct.OrderRate && + sameBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2903,11 +2924,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2979,12 +3000,12 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && product?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode) + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode) ) { return { ...product, @@ -3018,12 +3039,12 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0] + ?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode); + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -3178,17 +3199,17 @@ const BSBillingEditQuantity = (props) => { changeOrderCardDetails( CartOrderDetails?.map((i) => i?.InwardDtlId == updatedProduct?.InwardDtlId && - i?.BookingTypeName == updatedProduct?.BookingTypeName && - i?.localId === updatedProduct?.localId + i?.BookingTypeName == updatedProduct?.BookingTypeName && + i?.localId === updatedProduct?.localId ? { - ...updatedProduct, - Offer: 0, - OfferType: - updatedProduct?.Type === 'C' - ? updatedProduct?.OfferType - : null, - OfferMessage: null, - } + ...updatedProduct, + Offer: 0, + OfferType: + updatedProduct?.Type === 'C' + ? updatedProduct?.OfferType + : null, + OfferMessage: null, + } : i ) ) @@ -3224,10 +3245,10 @@ const BSBillingEditQuantity = (props) => { ((c?.OfferModeType && c?.OfferMode === 'B' ? true : c?.OfferMode !== 'B') && - c?.OfferMode !== 'P' && - c?.OfferMode !== 'C' && - c?.OfferMode !== 'O' && - c?.OfferMode !== 'L' + c?.OfferMode !== 'P' && + c?.OfferMode !== 'C' && + c?.OfferMode !== 'O' && + c?.OfferMode !== 'L' ? true : c?.Offer === 0); @@ -3481,16 +3502,21 @@ const BSBillingEditQuantity = (props) => { ); const editedProduct = { ...CartOrderDetails[editedProductIndex], - OrderQty: qty + OrderQty: qty, }; - await handleEditQuantity(editedProduct, editedProductIndex, editedProduct.OrderRate, qty); + await handleEditQuantity( + editedProduct, + editedProductIndex, + editedProduct.OrderRate, + qty + ); props.handleEditQuantityCancel(); setClearQuantity(false); }; const isKg = props?.Productdata?.Size == 1 && - ["KG", "KGS"].includes(props?.Productdata?.UomName?.toUpperCase()); + ['KG', 'KGS'].includes(props?.Productdata?.UomName?.toUpperCase()); return (
@@ -3589,23 +3615,30 @@ const BSBillingEditQuantity = (props) => { Packing - {isKg && ()} - + {isKg && ( + + )}
{RadioBtnSelection == 'Quantity' && ( <> -
+
{ + dispatch(changefocusStatusCust(!selectStatuscust)); + dispatch(changeCombofocus(false)); + }} + > @@ -3614,6 +3647,10 @@ const BSBillingEditQuantity = (props) => { type="number" value={Quantity} onChange={(e) => setQuantity(e.target.value)} + onBlur={() => { + dispatch(changefocusStatusCust(!selectStatuscust)); + dispatch(changeCombofocus(false)); + }} className="EditQuantity-Quantitybox" />
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx index adb7a6b..8a51da2 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx @@ -3859,7 +3859,8 @@ export default function BST1Payment() { )} {/* Customer Orders */} - {SelCustId && ( + {(SelCustId && tableOptions?.filter((item) => item.OptionName === 'PreviousBillFetch') + .length === 1) && ( {' '}
{ )} {/* Customer Orders */} - {SelCustId && ( + {(SelCustId && tableOptions?.filter((item) => item.OptionName === 'PreviousBillFetch') + .length === 1) && ( {' '}
{ const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails); if (calculatedOverAllQty + 1 > maxQtyLimit) { message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`); + return; + } + } else if (itemWiseLimitPreferenece) { + const inwardQtyMap = CartOrderDetails.reduce((acc, curr) => { + const inwardId = curr.InwardDtlId; + const qty = Number(curr.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log("Final InwardDtlId Qty Map:", inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + message.warning(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); return; } } diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx index d059d55..bc3de2f 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx @@ -100,6 +100,11 @@ const BSBillingTable3 = () => { setting?.SettingIdName?.toLowerCase() === 'decimal' && setting?.SettingValue === 'Y' ); + const salesaskiosk = preferenceDatas?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'salespageaskiosk' && + setting?.SettingValue === 'Y' + ); const SessionData = useSelector(StoredSessionData); const BranchId = SessionData?.BranchId; const AppId = SessionData?.AppId; @@ -366,8 +371,6 @@ const BSBillingTable3 = () => { await dispatch(changeUnpaidData(false)); await dispatch(changeReorderHoldDetails({})); await dispatch(changeReorderProductDetails([])); - await dispatch(ChangeSelectedCustDisable(false)); - await dispatch(changeSelectedOption(false)); await dispatch(changeBookingType(defaultBookingType || 'TakeAway')); // await dispatch(changeholddata([])) await dispatch(changeOrderType()); @@ -2357,7 +2360,7 @@ const BSBillingTable3 = () => { fontSize: '16px', }} > - {tableData?.length > 0 ? ( + {(tableData?.length > 0)? ( import('../../UtillComponents/PaymentGatewayEmbedded.jsx') ); @@ -269,6 +270,7 @@ const BSBillingTable3Pay = () => { const previousOrderOfferDetails = useSelector( GlobalPreviousOrderOfferDetails ); + const CustomerMobileNumber = useSelector(GlobalSelCustId, shallowEqual); const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const FreeProdList = useSelector(GlobalFreeProdList); const offerAppliedProducts = useSelector( @@ -301,6 +303,7 @@ const BSBillingTable3Pay = () => { const FontFamily = useSelector(GlobalSelectedFont); const GetCustId = useSelector(GlobalCustId); const SelCustId = useSelector(GlobalSelCustId); + console.log(GetCustId, SelCustId, 'GetCustId, SelCustId'); const selOption = useSelector(GlobalSelOption); const SelectedTableDetails = useSelector(GlobalSelectedTableDetails); const defaultBookingType = useSelector(GlobalDefaultBookingType); @@ -378,6 +381,17 @@ const BSBillingTable3Pay = () => { const [PrintOrderDetails, setPrintOrderDetails] = useState([]); const OrderCardDetail = useSelector(GlobalOrderCardDetails); const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false); + const [CustomerOtpmodalopen, setCustomerOtpmodalopen] = useState(false); + const isOtpEnabled = SettingDataSelector?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'kioskotp' && + setting?.SettingValue === 'Y' + ); + const salesaskiosk = SettingDataSelector?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'salespageaskiosk' && + setting?.SettingValue === 'Y' + ); console.log(OrderCardDetail, 'OrderCardDetail'); //Total calculation @@ -707,6 +721,10 @@ const BSBillingTable3Pay = () => { // dispatch(getPrintSelectionComponentData(Data1)).unwrap(); }, []); + useEffect(() => { + (!CustomerMobileNumber && isOtpEnabled && salesaskiosk) && setCustomerOtpmodalopen(true); + }, [PrintOrderDetails, CustomerMobileNumber]); + useEffect(() => { const getPrintData = async () => { try { @@ -875,7 +893,7 @@ const BSBillingTable3Pay = () => { //mohan end useEffect(() => { - if (OrderCardDetail?.length <= 0) { + if (OrderCardDetail?.length <= 0 && !salesaskiosk) { dispatch(changeCustomerID(null)); dispatch(changeSelectedCustId(null)); dispatch(changeSelectedOption(null)); @@ -1072,9 +1090,9 @@ const BSBillingTable3Pay = () => { setDefaultPaymentMode([]); } }; - if (salesBillEdit) { + // if (salesBillEdit) { setDefaultPaymentOption(); - } + // } }, [defaultPaymentTrigger, salesBillEdit]); const TokenPrint = async (index) => { @@ -3791,7 +3809,8 @@ const BSBillingTable3Pay = () => {
)} {/* Customer Orders */} - {SelCustId && ( + {(SelCustId && tableOptions?.filter((item) => item.OptionName === 'PreviousBillFetch') + .length === 1) && ( {' '}
{ } /> )} + + {(CustomerOtpmodalopen && isOtpEnabled && salesaskiosk) && ( + setCustomerOtpmodalopen(false)} + /> + )} ); diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx index 47011ad..0bc7c84 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx @@ -3920,7 +3920,8 @@ const BSBilling4Payment = () => { )} {/* Customer Orders */} - {SelCustId && ( + {(SelCustId && tableOptions?.filter((item) => item.OptionName === 'PreviousBillFetch') + .length === 1) && ( {' '}
import('../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx') ); -const OtherServiceMobilePrint = lazy( - () => import('../../BookingFunctionality/OtherServiceMobilePrint.jsx') -); const BSOtherServiceClaim = lazy( () => import('../../UtillComponents/BSOtherServiceClaim.jsx') ); @@ -4165,7 +4163,8 @@ const BSBillingTable5 = () => { '' )} {/* Customer Orders */} - {SelCustId && ( + {(SelCustId && tableOptions?.filter((item) => item.OptionName === 'PreviousBillFetch') + .length === 1) && ( {' '}
{ setMessageType('warning'); return; } + } else if (itemWiseLimitPreferenece) { + const inwardQtyMap = TableData.reduce((acc, curr) => { + const inwardId = curr?.InwardDtlId; + const qty = Number(curr?.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log("Final InwardDtlId Qty Map:", inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + setMessageData(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); + setMessageType('warning'); + return; + } } } const OtherOrderDatas = TableData?.filter( diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx index e9afb8d..bf21da6 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx @@ -4152,7 +4152,8 @@ const BST6Payment = () => { '' )} {/* Customer Orders */} - {SelCustId && ( + {(SelCustId && tableOptions?.filter((item) => item.OptionName === 'PreviousBillFetch') + .length === 1) && ( {' '}
{ )} {/* Customer Orders */} - {SelCustId && ( + {(SelCustId && tableOptions?.filter((item) => item.OptionName === 'PreviousBillFetch') + .length === 1) && ( {' '}
{ const formRef = useRef(null); const dispatch = useDispatch(); const [messageType, setMessageType] = useState(null); const [messageData, setMessageData] = useState(null); const CartOrderDetails = useSelector(GlobalOrderCardDetails); + const selectStatuscust = useSelector(GlobalfocusStatusCust); const [DeviceDetailOpen, setDeviceDetailOpen] = useState(props.DeviceDetails); const [ProductDetail, setProductDetail] = useState(props.ProductDetail); const [RadioBtnSelection, setRadioBtnSelection] = useState('Serial'); @@ -51,8 +55,8 @@ const BSImeiDetails = (props) => { ); formRef?.current?.setFieldsValue({ - description: productidentifier?.[0]?.Description || "", - }) + description: productidentifier?.[0]?.Description || '', + }); }, []); const CloseDeviceDetailModal = () => { props.handleDeviceDetailClose(); @@ -72,8 +76,7 @@ const BSImeiDetails = (props) => { } else { setSerialNumberList([...SerialNumberList, e]); } - } - else { + } else { setMessageType('error'); setMessageData('Already Selected '); } @@ -94,7 +97,6 @@ const BSImeiDetails = (props) => { setMessageData('you cant enter more than Order Qty'); } formRef.current?.resetFields(['SerialNumbertext', 'IMEINumbertext']); - }; const IMEINumberOnchange = (e) => { @@ -139,8 +141,10 @@ const BSImeiDetails = (props) => { setMessageType(null); }, []); const AddDeviceDetails = () => { - - console.log(formRef?.current?.getFieldsValue, "formRef?.current?.getFieldsValue") + console.log( + formRef?.current?.getFieldsValue, + 'formRef?.current?.getFieldsValue' + ); const maxLength = Math.max(SerialNumberList.length, IMEINumberList.length); // Create the new object array const IdentifyDetails = Array.from({ length: maxLength }, (_, index) => { @@ -165,17 +169,16 @@ const BSImeiDetails = (props) => { cartItem // if the item is already in the cart, increase the quantity of the item ) => cartItem.ProdId === ProductDetail.ProdId && - cartItem.InwardDtlId === ProductDetail.InwardDtlId && - cartItem?.OrderRate === ProductDetail?.OrderRate && - cartItem?.BookingTypeName === ProductDetail?.BookingTypeName + cartItem.InwardDtlId === ProductDetail.InwardDtlId && + cartItem?.OrderRate === ProductDetail?.OrderRate && + cartItem?.BookingTypeName === ProductDetail?.BookingTypeName ? { ...cartItem, ProductIdentifierDtls: IdentifyDetails } : cartItem // otherwise, return the cart item ) ) ); - formRef?.current?.resetFields() + formRef?.current?.resetFields(); CloseDeviceDetailModal(); - }; console.log(ProductDetail, 'ProductDetaildevice'); return ( @@ -239,7 +242,7 @@ const BSImeiDetails = (props) => { {RadioBtnSelection == 'Serial' && (
- {ProductDetail?.FullProductIdentifierDtls?.length > 0 && + {ProductDetail?.FullProductIdentifierDtls?.length > 0 && ( { onChangeFunction={(e) => SerialNumberOnchange(e)} /> - - } + )} { - await validateSafeInput(value); return Promise.resolve(); }, }, ]} > - { - // if (['e', 'E', '+', '-', '.'].includes(e.key)) { - // e.preventDefault(); - // } - // }} - /> +
{ + dispatch(changefocusStatusCust(!selectStatuscust)); + dispatch(changeCombofocus(false)); + }} + > + { + dispatch(changefocusStatusCust(!selectStatuscust)); + dispatch(changeCombofocus(false)); + }} + /> +
{
)} - {RadioBtnSelection == 'IMEI' && (
- {ProductDetail?.FullProductIdentifierDtls?.length > 0 && + {ProductDetail?.FullProductIdentifierDtls?.length > 0 && ( { className="field-DropDown" onChangeFunction={(e) => IMEINumberOnchange(e)} /> - } + + )} { - await validateSafeInput(value); return Promise.resolve(); }, }, ]} > - { - // if (['e', 'E', '+', '-', '.'].includes(e.key)) { - // e.preventDefault(); - // } - // }} - /> +
{ + dispatch(changefocusStatusCust(!selectStatuscust)); + dispatch(changeCombofocus(false)); + }} + > + { + dispatch(changefocusStatusCust(!selectStatuscust)); + dispatch(changeCombofocus(false)); + }} + /> +
{
)} -
+
Description..} @@ -411,7 +423,6 @@ const BSImeiDetails = (props) => {
-
{ icon={} >
-
+
} handleCancel={CloseDeviceDetailModal} /> -
+
); }; export default BSImeiDetails; diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx index a7ff4b7..5df19c0 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx @@ -190,7 +190,7 @@ import { getExpireProductsList, getLowStockAlertProductsList, } from '../../../../../Features/ProductPage/ProductPage.js'; - + // Jsx Files const CustomerOrders = lazy( () => import('../../BookingFunctionality/CustomerOrders.jsx') @@ -198,13 +198,9 @@ const CustomerOrders = lazy( const PaymentGatewayEmbedded = lazy( () => import('../../UtillComponents/PaymentGatewayEmbedded.jsx') ); -const MobileMultiPdfPrintTrigger = lazy( - () => import('../../UtillComponents/MobileMultiPdfPrintTrigger.jsx') -); -const OtherServicePrintStyle1 = lazy( - () => - import('../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx') -); +import MobileMultiPdfPrintTrigger from '../../UtillComponents/MobileMultiPdfPrintTrigger.jsx'; +import OtherServicePrintStyle1 from '../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx'; + import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx'; const QrinScreen = lazy( @@ -215,9 +211,8 @@ const SMSShare = lazy(() => import('../../../../WhatsAppShare/SmsShare')); const WhatsAppShare = lazy( () => import('../../../../WhatsAppShare/whatsAppShare') ); -const TokensinglePrint = lazy( - () => import('../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint') -); + +import TokensinglePrint from '../../../../paymentpdfPage/TokenOnlyPrints/TokeninsinglePrint'; import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; // Icons File @@ -2840,7 +2835,10 @@ const StandardTablePayment = () => { setPaybtnselected(PaymentOptionsModeId); setQrCode(false); setUpinotSelected(false); - if (holdCheckedSalesSetup || NavBarOptions?.some((e) => e?.OptionName == 'Hold')) { + if ( + holdCheckedSalesSetup || + NavBarOptions?.some((e) => e?.OptionName == 'Hold') + ) { getHolddata(); } setCurrentOrderNetAmount(0); @@ -3527,7 +3525,8 @@ const StandardTablePayment = () => { )} {/* Customer Orders */} - {SelCustId && ( + {(SelCustId && tableOptions?.filter((item) => item.OptionName === 'PreviousBillFetch') + .length === 1) && ( {' '}
{ )} {/* Customer Orders */} - {SelCustId && ( + {(SelCustId && tableOptions?.filter((item) => item.OptionName === 'PreviousBillFetch') + .length === 1) && ( {' '}
offer?.FreeProductsList?.FreeProdId === - matchingFreeProduct?.FreeProdId && + matchingFreeProduct?.FreeProdId && offer?.TableName === matchingFreeProduct?.TableName && offer?.TableUniqueName === - matchingFreeProduct?.TableUniqueName && + matchingFreeProduct?.TableUniqueName && offer?.OfferId === matchingFreeProduct?.OfferId && offer?.OfferMode === matchingFreeProduct?.OfferMode && offer?.FreeProductsList?.ProdVariantDetails?.[0] @@ -1695,7 +1695,7 @@ export default function BSC1Search(props) { 0 || - record.StockCount === 'Stock Not Maintained' + record.StockCount === 'Stock Not Maintained' ? { color: '#000', cursor: 'pointer' } : { color: '#f49898', cursor: 'not-allowed' } } @@ -1725,7 +1725,7 @@ export default function BSC1Search(props) { 0 || - record.StockCount === 'Stock Not Maintained' + record.StockCount === 'Stock Not Maintained' ? { color: '#000', cursor: 'pointer' } : { color: '#f49898', cursor: 'not-allowed' } } @@ -1755,7 +1755,7 @@ export default function BSC1Search(props) { 0 || - record.StockCount === 'Stock Not Maintained' + record.StockCount === 'Stock Not Maintained' ? { color: '#000', cursor: 'pointer' } : { color: '#f49898', cursor: 'not-allowed' } } @@ -1919,11 +1919,11 @@ export default function BSC1Search(props) { StockCount: qtydata?.ProductDetail?.[0]?.StockAvailable === 'Y' ? returnVariantStock( - qtydata?.ProductDetail?.[QtyIndex]?.ProdId, - item?.OverAllQty, - CartOrderDetails, - item?.ProdVariantName - ) + qtydata?.ProductDetail?.[QtyIndex]?.ProdId, + item?.OverAllQty, + CartOrderDetails, + item?.ProdVariantName + ) : 'Stock Not Maintained', }); }); @@ -1939,17 +1939,17 @@ export default function BSC1Search(props) { 'Batch No': item?.BatchRef, StockCount: onePeiceFlow ? returnCountStock( - item?.ProdId, - item?.BalanceQty, - CartOrderDetails, - item?.InwardDtlId - ) * item?.NoOfPcs + item?.ProdId, + item?.BalanceQty, + CartOrderDetails, + item?.InwardDtlId + ) * item?.NoOfPcs : returnCountStock( - item?.ProdId, - item?.BalanceQty, - CartOrderDetails, - item?.InwardDtlId - ), + item?.ProdId, + item?.BalanceQty, + CartOrderDetails, + item?.InwardDtlId + ), 'Stock Date': StockDate(item?.InwardDate), Price: onePeiceFlow ? item?.OnePcsPrice : item?.SellPrice, ExpDate: @@ -2003,13 +2003,13 @@ export default function BSC1Search(props) { (cartItem) => cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && cartItem?.OrderRate === - item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - VarientIndex - ]?.StockDetails?.[0]?.SellPrice && + item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + VarientIndex + ]?.StockDetails?.[0]?.SellPrice && !cartItem?.SalesId ); @@ -2018,9 +2018,9 @@ export default function BSC1Search(props) { (cartItem) => cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && // (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice) !cartItem?.SalesId ); @@ -2062,11 +2062,11 @@ export default function BSC1Search(props) { (cartItem) => cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[0]?.InwardDtlId && + item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] + ?.StockDetails?.[0]?.InwardDtlId && cartItem?.OrderRate === - item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[0]?.SellPrice && + item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] + ?.StockDetails?.[0]?.SellPrice && !cartItem?.SalesId ); @@ -2075,9 +2075,9 @@ export default function BSC1Search(props) { (cartItem) => cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && // (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice) !cartItem?.SalesId ); @@ -2155,13 +2155,13 @@ export default function BSC1Search(props) { (cartItem) => cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - index.key - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + index.key + ]?.StockDetails?.[0]?.InwardDtlId && cartItem?.OrderRate === - qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - index.key - ]?.StockDetails?.[0]?.SellPrice && + qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + index.key + ]?.StockDetails?.[0]?.SellPrice && !cartItem?.SalesId ); @@ -2169,11 +2169,11 @@ export default function BSC1Search(props) { let Isincartonepc = CartOrderDetails?.filter( (cartItem) => cartItem?.ProdId === - qtydata?.ProductDetail?.[QtyIndex]?.ProdId && + qtydata?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && // (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice) !cartItem?.SalesId ); @@ -2237,11 +2237,11 @@ export default function BSC1Search(props) { (cartItem) => cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key] - ?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key] + ?.StockDetails?.[0]?.InwardDtlId && cartItem?.OrderRate === - qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key] - ?.StockDetails?.[0]?.SellPrice && + qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key] + ?.StockDetails?.[0]?.SellPrice && !cartItem?.SalesId ); @@ -2250,9 +2250,9 @@ export default function BSC1Search(props) { (cartItem) => cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ - VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[ + VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && // (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice) !cartItem?.SalesId ); @@ -2327,15 +2327,15 @@ export default function BSC1Search(props) { let Isincart = CartOrderDetails?.find( (cartItem) => cartItem?.ProdId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ - item?.VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ + item?.VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && cartItem?.OrderRate === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ - item?.VarientIndex - ]?.StockDetails?.[0]?.SellPrice && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ + item?.VarientIndex + ]?.StockDetails?.[0]?.SellPrice && !cartItem?.SalesId ); @@ -2343,11 +2343,11 @@ export default function BSC1Search(props) { let Isincartonepc = CartOrderDetails?.filter( (cartItem) => cartItem?.ProdId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ - item?.VarientIndexs - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ + item?.VarientIndexs + ]?.StockDetails?.[0]?.InwardDtlId && // (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice) !cartItem?.SalesId ); @@ -2425,15 +2425,15 @@ export default function BSC1Search(props) { let Isincart = CartOrderDetails?.find( (cartItem) => cartItem?.ProdId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ - item?.VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ + item?.VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && cartItem?.OrderRate === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ - item?.VarientIndex - ]?.StockDetails?.[0]?.SellPrice && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ + item?.VarientIndex + ]?.StockDetails?.[0]?.SellPrice && !cartItem?.SalesId ); @@ -2441,11 +2441,11 @@ export default function BSC1Search(props) { let Isincartonepc = CartOrderDetails?.filter( (cartItem) => cartItem?.ProdId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId && cartItem?.InwardDtlId === - qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ - item?.VarientIndex - ]?.StockDetails?.[0]?.InwardDtlId && + qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[ + item?.VarientIndex + ]?.StockDetails?.[0]?.InwardDtlId && // (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice) !cartItem?.SalesId ); @@ -2565,7 +2565,7 @@ export default function BSC1Search(props) { const isKgsProduct = (a?.ProductDetail?.[QtyIndex]?.UomName?.toLowerCase() === 'kgs' || a?.ProductDetail?.[QtyIndex]?.UomName?.toLowerCase() === - 'kg'?.toLowerCase()) && + 'kg'?.toLowerCase()) && a?.ProductDetail?.[QtyIndex]?.Size === '1'; if ( @@ -2578,11 +2578,11 @@ export default function BSC1Search(props) { parseFloat( onePcs ? (a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[stockIndex]?.OnePcsPrice / - 1000) * - (parseFloat(WeightScaleWeight) * 1000) + ?.StockDetails?.[stockIndex]?.OnePcsPrice / + 1000) * + (parseFloat(WeightScaleWeight) * 1000) : a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[stockIndex]?.SellPrice / 1000 + ?.StockDetails?.[stockIndex]?.SellPrice / 1000 ) * (parseFloat(WeightScaleWeight) * 1000); let data = { @@ -2638,9 +2638,9 @@ export default function BSC1Search(props) { ?.StockDetails?.[stockIndex]?.InwardId, MRP: onePcs ? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[stockIndex]?.OnePcsPrice + ?.StockDetails?.[stockIndex]?.OnePcsPrice : a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[stockIndex]?.MRP, + ?.StockDetails?.[stockIndex]?.MRP, FullProductIdentifierDtls: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] ?.StockDetails?.[stockIndex]?.ProductIdentifierDtls, @@ -2748,19 +2748,19 @@ export default function BSC1Search(props) { ?.StockDetails?.[stockIndex]?.InwardId, MRP: onePcs ? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[stockIndex]?.OnePcsPrice + ?.StockDetails?.[stockIndex]?.OnePcsPrice : a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[stockIndex]?.MRP, + ?.StockDetails?.[stockIndex]?.MRP, OrderRate: onePcs ? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[stockIndex]?.OnePcsPrice + ?.StockDetails?.[stockIndex]?.OnePcsPrice : a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[stockIndex]?.SellPrice, + ?.StockDetails?.[stockIndex]?.SellPrice, SellingPrice: onePcs ? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[stockIndex]?.OnePcsPrice + ?.StockDetails?.[stockIndex]?.OnePcsPrice : a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[stockIndex]?.SellPrice, + ?.StockDetails?.[stockIndex]?.SellPrice, SuppId: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] ?.StockDetails?.[stockIndex]?.SuppId, @@ -2851,6 +2851,40 @@ export default function BSC1Search(props) { setMessageType('warning'); return; } + } else if (itemWiseLimitPreferenece) { + + const inwardQtyMap = CartOrderDetails.reduce((acc, curr) => { + const inwardId = curr?.InwardDtlId; + const qty = Number(curr?.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log("Final InwardDtlId Qty Map:", inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + setMessageData(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); + setMessageType('warning'); + return; + } } } @@ -2944,15 +2978,15 @@ export default function BSC1Search(props) { const isExistsInFreeProdList = hasOffer ? FreeProdList?.filter( - (f) => - f?.FreeProdId === item?.ProdId && - f?.ProdVariantDetails?.some((variant) => - variant?.StockDetails?.some( - (stock) => stock?.FreeInwardDtlId === item?.InwardDtlId - ) - ) && - f?.RemainingQty > 0 - ) + (f) => + f?.FreeProdId === item?.ProdId && + f?.ProdVariantDetails?.some((variant) => + variant?.StockDetails?.some( + (stock) => stock?.FreeInwardDtlId === item?.InwardDtlId + ) + ) && + f?.RemainingQty > 0 + ) : []; const calculateTaxAmounts = (qty, rate, taxPercentage) => { @@ -3019,10 +3053,10 @@ export default function BSC1Search(props) { ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' ? true : cartItem?.OfferMode !== 'B') && - cartItem?.OfferMode !== 'P' && - cartItem?.OfferMode !== 'C' && - cartItem?.OfferMode !== 'O' && - cartItem?.OfferMode !== 'L' + cartItem?.OfferMode !== 'P' && + cartItem?.OfferMode !== 'C' && + cartItem?.OfferMode !== 'O' && + cartItem?.OfferMode !== 'L' ? true : cartItem?.Offer === 0) ); @@ -3039,10 +3073,10 @@ export default function BSC1Search(props) { (cartItem) => itemMatchCondition(cartItem) && (cartItem?.OfferMode !== 'B' && - cartItem?.OfferMode !== 'P' && - cartItem?.OfferMode !== 'C' && - cartItem?.OfferMode !== 'O' && - cartItem?.OfferMode !== 'L' + cartItem?.OfferMode !== 'P' && + cartItem?.OfferMode !== 'C' && + cartItem?.OfferMode !== 'O' && + cartItem?.OfferMode !== 'L' ? true : cartItem?.Offer === 0) ); @@ -3056,10 +3090,10 @@ export default function BSC1Search(props) { ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' ? true : cartItem?.OfferMode !== 'B') && - cartItem?.OfferMode !== 'P' && - cartItem?.OfferMode !== 'L' && - cartItem?.OfferMode !== 'C' && - cartItem?.OfferMode !== 'O' + cartItem?.OfferMode !== 'P' && + cartItem?.OfferMode !== 'L' && + cartItem?.OfferMode !== 'C' && + cartItem?.OfferMode !== 'O' ? true : cartItem?.Offer === 0) ) @@ -3070,10 +3104,10 @@ export default function BSC1Search(props) { !( itemMatchCondition(cartItem) && (cartItem?.OfferMode !== 'B' && - cartItem?.OfferMode !== 'P' && - cartItem?.OfferMode !== 'L' && - cartItem?.OfferMode !== 'C' && - cartItem?.OfferMode !== 'O' + cartItem?.OfferMode !== 'P' && + cartItem?.OfferMode !== 'L' && + cartItem?.OfferMode !== 'C' && + cartItem?.OfferMode !== 'O' ? true : cartItem?.Offer === 0) ) @@ -3146,8 +3180,8 @@ export default function BSC1Search(props) { isItemInCart, item?.OtherProduct === 'Others' || item?.ScaleType === 'weight' ? ( - (item?.OrderQty || 0) + parseFloat(isItemInCart?.OrderQty) - )?.toFixed(3) + (item?.OrderQty || 0) + parseFloat(isItemInCart?.OrderQty) + )?.toFixed(3) : null ); const updatedData = addFirst @@ -3274,9 +3308,9 @@ export default function BSC1Search(props) { isItemInCartHold, item?.OtherProduct === 'Others' || item?.ScaleType === 'weight' ? ( - (item?.OrderQty || 0) + - parseFloat(isItemInCartHold?.OrderQty) - )?.toFixed(3) + (item?.OrderQty || 0) + + parseFloat(isItemInCartHold?.OrderQty) + )?.toFixed(3) : null ); const updatedData = addFirst @@ -3528,14 +3562,14 @@ export default function BSC1Search(props) { updatedCartData = cartData.map((item, idx) => idx === indexToCheck ? { - ...item, - Offer: null, - OfferMessage: undefined, - OfferMode: undefined, - OfferModeType: false, - OfferType: undefined, - OfferValue: null, - } + ...item, + Offer: null, + OfferMessage: undefined, + OfferMode: undefined, + OfferModeType: false, + OfferType: undefined, + OfferValue: null, + } : item ); } @@ -3586,8 +3620,8 @@ export default function BSC1Search(props) { ...item, Offer: sameProduct || - bestOffer?.OfferMode === 'I' || - bestOffer?.OfferMode === 'Q' + bestOffer?.OfferMode === 'I' || + bestOffer?.OfferMode === 'Q' ? bestOffer?.OfferAmount || item.Offer : item.Offer || bestOffer?.OfferAmount, OfferType: item?.OfferType || bestOffer?.OfferType, @@ -3604,10 +3638,10 @@ export default function BSC1Search(props) { ((c?.OfferModeType && c?.OfferMode === 'B' ? true : c?.OfferMode !== 'B') && - c?.OfferMode !== 'P' && - c?.OfferMode !== 'C' && - c?.OfferMode !== 'O' && - c?.OfferMode !== 'L' + c?.OfferMode !== 'P' && + c?.OfferMode !== 'C' && + c?.OfferMode !== 'O' && + c?.OfferMode !== 'L' ? true : c?.Offer === 0); @@ -3915,10 +3949,10 @@ export default function BSC1Search(props) { return FreeProdList.map((f, i) => i === index ? { - ...existing, - ...newFreeProd, - ProdVariantDetails: existing.ProdVariantDetails, - } + ...existing, + ...newFreeProd, + ProdVariantDetails: existing.ProdVariantDetails, + } : f ); } else { @@ -3988,7 +4022,7 @@ export default function BSC1Search(props) { const cycleSize = buyQty + getQty; const fullCycles = Math.floor( freeCartItem?.reduce((acc, fc) => acc + (fc?.OrderQty || 0), 0) / - cycleSize + cycleSize ); const totalFreeQty = fullCycles * getQty; @@ -4591,15 +4625,15 @@ export default function BSC1Search(props) { {option.ProductDetail?.filter( (item) => item.OnePcsAvailable == 'Y' ).length !== 0 && ( - { - setOnePeiceFlow(true); - }} - /> - )} + { + setOnePeiceFlow(true); + }} + /> + )}
), @@ -4633,7 +4667,7 @@ export default function BSC1Search(props) { OnfocusTrue()} + // onClick={() => OnfocusTrue()} />
{ProductSearch?.length > 5 && @@ -4724,8 +4758,8 @@ export default function BSC1Search(props) { { setMessageType('warning'); return; } + } else if (itemWiseLimitPreferenece) { + const inwardQtyMap = CartOrderDetails.reduce((acc, curr) => { + const inwardId = curr?.InwardDtlId; + const qty = Number(curr?.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = Qty || 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log('Final InwardDtlId Qty Map:', inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + setMessageData(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); + setMessageType('warning'); + return; + } } } diff --git a/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar1.jsx b/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar1.jsx index c35dc25..237b9da 100644 --- a/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar1.jsx +++ b/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar1.jsx @@ -157,6 +157,7 @@ import { FaParking } from 'react-icons/fa'; import { isMobile } from 'react-device-detect'; import { DefaultModal } from '../../../../Components/Modal/DefaultModal.jsx'; import '../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss'; +import { RiFullscreenExitFill, RiFullscreenFill } from 'react-icons/ri'; const subDirectory = import.meta.env.ENV_BASE_URL; const commonUrl = import.meta.env.ENV_COMMON_BASE_URL; @@ -263,6 +264,30 @@ const BSNavbar1 = (props) => { setAccIsOpen(false); } }; + const [isFullscreen, setIsFullscreen] = useState(false); + + + + const handleFullscreen = useCallback(async () => { + if (!isFullscreen) { + try { + await document.documentElement.requestFullscreen(); + setIsFullscreen(true); + } catch (error) { + console.error('Fullscreen error:', error); + } + } else { + try { + if (document.fullscreenElement) { + await document.exitFullscreen(); + } + setIsFullscreen(false); + } catch (error) { + console.error('Exit fullscreen error:', error); + } + } + }, [isFullscreen]); + useEffect(() => { if (!FeatureAddonData?.FeatureDtls?.length) return; @@ -967,6 +992,20 @@ const BSNavbar1 = (props) => { {formattedDate}
+ + +
+ {isFullscreen ? : } +
+
+
@@ -1168,7 +1207,7 @@ const BSNavbar1 = (props) => {
} trigger="click" - placement="left" + placement="left" open={open} onOpenChange={handleOpenChange} > diff --git a/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar2.jsx b/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar2.jsx index d13e7a4..9e5c595 100644 --- a/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar2.jsx +++ b/src/Pages/BookingScreen/Components/BSNavbar/BSNavbar2.jsx @@ -98,7 +98,7 @@ import { getUserProfile, userDataByUserId, } from '../../../../Features/UserAccount/userData.js'; - import { TbSettingsSearch } from 'react-icons/tb'; +import { TbSettingsSearch } from 'react-icons/tb'; import { FaParking } from 'react-icons/fa'; import BSNavBarUserInfo from './BSNavBarUserInfo'; import { OtherServicesCardlistdata } from '../../../../Features/OtherServices/OtherServices.js'; @@ -128,8 +128,8 @@ const FeaturesFunctionalities = lazy( const BSCustomerSelect = lazy( () => import('../UtillComponents/BSSelectCustomer.jsx') ); -// Scss -import '../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar2.scss'; + import '../../../../Styles/BookingScreen/Components/BSNavbar/BSNavbar2.scss'; +import { RiFullscreenExitFill, RiFullscreenFill } from 'react-icons/ri'; const subDirectory = import.meta.env.ENV_BASE_URL; const commonUrl = import.meta.env.ENV_COMMON_BASE_URL; @@ -239,6 +239,27 @@ const BSNavbar2 = () => { item.SettingIdName === 'VerifyProduct' && item?.SettingValue === 'Y' ); + const [isFullscreen, setIsFullscreen] = useState(false); + const handleFullscreen = useCallback(async () => { + if (!isFullscreen) { + try { + await document.documentElement.requestFullscreen(); + setIsFullscreen(true); + } catch (error) { + console.error('Fullscreen error:', error); + } + } else { + try { + if (document.fullscreenElement) { + await document.exitFullscreen(); + } + setIsFullscreen(false); + } catch (error) { + console.error('Exit fullscreen error:', error); + } + } + }, [isFullscreen]); + useEffect(() => { if (!FeatureAddonData?.FeatureDtls?.length) return; @@ -871,11 +892,10 @@ const BSNavbar2 = () => { )} )} -
- - {SalesMode?.SettingValue === 'Y' && !OtherServicesglobal && ( - - )} +
+ {SalesMode?.SettingValue === 'Y' && !OtherServicesglobal && ( + + )}
{!OtherServicesglobal && ScanLayoutScreen?.SettingValue === 'Y' && ( @@ -1280,6 +1300,18 @@ const BSNavbar2 = () => {
)} + + +
+ {isFullscreen ? : } +
+
+ {isMobile && (
{ + const SettingDataSelector = useSelector(PreferenceData); + const CustomerMobileNumber = useSelector(globalKioskCustomerMobileNo); + + const SessionData = useSelector(StoredSessionData, shallowEqual); + const dispatch = useDispatch(); + const [number, setNumber] = useState( + CustomerMobileNumber ? CustomerMobileNumber : '' + ); + const [messageType, setMessageType] = useState(null); + const [messageData, setMessageData] = useState(null); + const [canResend, setCanResend] = useState(true); + const [otpInput, setOtpInput] = useState(['', '', '', '']); + const [otpIndex, setOtpIndex] = useState(0); + const [otpSent, setOtpSent] = useState(false); + const [otpVerifed, setOtpVerified] = useState(false); + const [otpNumber, setOTPNumber] = useState(null); + const [maxLimitExceeded, setMaxLimitExceeded] = useState(null); + const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null); + const isOtpEnabled = SettingDataSelector?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'kioskotp' && + setting?.SettingValue === 'Y' + ); + const isTimeLimitEnabled = SettingDataSelector?.[0]?.SettingDtlDetails?.find( + (setting) => + (setting?.SettingIdName?.toLowerCase() === 'hours' || + setting?.SettingIdName?.toLowerCase() === 'minutes') && + setting?.SettingValue === 'Y' + ); + + useEffect(() => { + isIndianMobile(number) && fetchCustomerDetails(number); + }, [number]); + useEffect(() => { + if (otpInput.every((input) => input !== '')) { + verifyOtp(); + } + }, [otpInput]); + const fetchCustomerDetails = async (number) => { + const response = await dispatch( + getAddCustomerDetails({ + MobileNo: number, + AppId: SessionData.AppId, + CompId: SessionData.CompId, + BranchId: SessionData.BranchId, + }) + )?.unwrap(); + if (response?.data?.statusCode === 1) { + console.log( + 'response?.data?.CustomerId', + response?.data, + response?.data?.data?.[0]?.CustId + ); + dispatch(changeCustomerID(response?.data?.data?.[0]?.CustId)); + let custvalues = { + value: number, + label: response?.data?.data?.[0]?.CustName || number, + CustId: response?.data?.data?.[0]?.CustId, + ...response?.data?.data?.[0], + }; + // {value: '8428086416', label: 'mohan', CustId: 'CUST1-281-437-74', CustName: 'mohan', Address1: undefined, …} + await dispatch(changeSelectedOption(custvalues)); + await dispatch(changeSelectedCustId(response?.data?.data?.[0]?.CustId)); + await dispatch( + ChangeSelectedCustDisable(true) + ); + }else{ + let postdata = { + "CustMobile":number, + "CustomerProfile": null, + "AppId": SessionData.AppId, + "CompId": SessionData.CompId, + "BranchId": SessionData.BranchId, + "CreatedBy": SessionData.UserId, + "InitialOutStanding": null, + "OfferType": "P", + "MarriedStatus": "N", + "CustomerAddressDtl": [] + } + let response1 = await dispatch(postAddCustomerDetails(postdata)).unwrap(); + + if (response1?.data?.statusCode == 1) { + dispatch(changeSelectedOption(null)); + dispatch( + changeCustomerID( + response1?.data?.CustomerDetails?.[ + response1?.data?.CustomerDetails.length - 1 + ] + ) + ); + dispatch( + changeSelectedCustId(response1?.data?.CustomerDetails?.[0]?.CustId) + ); + dispatch( + ChangeSelectedCustDisable(true) + ); + + } else{ + setMessageData('Invalid mobile No.'); + setMessageType('error'); + setNumber(''); + } + } + }; + const setNumberFun = (newValue) => { + setNumber((prevNumber) => { + if (prevNumber.length < 10) { + return prevNumber + newValue; + } + return prevNumber; + }); + }; + + const handleOtpNumber = (num) => { + if (otpIndex > 3) return; + + const newOtp = [...otpInput]; + newOtp[otpIndex] = num.toString(); + setOtpInput(newOtp); + + if (otpIndex < 3) { + setOtpIndex(otpIndex + 1); + } + }; + + const handleOtpBackspace = () => { + if (otpIndex < 0) return; + + const newOtp = [...otpInput]; + + if (newOtp[otpIndex]) { + newOtp[otpIndex] = ''; + } else if (otpIndex > 0) { + newOtp[otpIndex - 1] = ''; + setOtpIndex(otpIndex - 1); + } + + setOtpInput(newOtp); + }; + + const handleBackspace = () => { + setNumber((prevNumber) => prevNumber.slice(0, -1)); + }; + const checkLast30MinOrder = async (MobileNo) => { + const response = await dispatch( + checkLastOrderTimeLimit({ + MobileNo, + AppId: SessionData.AppId, + CompId: SessionData.CompId, + BranchId: SessionData.BranchId, + }) + )?.unwrap(); + return response?.data; + }; + const sendOTP = async () => { + const valid = isIndianMobile(number); + if (valid) { + if (isTimeLimitEnabled) { + const withinTimeLimit = await checkLast30MinOrder(number); + if (withinTimeLimit?.IsEligible === false) { + // setMessageData(withinTimeLimit?.response); + // setMessageType('warning'); + setMaxLimitExceededMessage(withinTimeLimit?.response); + setMaxLimitExceeded(true); + await dispatch(changeSelectedOption(null)); + await dispatch(changeSelectedCustId(null)); + // Reset after 3 seconds + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2500); + return; + } + } + } else { + setMessageData('Please enter valid mobile No.'); + setMessageType('warning'); + return; + } + try { + setOtpIndex(0); + setOtpSent(true); + let response = await dispatch( + sendupiotp({ + MobileNo: number, + CreatedBy: 0, + }) + )?.unwrap(); + if (response?.data?.statusCode == 1) { + setMessageData('OTP sent to your mobile number'); + setMessageType('success'); + setOTPNumber(response?.data?.OTP); + startResendTimer(); + } + } catch (error) { + console.log(error); + } + }; + const verifyOtp = () => { + const enteredOtp = otpInput.join(''); + + if (enteredOtp === otpNumber?.toString()) { + setMessageType('success'); + setMessageData('OTP Verified Successfully'); + setOtpSent(false); + setOtpInput(['', '', '', '']); + HandleCloseModal(); + // setShowPaymentMethods(true); + setOtpVerified(true); + } else { + setMessageType('error'); + setMessageData('Invalid OTP'); + setOtpInput(['', '', '', '']); + setOtpIndex(0); + } + }; + const onComplete = useCallback(() => { + setMessageData(null); + setMessageType(null); + }, []); + return ( + <> + + 768 ? 900 : 700} + children={ +
+

+ {isOtpEnabled ? 'Enter Mobile Number To Order' : 'PAYMENT'} +

+
+ {!otpSent && !otpVerifed && ( + <> +
+ {/*

+ Get your order bill on your mobile
+ via SMS / Whatsapp +

*/} +
+ +
+ + {number?.length === 10 && !isIndianMobile(number) && ( +
+ Please Enter Valid Mobile Number +
+ )} +
+ + {/* input boxxes */} +
+
+
+

setNumberFun(1)}>1

+

setNumberFun(2)}>2

+

setNumberFun(3)}>3

+
+
+

setNumberFun(4)}>4

+

setNumberFun(5)}>5

+

setNumberFun(6)}>6

+
+
+

setNumberFun(7)}>7

+

setNumberFun(8)}>8

+

setNumberFun(9)}>9

+
+
+

+ +

+

setNumberFun(0)}>0

+

+
+
+
+ {isOtpEnabled && ( + <> + + + )} + + )} + {isOtpEnabled && otpSent && ( +
+
+ Enter OTP +
+ {/* Mobile Number + Edit */} +
+ {number} + + ``{' '} +
+ + {/* 4 Digit OTP Input */} +
+
+ {otpInput.map((digit, index) => ( + setOtpIndex(index)} + readOnly + /> + ))} +
+ +
+ {/* */} + + +
+
+
+
+
+

handleOtpNumber(1)}>1

+

handleOtpNumber(2)}>2

+

handleOtpNumber(3)}>3

+
+
+

handleOtpNumber(4)}>4

+

handleOtpNumber(5)}>5

+

handleOtpNumber(6)}>6

+
+
+

handleOtpNumber(7)}>7

+

handleOtpNumber(8)}>8

+

handleOtpNumber(9)}>9

+
+
+

+ +

+

handleOtpNumber(0)}>0

+

+
+
+
+ + {/* Buttons */} +
+ )} + {/* {(!isOtpEnabled || (otpVerifed)) && <> +

Select Payment Method

+ {console.log('selectedOption', selectedPaymentOption)} +
+ + {counterAvailability && ( +
handlePaymentOption('Counter')} + > + +

+ PAY AT THE COUNTER +

+
+ )} + {paymentOptionDetailsBusinessUpi && ( +
handlePaymentOption('BU')} + > + +

UPI

+
+ )} + {!paymentOptionDetailsBusinessUpi && !counterAvailability && ( +
+ Please Set Payment Options Contact Admin +
+ )} +
+ } */} +
+
+

+ + {maxLimitExceededMessage} +

+
+
+ } + /> + + ); +}; +export default CustomerMobileNumberModal; diff --git a/src/Pages/BookingScreen/Components/BookingFunctionality/CustomerOtp.scss b/src/Pages/BookingScreen/Components/BookingFunctionality/CustomerOtp.scss new file mode 100644 index 0000000..e68c81a --- /dev/null +++ b/src/Pages/BookingScreen/Components/BookingFunctionality/CustomerOtp.scss @@ -0,0 +1,701 @@ +.BSOTPpaymentModal_main { + display: flex; + flex-direction: column; + align-items: center; + justify-content: flex-start; + width: 100%; + height: 100%; + gap: 10px; + + .BSOTPprompt { + width: 100%; + display: flex; + align-items: flex-start; + justify-content: flex-start; + text-align: left; + + p { + text-align: left; + font-family: 'Gilroy'; + font-weight: 700; + font-size: 26px; + } + } + + .BSOTPKioskPayment-inputModal { + align-content: center; + align-items: center; + display: flex; + justify-content: center; + padding: 1rem 1rem; + flex-direction: column; + + .input-err { + color: red; + font-size: 13px; + margin-top: 4px; + font-family: 'Poppins', sans-serif; + } + + input { + width: 50vw; + height: 4rem; + padding: 0rem 1rem; + font-family: 'Gilroy', sans-serif; + font-size: 22px; + border: none; + letter-spacing: 1px; + font-weight: 500; + border: 1px solid rgba(0, 0, 0, 0.199); + border-radius: 8px; + } + } + + .BSOTPKiosk-dailpadModal { + background-color: #e1eef1; + display: flex; + flex-direction: column; + row-gap: 16px; + padding: 10px 10px; + border-radius: 8px; + width: 60%; + @media (max-width: 768px) { + width: 100%; + } + } + + .BSOTPpaymentChoise { + display: flex; + align-items: center; + justify-content: center; + column-gap: 3rem; + row-gap: 1rem; + + .BSOTPupi { + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-around; + width: 110px; + height: 110px; + border: 1px solid rgba(0, 0, 0, 0.199); + border-radius: 8px; + cursor: pointer; + + p { + font-weight: 500; + font-size: 16px; + } + } + } + + .BSOTPchoiseTitle { + display: flex; + width: 100%; + align-items: flex-start; + padding: 1rem 2rem; + } + + .BSOTPKioskPayment-dailpad-main { + display: flex; + flex-direction: column; + row-gap: 12px; + padding: 16px 0px; + align-items: center; + width: 100%; + overflow-x: hidden; + } + .BSOTPKioskPayment-dailpad-1, + .BSOTPKioskPayment-dailpad-2, + .BSOTPKioskPayment-dailpad-3 { + display: flex; + align-items: center; + justify-content: center; + column-gap: 1.5rem; + row-gap: 2rem; + + p { + background-color: #fff; + padding: 10px 10px; + width: 25%; + text-align: center; + border-radius: 12px; + cursor: pointer; + font-family: 'Gilroy', sans-serif; + font-weight: 600; + font-size: 28px; + } + } + + .BSOTPKioskPayment-dailpad-4 { + display: flex; + align-items: center; + justify-content: center; + flex-direction: row-reverse; + column-gap: 1.5rem; + + p { + background-color: #fff; + padding: 10px 10px; + width: 25%; + text-align: center; + border-radius: 12px; + cursor: pointer; + font-family: 'Gilroy', sans-serif; + font-weight: 600; + font-size: 28px; + } + } + + .ant-modal .ant-modal-content { + height: 90vh !important; + } +} + +.BSOTPTitlepayment { + margin: 0; + color: rgba(0, 0, 0, 0.88); + font-weight: 600; + font-size: 16px; + line-height: 1.5; + word-wrap: break-word; + font-family: 'Barlow Condensed'; + font-size: 24px !important; +} + +.BSOTPpaymentCardMain { + display: flex; + align-items: flex-start; + width: 100%; + flex-direction: row; + justify-content: space-around; + background-color: #fff; + box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px; + padding: 1rem 1rem; + height: 45vh; + position: relative; + + .ant-radio-wrapper .ant-radio-checked .ant-radio-inner { + background-color: var(--SELECTED_COLOR) !important; + border-color: var(--SELECTED_COLOR) !important; + } + + .BSOTPcardChooice { + width: 40%; + display: flex; + flex-direction: column; + align-items: flex-start; + row-gap: 10px; + column-gap: 10px; + } + + .BSOTPcardoption { + display: flex; + align-items: center; + justify-content: flex-start; + column-gap: 10px; + // box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px; + box-shadow: + rgba(0, 0, 0, 0.1) 0px 10px 36px 0px, + rgba(0, 0, 0, 0.06) 0px 0px 0px 1px; + border-radius: 6px; + + padding: 4px 14px; + cursor: pointer; + width: 95%; + + img { + width: 30px; + height: 22px; + } + } + + .BSOTPcardname { + font-size: 16px; + font-weight: 550; + } + + .BSOTPcardname2 { + font-size: 11px; + font-weight: 550; + margin-top: -1px; + } + + .BSOTPbankChooice { + width: 60%; + border-radius: 6px; + + .searchbar { + display: flex; + padding: 1px 12px; + // border: 1px solid #1c1c1c; + // box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px; + box-shadow: + rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, + rgba(0, 0, 0, 0.06) 0px 0px 0px 1px; + + border-radius: 6px; + align-items: center; + // border: 1px solid black; + } + + input { + border: none; + outline: none; + padding: 1px 10px; + } + + .titlechoose { + display: flex; + align-items: center; + font-size: 16px; + column-gap: 1rem; + padding-bottom: 9px; + border-bottom: 1px solid #1c1c1c; + } + + .choosecardMain { + padding: 10px 10px; + margin-top: -1rem; + } + + .bankname { + display: flex; + align-items: center; + column-gap: 10px; + font-size: 16px; + padding: 10px 10px; + font-weight: 500; + text-transform: capitalize; + } + } + + .BSOTPbuttonOfpay { + position: absolute; + bottom: -60px; + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + column-gap: 11rem; + padding: 1rem 4rem; + + .inr { + font-size: 22px; + color: #4eb14e; + font-weight: 600; + } + + .primary_Button { + display: flex; + align-items: center; + justify-content: center; + padding: 10px 16px; + cursor: pointer; + background-color: #4eb14e !important; + color: #fff; + border-radius: 6px; + } + } +} + +.searchbar :focus { + .ant-input-outlined { + box-shadow: none; + } +} + +.searchbar:focus-within { + .ant-input-outlined { + box-shadow: none; + } +} + +.searchbar .ant-input-search .ant-input:focus { + background-color: #fff !important; + border: #fff !important; +} + +.searchbar .ant-input-search .ant-input:focus { + border-color: #fff !important; +} + +.paymentCardMain .ant-collapse { + width: 100%; + border: none; + // box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px; + box-shadow: + rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, + rgba(0, 0, 0, 0.06) 0px 0px 0px 1px; +} + +.paymentCardMain .ant-radio-group, +.ant-radio-wrapper span.ant-radio + * { + padding: 10px 10px; +} + +.paymentCardMain .ant-modal .ant-modal-content { + padding: 54px 35px !important; +} + +.paymentCardMain + .ant-collapse + .ant-collapse-item:last-child + > .ant-collapse-content { + overflow: scroll; + height: 26vh; +} + +.paymentCardMain .ant-input-search .ant-input:hover, +.paymentCardMain .ant-input:hover { + border: none; + outline: none; + + &:focus { + border: none; + outline: none; + } +} + +@media (max-width: 768px) { + .BSOTPpaymentModal_main .BSOTPKiosk-dailpadModal { + padding: 2rem 0rem; + } + + .BSOTPpaymentModal_main .BSOTPpaymentChoise { + column-gap: 1rem; + } + + .BSOTPpaymentModal_main .BSOTPpaymentChoise .upi { + width: 100px; + } + + .BSOTPpaymentModal_main .BSOTPbuttonOfpay { + width: max-content; + } + + .BSOTPTitlepayment { + text-wrap: nowrap; + font-size: 19px !important; + } +} + +.BSOTPpayment-modal { + position: absolute; + top: 50%; + transform: translateY(-50%); + background: white; + width: 420px; + height: 540px; + border-radius: 12px; + box-shadow: 0 4px 25px rgba(0, 0, 0, 0.2); + padding: 16px; + z-index: 10; +} + +.BSOTPmodal-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 10px; + // filter: blur(5px); + // pointer-events: none; + // user-select: none; + width: 70vw; + margin: 1rem 0; + font-family: 'Poppins'; + font-weight: 500; + + @media (max-width: 768px) { + width: 95vw; + } +} + +.BSOTPpayment-modal { + position: fixed; + z-index: 1000; + top: 50%; + left: 0; + right: 0; + bottom: 0; + width: 100%; + border-radius: 0; + height: 100%; + backdrop-filter: blur(5px); + display: flex; + align-items: center; + flex-direction: column; + justify-content: center; + background-color: rgba(255, 255, 255, 0.2); + backdrop-filter: blur(8px); + -webkit-backdrop-filter: blur(8px); + /* for Safari */ +} + +.BSOTPpaymentclose-btn { + width: max-content; + height: max-content; + border: none; + background-color: unset; + color: #ff0000; + cursor: pointer; + font-size: 20px; + padding: 4px; +} + +.BSOTPpayment-frame { + width: 70vw; + height: 70vh; + + @media (max-width: 768px) { + width: 95vw; + height: 80vh; + } +} + +.BSOTPKioskOPTBTn { + width: 60%; + padding: 12px 16px; + font-size: 20px; + font-family: 'Poppins'; + font-weight: 400; + border: none; + outline: none; + background-color: #000000; + color: #fff; + border-radius: 10px; + cursor: pointer; + @media (max-width: 768px) { + width: 100%; + } +} + +.BSOTPotp-section { + text-align: center; + width: 100%; + + .BSOTPotp-mobile-row { + display: flex; + justify-content: center; + align-items: center; + gap: 15px; + margin-bottom: 20px; + font-family: 'Poppins'; + + .BSOTPotp-mobile-number { + font-size: 20px; + font-weight: 600; + letter-spacing: 1px; + } + + .BSOTPotp-edit-btn { + background: none; + border: none; + color: #007bff; + font-size: 14px; + cursor: pointer; + font-family: 'Poppins'; + + &:hover { + text-decoration: underline; + } + } + } + + .BSOTPotp-input-container { + display: flex; + justify-content: center; + gap: 20px; + + .BSOTP-otp-box { + width: 65px; + height: 65px; + font-size: 28px; + text-align: center; + border: 2px solid #ccc; + border-radius: 8px; + outline: none; + transition: 0.2s ease; + + &:focus { + border-color: #28a745; + box-shadow: 0 0 6px rgba(40, 167, 69, 0.4); + } + } + + .otp-box.active { + border: 2px solid #28a745; + } + } + + .BSOTPotp-buttons { + display: flex; + justify-content: center; + gap: 20px; + + button { + min-width: 140px; + padding: 12px 18px; + font-size: 16px; + font-weight: 500; + border-radius: 8px; + cursor: pointer; + transition: 0.2s ease; + font-family: 'Poppins', sans-serif !important; + display: flex; + align-items: center; + justify-content: center; + + &:disabled { + opacity: 0.5; + cursor: not-allowed; + } + } + + .verify-btn { + background-color: #28a745; + border: none; + color: #fff; + + &:hover:not(:disabled) { + background-color: #218838; + } + } + + .BSOTPresend-btn { + background-color: #ffc107; + border: none; + color: #000; + + &:hover:not(:disabled) { + background-color: #e0a800; + } + } + } +} +.BSOTPItem3Warning { + position: fixed; + top: 0%; + left: 0%; + bottom: 0; + right: 0%; + background-color: #00000096; + z-index: 100; + font-family: 'Poppins'; + font-size: 16px; + font-weight: 500; + width: 100%; + height: 100%; + overflow: hidden; + display: flex; + align-items: center; + justify-content: center; + gap: 10px; + flex-direction: column; + backdrop-filter: blur(4px); + + /* Animation initial state */ + opacity: 0; + visibility: hidden; + transition: + opacity 0.3s ease, + visibility 0.3s ease; + + p { + display: flex; + box-shadow: + rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, + rgba(0, 0, 0, 0.06) 0px 0px 0px 1px; + align-items: center; + justify-content: center; + gap: 10px; + background-color: #fff; + padding: 15px 20px; + border-radius: 8px; + + /* popup animation */ + transform: scale(0.8); + transition: transform 0.3s ease; + } +} + +/* When visible */ +.BSOTPItem3Warning.showing { + opacity: 1; + visibility: visible; + + p { + transform: scale(1); + } +} + +.BSOTPinputModal { + width: 100%; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + .input-err { + font-family: 'Poppins', sans-serif; + font-size: 12px; + margin-top: 6px; + color: rgb(224, 0, 0); + } + input { + width: 60%; + outline: none; + font-family: 'Poppins', sans-serif; + font-weight: 600; + margin: 0; + text-align: center; + height: 45px; + border-radius: 6px; + border: 1px solid #333; + font-size: 20px; + @media (max-width: 768px) { + width: 100%; + } + } +} +.BSOTPdailpad-main { + display: flex; + flex-direction: column; + row-gap: 12px; + padding: 14px 0px; + align-items: center; + overflow-x: hidden; + width: 100%; +} + +.BSOTPotp-box { + width: 55px; + height: 55px; + font-size: 24px; + text-align: center; + border: 2px solid #ccc; + border-radius: 8px; + outline: none; + transition: 0.2s ease; + font-family: 'Poppins'; + font-weight: 500; + + &:focus { + border-color: #28a745; + box-shadow: 0 0 6px rgba(40, 167, 69, 0.4); + } +} + +.BSOTPotp-box.active { + border: 2px solid #28a745; +} +.BSOTPpaymentModal-Master { + scrollbar-width: thin; + height: 90vh; + overflow: auto; +} +.optEnterResendOTP { + display: flex; + align-items: center; + justify-content: center; + gap: 1rem; +} diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSSelectCustomer.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSSelectCustomer.jsx index 58ddafc..b466313 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSSelectCustomer.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSSelectCustomer.jsx @@ -136,8 +136,11 @@ const BSCustomerSelect = ({ TopName = null }) => { ); const BSLayout1Data = useSelector(getTemplateData); const selOption = useSelector(GlobalSelOption); + console.log(selOption, 'selOption'); const GetCustId = useSelector(GlobalCustId); + console.log(GetCustId, 'GetCustId'); const Custdisable = useSelector(GlobalSelectedCustDisable); + console.log(Custdisable, 'Custdisable'); const SessionData = useSelector(StoredSessionData); const OrderOfferDetails = useSelector( GlobalOfferAppliedProducts, diff --git a/src/Pages/BookingScreen/Components/UtillComponents/CustomisedInvoiceChange.jsx b/src/Pages/BookingScreen/Components/UtillComponents/CustomisedInvoiceChange.jsx index 4ff3a51..32176f8 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/CustomisedInvoiceChange.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/CustomisedInvoiceChange.jsx @@ -172,7 +172,7 @@ const CustomisedInvoiceChange = () => { />
- + i.SettingIdName === 'PrintUom' )?.[0]; const estimatePrintHeader = @@ -146,8 +146,7 @@ const Printstyle4 = ({ )?.SettingValue === 'Y'; const estimateTitle = SettingData?.[0]?.SettingDtlDetails?.find( - (setting) => - setting?.SettingIdName?.toLowerCase() === 'estimatetitle' + (setting) => setting?.SettingIdName?.toLowerCase() === 'estimatetitle' )?.SettingValue === 'Y'; const bookingTypePreference = appPreferences?.find( (preference) => preference?.PreferredCatName === 'Booking Type' @@ -185,7 +184,7 @@ const Printstyle4 = ({ 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') && @@ -195,7 +194,7 @@ const Printstyle4 = ({ }); const lastTransaction = PaymentStatus?.find( (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ) + ); const keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { @@ -225,7 +224,7 @@ const Printstyle4 = ({ const TakeawayData = table2Data?.productDetails?.filter( (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' ); - console.log(TakeawayData, "TakeawayData") + console.log(TakeawayData, 'TakeawayData'); const DineInData = table2Data?.productDetails?.filter( (item) => item.BookingTypeName?.toLowerCase() === 'dine in' ); @@ -373,6 +372,7 @@ const Printstyle4 = ({ : 0; const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 10); + console.log(paginatedChunks, 'paginatedChunks') const headerStyle = { backgroundColor: GlobaldummyData ? SelectedHeaderColor @@ -444,8 +444,8 @@ const Printstyle4 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -495,7 +495,7 @@ const Printstyle4 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
{' '} @@ -561,12 +561,12 @@ const Printstyle4 = ({ >
Dt: {GlobaldummyData ? formattedDate : Date1} - - {SalesModePref?.SettingValue == 'Y' && + {SalesModePref?.SettingValue == 'Y' && (
{' '} - Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '} -
} + Name : {table2Data?.SalesMode == 'R' ? 'RT' : 'WS'}{' '} +
+ )}
@@ -574,10 +574,10 @@ const Printstyle4 = ({ {GlobaldummyData ? '51' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
{/*
{GlobaldummyData ? formattedDate : Date1}
*/}
@@ -620,7 +620,7 @@ const Printstyle4 = ({ > {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference && + {takeAwayPreference && (
TakeAway
- } + )}
{GlobaldummyData ? GlobalSlNo && ( - + ) - : SLNO && } + : SLNO && } {GlobaldummyData ? GlobalItem && : Item && } @@ -651,7 +651,7 @@ const Printstyle4 = ({ ? GlobalQuantity && ( {dataChunk?.map((item, index) => { - - const identifiers = item?.ProductIdentifierDtls ?? []; + const identifiers = + item?.ProductIdentifierDtls ?? []; const serials = identifiers - .filter(d => d.SerialNumber) - .map(d => d.SerialNumber); + .filter((d) => d.SerialNumber) + .map((d) => d.SerialNumber); const imeis = identifiers - .filter(d => d.IMEI1 || d.IMEI2) - .map(d => [d.IMEI1, d.IMEI2].filter(Boolean).join(", ")); + .filter((d) => d.IMEI1 || d.IMEI2) + .map((d) => + [d.IMEI1, d.IMEI2].filter(Boolean).join(', ') + ); const descriptions = identifiers - .filter(d => d.Description) - .map(d => d.Description); + .filter((d) => d.Description) + .map((d) => d.Description); - const packageList = PackageDetails?.filter( - pkg => pkg.ProdId === item.ProdId - ) ?? []; + const packageList = + PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ) ?? []; return ( {index + 1} - : SLNO && - } + : SLNO && ( + + )} {/* ITEM COLUMN */} {GlobaldummyData ? GlobalItem && : Item && ( - - ) - } + {/* Description from first identifier */} + {descriptions[0] && ( +
{descriptions[0]}
+ )} + + )} {/* Quantity */} - {(GlobaldummyData ? GlobalQuantity : Quantity) && ( - )} {/* HSN */} - {(GlobaldummyData ? GlobalHsnCode : HsnCode) && ( - )} {/* MRP */} {(GlobaldummyData ? GlobalMRP : MRP) && ( - )} {/* Discount */} - {(GlobaldummyData ? GlobalDiscount : Discount) && ( - @@ -915,20 +930,21 @@ const Printstyle4 = ({ {/* Rate */} {(GlobaldummyData ? GlobalRate : Rate) && ( - )} {/* Amount */} {(GlobaldummyData ? GlobalAmount : Amount) && ( - )} - ); })} @@ -964,7 +980,8 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalQuantity && ( - )} + + )} {GlobaldummyData ? GlobalItem && : Item && ( - - )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - ) + + ) : Quantity && ( - - )} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - ) + + ) : HsnCode && ( - - )} + + )} {GlobaldummyData ? GlobalMRP && ( - - ) + + ) : MRP && ( - - )} + + )} {GlobaldummyData ? GlobalDiscount && ( - - ) + + ) : Discount && ( - - )} + + )} {GlobaldummyData ? GlobalTax && ( - - ) + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - )} + table2Data?.OrderType !== 'E' && ( + + )} {GlobaldummyData ? GlobalRate && ( - - ) + + ) : Rate && ( - - )} + + )} {GlobaldummyData ? GlobalAmount && ( - - ) + + ) : Amount && ( - - )} + + )} ); })} @@ -1281,64 +1298,40 @@ const Printstyle4 = ({ : Number(table2Data?.NetAmount).toFixed(2)} - {/*
-
-
Items
-
Qty
- {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
- Off -
- )} -
Amount
-
-
-
:
-
:
- {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) &&
:
} -
:
-
-
-
- {GlobaldummyData - ? '8' - : totalQuantityFilter?.length} +
+
+
ITEM :
+
+ {GlobaldummyData ? '1,066' : productsData?.length}
-
- {GlobaldummyData ? '9' : totalQuantity} -
- {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
- {GlobaldummyData - ? '100' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)}{' '} -
- )} -
+
+
+
QTY :
+
{GlobaldummyData ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} + : Number( + productsData?.reduce( + (a, b) => a + b.SalesQty, + 0 + ) + )}
-
*/} +
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( @@ -1500,17 +1493,17 @@ const Printstyle4 = ({ ' hundred' + (num % 100 ? ' ' + - (num % 100 < 20 - ? ones[num % 100] - : tens[ - Math.floor( - (num % 100) / 10 - ) - ] + - (num % 10 - ? ' ' + - ones[num % 10] - : '')) + (num % 100 < 20 + ? ones[num % 100] + : tens[ + Math.floor( + (num % 100) / 10 + ) + ] + + (num % 10 + ? ' ' + + ones[num % 10] + : '')) : '') ); return num.toString(); @@ -1730,20 +1723,38 @@ const Printstyle4 = ({
{isEditedBill && lastTransaction && ( -
+
-
- Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+ + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} +
{'Adjustment Amount'} - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - - (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)} + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {Math.abs( + (lastTransaction?.BeforeAdjustment ?? 0) - + (lastTransaction?.AfterAdjustment ?? 0) + ).toFixed(2)}
-
- Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+ + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} +
@@ -1773,83 +1800,83 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalCredit && ( -
-
Advance Amount:
-
Opening Balance:
-
- ) +
+
Advance Amount:
+
Opening Balance:
+
+ ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
- {(() => { - const c = table2Data.CustomerDetails[0]; - const items = []; + table2Data?.CustomerDetails?.length > 0 && ( +
+ {(() => { + const c = table2Data.CustomerDetails[0]; + const items = []; - if ( - PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' - ) { - if (c.OldCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { + items.push({ + label: + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), + }); + } + } + + if (c.CurrentCreditBal !== 0) { items.push({ label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), + c.CurrentCreditBal > 0 + ? 'Current Advance Amount' + : 'Current Balance Amount', + value: Math.abs(c.CurrentCreditBal).toFixed( + 2 + ), }); } - } - if (c.CurrentCreditBal !== 0) { - items.push({ - label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed( - 2 - ), - }); - } - - return items.map((i, idx) => ( -

- - {i.label} - - : - - {i.value} - -

- )); - })()} -
- )} + return items.map((i, idx) => ( +

+ + {i.label} + + : + + {i.value} + +

+ )); + })()} +
+ )} {/*
*/}
{!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( @@ -1858,59 +1885,59 @@ const Printstyle4 = ({
{GlobaldummyData ? GlobalQrcodet && ( -
- image -
- Scan to Pay{' '} +
+ image +
+ Scan to Pay{' '} +
+
+ ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed( + 2 + )} +
-
- ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} -
-
- ) + ) : Qrcodet && - paymentTypeUPI && ( -
- -
- Scan to Pay{' '} + paymentTypeUPI && ( +
+ +
+ Scan to Pay{' '} +
+
+ ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed( + 2 + )} +
-
- ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} -
-
- )} + )}
)} @@ -1922,26 +1949,29 @@ const Printstyle4 = ({ extractLastNumber(table2Data?.SalesId)}
- {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( - <> - {/*

Split Payment:

*/} - {Object.keys(aggregatedPayments).map( - (paymentType) => ( -
- {paymentType}:{' '} - {aggregatedPayments[paymentType].toFixed(2)} -
- ) - )} - - )} + {PaymentStatusSuccess?.length > 1 && + !isEditedBill && ( + <> + {/*

Split Payment:

*/} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
+ {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed( + 2 + )} +
+ ) + )} + + )} {GlobaldummyData && GlobalCashierName && (
@@ -2017,28 +2047,28 @@ const Printstyle4 = ({
{GlobaldummyData ? GlobalIsnotes && ( -
-

- Notes : 10 days Return policy -

+
+

+ Notes : 10 days Return policy +

-
-
- ) +
+
+ ) : Notestext && ( -
-

- {Notestext} -

+
+

+ {Notestext} +

-
-
- )} +
+
+ )}
)} @@ -2058,137 +2088,137 @@ const Printstyle4 = ({ > {GlobaldummyData ? GlobaltermsAndConditions && ( -
-

- Terms & Conditions -

-
    -
  1. - Once goods are sold, they are not - exchangeable or refundable. -
  2. -
  3. - Please check the product before leaving - the counter. -
  4. -
-
- ) - : TermsnAdCondition == true && - TermsAndConditions?.length > 0 && ( -
-

- Terms & Conditions -

-
    - {TermsAndConditions?.map((item) => ( -
  1. - {item?.TermsandConditions} +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not + exchangeable or refundable.
    2. - ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
- )} +
  • + Please check the product before leaving + the counter. +
  • + +
    + ) + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && ( +
    +

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    + )} {GlobaldummyData ? GlobalSignature && ( -
    -

    - Signature -

    - -
    - ) +

    + Signature +

    + +
    + ) : Signature == true && ( -
    -

    - Signature -

    - -
    - )} +

    + Signature +

    + +
    + )}
    )}
    @@ -2259,51 +2289,40 @@ const Printstyle4 = ({ : Number(table2Data?.NetAmount).toFixed(2)}
    - {/*
    -
    -
    Items
    -
    Qty
    - {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
    - Off -
    - )} -
    Amount
    -
    -
    -
    :
    -
    :
    - {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) &&
    :
    } -
    :
    -
    -
    -
    - {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    +
    ITEM :
    +
    + {GlobaldummyData ? '1,066' : productsData?.length}
    -
    - {GlobaldummyData ? '9' : totalQuantity} -
    - {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
    - {GlobaldummyData - ? '100' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)}{' '} -
    - )} -
    +
    +
    +
    QTY :
    +
    {GlobaldummyData ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} + : Number( + productsData?.reduce( + (a, b) => a + b.SalesQty, + 0 + ) + )}
    -
    */} +
    {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( @@ -2465,16 +2484,16 @@ const Printstyle4 = ({ ' hundred' + (num % 100 ? ' ' + - (num % 100 < 20 - ? ones[num % 100] - : tens[ - Math.floor( - (num % 100) / 10 - ) - ] + - (num % 10 - ? ' ' + ones[num % 10] - : '')) + (num % 100 < 20 + ? ones[num % 100] + : tens[ + Math.floor( + (num % 100) / 10 + ) + ] + + (num % 10 + ? ' ' + ones[num % 10] + : '')) : '') ); return num.toString(); @@ -2694,20 +2713,38 @@ const Printstyle4 = ({
    {isEditedBill && lastTransaction && ( -
    +
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} +
    {'Adjustment Amount'} - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - - (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)} + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {Math.abs( + (lastTransaction?.BeforeAdjustment ?? 0) - + (lastTransaction?.AfterAdjustment ?? 0) + ).toFixed(2)}
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    @@ -2737,81 +2788,81 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {(() => { - const c = table2Data.CustomerDetails[0]; - const items = []; + table2Data?.CustomerDetails?.length > 0 && ( +
    + {(() => { + const c = table2Data.CustomerDetails[0]; + const items = []; - if ( - PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' - ) { - if (c.OldCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { + items.push({ + label: + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), + }); + } + } + + if (c.CurrentCreditBal !== 0) { items.push({ label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), + c.CurrentCreditBal > 0 + ? 'Current Advance Amount' + : 'Current Balance Amount', + value: Math.abs(c.CurrentCreditBal).toFixed(2), }); } - } - if (c.CurrentCreditBal !== 0) { - items.push({ - label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), - }); - } - - return items.map((i, idx) => ( -

    - - {i.label} - - : - - {i.value} - -

    - )); - })()} -
    - )} + return items.map((i, idx) => ( +

    + + {i.label} + + : + + {i.value} + +

    + )); + })()} +
    + )}
    {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( @@ -2820,55 +2871,55 @@ const Printstyle4 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - image -
    - Scan to Pay{' '} +
    + image +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - ) + ) : Qrcodet && - paymentTypeUPI && ( -
    - -
    - Scan to Pay{' '} + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} + )}
    )}
    @@ -2879,7 +2930,7 @@ const Printstyle4 = ({ extractLastNumber(table2Data?.SalesId)}
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -2973,28 +3024,28 @@ const Printstyle4 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : Notestext && ( -
    -

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -3014,137 +3065,137 @@ const Printstyle4 = ({ > {GlobaldummyData ? GlobaltermsAndConditions && ( -
    -

    - Terms & Conditions -

    -
      -
    1. - Once goods are sold, they are not - exchangeable or refundable. -
    2. -
    3. - Please check the product before leaving the - counter. -
    4. -
    -
    - ) - : TermsnAdCondition == true && - TermsAndConditions?.length > 0 && ( -
    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} +

      + Terms & Conditions +

      +
        +
      1. + Once goods are sold, they are not + exchangeable or refundable.
      2. - ))} - {/*
      3. Please check the product before leaving the counter.
      4. */} -
      -
    - )} +
  • + Please check the product before leaving the + counter. +
  • + +
    + ) + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && ( +
    +

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    + )} {GlobaldummyData ? GlobalSignature && ( -
    -

    - Signature -

    - -
    - ) +

    + Signature +

    + +
    + ) : Signature == true && ( -
    -

    - Signature -

    - -
    - )} +

    + Signature +

    + +
    + )}
    )}
    @@ -3227,18 +3278,18 @@ const Printstyle4 = ({ {GlobaldummyData ? 'BranchAddress, Town- 635XXX City - State' : (table2Data?.AddressDetails?.[0]?.Address1 || '') + - (table2Data?.AddressDetails?.[0]?.City - ? (table2Data?.AddressDetails?.[0]?.Address1 && - table2Data?.AddressDetails?.[0]?.City - ? '-' - : '') + table2Data?.AddressDetails?.[0]?.City - : '') + - (table2Data?.AddressDetails?.[0]?.Zip - ? (table2Data?.AddressDetails?.[0]?.City && - table2Data?.AddressDetails?.[0]?.Zip - ? '-' - : '') + table2Data?.AddressDetails?.[0]?.Zip - : '')} + (table2Data?.AddressDetails?.[0]?.City + ? (table2Data?.AddressDetails?.[0]?.Address1 && + table2Data?.AddressDetails?.[0]?.City + ? '-' + : '') + table2Data?.AddressDetails?.[0]?.City + : '') + + (table2Data?.AddressDetails?.[0]?.Zip + ? (table2Data?.AddressDetails?.[0]?.City && + table2Data?.AddressDetails?.[0]?.Zip + ? '-' + : '') + table2Data?.AddressDetails?.[0]?.Zip + : '')}
    {' '} @@ -3266,12 +3317,9 @@ const Printstyle4 = ({ >
    Dt: {GlobaldummyData ? formattedDate : Date1} - - {SalesModePref?.SettingValue == 'Y' && -
    - {' '} - Name : {table2Data?.SalesMode == "R" ? "RT" : "WS"}{' '} -
    } + {SalesModePref?.SettingValue == 'Y' && ( +
    Name : {table2Data?.SalesMode == 'R' ? 'RT' : 'WS'}
    + )}
    @@ -3279,10 +3327,10 @@ const Printstyle4 = ({ {GlobaldummyData ? '51' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    @@ -3320,7 +3368,7 @@ const Printstyle4 = ({
    {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference && + {takeAwayPreference && (
    Take Away
    - } + )}
    ####ItemItem
    {chunkIndex * chunkSize + index + 1} + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} - {/* Product Name */} -
    {item?.ProdName}
    +
    + {/* Product Name */} +
    {item?.ProdName}
    - {/* Package OR Size */} - {packageList.length > 0 ? ( -
    - {packageList.map((pkg, i) => ( -
    - {pkg.ParcelCount} PCS {pkg.ParcelQty} PACK ({pkg.ParcelType}) -
    - ))} -
    - ) : ( -
    - {(UomPrint?.SettingValue === 'Y' - ? (item?.Size || '1') + - (item?.SinglePc === 'Y' - ? ' PCS' - : item?.Type !== 'C' - ? ` ${item?.UomName}` - : ' COMBO') - : '')} - {item?.BrandName || ""} -
    - )} + {/* Package OR Size */} + {packageList.length > 0 ? ( +
    + {packageList.map((pkg, i) => ( +
    + {pkg.ParcelCount} PCS{' '} + {pkg.ParcelQty} PACK ( + {pkg.ParcelType}) +
    + ))} +
    + ) : ( +
    + {UomPrint?.SettingValue === 'Y' + ? (item?.Size || '1') + + (item?.SinglePc === 'Y' + ? ' PCS' + : item?.Type !== 'C' + ? ` ${item?.UomName}` + : ' COMBO') + : ''} + {item?.BrandName || ''} +
    + )} - {/* Serials */} - {serials.map((s, i) => ( -
    {s}
    - ))} + {/* Serials */} + {serials.map((s, i) => ( +
    {s}
    + ))} - {/* IMEIs */} - {imeis.map((iVal, i) => ( -
    {iVal}
    - ))} + {/* IMEIs */} + {imeis.map((iVal, i) => ( +
    {iVal}
    + ))} - {/* Description from first identifier */} - {descriptions[0] && ( -
    {descriptions[0]}
    - )} -
    + {(GlobaldummyData + ? GlobalQuantity + : Quantity) && ( + {item?.SalesQty} + {(GlobaldummyData + ? GlobalHsnCode + : HsnCode) && ( + {item?.HSN} - {item?.SinglePc === "Y" ? item?.Rate : item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} - {item?.Type !== "C" + {(GlobaldummyData + ? GlobalDiscount + : Discount) && ( + + {item?.Type !== 'C' ? item?.OfferAmt || 0 : item?.OfferValue || 0} + {item?.Rate} - {item?.Type !== "C" - ? (item?.TotalAmt || 0) - (item?.OfferAmt || 0) - : (item?.TotalAmt || 0) - (item?.OfferValue || 0)} + + {item?.Type !== 'C' + ? (item?.TotalAmt || 0) - + (item?.OfferAmt || 0) + : (item?.TotalAmt || 0) - + (item?.OfferValue || 0)}
    {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} -
    {item?.ProdName}
    - {UomPrint?.SettingValue === 'Y' && -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - } -
    +
    {item?.ProdName}
    + {UomPrint?.SettingValue === 'Y' && ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +
    - {item?.SalesQty} - + {item?.SalesQty} + - {item?.SalesQty} - + {item?.SalesQty} + - {item?.HSN} - + {item?.HSN} + - {item?.HSN} - + {item?.HSN} + - {item?.MRP} - + {item?.MRP} + - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + - {item.discount} - + {item.discount} + - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + - {item?.ProdTaxPercentage || 0} - + {item?.ProdTaxPercentage || 0} + - {item?.ProdTaxPercentage || 0} - + {item?.ProdTaxPercentage || 0} + - {item?.Rate} - + {item?.Rate} + - {item?.Rate} - + {item?.Rate} + - {item?.TotalAmt} - + {item?.TotalAmt} + - {' '} - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || - 0} - + {' '} + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    @@ -3380,7 +3428,7 @@ const Printstyle4 = ({ )} {GlobaldummyData ? GlobalDiscount && ( - ) @@ -3418,18 +3466,18 @@ const Printstyle4 = ({ ) : Rate && ( - )} {GlobaldummyData ? GlobalAmount && ( - ) : Amount && ( - )} @@ -3457,212 +3505,246 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalItem && : Item && ( - - )} + {/* Description from first identifier */} + {item?.ProductIdentifierDtls?.find( + (d) => + d.SerialNumber || d.IMEI1 || d.IMEI2 + )?.Description && ( +
    + { + item.ProductIdentifierDtls.find( + (d) => + d.SerialNumber || + d.IMEI1 || + d.IMEI2 + ).Description + } +
    + )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - ) + {/* Description from first identifier */} + {item?.ProductIdentifierDtls?.find( + (d) => + d.SerialNumber || + d.IMEI1 || + d.IMEI2 + )?.Description && ( +
    + { + item.ProductIdentifierDtls.find( + (d) => + d.SerialNumber || + d.IMEI1 || + d.IMEI2 + ).Description + } +
    + )} + + ) : ( +
    + {UomPrint?.SettingValue === 'Y' && ( + <> + ({item?.Size || '1'}){' '} + {item?.SinglePc === 'Y' + ? 'PCS' + : item?.Type !== 'C' + ? item?.UomName + : 'COMBO'}{' '} + + )} + {item?.BrandName || ''} +
    + )} + + + ) : Quantity && ( - - )} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - ) + + ) : HsnCode && ( - - )} + + )} {GlobaldummyData ? GlobalMRP && ( - - ) + + ) : MRP && ( - - ) - : Tax == true && - table2Data?.OrderType !== 'E' && ( - - )} - - )} + + ) + : Tax == true && + table2Data?.OrderType !== 'E' && ( + + )} + + )} {GlobaldummyData ? GlobalDiscount && ( - - ) + + ) : Discount && ( - - )} + + )} {GlobaldummyData ? GlobalRate && ( - - ) + + ) : Rate && ( - - )} + + )} {GlobaldummyData ? GlobalAmount && ( - - ) + + ) : Amount && ( - - )} + + )} ); } @@ -3697,48 +3779,48 @@ const Printstyle4 = ({ : Item && } {GlobaldummyData ? GlobalQuantity && ( - - ) + + ) : Quantity && ( - - )} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - ) + + ) : HsnCode && ( - - )} + + )} {GlobaldummyData ? GlobalMRP && ( - - ) + + ) : MRP && ( - - )} + + )} {GlobaldummyData ? GlobalDiscount && ( - - ) + + ) : Discount && ( - - )} + + )} {/* {GlobaldummyData ? GlobalTax && ( - ) + + ) : Rate && ( - - )} + + )} {GlobaldummyData ? GlobalAmount && ( - - ) + + ) : Amount && ( - - )} + + )} @@ -3807,159 +3889,160 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalItem && : Item && ( - - )} + ? ` ${ + item.ProductIdentifierDtls.find( + (item1) => + item1.IMEI1 || + item1.IMEI2 || + item1.SerialNumber + ).Description + }` + : '') + ).trim()} + + )} {GlobaldummyData ? GlobalQuantity && ( - - ) + + ) : Quantity && ( - - )} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - ) + + ) : HsnCode && ( - - )} + + )} {GlobaldummyData ? GlobalMRP && ( - - ) + + ) : MRP && ( - - )} + + )} {GlobaldummyData ? GlobalDiscount && ( - - ) + + ) : Discount && ( - - )} + + )} {GlobaldummyData ? GlobalTax && ( - - ) + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - )} + table2Data?.OrderType !== 'E' && ( + + )} {GlobaldummyData ? GlobalRate && ( - - ) + + ) : Rate && ( - - )} + + )} {GlobaldummyData ? GlobalAmount && ( - - ) + + ) : Amount && ( - - )} + + )} ); } @@ -3980,7 +4063,6 @@ const Printstyle4 = ({ )}
    -
    - {/*
    -
    OVER ALL QTY
    -
    - {GlobaldummyData - ? '1,066' - : Number(productsData?.reduce((a, b) => a + b.SalesQty, 0))} -
    -
    */} +
    -
    +
    ITEM :
    -
    - {GlobaldummyData - ? '1,066' - : productsData?.length} -
    +
    {GlobaldummyData ? '1,066' : productsData?.length}
    -
    +
    QTY :
    {GlobaldummyData @@ -4054,51 +4112,7 @@ const Printstyle4 = ({ : Number(productsData?.reduce((a, b) => a + b.SalesQty, 0))}
    -
    - - {/*
    -
    -
    Items
    -
    Qty
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off -
    - )} -
    Amount
    -
    -
    -
    :
    -
    :
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    :
    - )} -
    :
    -
    -
    -
    - {GlobaldummyData ? '8' : totalQuantityFilter?.length} -
    -
    - {GlobaldummyData ? '9' : totalQuantity} -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - {GlobaldummyData - ? '100' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)}{' '} -
    - )} -
    - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    -
    */}
    {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( @@ -4251,14 +4265,14 @@ const Printstyle4 = ({ ' hundred' + (num % 100 ? ' ' + - (num % 100 < 20 - ? ones[num % 100] - : tens[ - Math.floor((num % 100) / 10) - ] + - (num % 10 - ? ' ' + ones[num % 10] - : '')) + (num % 100 < 20 + ? ones[num % 100] + : tens[ + Math.floor((num % 100) / 10) + ] + + (num % 10 + ? ' ' + ones[num % 10] + : '')) : '') ); return num.toString(); @@ -4474,20 +4488,33 @@ const Printstyle4 = ({
    {isEditedBill && lastTransaction && ( -
    +
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    {'Adjustment Amount'} {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - - (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)} + {Math.abs( + (lastTransaction?.BeforeAdjustment ?? 0) - + (lastTransaction?.AfterAdjustment ?? 0) + ).toFixed(2)}
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    )} {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {(() => { - const c = table2Data.CustomerDetails[0]; - const items = []; + table2Data?.CustomerDetails?.length > 0 && ( +
    + {(() => { + const c = table2Data.CustomerDetails[0]; + const items = []; - if ( - PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' - ) { - if (c.OldCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' + ) { + if (c.OldCreditBal !== 0) { + items.push({ + label: + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), + }); + } + } + + if (c.CurrentCreditBal !== 0) { items.push({ label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), + c.CurrentCreditBal > 0 + ? 'Current Advance Amount' + : 'Current Balance Amount', + value: Math.abs(c.CurrentCreditBal).toFixed(2), }); } - } - if (c.CurrentCreditBal !== 0) { - items.push({ - label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), - }); - } - - return items.map((i, idx) => ( -

    - {i.label} - : - {i.value} -

    - )); - })()} -
    - )} + return items.map((i, idx) => ( +

    + {i.label} + : + {i.value} +

    + )); + })()} +
    + )}
    {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( @@ -4597,62 +4636,61 @@ const Printstyle4 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - image -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} +
    + image +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    -
    - ) + ) : Qrcodet && - paymentTypeUPI && ( -
    - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} + paymentTypeUPI && ( +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    -
    - )} + )}
    )}
    - {/*
    Scan to Pay
    */}
    YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4737,21 +4775,21 @@ const Printstyle4 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : Notestext && ( -
    -

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -4771,136 +4809,136 @@ const Printstyle4 = ({ > {GlobaldummyData ? GlobaltermsAndConditions && ( -
    -

    - Terms & Conditions -

    -
      -
    1. - Once goods are sold, they are not exchangeable or - refundable. -
    2. -
    3. - Please check the product before leaving the counter. -
    4. -
    -
    - ) - : TermsnAdCondition == true && - TermsAndConditions?.length > 0 && ( -
    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} +

      + Terms & Conditions +

      +
        +
      1. + Once goods are sold, they are not exchangeable or + refundable.
      2. - ))} - {/*
      3. Please check the product before leaving the counter.
      4. */} -
      -
    - )} +
  • + Please check the product before leaving the counter. +
  • + +
    + ) + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && ( +
    +

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    + )} {GlobaldummyData ? GlobalSignature && ( -
    -

    - Signature -

    - -
    - ) +

    + Signature +

    + +
    + ) : Signature == true && ( -
    -

    - Signature -

    - -
    - )} +

    + Signature +

    + +
    + )}
    )}
    diff --git a/src/Pages/BookingScreen/Template/PaymentOptions.js b/src/Pages/BookingScreen/Template/PaymentOptions.js index 4d8790a..334b50b 100644 --- a/src/Pages/BookingScreen/Template/PaymentOptions.js +++ b/src/Pages/BookingScreen/Template/PaymentOptions.js @@ -192,12 +192,25 @@ export const usePaymentOptions = ({ AppId, CompId, BranchId, UserId }) => { ) === undefined && Pay_at_the_counter !== undefined; - if (UpiCondition) { + let BusinessUPI = Formated_Payment_Details?.find((item) => item.OptionName == 'Business Upi') + if (UpiCondition || BusinessUPI) { let UpiDetailsResponse = await dispatch( getPaymentUPIDetails({ CompId, AppId, BranchId, DetailType: 'U' }) ).unwrap(); + let BusinessUpi = await dispatch( + getPaymentUPIDetails({ CompId, AppId, BranchId, DetailType: 'BU' }) + ).unwrap(); + let data = BusinessUpi?.data?.data + const hasNonUPI = Formated_Payment_Details + ?.find(item => item.OptionName === 'Pay at the counter') + ?.ModeDetails + ?.every(e => e?.ModeName !== "UPI"); + + const hasChooseBusinessUpi = Formated_Payment_Details + ?.find(item => item.OptionName === 'Business Upi') + ?.ModeDetails if ( - UpiDetailsResponse?.data?.statusCode === 0 && + UpiDetailsResponse?.data?.statusCode === 0 && BusinessUpi?.data?.statusCode === 0 && BusinessUpi?.data?.data?.length === 0 && UpiDetailsResponse?.data?.data?.length === 0 ) { Formated_Payment_Details = Formated_Payment_Details.map((item) => { @@ -210,6 +223,62 @@ export const usePaymentOptions = ({ AppId, CompId, BranchId, UserId }) => { return item; }); } + else if (BusinessUpi?.data?.data?.length === 1 && hasNonUPI && hasChooseBusinessUpi) { + Formated_Payment_Details = Formated_Payment_Details.map((item) => { + if (item.OptionName === 'Pay at the counter') { + let reqDatfromBusinessUpi = BusinessUPI?.ModeDetails?.[0] + + return { + ...item, + ModeDetails: [ + ...item?.ModeDetails, + { + "PaymentOptionId": reqDatfromBusinessUpi?.PaymentOptionId, + "PaymentModeId": reqDatfromBusinessUpi?.PaymentModeId, + "ModeId": reqDatfromBusinessUpi?.ModeId, + "ModeName": "UPI", + "ModeDefault": "Y", + "ModeImage": "", + "PayOpt": null, + "CardType": null, + "MerchantUPIId": null, + "MerchantMobile": null, + "MerchantNumber": null, + "RefreshToken": null, + "Token": null, + "MerchantId": null, + "ActiveStatus": reqDatfromBusinessUpi?.ActiveStatus, + "CreatedBy": 0, + "CreatedDate": "2026-03-03T19:07:54.393", + "UpdatedBy": null, + "UpdatedDate": null, + "MethodDetails": [] + } + ], + }; + } + + // IMPORTANT: return other items unchanged + return item; + }); + } + else if (UpiDetailsResponse?.data?.statusCode === 0 && UpiDetailsResponse?.data?.data?.length === 0) { + Formated_Payment_Details = Formated_Payment_Details.map((item) => { + if (item.OptionName === 'Pay at the counter') { + return { + ...item, + ModeDetails: Pay_at_the_counter_witoutUPIMode, + }; + } + return item; + }); + + } + + + + //// + } if ( diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCA4Standard.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCA4Standard.jsx index 5cb21a2..3176e9a 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCA4Standard.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCA4Standard.jsx @@ -1,9 +1,9 @@ -import React from "react"; -import { useDispatch, useSelector } from "react-redux"; +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; import { extractLastNumber, extractLastNumberOrderId, -} from "../../../../Services/Others"; +} from '../../../../Services/Others'; import { GlobalprintSlNo, GlobalprintItem, @@ -23,13 +23,33 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, -} from "../../../../Features/ThemeChange/ThemeChange"; + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedFooterColor, + GlobalRowType, + GlobalSelectedFooterFontColor, +} from '../../../../Features/ThemeChange/ThemeChange'; // import "../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/DCPrintStyle1.scss"; -import QRCode from "react-qr-code"; -import { GlobalUpiIDprint } from "../../../../Features/BookingScreen/BookingData/BookingData"; -import signature from "../../../../Images/signatureimage.jpg" -const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCity, BranchZip, Date1, - table2Data, PaymentStatus, PrintGreeting, printDatas, DCPrintTemplateDtl }) => { +import QRCode from 'react-qr-code'; +import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import signature from '../../../../Images/signatureimage.jpg'; +const DCInvoiceTemplate = ({ + BranchName, + BranchDetails, + BranchAddress, + BranchCity, + BranchZip, + Date1, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + DCPrintTemplateDtl, +}) => { const formatDate = (dateString = '') => { const date = new Date(dateString); const day = date.getDate().toString().padStart(2, '0'); @@ -57,17 +77,17 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit acc[item.ConfigName] = true; return acc; }, {}); - console.log(table2Data, "FieldDetails") - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - console.log(Item, "Item") - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; + console.log(table2Data, 'FieldDetails'); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + console.log(Item, 'Item'); + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; const GlobalSlNo = useSelector(GlobalprintSlNo); const GlobalItem = useSelector(GlobalprintItem); const GlobalMRP = useSelector(GlobalprintMRP); @@ -82,41 +102,41 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); const GlobalSignatureImages = useSelector(GlobalSignatureImage); const GlobalIsnotes = useSelector(Globalnotes); - const GlobalthemeFormatr = useSelector(GlobalthemeFormat) - const GlobalBilltext = useSelector(GlobalBillName) + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); + const GlobalBilltext = useSelector(GlobalBillName); const keysLength = Object.keys(table2Data ?? {}).length; - console.log(GlobalDiscount, Discount, "Discount"); + console.log(GlobalDiscount, Discount, 'Discount'); - let BankDetails = BranchDetails?.BankDetails - let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions - let SignatureImg = DCPrintTemplateDtl?.Signature - let Notestext = DCPrintTemplateDtl?.Notes - let BillName = DCPrintTemplateDtl?.PrintHdrName - let FormatTheme = DCPrintTemplateDtl?.PrintType == "S" ? true : false - let PageSize = DCPrintTemplateDtl?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - console.log(BranchDetails, "BranchDetails"); - console.log(table2Data, "FormatThemekjhjk", PaymentStatus) + let BankDetails = BranchDetails?.BankDetails; + let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions; + let SignatureImg = DCPrintTemplateDtl?.Signature; + let Notestext = DCPrintTemplateDtl?.Notes; + let BillName = DCPrintTemplateDtl?.PrintHdrName; + let FormatTheme = DCPrintTemplateDtl?.PrintType == 'S' ? true : false; + let PageSize = DCPrintTemplateDtl?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + console.log(BranchDetails, 'BranchDetails'); + console.log(table2Data, 'FormatThemekjhjk', PaymentStatus); if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } const currentDate = new Date(); - const day = currentDate.getDate().toString().padStart(2, "0"); + const day = currentDate.getDate().toString().padStart(2, '0'); const monthNames = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', ]; const monthIndex = currentDate.getMonth(); const year = currentDate.getFullYear().toString().slice(-2); @@ -124,13 +144,13 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; const TakeawayData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === "takeaway" + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' ); const DineInData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === "dine in" + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' ); let PaymentStatusSuccess = PaymentStatus?.filter( - (ps) => ps.PaymentStatus === "S" + (ps) => ps.PaymentStatus === 'S' ); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, @@ -159,63 +179,71 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit const offers = table2Data?.OrderOfferDetails || []; let TotalOfferAmount = 0; - console.log(table2Data, "productsDatakl") + console.log(table2Data, 'productsDatakl'); // Calculate SalesWiseOffers total amount - offers.forEach(offer => { + offers.forEach((offer) => { if (offer.TableName === 'SalesWiseOffers') { TotalOfferAmount += offer.OfferAmount; } }); - const hasMappedOffer = offers.some(offer => - ["ItemWiseOffers", "BundleOffers", "QuantityWiseOffers"].includes(offer.TableName) + const hasMappedOffer = offers.some((offer) => + ['ItemWiseOffers', 'BundleOffers', 'QuantityWiseOffers'].includes( + offer.TableName + ) ); if (hasMappedOffer) { - - const productTotal = productsData?.reduce((acc, item) => acc + (item?.Type != "C" ? item.OfferAmt : item.OfferValue || 0), 0); + const productTotal = productsData?.reduce( + (acc, item) => + acc + (item?.Type != 'C' ? item.OfferAmt : item.OfferValue || 0), + 0 + ); TotalOfferAmount += productTotal; } else { - const Combothere = productsData?.filter(item => item?.Type == "C") - const CombothereTotal = Combothere?.reduce((acc, item) => acc + (item.OfferValue || 0), 0); + const Combothere = productsData?.filter((item) => item?.Type == 'C'); + const CombothereTotal = Combothere?.reduce( + (acc, item) => acc + (item.OfferValue || 0), + 0 + ); TotalOfferAmount += CombothereTotal; } - const invoiceData = { company: { - name: "Prematix Software Solution Pvt Ltd.", - address: "#589, 2nd floor, VP Chambers, 1st cross, 3rd block, Koramangala, Bengaluru- 560034.", - phone: "9344270900", - email: "info@prematix.com", - gstin: "29AAICP0469K1ZX" + name: 'Prematix Software Solution Pvt Ltd.', + address: + '#589, 2nd floor, VP Chambers, 1st cross, 3rd block, Koramangala, Bengaluru- 560034.', + phone: '9344270900', + email: 'info@prematix.com', + gstin: '29AAICP0469K1ZX', }, invoice: { - state: "Karnataka", - stateCode: "29", - date: "13/04/2024", - number: "BLR/01/2024-25", - reverseCharge: "", - placeOfSupply: "", - dateOfSupply: "", - vehicleNumber: "", - transportationMode: "" + state: 'Karnataka', + stateCode: '29', + date: '13/04/2024', + number: 'BLR/01/2024-25', + reverseCharge: '', + placeOfSupply: '', + dateOfSupply: '', + vehicleNumber: '', + transportationMode: '', }, billTo: { - name: "Ooty Boat House", - address: "No:2, North Lake Road,", - state: "Tamil Nadu", - stateCode: "33", - gstin: "", - poNumber: "BLR/14/2024", - poDate: "11/04/2024" + name: 'Ooty Boat House', + address: 'No:2, North Lake Road,', + state: 'Tamil Nadu', + stateCode: '33', + gstin: '', + poNumber: 'BLR/14/2024', + poDate: '11/04/2024', }, items: [ { sr: 1, - name: "Acrylic Scanner Box", - hsn: "39204900", - uom: "INR", + name: 'Acrylic Scanner Box', + hsn: '39204900', + uom: 'INR', qty: 1, rate: 6501, amount: 6501, @@ -225,15 +253,15 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit cgstAmount: 0, sgstRate: 0, sgstAmount: 0, - igstRate: 18.00, + igstRate: 18.0, igstAmount: 1170, - totalAmount: 7671 + totalAmount: 7671, }, { sr: 2, name: '32" Wide Angle view display FHD', - hsn: "84716030", - uom: "INR", + hsn: '84716030', + uom: 'INR', qty: 1, rate: 48317, amount: 48317, @@ -243,15 +271,15 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit cgstAmount: 0, sgstRate: 0, sgstAmount: 0, - igstRate: 18.00, + igstRate: 18.0, igstAmount: 8697, - totalAmount: 57014 + totalAmount: 57014, }, { sr: 3, - name: "Service charges", - hsn: "999630", - uom: "INR", + name: 'Service charges', + hsn: '999630', + uom: 'INR', qty: 1, rate: 25000, amount: 25000, @@ -261,11 +289,10 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit cgstAmount: 0, sgstRate: 0, sgstAmount: 0, - igstRate: 18.00, + igstRate: 18.0, igstAmount: 4500, - totalAmount: 29500 + totalAmount: 29500, }, - ], totals: { beforeTax: 83660, @@ -274,63 +301,110 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit cgst: 0, totalGst: 15059, afterTax: 98719, - amountInWords: "Ninety Eight Thousand Seven Hundred and Nineteen Rupees Only" + amountInWords: + 'Ninety Eight Thousand Seven Hundred and Nineteen Rupees Only', }, bankDetails: { - bankName: "State Bank of India", - accountNo: "34850253701", - ifscCode: "SBIN0006242", - branchName: "Mookandapalli" - } + bankName: 'State Bank of India', + accountNo: '34850253701', + ifscCode: 'SBIN0006242', + branchName: 'Mookandapalli', + }, }; - const chunkSize = PageSize == "A5" ? 8 : 9; + const chunkSize = PageSize == 'A5' ? 8 : 9; let dataSource = table2Data?.ProductDetails || []; - const paginatedChunks = []; for (let i = 0; i < dataSource.length; i += chunkSize) { paginatedChunks.push(dataSource.slice(i, i + chunkSize)); } - const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; - const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == "A5" ? 4 : 6); + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 4 : 6); - console.log(table2Data, "table2Datah") + console.log(table2Data, 'table2Datah'); const companyName = table2Data?.CompName; - const companyAddress = table2Data?.AddressDetails?.[0]?.Address1 + table2Data?.AddressDetails?.[0]?.Address2 || "#589, 2nd floor, VP Chambers, 1st cross, 3rd block, Koramangala, Bengaluru- 560034."; - const companyPhone = table2Data?.BrMobile + "," + table2Data?.BrMobile2 !== null ? table2Data?.BrMobile2 : ""; - const companyEmail = table2Data?.CompanyEmail || "info@prematix.com"; + const companyAddress = + table2Data?.AddressDetails?.[0]?.Address1 + + table2Data?.AddressDetails?.[0]?.Address2 || + '#589, 2nd floor, VP Chambers, 1st cross, 3rd block, Koramangala, Bengaluru- 560034.'; + const companyPhone = + table2Data?.BrMobile + ',' + table2Data?.BrMobile2 !== null + ? table2Data?.BrMobile2 + : ''; + const companyEmail = table2Data?.CompanyEmail || 'info@prematix.com'; const companyGSTIN = table2Data?.CompGSTIN; - - const InvoiceAmountWords = ({ amount }) => { const numberToWords = (num) => { const a = [ - "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", - "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", - "Eighteen", "Nineteen" + '', + 'One', + 'Two', + 'Three', + 'Four', + 'Five', + 'Six', + 'Seven', + 'Eight', + 'Nine', + 'Ten', + 'Eleven', + 'Twelve', + 'Thirteen', + 'Fourteen', + 'Fifteen', + 'Sixteen', + 'Seventeen', + 'Eighteen', + 'Nineteen', + ]; + const b = [ + '', + '', + 'Twenty', + 'Thirty', + 'Forty', + 'Fifty', + 'Sixty', + 'Seventy', + 'Eighty', + 'Ninety', ]; - const b = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"]; - if (num === 0) return "Zero"; + if (num === 0) return 'Zero'; if (num < 20) return a[num]; - if (num < 100) return b[Math.floor(num / 10)] + (num % 10 ? " " + a[num % 10] : ""); + if (num < 100) + return b[Math.floor(num / 10)] + (num % 10 ? ' ' + a[num % 10] : ''); if (num < 1000) - return a[Math.floor(num / 100)] + " Hundred" + (num % 100 ? " and " + numberToWords(num % 100) : ""); + return ( + a[Math.floor(num / 100)] + + ' Hundred' + + (num % 100 ? ' and ' + numberToWords(num % 100) : '') + ); if (num < 100000) - return numberToWords(Math.floor(num / 1000)) + " Thousand" + (num % 1000 ? " " + numberToWords(num % 1000) : ""); + return ( + numberToWords(Math.floor(num / 1000)) + + ' Thousand' + + (num % 1000 ? ' ' + numberToWords(num % 1000) : '') + ); - return "Number too large"; + return 'Number too large'; }; return (

    Total Invoice Amount in Words:

    -

    +

    {numberToWords(amount)}

    @@ -339,53 +413,117 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit const products = [ { - ProdName: "ITEM 1", + ProdName: 'ITEM 1', Rate: 88.0, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, - HSN: "01", + HSN: '01', }, { - ProdName: "ITEM 2", + ProdName: 'ITEM 2', Rate: 300.0, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, - HSN: "02", + HSN: '02', }, { - ProdName: "ITEM 3", + ProdName: 'ITEM 3', Rate: 200.0, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, - HSN: "03", + HSN: '03', }, { - ProdName: "ITEM 4", + ProdName: 'ITEM 4', Rate: 30.0, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, - HSN: "04", + HSN: '04', }, { - ProdName: "ITEM 5", + ProdName: 'ITEM 5', Rate: 30.0, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, - HSN: "05", + HSN: '05', }, - ]; + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; return ( <> @@ -718,127 +856,236 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit <> -
    +
    {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    0 ? ' print-page-break' : ''}`} style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: FormatTheme ? PageSize == "A5" ? '170mm' : "255mm" : "", }} key={chunkIndex}> - +
    0 ? ' print-page-break' : ''}`} + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: FormatTheme + ? PageSize == 'A5' + ? '170mm' + : '255mm' + : '', + }} + key={chunkIndex} + > {/*
    */} {/* Header */} -
    -
    -

    {GlobaldummyData ? "XYZ Shop" : BranchName}

    -

    {GlobaldummyData - ? "BranchAddress, Town- 635XXX City - State" - : (BranchAddress || "") + - (BranchCity - ? (BranchAddress && BranchCity ? "-" : "") + BranchCity - : "") + - (BranchZip - ? (BranchCity && - BranchZip - ? "-" - : "") + BranchZip - : "")}

    +
    +
    +

    + {GlobaldummyData ? 'XYZ Shop' : BranchName} +

    +

    + {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +

    - {BranchDetails?.BrGSTIN &&
    GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : BranchDetails?.BrGSTIN}, CIN :u00045hhsgbubufsdug
    } - {BranchDetails?.BrMobile && -
    - {" "} - Mobile : +91 {GlobaldummyData ? "986XXXXXXX" : BranchDetails?.BrMobile} + {BranchDetails?.BrGSTIN && ( +
    + GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : BranchDetails?.BrGSTIN} + , CIN :u00045hhsgbubufsdug
    - } + )} + {BranchDetails?.BrMobile && ( +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData + ? '986XXXXXXX' + : BranchDetails?.BrMobile} +
    + )}
    -
    {GlobaldummyData ? 'Cash Bill' : BillName ? BillName : "Delivery Challan"}
    - {table2Data?.dispatchPrint !== true &&
    -
    +
    + {GlobaldummyData + ? 'Cash Bill' + : BillName + ? BillName + : 'Delivery Challan'}{' '} +
    + {table2Data?.dispatchPrint !== true && ( +
    +
    +
    + {' '} + Delivery ChallanNo: + {GlobaldummyData ? '121' : table2Data?.DCNo} +
    +
    -
    - {" "} - Delivery ChallanNo: - {GlobaldummyData - ? "121" - : table2Data?.DCNo} +
    +
    + {' '} + Date :{' '} + {GlobaldummyData ? formattedDate : Date1}{' '} +
    + )} + {table2Data?.dispatchPrint === true && ( +
    +
    +
    + {' '} + Dispatch No: + {table2Data?.DispatchId} +
    +
    -
    -
    - {" "} - Date : {GlobaldummyData ? formattedDate : Date1}{" "} +
    +
    + {' '} + Dispatch Date :{' '} + {formatDate(table2Data?.CreatedDate)}{' '} +
    +
    +
    +
    + {' '} + Ref No #: {table2Data?.RequestId}{' '} +
    +
    +
    +
    + {' '} + Requested Date :{' '} + {formatDate(table2Data?.RequestedDate)}{' '} +
    -
    } - {table2Data?.dispatchPrint === true &&
    -
    - -
    - {" "} - Dispatch No: - {table2Data?.DispatchId} -
    -
    - -
    -
    - {" "} - Dispatch Date : {formatDate(table2Data?.CreatedDate)}{" "} -
    -
    -
    -
    - {" "} - Ref No #: {table2Data?.RequestId}{" "} -
    -
    -
    -
    - {" "} - Requested Date : {formatDate(table2Data?.RequestedDate)}{" "} -
    -
    -
    } - - + )}
    -
    - {table2Data?.ToBranchDtl?.length > 0 &&
    -
    -
    Delivery To :
    -
    -
    {table2Data?.ToBranchDtl?.[0]?.BranchName}
    - {table2Data?.ToBranchDtl?.[0]?.Address1 &&
    {table2Data?.ToBranchDtl?.[0]?.Address1}
    } - {(table2Data?.ToBranchDtl?.[0]?.City || table2Data?.ToBranchDtl?.[0]?.Dist || table2Data?.ToBranchDtl?.[0]?.Zip) &&
    {`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
    } - {table2Data?.ToBranchDtl?.[0]?.BrGSTIN &&
    {table2Data?.ToBranchDtl?.[0]?.BrGSTIN}
    } + {table2Data?.ToBranchDtl?.length > 0 && ( +
    +
    +
    + Delivery To : +
    +
    +
    + {table2Data?.ToBranchDtl?.[0]?.BranchName} +
    + {table2Data?.ToBranchDtl?.[0]?.Address1 && ( +
    + {table2Data?.ToBranchDtl?.[0]?.Address1} +
    + )} + {(table2Data?.ToBranchDtl?.[0]?.City || + table2Data?.ToBranchDtl?.[0]?.Dist || + table2Data?.ToBranchDtl?.[0]?.Zip) && ( +
    {`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
    + )} + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN && ( +
    + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN} +
    + )} +
    -
    } + )}
    - {(table2Data?.CustName || table2Data?.CustMobile) && -
    + {(table2Data?.CustName || table2Data?.CustMobile) && ( +

    Details of Customer

    - {table2Data?.CustName ?
    Name : - {GlobaldummyData ? ( - - {"XXXYYY"} - - ) : table2Data?.CustName} -
    : ""} + {table2Data?.CustName ? ( +
    + Name : + {GlobaldummyData ? ( + + {'XXXYYY'} + + ) : ( + table2Data?.CustName + )} +
    + ) : ( + '' + )} - {table2Data?.CustMobile ?
    Mobile No: {table2Data?.CustMobile}
    : ""} + {table2Data?.CustMobile ? ( +
    + Mobile No:{' '} + {table2Data?.CustMobile} +
    + ) : ( + '' + )} {/*
    Address: {table2Data?.CustomerDetails?.length > 0 && !GlobaldummyData && ( @@ -848,40 +1095,96 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit
    State: {table2Data?.CustomerDetails?.[0]?.State}
    */} -
    -
    - } + )}
    -
    - - {/* Items Table */} -
    +
    -
    + Dis{' '} - Rate + + Amt + Amt + Amt {item?.ProdName} -
    {item?.ProdName}
    +
    +
    {item?.ProdName}
    - {/* Serial Numbers */} - {item?.ProductIdentifierDtls - ?.filter(d => d.SerialNumber) - ?.map((d, i) => ( + {/* Serial Numbers */} + {item?.ProductIdentifierDtls?.filter( + (d) => d.SerialNumber + )?.map((d, i) => (
    {d.SerialNumber}
    ))} - {/* IMEI Numbers */} - {item?.ProductIdentifierDtls - ?.filter(d => d.IMEI1 || d.IMEI2) - ?.map((d, i) => ( + {/* IMEI Numbers */} + {item?.ProductIdentifierDtls?.filter( + (d) => d.IMEI1 || d.IMEI2 + )?.map((d, i) => (
    - {[d.IMEI1, d.IMEI2].filter(Boolean).join(", ")} + {[d.IMEI1, d.IMEI2] + .filter(Boolean) + .join(', ')}
    ))} - {/* Description from first identifier */} - {item?.ProductIdentifierDtls?.find(d => d.SerialNumber || d.IMEI1 || d.IMEI2)?.Description && ( -
    - {item.ProductIdentifierDtls.find(d => d.SerialNumber || d.IMEI1 || d.IMEI2).Description} -
    - )} -
    - {item?.SalesQty} + + {item?.SalesQty} -
    - - {/* Package Details */} - {PackageDetails?.filter(pkg => pkg.ProdId === item.ProdId).length > 0 ? ( -
    - {PackageDetails - ?.filter(pkg => pkg.ProdId === item.ProdId) - ?.map((pkg, index) => ( +
    + {/* Package Details */} + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((pkg, index) => (
    - {pkg.ParcelCount} PCS {pkg.ParcelQty} PACK ({pkg.ParcelType}) + {pkg.ParcelCount} PCS{' '} + {pkg.ParcelQty} PACK ( + {pkg.ParcelType})
    ))} - {/* Serial */} - {item?.ProductIdentifierDtls - ?.filter(d => d.SerialNumber) - ?.map((d, i) => ( + {/* Serial */} + {item?.ProductIdentifierDtls?.filter( + (d) => d.SerialNumber + )?.map((d, i) => (
    {d.SerialNumber}
    ))} - {/* IMEI */} - {item?.ProductIdentifierDtls - ?.filter(d => d.IMEI1 || d.IMEI2) - ?.map((d, i) => ( + {/* IMEI */} + {item?.ProductIdentifierDtls?.filter( + (d) => d.IMEI1 || d.IMEI2 + )?.map((d, i) => (
    - {[d.IMEI1, d.IMEI2].filter(Boolean).join(', ')} + {[d.IMEI1, d.IMEI2] + .filter(Boolean) + .join(', ')}
    ))} - {/* Description from first identifier */} - {item?.ProductIdentifierDtls?.find(d => d.SerialNumber || d.IMEI1 || d.IMEI2)?.Description && ( -
    - {item.ProductIdentifierDtls.find(d => d.SerialNumber || d.IMEI1 || d.IMEI2).Description} -
    - )} - -
    - ) : ( -
    - {UomPrint?.SettingValue === 'Y' && ( - <>({item?.Size || '1'}) {item?.SinglePc === 'Y' ? 'PCS' : item?.Type !== 'C' ? item?.UomName : 'COMBO'} - )} - {item?.BrandName || ""} -
    - )} - -
    -
    - {item?.SalesQty} - + {item?.SalesQty} + - {item?.HSN} - + {item?.HSN} + - {item?.HSN} - + {item?.HSN} + - {item?.MRP} - + {item?.MRP} + - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - {GlobaldummyData - ? GlobalTax && ( - - {/* */} - - GST:{' '} - {' '} - {item?.ProdTaxPercentage || 0} - - {/* */} - - GST:{' '} - {' '} - {item?.ProdTaxPercentage || 0} - + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + {GlobaldummyData + ? GlobalTax && ( + + {/* */} + + GST:{' '} + {' '} + {item?.ProdTaxPercentage || 0} + + {/* */} + + GST:{' '} + {' '} + {item?.ProdTaxPercentage || 0} + - {item.discount} - + {item.discount} + - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + - {item?.Rate} - + {item?.Rate} + - {item?.Rate} - + {item?.Rate} + - {item?.TotalAmt} - + {item?.TotalAmt} + - {' '} - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || 0} - + {' '} + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    Item - Qty - + Qty + - Qty - + Qty + - HSN - + HSN + - HSN - + HSN + - MRP - + MRP + - MRP - + MRP + - Dis{' '} - + Dis{' '} + - Dis{' '} - + Dis{' '} + - Rate - + Rate + - Rate - + Rate + - Amt - + Amt + - Amt - + Amt +
    {item?.ProdName} -
    {item?.ProdName}
    - {( - (item?.ProductIdentifierDtls - ?.length > 0 - ? item?.ProductIdentifierDtls.filter( - (items) => items.SerialNumber - ) - .map( - (a, index) => - ` ${a.SerialNumber}` - ) - .join('') - : '') + - (item?.ProductIdentifierDtls - ?.length > 0 - ? item?.ProductIdentifierDtls.filter( - (item1) => - item1.IMEI1 || item1.IMEI2 - ) - .map((item2) => { - const imei1 = - item2.IMEI1 || ''; - const imei2 = - item2.IMEI2 || ''; - return ` ${[imei1, imei2].filter(Boolean).join(',')}`; - }) - .join('') - : '') - + - (item?.ProductIdentifierDtls?.length > 0 && +
    +
    {item?.ProdName}
    + {( + (item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls.filter( + (items) => items.SerialNumber + ) + .map( + (a, index) => ` ${a.SerialNumber}` + ) + .join('') + : '') + + (item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls.filter( + (item1) => + item1.IMEI1 || item1.IMEI2 + ) + .map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ` ${[imei1, imei2].filter(Boolean).join(',')}`; + }) + .join('') + : '') + + (item?.ProductIdentifierDtls?.length > + 0 && item?.ProductIdentifierDtls.find( (item1) => - item1.IMEI1 || item1.IMEI2 || item1.SerialNumber + item1.IMEI1 || + item1.IMEI2 || + item1.SerialNumber )?.Description - ? ` ${item.ProductIdentifierDtls.find( - (item1) => - item1.IMEI1 || item1.IMEI2 || item1.SerialNumber - ).Description}` - : '') - ).trim()} -
    - {item?.SalesQty} -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    -
    + {item?.SalesQty} +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    +
    - {item?.SalesQty} - {UomPrint?.SettingValue === 'Y' && -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - } -
    + {item?.SalesQty} + {UomPrint?.SettingValue === 'Y' && ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +
    - {item?.HSN} - + {item?.HSN} + - {item?.HSN} - + {item?.HSN} + - {item?.MRP} - + {item?.MRP} + - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + - {item.discount} - + {item.discount} + - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + - {item?.ProdTaxPercentage || 0} - + {item?.ProdTaxPercentage || 0} + - {item?.ProdTaxPercentage || 0} - + {item?.ProdTaxPercentage || 0} + - {item?.Rate} - + {item?.Rate} + - {item?.Rate} - + {item?.Rate} + - {item?.TotalAmt} - + {item?.TotalAmt} + - {' '} - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || 0} - + {' '} + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    +
    {GlobaldummyData - ? GlobalSlNo && : - SLNO == true && } + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} {GlobaldummyData - ? GlobalItem && : - Item == true && } - + ? GlobalItem && ( + + ) + : Item == true && ( + + )} {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } */} {GlobaldummyData - ? GlobalQuantity && - : Quantity == true && } + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} {/* */} @@ -901,80 +1204,110 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit {GlobaldummyData ? GlobalAmount && : Amount == true && } */} - - - {((GlobaldummyData ? products : dataChunk) || []).map((item, idx) => ( - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && ( - - - )} - {/* {GlobaldummyData + {((GlobaldummyData ? products : dataChunk) || []).map( + (item, idx) => ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item == true && ( + + )} + {/* {GlobaldummyData ? GlobalHsnCode && ( )} */} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity == true && ( - - )} - {/* {GlobaldummyData + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {/* {GlobaldummyData ? GlobalMRP && ( )} */} - - ))} - - - + + ) + )}
    S.NoS.No + S.No + + S.No + ItemItem + Item + + Item + HSN HSN QtyQty + Qty + + Qty + UOM UOMAmountAmount
    - {chunkIndex * chunkSize + idx + 1} - - {chunkIndex * chunkSize + idx + 1} - {item?.ProdName} -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : "1"}{" "} - {item?.SinglePc == "Y" - ? "PCS" - : item?.Type != "C" - ? item?.UomName - : "COMBO"} - ) {item?.RequestVariantName ? item?.RequestVariantName : ""} -
    -  {" "} - {item?.BrandName !== null - ? item?.BrandName - : ""} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == "" || - items.SerialNumber == null - ) - )?.map((a) => { - return
    {a.SerialNumber}
    ; - }) - : ""}{" "} - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls.filter( - (item1) => - item1.IMEI1 !== "" || item1.IMEI2 !== "" - )?.map((item2) => { - const imei1 = item2.IMEI1 || ""; - const imei2 = item2.IMEI2 || ""; - return ( -
    - {[imei1, imei2] - .filter(Boolean) - .join(",")} -
    - ); - }) - : ""} -
    + {chunkIndex * chunkSize + idx + 1} + + {chunkIndex * chunkSize + idx + 1} + + {item?.ProdName} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + )  + {item?.RequestVariantName + ? item?.RequestVariantName + : ''} +
    +  {' '} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return
    {a.SerialNumber}
    ; + }) + : ''}{' '} + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls.filter( + (item1) => + item1.IMEI1 !== '' || + item1.IMEI2 !== '' + )?.map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) + : ''} +
    {item?.HSN} @@ -985,18 +1318,27 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit {item?.HSN} - {item?.SalesQty} - - {item?.Qty || item?.DispatchedQty} - + {item?.SalesQty} + + {item?.Qty || item?.DispatchedQty} + {item?.MRP} @@ -1039,11 +1381,9 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    @@ -1103,28 +1443,32 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit
    )} - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - -
    - - {/* Summary */} -
    - {/* {GlobaldummyData ?
    + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( +
    + {/* Summary */} +
    + {/* {GlobaldummyData ?
    :
    } */} -
    - - - {/*
    +
    + {/*
    Total Amount Before Tax
    {GlobaldummyData ? 736 : table2Data?.BillAmount}
    */} - {/*
    + {/*
    {OrderDetailGST?.map((item, index) => (
    @@ -1158,135 +1502,254 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit ))}
    */} - {/*
    + {/*
    GST Payable on Reverse Charge
    */} - {/*
    */} + {/*
    */} - {/*
    + {/*
    Total Amount After Tax :
    {GlobaldummyData ? 736 : table2Data?.NetAmount}
    */} - {/*
    + {/*
    Total Amount After Tax {GlobaldummyData ? 736 : table2Data?.NetAmount}
    */} - {/*
    + {/*
    {GlobaldummyData ? 736 : table2Data?.NetAmount}
    */} -
    -
    - - {/* Footer */} -
    -
    - {(BankDetails?.length > 0) && (<> -

    Bank Details:

    -
    -
    Bank Name: {BankDetails?.[0]?.BankName}
    -
    Account No.: {BankDetails?.[0]?.AccountNo}
    -
    IFSC Code: {BankDetails?.[0]?.IFSCCode}
    -
    Branch Name: {BankDetails?.[0]?.BankBranch}
    -
    -
    - )} - -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    ) - }
    -
    -
    -

    Certified that the particulars given above are true and correct.

    -
    -
    - {GlobaldummyData ?

    Company Name

    - :

    "For" {companyName}

    } -

    Authorised Signatory

    - {GlobaldummyData ? GlobalSignature && (
    - -
    ) : Signature == true && ( -
    - -
    + {/* Footer */} +
    +
    + {BankDetails?.length > 0 && ( + <> +

    + Bank Details: +

    +
    +
    + Bank Name:{' '} + {BankDetails?.[0]?.BankName} +
    +
    + Account No.:{' '} + {BankDetails?.[0]?.AccountNo} +
    +
    + IFSC Code:{' '} + {BankDetails?.[0]?.IFSCCode} +
    +
    + Branch Name:{' '} + {BankDetails?.[0]?.BankBranch} +
    +
    +
    + )} -

    (Common Seal)

    + +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not + exchangeable or refundable. +
    2. +
    3. + Please check the product before leaving + the counter. +
    4. +
    +
    + ) + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && ( +
    +

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    + )} +
    +
    +
    +
    +

    + Certified that the particulars given above are + true and correct. +

    +
    +
    + {GlobaldummyData ? ( +

    Company Name

    + ) : ( +

    + {' '} + "For" {companyName} +

    + )} +

    + Authorised Signatory +

    + + {GlobaldummyData + ? GlobalSignature && ( +
    + +
    + ) + : Signature == true && ( +
    + +
    + )} +

    (Common Seal)

    +
    + {/*
    */} + + {/* Copy Labels */} +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : Notestext && ( +
    +

    + {Notestext} +

    + + {/*
    */} +
    + )} +
    - {/*
    */} - - - - - {/* Copy Labels */} -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - - {/*
    */} -
    ) - } -
    -
    - } + )}
    //
    ))}
    {/*
    */} - {shouldFooterBeOnNewPage && FormatTheme && + {shouldFooterBeOnNewPage && FormatTheme && (
    -
    <> - {/*
    */} {/* Summary */} {/*
    */} @@ -1297,7 +1760,6 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit
    } */} {/*
    */} - {/*
    Total Amount Before Tax @@ -1354,55 +1816,169 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit {/*
    */} {/* Footer */} -
    +
    - {BankDetails?.length > 0 && (<> -

    Bank Details:

    -
    -
    Bank Name: {BankDetails?.[0]?.BankName}
    -
    Account No.: {BankDetails?.[0]?.AccountNo}
    -
    IFSC Code: {BankDetails?.[0]?.IFSCCode}
    -
    Branch Name: {BankDetails?.[0]?.BankBranch}
    -
    -
    - )} + {BankDetails?.length > 0 && ( + <> +

    Bank Details:

    +
    +
    + Bank Name:{' '} + {BankDetails?.[0]?.BankName} +
    +
    + Account No.:{' '} + {BankDetails?.[0]?.AccountNo} +
    +
    + IFSC Code:{' '} + {BankDetails?.[0]?.IFSCCode} +
    +
    + Branch Name:{' '} + {BankDetails?.[0]?.BankBranch} +
    +
    +
    + + )}
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    ) - } + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not + exchangeable or refundable. +
    2. +
    3. + Please check the product before leaving the + counter. +
    4. +
    +
    + ) + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && ( +
    +

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    + )}
    -
    +
    -

    Certified that the particulars given above are true and correct.

    +

    + Certified that the particulars given above are true + and correct. +

    - {GlobaldummyData ?

    Company Name

    - :

    "For" {companyName}

    } + {GlobaldummyData ? ( +

    Company Name

    + ) : ( +

    "For" {companyName}

    + )}

    Authorised Signatory

    - {GlobaldummyData ? GlobalSignature && (
    - -
    ) : Signature == true && (
    - -
    )} + {GlobaldummyData + ? GlobalSignature && ( +
    + +
    + ) + : Signature == true && ( +
    + +
    + )}

    (Common Seal)

    @@ -1411,28 +1987,39 @@ const DCInvoiceTemplate = ({ BranchName, BranchDetails, BranchAddress, BranchCit {/* Copy Labels */}
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    -
    -
    ) : - Notestext && (
    -

    {Notestext}

    +
    +
    + ) + : Notestext && ( +
    +

    + {Notestext} +

    - {/*
    */} -
    ) - } + {/*
    */} +
    + )}
    - } - + )}
    ); }; -export default DCInvoiceTemplate; \ No newline at end of file +export default DCInvoiceTemplate; diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintA4Style11.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintA4Style11.jsx index b999801..8f99621 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintA4Style11.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintA4Style11.jsx @@ -20,6 +20,15 @@ import { GlobalprintSlNo, GlobalprinttermsAndConditions, GlobalPritdummyData, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, GlobalSignatureImage, GlobalthemeFormat, } from '../../../../Features/ThemeChange/ThemeChange'; @@ -200,6 +209,72 @@ const DCPrintA4Style11 = ({ lastChunkRows > (!isMobile ? 10 : PageSize === 'A5' ? 5 : 14); console.log(lastChunkRows, shouldFooterBeOnNewPage, 'dataSourcedataSource'); + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + return (
    @@ -248,6 +324,8 @@ const DCPrintA4Style11 = ({ alignItems: 'center', padding: '12px 0', borderBottom: '1px solid black', + ...headerStyle, + width: '100%', }} > {/* Logo Image */} @@ -583,6 +661,7 @@ const DCPrintA4Style11 = ({ style={{ width: '10%', textAlign: 'center', + ...tableHeaderStyle, }} > S.No @@ -593,25 +672,30 @@ const DCPrintA4Style11 = ({ style={{ width: '10%', textAlign: 'center', + ...tableHeaderStyle, }} > S.No )} {GlobaldummyData - ? GlobalItem && Item - : Item == true && Item} - {/* {GlobaldummyData - ? GlobalHsnCode && HSN - : HsnCode == true && ( - HSN - )} */} + ? GlobalItem && ( + + Item + + ) + : Item == true && ( + + Item + + )} {GlobaldummyData ? GlobalQuantity && ( Qty @@ -622,6 +706,7 @@ const DCPrintA4Style11 = ({ style={{ width: '10%', textAlign: 'center', + ...tableHeaderStyle, }} > Qty @@ -656,7 +741,22 @@ const DCPrintA4Style11 = ({ {dataChunk?.map((item, index) => ( - + {GlobaldummyData ? GlobalSlNo && ( @@ -1070,6 +1170,7 @@ const DCPrintA4Style11 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData @@ -1260,6 +1361,7 @@ const DCPrintA4Style11 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintStyleA5.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintStyleA5.jsx index 133dd7f..8686133 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintStyleA5.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCA4/DCPrintStyleA5.jsx @@ -1,20 +1,62 @@ import React, { useEffect, useState } from 'react'; import { useDispatch } from 'react-redux'; -import moment from "moment"; -import { extractLastNumberOrderId, getSession } from '../../../../Services/Others'; +import moment from 'moment'; +import { + extractLastNumberOrderId, + getSession, +} from '../../../../Services/Others'; import { getBranchDetail } from '../../../../Features/BrachLogin/BranchLogin'; -import QRcode from '../../../../Images/QRcode.png' -import { printDiv } from "../../../../Services/Others"; +import QRcode from '../../../../Images/QRcode.png'; +import { printDiv } from '../../../../Services/Others'; // import HpyImg from "../../../../Images/happyemoji.png" -import '../../../../Styles/BookingScreen/PrintTemplates/A4/DCPrintA4Style11.scss' +import '../../../../Styles/BookingScreen/PrintTemplates/A4/DCPrintA4Style11.scss'; import { useSelector } from 'react-redux'; -import { GloabalFieldDetails, GlobalBillName, Globalnotes, GlobalprintAmount, GlobalprintDiscount, GlobalprintHsnCode, GlobalprintItem, GlobalprintMRP, GlobalprintQrcodet, GlobalprintQuantity, GlobalprintRate, GlobalprintSignature, GlobalprintSlNo, GlobalprinttermsAndConditions, GlobalPritdummyData, GlobalSignatureImage, GlobalthemeFormat } from '../../../../Features/ThemeChange/ThemeChange'; -import signature from "../../../../Images/signatureimage.jpg" +import { + GloabalFieldDetails, + GlobalBillName, + Globalnotes, + GlobalprintAmount, + GlobalprintDiscount, + GlobalprintHsnCode, + GlobalprintItem, + GlobalprintMRP, + GlobalprintQrcodet, + GlobalprintQuantity, + GlobalprintRate, + GlobalprintSignature, + GlobalprintSlNo, + GlobalprinttermsAndConditions, + GlobalPritdummyData, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSignatureImage, + GlobalthemeFormat, +} from '../../../../Features/ThemeChange/ThemeChange'; +import signature from '../../../../Images/signatureimage.jpg'; import QRCode from 'react-qr-code'; -const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, BranchZip, Date1, base64Image, - table2Data, PaymentStatus, PrintGreeting, printDatas, DCPrintTemplateDtl }) => { - const GlobalthemeFormatr = useSelector(GlobalthemeFormat) +const DCPrintStyleA5 = ({ + BranchName, + BranchDetails, + BranchAddress, + BranchCity, + BranchZip, + Date1, + base64Image, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + DCPrintTemplateDtl, +}) => { + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); const GlobalSignature = useSelector(GlobalprintSignature); const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { @@ -23,19 +65,19 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, {}); const GlobalIsnotes = useSelector(Globalnotes); const GlobalSignatureImages = useSelector(GlobalSignatureImage); - console.log(FieldDetails, "FieldDetails") - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - const isNotes = FieldDetails?.["Notes"]; + console.log(FieldDetails, 'FieldDetails'); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + const isNotes = FieldDetails?.['Notes']; const GlobalSlNo = useSelector(GlobalprintSlNo); const GlobalItem = useSelector(GlobalprintItem); const GlobalMRP = useSelector(GlobalprintMRP); @@ -46,23 +88,23 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, const GlobalHsnCode = useSelector(GlobalprintHsnCode); const GlobalQrcodet = useSelector(GlobalprintQrcodet); const GlobaldummyData = useSelector(GlobalPritdummyData); - const GlobalBilltext = useSelector(GlobalBillName) + const GlobalBilltext = useSelector(GlobalBillName); const currentDate = new Date(); - console.log(FieldDetails, "FieldDetails") - const day = currentDate.getDate().toString().padStart(2, "0"); + console.log(FieldDetails, 'FieldDetails'); + const day = currentDate.getDate().toString().padStart(2, '0'); const monthNames = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', ]; const monthIndex = currentDate.getMonth(); const year = currentDate.getFullYear().toString().slice(-2); @@ -90,13 +132,13 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, return day && month && year ? `${day}-${month}-${year}` : '-'; }; const TakeawayData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === "takeaway" + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' ); const DineInData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === "dine in" + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' ); let PaymentStatusSuccess = PaymentStatus?.filter( - (ps) => ps.PaymentStatus === "S" + (ps) => ps.PaymentStatus === 'S' ); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, @@ -121,14 +163,14 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, {} ); - let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions - let SignatureImg = DCPrintTemplateDtl?.Signature - let Notestext = DCPrintTemplateDtl?.Notes - let BillName = DCPrintTemplateDtl?.PrintHdrName - let FormatTheme = DCPrintTemplateDtl?.PrintType == "S" ? true : false - let PageSize = DCPrintTemplateDtl?.PageSize + let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions; + let SignatureImg = DCPrintTemplateDtl?.Signature; + let Notestext = DCPrintTemplateDtl?.Notes; + let BillName = DCPrintTemplateDtl?.PrintHdrName; + let FormatTheme = DCPrintTemplateDtl?.PrintType == 'S' ? true : false; + let PageSize = DCPrintTemplateDtl?.PageSize; - console.log(FormatTheme, "TermsAndConditions") + console.log(FormatTheme, 'TermsAndConditions'); const productsData = table2Data?.productDetails || []; const offers = table2Data?.OrderOfferDetails || []; @@ -137,7 +179,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, const products = [ { id: 1, - name: "Butter Naan", + name: 'Butter Naan', price: 88.0, quantity: 2, mrp: 50, @@ -146,7 +188,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, { id: 2, - name: "Grill Chicken (f)", + name: 'Grill Chicken (f)', price: 300.0, quantity: 1, mrp: 50, @@ -155,7 +197,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, { id: 3, - name: "Tandoori Chicken (H) ", + name: 'Tandoori Chicken (H) ', price: 200.0, quantity: 1, mrp: 50, @@ -164,7 +206,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, { id: 4, - name: "Kulfi", + name: 'Kulfi', price: 30.0, quantity: 1, mrp: 50, @@ -173,7 +215,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, { id: 1, - name: "Butter Naan", + name: 'Butter Naan', price: 88.0, quantity: 2, mrp: 50, @@ -182,7 +224,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, }, { id: 2, - name: "Grill Chicken (f)", + name: 'Grill Chicken (f)', price: 300.0, quantity: 1, mrp: 50, @@ -194,39 +236,136 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, const chunkSize = 11; let dataSource = table2Data?.ProductDetails || []; - - // Paginate the data const paginatedChunks = []; for (let i = 0; i < dataSource.length; i += chunkSize) { paginatedChunks.push(dataSource.slice(i, i + chunkSize)); } - const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; const shouldFooterBeOnNewPage = lastChunkRows > 6; + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + return ( - -
    - -
    +
    +
    {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    -
    - -
    - -
    +
    +
    + textAlign: 'left', + }} + > +
    {/* Logo Image */} {/* {base64Image && (
    @@ -244,148 +383,376 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, )} */} {/* Store Info */} -
    -
    - {GlobaldummyData ? "XYZ Shop" : BranchName} +
    +
    + {GlobaldummyData ? 'XYZ Shop' : BranchName}
    {/* Address */} -
    +
    {GlobaldummyData - ? "BranchAddress, Town- 635XXX City - State" - : [ - BranchAddress, - BranchCity, - BranchZip - ].filter(Boolean).join(' - ') - } + ? 'BranchAddress, Town- 635XXX City - State' + : [BranchAddress, BranchCity, BranchZip] + .filter(Boolean) + .join(' - ')}
    - {BranchDetails?.BrGSTIN &&
    GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : BranchDetails?.BrGSTIN}, CIN :u00045hhsgbubufsdug
    } - - {BranchDetails?.BrMobile &&
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile}
    } + {BranchDetails?.BrGSTIN && ( +
    + GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : BranchDetails?.BrGSTIN} + , CIN :u00045hhsgbubufsdug +
    + )} + {BranchDetails?.BrMobile && ( +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData + ? '986XXXXXXX' + : BranchDetails?.BrMobile} +
    + )}
    {/* Order Type */} - - -
    - - - -
    - {table2Data?.ToBranchDtl?.length > 0 && <> -
    -
    Delivery To :
    -
    -
    {table2Data?.ToBranchDtl?.[0]?.BranchName}
    - {table2Data?.ToBranchDtl?.[0]?.Address1 &&
    {table2Data?.ToBranchDtl?.[0]?.Address1}
    } - {(table2Data?.ToBranchDtl?.[0]?.City || table2Data?.ToBranchDtl?.[0]?.Dist || table2Data?.ToBranchDtl?.[0]?.Zip) &&
    {`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
    } - {table2Data?.ToBranchDtl?.[0]?.BrGSTIN &&
    {table2Data?.ToBranchDtl?.[0]?.BrGSTIN}
    } -
    -
    -
    - } - {(table2Data?.CustMobile || table2Data?.CustName || table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && + {table2Data?.ToBranchDtl?.length > 0 && ( <> -
    - {(table2Data?.CustMobile || table2Data?.CustName) && -
    -
    Delivery Details
    - {table2Data?.CustMobile &&
    Mobile NO :{table2Data?.CustMobile}
    } - {table2Data?.CustName &&
    Name:{table2Data?.CustName}
    } +
    +
    + Delivery To : +
    +
    +
    + {table2Data?.ToBranchDtl?.[0]?.BranchName}
    - } - {(table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && -
    -
    Vehicle Details
    - {table2Data?.VehicleNo &&
    Vehicle No :{table2Data?.VehicleNo}
    } - {table2Data?.TransporterId &&
    Transporter Id :{table2Data?.TransporterId}
    } - {table2Data?.TransporterName &&
    Transporter Name :{table2Data?.TransporterName}
    } -
    - } + {table2Data?.ToBranchDtl?.[0]?.Address1 && ( +
    + {table2Data?.ToBranchDtl?.[0]?.Address1} +
    + )} + {(table2Data?.ToBranchDtl?.[0]?.City || + table2Data?.ToBranchDtl?.[0]?.Dist || + table2Data?.ToBranchDtl?.[0]?.Zip) && ( +
    {`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
    + )} + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN && ( +
    + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN} +
    + )} +

    - } + )} + {(table2Data?.CustMobile || + table2Data?.CustName || + table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( + <> +
    + {(table2Data?.CustMobile || table2Data?.CustName) && ( +
    +
    + Delivery Details +
    + {table2Data?.CustMobile && ( +
    + {' '} + Mobile NO :{table2Data?.CustMobile}{' '} +
    + )} + {table2Data?.CustName && ( +
    + {' '} + Name:{table2Data?.CustName} +
    + )} +
    + )} + {(table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( +
    +
    + Vehicle Details +
    + {table2Data?.VehicleNo && ( +
    + {' '} + Vehicle No :{table2Data?.VehicleNo} +
    + )} + {table2Data?.TransporterId && ( +
    + {' '} + Transporter Id :{table2Data?.TransporterId} +
    + )} + {table2Data?.TransporterName && ( +
    + {' '} + Transporter Name :{table2Data?.TransporterName} +
    + )} +
    + )} +
    +
    + + )} - {table2Data?.dispatchPrint !== true &&
    -
    Delivery Challan NO :{GlobaldummyData ? '51' : table2Data?.DCNo}
    -
    {GlobaldummyData ? 'Cash Bill' : BillName ? BillName : "Delivery Challan"}
    -
    {Date1}
    -
    } - - {table2Data?.dispatchPrint === true &&
    -
    Dispatch No #:{table2Data?.DispatchId}
    -
    {"Delivery Challan"}
    -
    Dispatch Date: {formatDate(table2Data?.CreatedDate)}
    -
    } - {table2Data?.dispatchPrint === true &&
    -
    Ref No #:{table2Data?.RequestId}
    -
    -
    Requested Date: {formatDate(table2Data?.RequestedDate)}
    -
    } + {table2Data?.dispatchPrint !== true && ( +
    +
    + {' '} + Delivery Challan NO : + {GlobaldummyData ? '51' : table2Data?.DCNo}{' '} +
    +
    + {GlobaldummyData + ? 'Cash Bill' + : BillName + ? BillName + : 'Delivery Challan'}{' '} +
    +
    + {' '} +
    {Date1}
    {' '} +
    +
    + )} + {table2Data?.dispatchPrint === true && ( +
    +
    + {' '} + Dispatch No #:{table2Data?.DispatchId}{' '} +
    +
    + {'Delivery Challan'}{' '} +
    +
    + {' '} +
    + Dispatch Date: {formatDate(table2Data?.CreatedDate)} +
    {' '} +
    +
    + )} + {table2Data?.dispatchPrint === true && ( +
    +
    + {' '} + Ref No #:{table2Data?.RequestId}{' '} +
    +
    +
    + {' '} +
    + Requested Date: {formatDate(table2Data?.RequestedDate)} +
    {' '} +
    +
    + )}
    - < br /> +
    -
    - {(table2Data?.ProductDetails?.length > 0 || GlobaldummyData) && ( <> - 0) ? "6rem" : "2rem" }}> +
    0 + ? '6rem' + : '2rem', + }} + > -
    {/* Placeholder for the fixed-position header */} -
    +
    - -
    - + -
    +
    + - + {GlobaldummyData - ? GlobalSlNo && - : SLNO == true && } + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} {GlobaldummyData - ? GlobalItem && - : Item == true && } - {/* {GlobaldummyData - ? GlobalHsnCode && - : HsnCode == true && ( - - )} */} + ? GlobalItem && ( + + ) + : Item == true && ( + + )} {GlobaldummyData - ? GlobalQuantity && + ? GlobalQuantity && ( + + ) : Quantity == true && ( - - )} + + )} {/* {GlobaldummyData ? GlobalMRP && : MRP == true && } @@ -410,37 +777,63 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, Amt )} */} - {dataChunk?.map((item, index) => ( - + {GlobaldummyData ? GlobalSlNo && ( - - ) + + ) : SLNO == true && ( - - )} + + )} {GlobaldummyData ? GlobalItem && : Item == true && ( - - )} + + )} {/* {GlobaldummyData ? GlobalHsnCode && ( - ) + + ) : Quantity == true && ( - - )} + + )} {/* {GlobaldummyData ? GlobalMRP && ( @@ -551,68 +944,205 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, )} */} - ))}
    S.NoS.No + S.No + + S.No + ItemItemHSNHSN + Item + + Item + Qty + Qty + Qty + Qty + MRPMRP
    - {index + 1} - + {index + 1} + - {chunkIndex * chunkSize + index + 1} - + {chunkIndex * chunkSize + index + 1} + {item?.name} - -
    {item?.ProdName}
    -
    {!(item?.ProdVariantName || item?.RequestVariantName)?.toLowerCase()?.includes('variant') && Variant:{item?.ProdVariantName || item?.RequestVariantName} }
    - {/*
    +
    +
    {item?.ProdName}
    +
    + {!( + item?.ProdVariantName || + item?.RequestVariantName + ) + ?.toLowerCase() + ?.includes('variant') && ( + + Variant: + {item?.ProdVariantName || + item?.RequestVariantName}{' '} + + )} +
    + {/*
    ({item?.Size ? item?.Size : "1"}{" "} {item?.SinglePc == "Y" ? "PCS" @@ -449,12 +842,12 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, : "COMBO"} )
    */} -  {" "} - {/* {item?.BrandName !== null +  {' '} + {/* {item?.BrandName !== null ? item?.BrandName : ""}   */} - {/* {item?.ProductIdentifierDtls?.length > 0 + {/* {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls?.filter( (items) => !( @@ -465,7 +858,7 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, return
    {a.SerialNumber}
    ; }) : ""}{" "} */} - {/* {item?.ProductIdentifierDtls?.length > 0 + {/* {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( (item1) => item1.IMEI1 !== "" || item1.IMEI2 !== "" @@ -481,8 +874,8 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, ); }) : ""} */} -
    @@ -496,15 +889,15 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, )} */} {GlobaldummyData ? GlobalQuantity && ( - - {item?.quantity} - + {item?.quantity} + - {item?.Qty || item?.DispatchedQty} - + {item?.Qty || item?.DispatchedQty} +
    - {((!FormatTheme) && (chunkIndex === paginatedChunks.length - 1)) && -
    + {!FormatTheme && + chunkIndex === paginatedChunks.length - 1 && ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    +
    +
    + ) + : Notestext && ( +
    +

    + {Notestext} +

    -
    -
    ) : - Notestext && (
    -

    {Notestext}

    +
    +
    + )} -
    -
    ) - } - - -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    ) - } - - {GlobaldummyData ? GlobalSignature && (
    -

    Signature

    - -
    ) : Signature == true && (
    -

    Signature

    - -
    )} +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are + not exchangeable or refundable. +
    2. +
    3. + Please check the product before + leaving the counter. +
    4. +
    +
    + ) + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && ( +
    +

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map( + (item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ) + )} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    + )} + {GlobaldummyData + ? GlobalSignature && ( +
    +

    + Signature +

    + +
    + ) + : Signature == true && ( +
    +

    + Signature +

    + +
    + )} +
    -
    } + )}
    {/* {(chunkIndex === paginatedChunks.length - 1) && ( @@ -630,152 +1160,387 @@ const DCPrintStyleA5 = ({ BranchName, BranchDetails, BranchAddress, BranchCity,
    +
    )} - -
    + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    +
    +
    + ) + : Notestext && ( +
    +

    + {Notestext} +

    +
    +
    + )} +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not exchangeable + or refundable. +
    2. +
    3. + Please check the product before leaving the + counter. +
    4. +
    +
    + ) + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && ( +
    +

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    + )} - - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && ( -
    - - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - -
    -
    ) - } - - -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    ) - } - - {GlobaldummyData ? GlobalSignature && (
    -

    Signature

    - -
    ) : Signature == true && (
    -

    Signature

    - -
    )} - + {GlobaldummyData + ? GlobalSignature && ( +
    +

    + Signature +

    + +
    + ) + : Signature == true && ( +
    +

    + Signature +

    + +
    + )} +
    -
    - )} -
    + )} +
    ))} {shouldFooterBeOnNewPage && FormatTheme && (
    -
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    +
    +
    + ) + : Notestext && ( +
    +

    + {Notestext} +

    -
    -
    ) : - Notestext && (
    -

    {Notestext}

    +
    +
    + )} -
    -
    ) - } - - -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    ) - } - - {GlobaldummyData ? GlobalSignature && (
    -

    Signature

    - -
    ) : Signature == true && (
    -

    Signature

    - -
    )} +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not exchangeable or + refundable. +
    2. +
    3. + Please check the product before leaving the counter. +
    4. +
    +
    + ) + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && ( +
    +

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    + )} + {GlobaldummyData + ? GlobalSignature && ( +
    +

    + Signature +

    + +
    + ) + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    )}
    -
    - ); }; diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCInvicePrint.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCInvicePrint.jsx index 524dd96..873ae12 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCInvicePrint.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCInvicePrint.jsx @@ -1,815 +1,1980 @@ - import { useSelector } from 'react-redux'; import { isMobile } from 'react-device-detect'; import moment from 'moment'; -import { GlobalPritdummyData } from '../../../../Features/ThemeChange/ThemeChange'; +import { + GlobalPritdummyData, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, +} from '../../../../Features/ThemeChange/ThemeChange'; import { extractLastNumberOrderId } from '../../../../Services/Others'; const DCInvicePrint = ({ - index, - table2Data, - Date1, - totalQuantity, - OrderDetailGST, - OrderDetailIGST, - PaymentStatus, - printDatas, - BranchDetails, - BankDetails + index, + table2Data, + Date1, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + PaymentStatus, + printDatas, + BranchDetails, + BankDetails, + DCPrintTemplateDtl, }) => { - const GlobaldummyData = useSelector(GlobalPritdummyData); - let BillName = printDatas?.PrintHdrName - console.log(table2Data, 'table2Datatable2Data'); + const GlobaldummyData = useSelector(GlobalPritdummyData); + let BillName = printDatas?.PrintHdrName; + console.log(table2Data, 'table2Datatable2Data'); - const numberToWords = (num) => { - const a = [ - "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", - "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", - "Eighteen", "Nineteen" - ]; - const b = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"]; + let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { + acc[item.ConfigName] = true; + return acc; + }, {}); - if (num === 0) return "Zero"; - if (num < 20) return a[num]; - if (num < 100) return b[Math.floor(num / 10)] + (num % 10 ? " " + a[num % 10] : ""); - if (num < 1000) - return a[Math.floor(num / 100)] + " Hundred" + (num % 100 ? " and " + numberToWords(num % 100) : ""); - if (num < 100000) - return numberToWords(Math.floor(num / 1000)) + " Thousand" + (num % 1000 ? " " + numberToWords(num % 1000) : ""); - if (num < 10000000) - return numberToWords(Math.floor(num / 100000)) + " Lakh" + (num % 100000 ? " " + numberToWords(num % 100000) : ""); - if (num < 1000000000) - return numberToWords(Math.floor(num / 10000000)) + " Crore" + (num % 10000000 ? " " + numberToWords(num % 10000000) : ""); + const numberToWords = (num) => { + const a = [ + '', + 'One', + 'Two', + 'Three', + 'Four', + 'Five', + 'Six', + 'Seven', + 'Eight', + 'Nine', + 'Ten', + 'Eleven', + 'Twelve', + 'Thirteen', + 'Fourteen', + 'Fifteen', + 'Sixteen', + 'Seventeen', + 'Eighteen', + 'Nineteen', + ]; + const b = [ + '', + '', + 'Twenty', + 'Thirty', + 'Forty', + 'Fifty', + 'Sixty', + 'Seventy', + 'Eighty', + 'Ninety', + ]; - return "Number too large"; - }; + if (num === 0) return 'Zero'; + if (num < 20) return a[num]; + if (num < 100) + return b[Math.floor(num / 10)] + (num % 10 ? ' ' + a[num % 10] : ''); + if (num < 1000) + return ( + a[Math.floor(num / 100)] + + ' Hundred' + + (num % 100 ? ' and ' + numberToWords(num % 100) : '') + ); + if (num < 100000) + return ( + numberToWords(Math.floor(num / 1000)) + + ' Thousand' + + (num % 1000 ? ' ' + numberToWords(num % 1000) : '') + ); + if (num < 10000000) + return ( + numberToWords(Math.floor(num / 100000)) + + ' Lakh' + + (num % 100000 ? ' ' + numberToWords(num % 100000) : '') + ); + if (num < 1000000000) + return ( + numberToWords(Math.floor(num / 10000000)) + + ' Crore' + + (num % 10000000 ? ' ' + numberToWords(num % 10000000) : '') + ); - const invoiceData = { - // Company Details - mapped from A4Standard - companyName: table2Data?.CompName || BranchDetails?.BrName || "", - companyspecname: table2Data?.AppSpecificName || "", - companyAddress: { - address1: BranchDetails?.Address1 || "", - address2: BranchDetails?.Address2 || "", - city: BranchDetails?.City || "", - state: BranchDetails?.State || "", - zip: BranchDetails?.Zip || "" - }, - companyGSTIN: table2Data?.CompGSTIN || BranchDetails?.GSTIN || "", - companyEmail: table2Data?.CompanyEmail || BranchDetails?.BrEmail || "", - companyMobile: BranchDetails?.BrMobile || "", - companyMobile2: BranchDetails?.BrMobile2 || "", + return 'Number too large'; + }; - // Invoice Details - mapped from A4Standard - invoiceNo: table2Data?.[0]?.DCNo ? - extractLastNumberOrderId( - table2Data?.[0]?.DCNo, - ) : "", - invoiceDate: moment(Date1).format('DD-MM-YYYY') || "", + const invoiceData = { + // Company Details - mapped from A4Standard + companyName: table2Data?.CompName || BranchDetails?.BrName || '', + companyspecname: table2Data?.AppSpecificName || '', + companyAddress: { + address1: BranchDetails?.Address1 || '', + address2: BranchDetails?.Address2 || '', + city: BranchDetails?.City || '', + state: BranchDetails?.State || '', + zip: BranchDetails?.Zip || '', + }, + companyGSTIN: table2Data?.CompGSTIN || BranchDetails?.GSTIN || '', + companyEmail: table2Data?.CompanyEmail || BranchDetails?.BrEmail || '', + companyMobile: BranchDetails?.BrMobile || '', + companyMobile2: BranchDetails?.BrMobile2 || '', - // Customer Details - mapped from A4Standard CustomerDetails array - customerName: table2Data?.[0]?.CustName || table2Data?.CustName - || "", - customerMobile: table2Data?.[0]?.CustMobile || table2Data?.CustMobile || "", - customerGSTIN: table2Data?.[0]?.SuppGSTIN || table2Data?.CustGSTIN || "", - VehicleNo: table2Data?.[0]?.VehicleNo || table2Data?.VehicleNo || "", - TransporterId: table2Data?.[0]?.TransporterId || table2Data?.TransporterId || "", - TransporterName: table2Data?.[0]?.TransporterName || table2Data?.TransporterName || "", - customerAddress: { - address1: table2Data?.CustomerDetails?.[0]?.Address1 || "", - address2: table2Data?.CustomerDetails?.[0]?.Address2 || "", - state: table2Data?.CustomerDetails?.[0]?.State || "" - }, + // Invoice Details - mapped from A4Standard + invoiceNo: table2Data?.[0]?.DCNo + ? extractLastNumberOrderId(table2Data?.[0]?.DCNo) + : '', + invoiceDate: moment(Date1).format('DD-MM-YYYY') || '', - // Product Details - mapped from A4Standard productDetails - productDetails: table2Data?.[0]?.ProductDetails || [], + // Customer Details - mapped from A4Standard CustomerDetails array + customerName: table2Data?.[0]?.CustName || table2Data?.CustName || '', + customerMobile: table2Data?.[0]?.CustMobile || table2Data?.CustMobile || '', + customerGSTIN: table2Data?.[0]?.SuppGSTIN || table2Data?.CustGSTIN || '', + VehicleNo: table2Data?.[0]?.VehicleNo || table2Data?.VehicleNo || '', + TransporterId: + table2Data?.[0]?.TransporterId || table2Data?.TransporterId || '', + TransporterName: + table2Data?.[0]?.TransporterName || table2Data?.TransporterName || '', + customerAddress: { + address1: table2Data?.CustomerDetails?.[0]?.Address1 || '', + address2: table2Data?.CustomerDetails?.[0]?.Address2 || '', + state: table2Data?.CustomerDetails?.[0]?.State || '', + }, - // Totals - mapped from A4Standard - totalAmount: Number(table2Data?.[0]?.TotalAmount || table2Data?.TotalAmt), - taxAmount: Number(OrderDetailGST), - grandTotal: Number(table2Data?.[0]?.TotalAmount || table2Data?.GrandTotal), - totalBillAmount: Number(table2Data?.[0]?.BillAmount || table2Data?.NetAmount || 0), - // Bank Details - mapped from A4Standard - bankDetails: BankDetails?.[0] || null - }; + // Product Details - mapped from A4Standard productDetails + productDetails: table2Data?.[0]?.ProductDetails || [], - console.log(table2Data, "Date1Date1", invoiceData,) + // Totals - mapped from A4Standard + totalAmount: Number(table2Data?.[0]?.TotalAmount || table2Data?.TotalAmt), + taxAmount: Number(OrderDetailGST), + grandTotal: Number(table2Data?.[0]?.TotalAmount || table2Data?.GrandTotal), + totalBillAmount: Number( + table2Data?.[0]?.BillAmount || table2Data?.NetAmount || 0 + ), + // Bank Details - mapped from A4Standard + bankDetails: BankDetails?.[0] || null, + }; - let PageSize = printDatas?.PageSize + console.log(table2Data, 'Date1Date1', invoiceData); + let PageSize = printDatas?.PageSize; - const cgstTotal = OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.CGST || 0), 0))?.toFixed(2) - : 0; - const sgstTotal = OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.SGST || 0), 0))?.toFixed(2) - : 0; - const igstTotal = OrderDetailIGST && OrderDetailIGST.length > 0 - ? Number(OrderDetailIGST.reduce((sum, item) => sum + (item.IGST || 0), 0))?.toFixed(2) - : 0; + const cgstTotal = + OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce((sum, item) => sum + (item.CGST || 0), 0) + )?.toFixed(2) + : 0; + const sgstTotal = + OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce((sum, item) => sum + (item.SGST || 0), 0) + )?.toFixed(2) + : 0; + const igstTotal = + OrderDetailIGST && OrderDetailIGST.length > 0 + ? Number( + OrderDetailIGST.reduce((sum, item) => sum + (item.IGST || 0), 0) + )?.toFixed(2) + : 0; - // Calculate round off value - const roundOffValue = Number(invoiceData.grandTotal) - ( - Number(invoiceData.totalBillAmount) + - Number(cgstTotal) + - Number(sgstTotal) + - Number(igstTotal) + // Calculate round off value + const roundOffValue = + Number(invoiceData.grandTotal) - + (Number(invoiceData.totalBillAmount) + + Number(cgstTotal) + + Number(sgstTotal) + + Number(igstTotal)); + + function RoundOffFun(amount) { + const roundedAmount = Math.round(amount); + const roundOffValue = parseFloat((roundedAmount - amount).toFixed(2)); + // const symbol = roundOffValue > 0 ? '+' : ''; // Add "+" symbol for positive values ${symbol} + console.log( + 'Rounded Amount:', + roundedAmount, + 'Round Off Value:', + roundOffValue + ); + return `${roundOffValue.toFixed(2)}`; + } + + // Allow up to 10 items per page + const chunkSize = isMobile ? 7 : PageSize == 'A5' ? 9 : 8; + let dataSource = []; + dataSource = table2Data?.[0]?.ProductDetails || []; + if (!Array.isArray(dataSource)) { + dataSource = []; + } + + console.log('Final DataSource:', table2Data); + + const paginatedChunks = []; + + // Always create at least one chunk, even if empty + if (dataSource.length === 0) { + paginatedChunks.push([]); + } else { + // Split data into chunks + for (let i = 0; i < dataSource.length; i += chunkSize) { + const chunk = dataSource.slice(i, i + chunkSize); + paginatedChunks.push(chunk); + } + } + + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + // If last page has more than 6 items, move footer to new page + const shouldFooterBeOnNewPage = lastChunkRows === chunkSize; + + // If footer should be on new page, add an empty chunk for footer-only page + if (shouldFooterBeOnNewPage && paginatedChunks.length > 0) { + paginatedChunks.push([]); // Empty chunk for footer-only page + } + + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + + return ( +
    + {paginatedChunks.map((dataChunk, chunkIndex) => ( +
    0 ? ' print-page-break' : ''}` + } + style={{ + display: 'flex', + flexDirection: 'column', + // justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) ? "space-between" : "", + height: isMobile ? '275mm' : PageSize == 'A5' ? '130mm' : '245mm', + marginBottom: '0', + pageBreakAfter: + chunkIndex < paginatedChunks.length - 1 ? 'always' : 'auto', + }} + > + {renderInvoiceContent(dataChunk, chunkIndex)} +
    + ))} +
    + ); + + function renderInvoiceContent(dataChunk, chunkIndex) { + console.log( + `Rendering page ${chunkIndex + 1}, chunk has ${dataChunk.length} items:`, + dataChunk ); - function RoundOffFun(amount) { - const roundedAmount = Math.round(amount); - const roundOffValue = parseFloat((roundedAmount - amount).toFixed(2)); - // const symbol = roundOffValue > 0 ? '+' : ''; // Add "+" symbol for positive values ${symbol} - console.log("Rounded Amount:", roundedAmount, "Round Off Value:", roundOffValue); - return `${roundOffValue.toFixed(2)}`; - - } - - // Allow up to 10 items per page - const chunkSize = isMobile ? 7 : PageSize == "A5" ? 9 : 8; - let dataSource = []; - dataSource = table2Data?.[0]?.ProductDetails || []; - if (!Array.isArray(dataSource)) { - dataSource = []; - } - - console.log("Final DataSource:", table2Data,); - - const paginatedChunks = []; - - // Always create at least one chunk, even if empty - if (dataSource.length === 0) { - paginatedChunks.push([]); - } else { - // Split data into chunks - for (let i = 0; i < dataSource.length; i += chunkSize) { - const chunk = dataSource.slice(i, i + chunkSize); - paginatedChunks.push(chunk); - } - } - - const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; - // If last page has more than 6 items, move footer to new page - const shouldFooterBeOnNewPage = lastChunkRows === chunkSize; - - // If footer should be on new page, add an empty chunk for footer-only page - if (shouldFooterBeOnNewPage && paginatedChunks.length > 0) { - paginatedChunks.push([]); // Empty chunk for footer-only page - } + const isFirstPage = chunkIndex === 0; + const isLastPage = chunkIndex === paginatedChunks.length - 1; + const isFooterOnlyPage = + isLastPage && dataChunk.length === 0 && shouldFooterBeOnNewPage; + console.log( + `Page ${chunkIndex + 1}: isFirstPage=${isFirstPage}, isLastPage=${isLastPage}, isFooterOnlyPage=${isFooterOnlyPage}` + ); return ( -
    - {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    0 ? ' print-page-break' : ''}`} - style={{ - display: "flex", - flexDirection: "column", - // justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) ? "space-between" : "", - height: isMobile ? "275mm" : PageSize == "A5" ? '130mm' : "245mm", - marginBottom: "0", - pageBreakAfter: chunkIndex < paginatedChunks.length - 1 ? 'always' : 'auto' - }} - > - {renderInvoiceContent(dataChunk, chunkIndex)} + <> + {/* Header - Only on first page */} + {isFirstPage && ( + <> +
    +
    +

    + {table2Data?.OrderType === 'E' + ? 'Estimate' + : BillName + ? BillName + : 'Tax Invoice'} +

    +
    +
    + (ORIGINAL FOR RECIPIENT)
    - ))} -
    - ); +
    +
    + + )} - function renderInvoiceContent(dataChunk, chunkIndex) { - console.log(`Rendering page ${chunkIndex + 1}, chunk has ${dataChunk.length} items:`, dataChunk); + {/* Main Container - Always show */} +
    + {/* Top Section - Company and Invoice Details - Only on first page */} + {isFirstPage && ( +
    + {/* Left - Company Details */} +
    +
    +
    + {invoiceData.companyName} +
    +
    + {invoiceData.companyspecname} +
    +
    {invoiceData.companyAddress.address1}
    +
    {invoiceData.companyAddress.address2}
    +
    + {invoiceData.companyAddress.city}{' '} + {invoiceData.companyAddress.zip + ? ` - ${invoiceData.companyAddress.zip}` + : ''} +
    +
    {invoiceData.companyAddress.state}
    +
    GSTIN/UIN: {invoiceData.companyGSTIN}
    + {/*
    State Name: Tamil Nadu, Code: 33
    */} + {invoiceData.companyEmail && ( +
    E-Mail: {invoiceData.companyEmail}
    + )} + {invoiceData.companyMobile && ( +
    + Mobile: +91 {invoiceData.companyMobile} + {invoiceData.companyMobile2 + ? `, ${invoiceData.companyMobile2}` + : ''} +
    + )} +
    + {/* Buyer Details */} +
    +
    + Buyer (Bill to) +
    +
    + {invoiceData.customerName} +
    + {invoiceData.customerAddress.address1 && ( +
    {invoiceData.customerAddress.address1}
    + )} + {invoiceData.customerAddress.address2 && ( +
    {invoiceData.customerAddress.address2}
    + )} + {invoiceData.customerMobile && ( +
    Mobile: {invoiceData.customerMobile}
    + )} + {invoiceData.customerGSTIN && ( +
    GSTIN/UIN: {invoiceData.customerGSTIN}
    + )} + {invoiceData.customerAddress.state && ( +
    State Name: {invoiceData.customerAddress.state}
    + )} + {invoiceData.VehicleNo && ( +
    Vehicle No : {invoiceData.VehicleNo}
    + )} + {invoiceData.TransporterName && ( +
    Transporter Name: {invoiceData.TransporterName}
    + )} + {invoiceData.TransporterId && ( +
    Transporter Id: {invoiceData.TransporterId}
    + )} +
    +
    - console.log(`Page ${chunkIndex + 1}: isFirstPage=${isFirstPage}, isLastPage=${isLastPage}, isFooterOnlyPage=${isFooterOnlyPage}`); + {/* Right - Invoice Details */} +
    + {/* Invoice No and Date */} +
    +
    +
    + Invoice No. +
    +
    + {invoiceData.invoiceNo} +
    +
    +
    +
    Dated
    +
    + {invoiceData.invoiceDate} +
    +
    +
    - return ( - <> - {/* Header - Only on first page */} - {isFirstPage && ( + {/* Delivery Note and Payment Terms */} +
    +
    +
    + Delivery Note +
    +
    +
    +
    +
    + Mode/Terms of Payment +
    +
    +
    +
    + + {/* Reference and Other References */} +
    +
    +
    + Reference No. & Date +
    +
    +
    +
    +
    + Other References +
    +
    +
    +
    + + {/* Buyer's Order */} +
    +
    +
    + Buyer's Order No. +
    +
    +
    +
    +
    + Dated +
    +
    +
    +
    + + {/* Dispatch Details */} +
    +
    +
    + Dispatch Doc No. +
    +
    +
    +
    +
    + Delivery Note Date +
    +
    +
    +
    + + {/* Dispatched through and Destination */} +
    +
    +
    + Dispatched through +
    +
    +
    +
    +
    + Destination +
    +
    +
    +
    + + {/* Terms of Delivery */} +
    +
    + Terms of Delivery +
    +
    +
    +
    +
    + )} + + {/* Continuation header for non-first pages */} + {!isFirstPage && ( +
    +

    + {isFooterOnlyPage ? 'Tax Invoice' : 'Tax Invoice '} +

    +
    + Invoice No: {invoiceData.invoiceNo} +
    +
    + )} + + {/* Items Table - Show only if there are items or not a footer-only page */} + {(dataChunk.length > 0 || !isFooterOnlyPage) && ( +
    + {/* Table Header */} +
    +
    + Sl.No +
    +
    + Description of Goods +
    +
    + HSN/SAC +
    +
    + Quantity +
    +
    + Rate +
    +
    + per +
    +
    + Amount +
    +
    + + {/* Table Rows - Dynamic data from dataChunk */} + {dataChunk && dataChunk.length > 0 ? ( + <> + {dataChunk?.map((item, index) => ( +
    +
    + {chunkIndex * chunkSize + index + 1} +
    +
    +
    + {item.ProdName || 'Product Name'} +
    + {item.BrandName && ( +
    + {item.BrandName} +
    + )} +
    +
    + {item.HSN || ''} +
    +
    + {item.Qty || 0} {item.UomName || 'NOS'} +
    +
    + {Number(item.ProductRate || 0)?.toLocaleString( + 'en-IN', + { minimumFractionDigits: 2, maximumFractionDigits: 2 } + )} +
    +
    + {item.UomName || 'NOS'} +
    +
    + {Number(item.TotalAmount || 0)?.toLocaleString( + 'en-IN', + { minimumFractionDigits: 2, maximumFractionDigits: 2 } + )} +
    +
    + ))} + {/* Tax summary */} + {isLastPage && ( <> -
    -
    -

    {table2Data?.OrderType === "E" ? "Estimate" : (BillName ? BillName : "Tax Invoice")}

    -
    -
    (ORIGINAL FOR RECIPIENT)
    -
    + {/* Total without tax amount */} +
    +
    +
    +
    +
    +
    +
    +
    + ₹{' '} + {Number(invoiceData?.totalAmount).toLocaleString( + 'en-IN', + { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + } + )}
    +
    + {/* CGST */} + {OrderDetailGST && OrderDetailGST.length > 0 && ( +
    +
    +
    + CGST +
    +
    +
    +
    +
    + { +
    + {OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce( + (sum, item) => sum + (item.CGST || 0), + 0 + ) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : '0.00'} +
    + } +
    + )} + {/* SGST */} + {OrderDetailGST && OrderDetailGST.length > 0 && ( +
    +
    +
    + SGST +
    +
    +
    +
    +
    +
    + {OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce( + (sum, item) => sum + (item.SGST || 0), + 0 + ) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : '0.00'} +
    +
    + )} + {/* IGST */} + {OrderDetailIGST && OrderDetailIGST.length > 0 && ( +
    +
    +
    + IGST +
    +
    +
    +
    +
    + +
    + {OrderDetailIGST && OrderDetailIGST.length > 0 + ? Number( + OrderDetailIGST.reduce( + (sum, item) => sum + (item.IGST || 0), + 0 + ) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : '0.00'} +
    +
    + )} + {/* Rounding Off */} +
    +
    +
    + ROUNDING OFF +
    +
    +
    +
    +
    + +
    + {RoundOffFun(roundOffValue)} +
    +
    + {Array.from({ + length: chunkSize - dataChunk.length, + })?.map((_, idx) => ( +
    +
    +   +
    +
    +   +
    +
    +   +
    +
    +   +
    +
    +   +
    +
    +   +
    +
    +   +
    +
    + ))} + {/* Total */} +
    +
    +
    + Total +
    +
    +
    + {totalQuantity || + invoiceData.productDetails?.reduce( + (sum, item) => sum + (item.Qty || 0), + 0 + ) || + 0}{' '} + NOS +
    +
    +
    +
    + ₹{' '} + {Number(invoiceData.grandTotal).toLocaleString( + 'en-IN', + { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + } + )} +
    +
    - )} + )} + + ) : ( + // Show empty row when no data +
    +
    + - +
    +
    + No items to display +
    +
    + - +
    +
    + - +
    +
    + - +
    +
    + - +
    +
    + - +
    +
    + )} +
    + )} + {/* Tax summary - Only on last page */} - {/* Main Container - Always show */} -
    + {/* Footer content - Only on last page */} + {isLastPage && ( + <> + {/* Amount in Words */} +
    +
    +
    + Amount Chargeable (in words) +
    +
    + INR {numberToWords(Math.floor(invoiceData.grandTotal))} Only +
    +
    +

    E. & O.E

    +
    - {/* Top Section - Company and Invoice Details - Only on first page */} - {isFirstPage && ( -
    + {/* Tax Breakdown Table */} + {OrderDetailIGST && OrderDetailIGST.length > 0 && ( +
    + {/* Tax Table Header - Main Headers */} +
    +
    + HSN/SAC +
    +
    + Taxable Value +
    +
    + CGST +
    +
    + SGST/UTGST +
    +
    + Tax Amount +
    +
    - {/* Left - Company Details */} -
    -
    +
    +
    +
    + Rate +
    +
    + Amount +
    +
    + Rate +
    +
    + Amount +
    +
    +
    - fontSize: '11px', - textAlign: 'left' - }}> - -
    - {invoiceData.companyName} -
    -
    {invoiceData.companyspecname}
    -
    {invoiceData.companyAddress.address1}
    -
    {invoiceData.companyAddress.address2}
    -
    {invoiceData.companyAddress.city} {invoiceData.companyAddress.zip ? ` - ${invoiceData.companyAddress.zip}` : ""}
    -
    {invoiceData.companyAddress.state}
    -
    GSTIN/UIN: {invoiceData.companyGSTIN}
    - {/*
    State Name: Tamil Nadu, Code: 33
    */} - {invoiceData.companyEmail &&
    E-Mail: {invoiceData.companyEmail}
    } - {invoiceData.companyMobile &&
    Mobile: +91 {invoiceData.companyMobile}{invoiceData.companyMobile2 ? `, ${invoiceData.companyMobile2}` : ""}
    } -
    - {/* Buyer Details */} -
    -
    Buyer (Bill to)
    -
    {invoiceData.customerName}
    - {invoiceData.customerAddress.address1 &&
    {invoiceData.customerAddress.address1}
    } - {invoiceData.customerAddress.address2 &&
    {invoiceData.customerAddress.address2}
    } - {invoiceData.customerMobile &&
    Mobile: {invoiceData.customerMobile}
    } - {invoiceData.customerGSTIN &&
    GSTIN/UIN: {invoiceData.customerGSTIN}
    } - {invoiceData.customerAddress.state &&
    State Name: {invoiceData.customerAddress.state}
    } - {invoiceData.VehicleNo &&
    Vehicle No : {invoiceData.VehicleNo}
    } - {invoiceData.TransporterName &&
    Transporter Name: {invoiceData.TransporterName}
    } - {invoiceData.TransporterId &&
    Transporter Id: {invoiceData.TransporterId}
    } -
    - -
    - - {/* Right - Invoice Details */} -
    - - {/* Invoice No and Date */} -
    -
    -
    Invoice No.
    -
    {invoiceData.invoiceNo}
    -
    -
    -
    Dated
    -
    {invoiceData.invoiceDate}
    -
    -
    - - {/* Delivery Note and Payment Terms */} -
    -
    -
    Delivery Note
    -
    -
    -
    -
    Mode/Terms of Payment
    -
    -
    -
    - - {/* Reference and Other References */} -
    -
    -
    Reference No. & Date
    -
    -
    -
    -
    Other References
    -
    -
    -
    - - {/* Buyer's Order */} -
    -
    -
    Buyer's Order No.
    -
    -
    -
    -
    Dated
    -
    -
    -
    - - {/* Dispatch Details */} -
    -
    -
    Dispatch Doc No.
    -
    -
    -
    -
    Delivery Note Date
    -
    -
    -
    - - {/* Dispatched through and Destination */} -
    -
    -
    Dispatched through
    -
    -
    -
    -
    Destination
    -
    -
    -
    - - {/* Terms of Delivery */} -
    -
    Terms of Delivery
    -
    -
    - -
    + {/* Tax Table Rows - Dynamic from OrderDetailGST */} + {OrderDetailGST && OrderDetailGST.length > 0 ? ( + OrderDetailGST?.map((taxItem, index) => ( +
    +
    + {taxItem.HSN || ''}
    - )} - - {/* Continuation header for non-first pages */} - {!isFirstPage && ( -
    -

    - {isFooterOnlyPage ? 'Tax Invoice' : 'Tax Invoice '} -

    -
    Invoice No: {invoiceData.invoiceNo}
    +
    + {Number(taxItem.WithoutTaxRate || 0).toLocaleString( + 'en-IN', + { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + } + )}
    - )} - - {/* Items Table - Show only if there are items or not a footer-only page */} - {(dataChunk.length > 0 || !isFooterOnlyPage) && ( -
    - {/* Table Header */} -
    -
    Sl.No
    -
    Description of Goods
    -
    HSN/SAC
    -
    Quantity
    -
    Rate
    -
    per
    -
    Amount
    -
    - - {/* Table Rows - Dynamic data from dataChunk */} - {(dataChunk && dataChunk.length > 0) ? ( - <> - {dataChunk?.map((item, index) => ( -
    -
    {chunkIndex * chunkSize + index + 1}
    -
    -
    {item.ProdName || 'Product Name'}
    - {item.BrandName &&
    {item.BrandName}
    } -
    -
    {item.HSN || ''}
    -
    {item.Qty || 0} {item.UomName || 'NOS'}
    -
    {Number(item.ProductRate || 0)?.toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
    -
    {item.UomName || 'NOS'}
    -
    {Number(item.TotalAmount || 0)?.toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
    -
    - ))} - {/* Tax summary */} - {isLastPage && - ( - <> - {/* Total without tax amount */} -
    -
    -
    -
    -
    -
    -
    -
    - ₹ {Number(invoiceData?.totalAmount).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })} -
    -
    - {/* CGST */} - {OrderDetailGST && OrderDetailGST.length > 0 &&
    -
    -
    CGST
    -
    -
    -
    -
    - {
    - {OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.CGST || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - : "0.00"} -
    } -
    } - {/* SGST */} - {OrderDetailGST && OrderDetailGST.length > 0 &&
    -
    -
    SGST
    -
    -
    -
    -
    -
    - {OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.SGST || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - : "0.00"} -
    -
    } - {/* IGST */} - {OrderDetailIGST && OrderDetailIGST.length > 0 && ( -
    -
    -
    IGST
    -
    -
    -
    -
    - -
    - {OrderDetailIGST && OrderDetailIGST.length > 0 - ? Number(OrderDetailIGST.reduce((sum, item) => sum + (item.IGST || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - : "0.00"} -
    -
    - )} - {/* Rounding Off */} -
    -
    -
    ROUNDING OFF
    -
    -
    -
    -
    - -
    - {RoundOffFun(roundOffValue)} -
    -
    - {Array.from({ length: chunkSize - dataChunk.length })?.map((_, idx) => ( -
    -
     
    -
     
    -
     
    -
     
    -
     
    -
     
    -
     
    -
    - ))} - {/* Total */} -
    -
    -
    Total
    -
    -
    - {totalQuantity || - (invoiceData.productDetails?.reduce((sum, item) => sum + (item.Qty || 0), 0)) || - 0} NOS -
    -
    -
    -
    - ₹ {Number(invoiceData.grandTotal).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })} -
    -
    - - )} - - ) : ( - - // Show empty row when no data -
    -
    -
    -
    No items to display
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - )} +
    + {taxItem.TaxPercentage + ? taxItem.TaxPercentage / 2 + '%' + : '0%'}
    +
    + {Number(taxItem.CGST || 0).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + })} +
    +
    + {taxItem.TaxPercentage + ? taxItem.TaxPercentage / 2 + '%' + : '0%'} +
    +
    + {Number(taxItem.SGST || 0).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + })} +
    +
    + {Number( + (taxItem.CGST || 0) + (taxItem.SGST || 0) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + })} +
    +
    + )) + ) : ( + // Show 0 values when no GST data +
    +
    + - +
    +
    + 0.00 +
    +
    + 0% +
    +
    + 0.00 +
    +
    + 0% +
    +
    + 0.00 +
    +
    + 0.00 +
    +
    + )} + + {/* Tax Table Total */} +
    +
    + Total +
    +
    + {OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce( + (sum, item) => sum + (item.WithoutTaxRate || 0), + 0 + ) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : '0.00'} +
    +
    +
    + {OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce( + (sum, item) => sum + (item.CGST || 0), + 0 + ) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : '0.00'} +
    +
    +
    + {OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce( + (sum, item) => sum + (item.SGST || 0), + 0 + ) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : '0.00'} +
    +
    + {OrderDetailGST && OrderDetailGST.length > 0 + ? Number( + OrderDetailGST.reduce( + (sum, item) => + sum + + (item.CGST || 0) + + (item.SGST || 0) + + (item.WithoutTaxRate || 0), + 0 + ) + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + : '0.00'} +
    +
    +
    + )} + + {/* Tax Amount in Words */} + {OrderDetailIGST && OrderDetailIGST.length > 0 && ( +
    +
    + Tax Amount (in words): INR{' '} + {numberToWords( + Math.floor( + invoiceData.taxAmount || + OrderDetailGST?.reduce( + (sum, item) => + sum + (item.CGST || 0) + (item.SGST || 0), + 0 + ) || + 0 + ) + )}{' '} + Only +
    +
    + )} + + {/* Bank Details and Signature */} +
    + {/* Declaration */} +
    +
    +
    + Declaration +
    +
    + We declare that this invoice shows the actual price of the + goods described and that all particulars are true and + correct. +
    +
    +
    + + {/* Signature Section */} +
    + {/* Bank Details */} +
    +
    + Company's Bank Details +
    +
    + + A/c Holder's Name: + {' '} + {invoiceData.companyName} +
    +
    + Bank Name:{' '} + {invoiceData.bankDetails?.BankName || ''} +
    +
    + A/c No.:{' '} + {invoiceData.bankDetails?.AccountNo || ''} +
    +
    + + Branch & IFS Code: + {' '} + {invoiceData.bankDetails?.BankBranch || ''} &{' '} + {invoiceData.bankDetails?.IFSCCode || ''} +
    + {invoiceData.bankDetails?.SWIFTCode && ( +
    + SWIFT Code:{' '} + {invoiceData.bankDetails?.SWIFTCode || ''} +
    )} - {/* Tax summary - Only on last page */} - - {/* Footer content - Only on last page */} - {isLastPage && ( - <> - {/* Amount in Words */} -
    -
    -
    Amount Chargeable (in words)
    -
    INR {numberToWords(Math.floor(invoiceData.grandTotal))} Only
    -
    -

    E. & O.E

    -
    - - - {/* Tax Breakdown Table */} - {OrderDetailIGST && OrderDetailIGST.length > 0 &&
    - - {/* Tax Table Header - Main Headers */} -
    -
    HSN/SAC
    -
    Taxable Value
    -
    CGST
    -
    SGST/UTGST
    -
    Tax Amount
    -
    - - {/* Tax Table Sub-Headers */} -
    -
    -
    -
    Rate
    -
    Amount
    -
    Rate
    -
    Amount
    -
    -
    - - {/* Tax Table Rows - Dynamic from OrderDetailGST */} - {OrderDetailGST && OrderDetailGST.length > 0 ? ( - OrderDetailGST?.map((taxItem, index) => ( -
    -
    {taxItem.HSN || ''}
    -
    {Number(taxItem.WithoutTaxRate || 0).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
    -
    {taxItem.TaxPercentage ? (taxItem.TaxPercentage / 2) + '%' : '0%'}
    -
    {Number(taxItem.CGST || 0).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
    -
    {taxItem.TaxPercentage ? (taxItem.TaxPercentage / 2) + '%' : '0%'}
    -
    {Number(taxItem.SGST || 0).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
    -
    {Number((taxItem.CGST || 0) + (taxItem.SGST || 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
    -
    - )) - ) : ( - // Show 0 values when no GST data -
    -
    -
    -
    0.00
    -
    0%
    -
    0.00
    -
    0%
    -
    0.00
    -
    0.00
    -
    - )} - - {/* Tax Table Total */} -
    -
    Total
    -
    - {OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.WithoutTaxRate || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - : "0.00" - } -
    -
    -
    - {OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.CGST || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - : "0.00" - } -
    -
    -
    - {OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.SGST || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - : "0.00" - } -
    -
    - {OrderDetailGST && OrderDetailGST.length > 0 - ? Number(OrderDetailGST.reduce((sum, item) => sum + (item.CGST || 0) + (item.SGST || 0) + (item.WithoutTaxRate || 0), 0)).toLocaleString('en-IN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) - : "0.00" - } -
    -
    -
    } - - {/* Tax Amount in Words */} - {OrderDetailIGST && OrderDetailIGST.length > 0 &&
    -
    - Tax Amount (in words): INR {numberToWords(Math.floor(invoiceData.taxAmount || (OrderDetailGST?.reduce((sum, item) => sum + (item.CGST || 0) + (item.SGST || 0), 0) || 0)))} Only -
    -
    } - - {/* Bank Details and Signature */} -
    - {/* Declaration */} -
    -
    -
    Declaration
    -
    We declare that this invoice shows the actual price of the goods described and that all particulars are true and correct.
    -
    -
    - - - {/* Signature Section */} -
    - {/* Bank Details */} -
    -
    Company's Bank Details
    -
    A/c Holder's Name: {invoiceData.companyName}
    -
    Bank Name: {invoiceData.bankDetails?.BankName || ""}
    -
    A/c No.: {invoiceData.bankDetails?.AccountNo || ""}
    -
    Branch & IFS Code: {invoiceData.bankDetails?.BankBranch || ""} & {invoiceData.bankDetails?.IFSCCode || ""}
    - {invoiceData.bankDetails?.SWIFTCode &&
    SWIFT Code: {invoiceData.bankDetails?.SWIFTCode || ""}
    } -
    -
    -
    for {invoiceData.companyName}
    -
    -
    -
    - {/*
    DD
    +
    +
    +
    + for {invoiceData.companyName} +
    +
    +
    +
    + {/*
    DD
    TECHNOLOGIES
    ELECTRONICS
    */} -
    -
    -
    Authorised Signatory
    -
    -
    -
    -
    - - )} - -
    - - {/* Footer - Only on last page */} - {isLastPage && ( -
    -
    This is a Computer Generated Invoice
    +
    +
    +
    + Authorised Signatory +
    - )} +
    +
    +
    - ); - } + )} +
    + + {/* Footer - Only on last page */} + {isLastPage && ( +
    +
    This is a Computer Generated Invoice
    +
    + )} + + ); + } }; export default DCInvicePrint; diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle1.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle1.jsx index b0f451b..e7dca4e 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle1.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle1.jsx @@ -1,9 +1,9 @@ -import React from "react"; -import { useDispatch, useSelector } from "react-redux"; +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; import { extractLastNumber, extractLastNumberOrderId, -} from "../../../../Services/Others"; +} from '../../../../Services/Others'; import { GlobalprintSlNo, GlobalprintItem, @@ -23,33 +23,52 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, -} from "../../../../Features/ThemeChange/ThemeChange"; -import "../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.scss"; -import QRCode from "react-qr-code"; -import { GlobalUpiIDprint } from "../../../../Features/BookingScreen/BookingData/BookingData"; -import signature from "../../../../Images/signatureimage.jpg" -import { ApplicationPreferences } from "../../../../Features/BrachLogin/BranchLogin"; -import { isMobile } from "react-device-detect"; -const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalSelectedNetAmountColor, + GlobalSelectedNetAmountFontColor, +} from '../../../../Features/ThemeChange/ThemeChange'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.scss'; +import QRCode from 'react-qr-code'; +import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import signature from '../../../../Images/signatureimage.jpg'; +import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; +import { isMobile } from 'react-device-detect'; +const DCPrintStyle1 = ({ + BranchName, + BranchDetails, + BranchAddress, BranchCity, - BranchZip, Date1, - table2Data, PaymentStatus, PrintGreeting, printDatas, DCPrintTemplateDtl }) => { - + BranchZip, + Date1, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + DCPrintTemplateDtl, +}) => { const dispatch = useDispatch(); let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { acc[item.ConfigName] = true; return acc; }, {}); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - console.log(Item, "Item") - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + console.log(Item, 'Item'); + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; const GlobalSlNo = useSelector(GlobalprintSlNo); const GlobalItem = useSelector(GlobalprintItem); const GlobalMRP = useSelector(GlobalprintMRP); @@ -64,20 +83,51 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); const GlobalSignatureImages = useSelector(GlobalSignatureImage); const GlobalIsnotes = useSelector(Globalnotes); - const GlobalthemeFormatr = useSelector(GlobalthemeFormat) - const GlobalBilltext = useSelector(GlobalBillName) + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); + const GlobalBilltext = useSelector(GlobalBillName); + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + const SelectedNetAmountColor = useSelector(GlobalSelectedNetAmountColor); + const SelectedNetAmountFontColor = useSelector( + GlobalSelectedNetAmountFontColor + ); const keysLength = Object.keys(table2Data ?? {}).length; - console.log(GlobalDiscount, Discount, "Discount"); - console.log(printDatas, "GlobalthemeFormatr"); - let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions - let SignatureImg = DCPrintTemplateDtl?.Signature - let Notestext = DCPrintTemplateDtl?.Notes - let BillName = DCPrintTemplateDtl?.PrintHdrName - let FormatTheme = DCPrintTemplateDtl?.PrintType == "S" ? true : false - let PageSize = DCPrintTemplateDtl?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; + let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions; + let SignatureImg = DCPrintTemplateDtl?.Signature; + let Notestext = DCPrintTemplateDtl?.Notes; + let BillName = DCPrintTemplateDtl?.PrintHdrName; + let FormatTheme = DCPrintTemplateDtl?.PrintType == 'S' ? true : false; + let PageSize = DCPrintTemplateDtl?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + const netAmtColor = printColors?.find((obj) => obj.netAmtColor)?.netAmtColor; const formatDate = (dateString = '') => { const date = new Date(dateString); @@ -99,26 +149,26 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, const month = months[date.getMonth()]; const year = date.getFullYear(); return day && month && year ? `${day}-${month}-${year}` : '-'; - } + }; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } const currentDate = new Date(); - const day = currentDate.getDate().toString().padStart(2, "0"); + const day = currentDate.getDate().toString().padStart(2, '0'); const monthNames = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', ]; const monthIndex = currentDate.getMonth(); const year = currentDate.getFullYear().toString().slice(-2); @@ -132,74 +182,73 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, 0 ); - const products = [ { - ProdName: "ITEM 1", + ProdName: 'ITEM 1', Rate: 88.0, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, - HSN: "01", + HSN: '01', }, { - ProdName: "ITEM 2", + ProdName: 'ITEM 2', Rate: 300.0, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, - HSN: "02", + HSN: '02', }, { - ProdName: "ITEM 3", + ProdName: 'ITEM 3', Rate: 200.0, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, - HSN: "03", + HSN: '03', }, { - ProdName: "ITEM 4", + ProdName: 'ITEM 4', Rate: 30.0, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, - HSN: "04", + HSN: '04', }, { - ProdName: "ITEM 5", + ProdName: 'ITEM 5', Rate: 30.0, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, - HSN: "05", + HSN: '05', }, { - ProdName: "ITEM 6", + ProdName: 'ITEM 6', Rate: 130.0, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, - HSN: "06", + HSN: '06', }, { - ProdName: "ITEM 7", + ProdName: 'ITEM 7', Rate: 230.0, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, - HSN: "08", + HSN: '08', }, ]; - const chunkSize = PageSize == "A5" ? 9 : 13; + const chunkSize = PageSize == 'A5' ? 9 : 13; let dataSource = table2Data?.ProductDetails || []; @@ -208,185 +257,346 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, for (let i = 0; i < dataSource.length; i += chunkSize) { paginatedChunks.push(dataSource.slice(i, i + chunkSize)); } - const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; - const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == "A5" ? 5 : 10); + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 10); + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + const netAmountStyle = { + backgroundColor: GlobaldummyData + ? SelectedNetAmountColor + : netAmtColor?.background, + + color: GlobaldummyData ? SelectedNetAmountFontColor : netAmtColor?.font, + }; return ( - - <>
    {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    0 ? ' print-page-break' : ''}`} style={{ display: "flex", flexDirection: "column", height: FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> - - +
    0 ? ' print-page-break' : ''}`} + style={{ + display: 'flex', + flexDirection: 'column', + height: FormatTheme ? (PageSize == 'A5' ? '170mm' : '257mm') : '', + }} + key={chunkIndex} + > {/*
    */} -
    -
    +
    +
    - {" "} - {GlobaldummyData ? "XYZ Shop" : BranchName} + {' '} + {GlobaldummyData ? 'XYZ Shop' : BranchName}
    -
    +
    {GlobaldummyData - ? "BranchAddress, Town- 635XXX City - State" - : (BranchAddress || "") + - (BranchCity - ? (BranchAddress && BranchCity ? "-" : "") + BranchCity - : "") + - (BranchZip - ? (BranchCity && - BranchZip - ? "-" - : "") + BranchZip - : "")} + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')}
    - {BranchDetails?.BrGSTIN &&
    GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : BranchDetails?.BrGSTIN}, CIN :u00045hhsgbubufsdug
    } - {BranchDetails?.BrMobile && -
    - {" "} - Mobile : +91 {GlobaldummyData ? "986XXXXXXX" : BranchDetails?.BrMobile} + {BranchDetails?.BrGSTIN && ( +
    + GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : BranchDetails?.BrGSTIN} + , CIN :u00045hhsgbubufsdug
    - } + )} + {BranchDetails?.BrMobile && ( +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile} +
    + )}
    -
    {GlobaldummyData ? 'Cash Bill' : BillName ? BillName : "Delivery Challan"}
    - +
    + {GlobaldummyData + ? 'Cash Bill' + : BillName + ? BillName + : 'Delivery Challan'}{' '} +
    -
    - {table2Data?.ToBranchDtl?.length > 0 && <> -
    -
    -
    Delivery To :
    -
    -
    {table2Data?.ToBranchDtl?.[0]?.BranchName}
    - {table2Data?.ToBranchDtl?.[0]?.Address1 &&
    {table2Data?.ToBranchDtl?.[0]?.Address1}
    } - {(table2Data?.ToBranchDtl?.[0]?.City || table2Data?.ToBranchDtl?.[0]?.Dist || table2Data?.ToBranchDtl?.[0]?.Zip) &&
    {`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
    } - {table2Data?.ToBranchDtl?.[0]?.BrGSTIN &&
    {table2Data?.ToBranchDtl?.[0]?.BrGSTIN}
    } + {table2Data?.ToBranchDtl?.length > 0 && ( + <> +
    +
    +
    + Delivery To : +
    +
    +
    + {table2Data?.ToBranchDtl?.[0]?.BranchName} +
    + {table2Data?.ToBranchDtl?.[0]?.Address1 && ( +
    + {table2Data?.ToBranchDtl?.[0]?.Address1} +
    + )} + {(table2Data?.ToBranchDtl?.[0]?.City || + table2Data?.ToBranchDtl?.[0]?.Dist || + table2Data?.ToBranchDtl?.[0]?.Zip) && ( +
    {`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
    + )} + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN && ( +
    + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN} +
    + )} +
    -
    - } + + )}
    {/* orderdetails */} - {(((GlobaldummyData - ? "121" - : table2Data?.DCNo) || (GlobaldummyData ? formattedDate : Date1)) && table2Data?.dispatchPrint !== true) &&
    -
    + {((GlobaldummyData ? '121' : table2Data?.DCNo) || + (GlobaldummyData ? formattedDate : Date1)) && + table2Data?.dispatchPrint !== true && ( +
    +
    +
    + {' '} + Delivery ChallanNo: + {GlobaldummyData ? '121' : table2Data?.DCNo} +
    +
    -
    - {" "} - Delivery ChallanNo: - {GlobaldummyData - ? "121" - : table2Data?.DCNo} +
    +
    + {' '} + Date : {GlobaldummyData ? formattedDate : Date1}{' '} +
    + )} -
    -
    - {" "} - Date : {GlobaldummyData ? formattedDate : Date1}{" "} + {table2Data?.dispatchPrint === true && + (table2Data?.RequestId || + formatDate(table2Data?.CreatedDate)) && ( +
    +
    +
    + {' '} + Ref No #: + {table2Data?.RequestId} +
    +
    + +
    +
    + {' '} + Dispatched Date :{' '} + {formatDate(table2Data?.CreatedDate)}{' '} +
    -
    } - - {(table2Data?.dispatchPrint === true && ((table2Data?.RequestId) || (formatDate(table2Data?.CreatedDate)))) &&
    -
    -
    - {" "} - Ref No #: - {table2Data?.RequestId} + )} + {table2Data?.dispatchPrint === true && table2Data?.DispatchId && ( +
    +
    +
    + {' '} + Dispatch No #: + {table2Data?.DispatchId} +
    - -
    -
    - {" "} - Dispatched Date : {formatDate(table2Data?.CreatedDate)}{" "} -
    -
    -
    } - {((table2Data?.dispatchPrint === true && table2Data?.DispatchId)) &&
    -
    -
    - {" "} - Dispatch No #: - {table2Data?.DispatchId} -
    -
    -
    } + )} {/* orderdetails */}
    - {(table2Data?.CustMobile || table2Data?.CustName || table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && + {(table2Data?.CustMobile || + table2Data?.CustName || + table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( <>
    - {(table2Data?.CustMobile || table2Data?.CustName) && + {(table2Data?.CustMobile || table2Data?.CustName) && (
    -
    Delivery Details
    - {table2Data?.CustMobile &&
    Mobile NO :{table2Data?.CustMobile}
    } - {table2Data?.CustName &&
    Name:{table2Data?.CustName}
    } +
    + Delivery Details +
    + {table2Data?.CustMobile && ( +
    + {' '} + Mobile NO :{table2Data?.CustMobile}{' '} +
    + )} + {table2Data?.CustName && ( +
    + {' '} + Name:{table2Data?.CustName} +
    + )}
    - } - {(table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && + )} + {(table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && (
    -
    Vehicle Details
    - {table2Data?.VehicleNo &&
    Vehicle No :{table2Data?.VehicleNo}
    } - {table2Data?.TransporterId &&
    Transporter Id :{table2Data?.TransporterId}
    } - {table2Data?.TransporterName &&
    Transporter Name :{table2Data?.TransporterName}
    } +
    + Vehicle Details +
    + {table2Data?.VehicleNo && ( +
    + {' '} + Vehicle No :{table2Data?.VehicleNo} +
    + )} + {table2Data?.TransporterId && ( +
    + {' '} + Transporter Id :{table2Data?.TransporterId} +
    + )} + {table2Data?.TransporterName && ( +
    + {' '} + Transporter Name :{table2Data?.TransporterName} +
    + )}
    - } + )}

    - } + )} {/* itemdata (loop) */} -
    -
    - +
    {(table2Data?.ProductDetails?.length > 0 || GlobaldummyData) && ( <> - -
    - + {GlobaldummyData - ? GlobalSlNo && - : SLNO == true && } + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} {GlobaldummyData ? GlobalItem && - : Item == true && } + : Item == true && ( + + )} {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && ( )} */} {GlobaldummyData - ? GlobalQuantity && + ? GlobalQuantity && ( + + ) : Quantity == true && ( - - )} + + )} {/* {GlobaldummyData ? GlobalMRP && : MRP == true && } @@ -414,38 +624,58 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, - {dataChunk?.map( - (item, index) => ( - - {GlobaldummyData - ? GlobalSlNo && ( - + {GlobaldummyData + ? GlobalSlNo && ( + ) - : SLNO == true && ( - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && ( + {GlobaldummyData + ? GlobalItem && + : Item == true && ( )} - {/* {GlobaldummyData + {/* {GlobaldummyData ? GlobalHsnCode && ( )} */} - {GlobaldummyData - ? GlobalQuantity && ( - ) - : Quantity == true && ( - )} - {/* {GlobaldummyData + {/* {GlobaldummyData ? GlobalMRP && ( )} */} - - ) - )} + + ))}
    S.NoS.No + S.No + + S.No + ItemItemItemHSNHSNQtyQtyQty + Qty + MRPMRP
    + {dataChunk?.map((item, index) => ( +
    {index + 1} + : SLNO == true && ( + {chunkIndex * chunkSize + index + 1} {item?.ProdName}{item?.ProdName}
    {item?.ProdName}
    - {!(item?.ProdVariantName || item?.RequestVariantName)?.toLowerCase()?.includes( - 'variant' - ) && Variant:{item?.ProdVariantName || item?.RequestVariantName} } -  {" "} -   + {!( + item?.ProdVariantName || + item?.RequestVariantName + ) + ?.toLowerCase() + ?.includes('variant') && ( + + Variant: + {item?.ProdVariantName || + item?.RequestVariantName}{' '} + + )} +    
    {item?.HSN} @@ -456,18 +686,18 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, {item?.HSN} + {GlobaldummyData + ? GlobalQuantity && ( + {item?.SalesQty} + : Quantity == true && ( + {item?.Qty || item?.DispatchedQty} {item?.MRP} @@ -511,9 +741,8 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress,
    @@ -521,97 +750,212 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, )} {/* itemdata */} - -
    - - {((chunkIndex === paginatedChunks.length - 1)) && - + {chunkIndex === paginatedChunks.length - 1 && ( <>
    - {/* {ExtraChargeTotal > 0 &&

    Extra Charges:{ExtraChargeTotal}

    } */} - - - -
    - - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    -
    -
    ) : - Notestext && (
    -

    {Notestext}

    +
    +
    + ) + : Notestext && ( +
    +

    + {Notestext} +

    -
    -
    ) - } +
    +
    + )} +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not exchangeable + or refundable. +
    2. +
    3. + Please check the product before leaving the + counter. +
    4. +
    +
    + ) + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && ( +
    +

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    + )} -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    ) - } - - {GlobaldummyData ? GlobalSignature && (
    -

    Signature

    - -
    ) : Signature == true && (
    -

    Signature

    - -
    )} - + {GlobaldummyData + ? GlobalSignature && ( +
    +

    + Signature +

    + +
    + ) + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && ( + {PrintGreeting?.SettingValue === 'Y' && (
    Thank You Visit Again @@ -619,16 +963,10 @@ const DCPrintStyle1 = ({ BranchName, BranchDetails, BranchAddress, )}
    - - } - + )}
    ))} - - -
    - ); }; diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle10.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle10.jsx index f4389c8..9a5ddfb 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle10.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle10.jsx @@ -23,6 +23,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.scss'; @@ -304,6 +313,72 @@ const DCPrintStyle10 = ({ const shouldFooterBeOnNewPage = lastChunkRows > (!isMobile ? 15 : PageSize == 'A5' ? 5 : 10); + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + return ( <> {FormatTheme ? ( @@ -353,7 +428,7 @@ const DCPrintStyle10 = ({ width: '100%', }} > -
    +
    {GlobaldummyData ? GlobalSlNo && ( - S.N + + S.N + ) - : SLNO && S.N} + : SLNO && ( + + S.N + + )} {GlobaldummyData ? GlobalItem && ( - Item + + Item + ) - : Item && Item} + : Item && ( + + Item + + )} {GlobaldummyData ? GlobalQuantity && ( Qty ) : Quantity && ( Qty )} - {/* {GlobaldummyData ? GlobalHsnCode && HSN : HsnCode && HSN} - {GlobaldummyData ? GlobalMRP && MRP : MRP && MRP} - {GlobaldummyData ? GlobalDiscount && Dis : Discount && Dis } - {GlobaldummyData ? GlobalRate && Rate : Rate && Rate} - {GlobaldummyData ? GlobalAmount && Amt : Amount && Amt} */} {dataChunk?.map((item, index) => { return ( - + {GlobaldummyData ? GlobalSlNo && ( {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle11.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle11.jsx index b7c9ce6..10ded40 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle11.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle11.jsx @@ -25,6 +25,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, + GlobalSelectedTableBodyFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.scss'; @@ -287,6 +296,72 @@ const DCPrintStyle11 = ({ : 0; const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 10); + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + return ( <> {FormatTheme ? ( @@ -331,6 +406,7 @@ const DCPrintStyle11 = ({ padding: 0, fontWeight: 600, textAlign: 'center', + ...headerStyle, }} >
    {GlobaldummyData @@ -360,7 +437,7 @@ const DCPrintStyle11 = ({ width: '100%', }} > -
    +
    {base64Image ? ( {GlobaldummyData ? GlobalSlNo && ( - S.No + + S.No + ) - : SLNO && S.No} + : SLNO && ( + + S.No + + )} {GlobaldummyData ? GlobalItem && ( - Item + + Item + ) - : Item && Item} + : Item && ( + + Item + + )} {GlobaldummyData ? GlobalQuantity && ( Qty ) : Quantity && ( Qty )} - {/* {GlobaldummyData ? GlobalHsnCode && HSN : HsnCode && HSN} - {GlobaldummyData ? GlobalMRP && MRP : MRP && MRP} - {GlobaldummyData ? GlobalDiscount && Dis : Discount && Dis } - {GlobaldummyData ? GlobalRate && Rate : Rate && Rate} - {GlobaldummyData ? GlobalAmount && Amt : Amount && Amt} */} {dataChunk?.map((item, index) => { return ( - + {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( @@ -695,11 +808,6 @@ const DCPrintStyle11 = ({ {item?.Qty || item?.DispatchedQty} )} - {/* {GlobaldummyData ? GlobalHsnCode && {item?.HSN} : HsnCode && {item?.HSN}} - {GlobaldummyData ? GlobalMRP && {item?.MRP} : MRP && {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}} - {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount && {item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}} - {GlobaldummyData ? GlobalRate && {item?.Rate} : Rate && {item?.Rate}} - {GlobaldummyData ? GlobalAmount && {item?.TotalAmt} : Amount && {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}} */} ); })} @@ -751,6 +859,7 @@ const DCPrintStyle11 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle12.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle12.jsx index 84d0a69..0ec42e5 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle12.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle12.jsx @@ -26,6 +26,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.scss'; @@ -433,6 +442,72 @@ const DCPrintstyle12 = ({ await printDiv('DCPrintStyle12', style12, 'FontApply'); }; + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + return ( <> {FormatTheme ? ( @@ -483,7 +558,10 @@ const DCPrintstyle12 = ({ width: '100%', }} > -
    +
    {GlobaldummyData - ? GlobalSlNo && S.No - : SLNO && S.No} + ? GlobalSlNo && ( + S.No + ) + : SLNO && ( + S.No + )} {GlobaldummyData - ? GlobalItem && Description - : Item && Des} + ? GlobalItem && ( + + Description + + ) + : Item && ( + Des + )} {GlobaldummyData ? GlobalQuantity && ( - Qty + + Qty + ) : Quantity && ( - Qty + + Qty + )} - {/* {GlobaldummyData ? GlobalMRP && MRP : MRP && MRP} - {GlobaldummyData ? GlobalRate && Rate : Rate && Rate} - {GlobaldummyData ? GlobalHsnCode && HSN : HsnCode && HSN} - {GlobaldummyData ? GlobalDiscount && (%) : Discount && (%)} - {GlobaldummyData ? GlobalAmount && Amt : Amount && Amt} */} {dataChunk?.map((item, index) => { return ( - + {GlobaldummyData ? GlobalSlNo && ( @@ -841,11 +951,6 @@ const DCPrintstyle12 = ({ {item?.Qty || item?.DispatchedQty} )} - {/* {GlobaldummyData ? GlobalMRP && {item?.MRP} : MRP && {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}} - {GlobaldummyData ? GlobalRate && {item?.Rate} : Rate && {item?.Rate}} - {GlobaldummyData ? GlobalHsnCode && {item?.HSN} : HsnCode && {item?.HSN}} - {GlobaldummyData ? GlobalDiscount && {item?.discount} : Discount && {item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}} - {GlobaldummyData ? GlobalAmount && {item?.TotalAmt} : Amount && {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}} */} ); })} @@ -898,6 +1003,7 @@ const DCPrintstyle12 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle2.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle2.jsx index e75c9c4..e3a3c1d 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle2.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle2.jsx @@ -1,383 +1,912 @@ -import React from "react"; -import { useDispatch, useSelector } from "react-redux"; +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; import { - GlobalprintSlNo, - GlobalprintItem, - GlobalprintMRP, - GlobalprintDiscount, - GlobalprintQuantity, - GlobalprintRate, - GlobalprintAmount, - GlobalprintHsnCode, - GlobalprintQrcodet, - GlobalPritdummyData, - changeReprintDataFound, - GloabalFieldDetails, - GlobalprintSignature, - GlobalprinttermsAndConditions, - GlobalSignatureImage, - Globalnotes, - GlobalthemeFormat, - GlobalBillName, -} from "../../../../Features/ThemeChange/ThemeChange"; + GlobalprintSlNo, + GlobalprintItem, + GlobalprintMRP, + GlobalprintDiscount, + GlobalprintQuantity, + GlobalprintRate, + GlobalprintAmount, + GlobalprintHsnCode, + GlobalprintQrcodet, + GlobalPritdummyData, + changeReprintDataFound, + GloabalFieldDetails, + GlobalprintSignature, + GlobalprinttermsAndConditions, + GlobalSignatureImage, + Globalnotes, + GlobalthemeFormat, + GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableBodyColor, + GlobalSelectedFooterColor, + GlobalSelectedNetAmountColor, + GlobalSelectedFooterFontColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedPrintHeaderFontColor, + GlobalRowType, +} from '../../../../Features/ThemeChange/ThemeChange'; +import signature from '../../../../Images/signatureimage.jpg'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.scss'; +import { isMobile } from 'react-device-detect'; +const DCPrintstyle2 = ({ + BranchName, + BranchDetails, + BranchAddress, + BranchCity, + BranchZip, + Date1, + table2Data, + PaymentStatus, + PrintGreeting, + base64Image, + DCPrintTemplateDtl, +}) => { + const dispatch = useDispatch(); + let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { + acc[item.ConfigName] = true; + return acc; + }, {}); -import signature from "../../../../Images/signatureimage.jpg" -import "../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.scss"; -import { isMobile } from "react-device-detect"; -const DCPrintstyle2 = ({ BranchName, BranchDetails, BranchAddress, - BranchCity, - BranchZip, Date1, - table2Data, PaymentStatus, PrintGreeting, base64Image, DCPrintTemplateDtl }) => { - - const dispatch = useDispatch(); - let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { - acc[item.ConfigName] = true; - return acc; - }, {}); - - const formatDate = (dateString = '') => { - const date = new Date(dateString); - const day = date.getDate().toString().padStart(2, '0'); - const months = [ - 'Jan', - 'Feb', - 'Mar', - 'Apr', - 'May', - 'Jun', - 'Jul', - 'Aug', - 'Sep', - 'Oct', - 'Nov', - 'Dec', - ]; - const month = months[date.getMonth()]; - const year = date.getFullYear(); - return day && month && year ? `${day}-${month}-${year}` : '-'; - } - - - console.log(FieldDetails, "FieldDetails") - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - console.log(Item, "Item") - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const GlobalSlNo = useSelector(GlobalprintSlNo); - const GlobalItem = useSelector(GlobalprintItem); - const GlobalMRP = useSelector(GlobalprintMRP); - const GlobalDiscount = useSelector(GlobalprintDiscount); - const GlobalQuantity = useSelector(GlobalprintQuantity); - const GlobalRate = useSelector(GlobalprintRate); - const GlobalAmount = useSelector(GlobalprintAmount); - const GlobalHsnCode = useSelector(GlobalprintHsnCode); - const GlobalQrcodet = useSelector(GlobalprintQrcodet); - const GlobaldummyData = useSelector(GlobalPritdummyData); - const GlobalSignature = useSelector(GlobalprintSignature); - const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); - const GlobalSignatureImages = useSelector(GlobalSignatureImage); - const GlobalIsnotes = useSelector(Globalnotes); - const GlobalthemeFormatr = useSelector(GlobalthemeFormat) - const GlobalBilltext = useSelector(GlobalBillName) - - let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions - let SignatureImg = DCPrintTemplateDtl?.Signature - let Notestext = DCPrintTemplateDtl?.Notes - let BillName = DCPrintTemplateDtl?.PrintHdrName - let FormatTheme = DCPrintTemplateDtl?.PrintType == "S" ? true : false - let PageSize = DCPrintTemplateDtl?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - console.log(Signature, TermsnAdCondition, TermsAndConditions, SignatureImg, "FormatTheme"); - - - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") - const keysLength = Object.keys(table2Data ?? {}).length; - if (keysLength > 0) { - dispatch(changeReprintDataFound(true)); - } - const currentDate = new Date(); - const day = currentDate.getDate().toString().padStart(2, "0"); - const monthNames = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", + const formatDate = (dateString = '') => { + const date = new Date(dateString); + const day = date.getDate().toString().padStart(2, '0'); + const months = [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', ]; - const monthIndex = currentDate.getMonth(); - const year = currentDate.getFullYear().toString().slice(-2); + const month = months[date.getMonth()]; + const year = date.getFullYear(); + return day && month && year ? `${day}-${month}-${year}` : '-'; + }; - const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; + console.log(FieldDetails, 'FieldDetails'); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + console.log(Item, 'Item'); + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalMRP = useSelector(GlobalprintMRP); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalQuantity = useSelector(GlobalprintQuantity); + const GlobalRate = useSelector(GlobalprintRate); + const GlobalAmount = useSelector(GlobalprintAmount); + const GlobalHsnCode = useSelector(GlobalprintHsnCode); + const GlobalQrcodet = useSelector(GlobalprintQrcodet); + const GlobaldummyData = useSelector(GlobalPritdummyData); + const GlobalSignature = useSelector(GlobalprintSignature); + const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); + const GlobalSignatureImages = useSelector(GlobalSignatureImage); + const GlobalIsnotes = useSelector(Globalnotes); + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); + const GlobalBilltext = useSelector(GlobalBillName); + let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions; + let SignatureImg = DCPrintTemplateDtl?.Signature; + let Notestext = DCPrintTemplateDtl?.Notes; + let BillName = DCPrintTemplateDtl?.PrintHdrName; + let FormatTheme = DCPrintTemplateDtl?.PrintType == 'S' ? true : false; + let PageSize = DCPrintTemplateDtl?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + console.log( + Signature, + TermsnAdCondition, + TermsAndConditions, + SignatureImg, + 'FormatTheme' + ); - const products = [ - { ProdName: 'ITEM 1', Rate: 88.00, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01' }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02' }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03' }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04' }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05' }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06' }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08' }, - ]; + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); + const keysLength = Object.keys(table2Data ?? {}).length; + if (keysLength > 0) { + dispatch(changeReprintDataFound(true)); + } + const currentDate = new Date(); + const day = currentDate.getDate().toString().padStart(2, '0'); + const monthNames = [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', + ]; + const monthIndex = currentDate.getMonth(); + const year = currentDate.getFullYear().toString().slice(-2); - const chunkSize = !isMobile ? 11 : PageSize == "A5" ? 11 : 16; + const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; - let dataSource = table2Data?.ProductDetails || []; + const products = [ + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + }, + ]; - // Paginate the data - const paginatedChunks = []; - for (let i = 0; i < dataSource.length; i += chunkSize) { - paginatedChunks.push(dataSource.slice(i, i + chunkSize)); - } - const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; - const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == "A5" ? 5 : 10); + const chunkSize = !isMobile ? 11 : PageSize == 'A5' ? 11 : 16; - return ( - <> + let dataSource = table2Data?.ProductDetails || []; + // Paginate the data + const paginatedChunks = []; + for (let i = 0; i < dataSource.length; i += chunkSize) { + paginatedChunks.push(dataSource.slice(i, i + chunkSize)); + } + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 10); + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + const netAmtColor = printColors?.find((obj) => obj.netAmtColor)?.netAmtColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + + return ( + <> +
    + {paginatedChunks.map((dataChunk, chunkIndex) => ( +
    0 ? ' print-page-break' : ''}`} + style={{ + display: 'flex', + flexDirection: 'column', + height: PageSize == 'A5' ? '170mm' : '257mm', + }} + key={chunkIndex} + >
    + className="header" + style={{ + position: isMobile + ? GlobaldummyData + ? 'absolute' + : 'fixed' + : '', + top: 0, + width: '100%', + ...headerStyle, + }} + > +
    +
    + {base64Image ? ( + image + ) : null} +
    - {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    0 ? ' print-page-break' : ''}`} style={{ display: "flex", flexDirection: "column", height: PageSize == "A5" ? '170mm' : "257mm", }} key={chunkIndex}> +
    +
    + {GlobaldummyData ? 'XYZ Shop' : BranchName} +
    -
    -
    +
    + {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +
    + {BranchDetails?.BrGSTIN && ( +
    + GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : BranchDetails?.BrGSTIN} + , CIN :u00045hhsgbubufsdug +
    + )} -
    - {(base64Image) ? image : null} -
    + {BranchDetails?.BrMobile && ( +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile} +
    + )} +
    +
    -
    -
    {GlobaldummyData ? 'XYZ Shop' : BranchName}
    +
    + {GlobaldummyData + ? 'Cash Bill' + : BillName + ? BillName + : 'Delivery Challan'}{' '} +
    -
    {GlobaldummyData ? - 'BranchAddress, Town- 635XXX City - State' : - (BranchAddress || '') + (BranchCity ? (BranchAddress && BranchCity ? '-' : '') + BranchCity : '') + (BranchZip ? (BranchCity && BranchZip ? '-' : '') + BranchZip : '')} -
    - {BranchDetails?.BrGSTIN &&
    GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : BranchDetails?.BrGSTIN}, CIN :u00045hhsgbubufsdug
    } - - {BranchDetails?.BrMobile &&
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile}
    } - -
    - -
    - -
    {GlobaldummyData ? 'Cash Bill' : BillName ? BillName : "Delivery Challan"}
    - - - {table2Data?.dispatchPrint !== true &&
    -
    -
    Delivery Challan No :{GlobaldummyData ? 'A22' : table2Data?.DCNo}
    -
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    } - {table2Data?.dispatchPrint === true &&
    -
    -
    Ref No #:{table2Data?.RequestId}
    -
    -
    Requested Date :{formatDate(table2Data?.RequestedDate)}
    -
    } -
    - {table2Data?.dispatchPrint === true && <> -
    -
    -
    Dispatch No #:{table2Data?.DispatchId}
    -
    -
    Dispatch Date :{formatDate(table2Data?.CreatedDate)}
    -
    -
    - } - {table2Data?.ToBranchDtl?.length > 0 && <> -
    -
    Delivery To :
    -
    -
    {table2Data?.ToBranchDtl?.[0]?.BranchName}
    - {table2Data?.ToBranchDtl?.[0]?.Address1 &&
    {table2Data?.ToBranchDtl?.[0]?.Address1}
    } - {(table2Data?.ToBranchDtl?.[0]?.City || table2Data?.ToBranchDtl?.[0]?.Dist || table2Data?.ToBranchDtl?.[0]?.Zip) &&
    {`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
    } - {table2Data?.ToBranchDtl?.[0]?.BrGSTIN &&
    {table2Data?.ToBranchDtl?.[0]?.BrGSTIN}
    } -
    -
    - } + {table2Data?.dispatchPrint !== true && ( +
    +
    +
    + Delivery Challan No : + {GlobaldummyData ? 'A22' : table2Data?.DCNo} +
    +
    +
    + {GlobaldummyData ? formattedDate : Date1} +
    +
    + )} + {table2Data?.dispatchPrint === true && ( +
    +
    +
    + Ref No #:{table2Data?.RequestId} +
    +
    +
    + Requested Date :{formatDate(table2Data?.RequestedDate)} +
    +
    + )} +
    + {table2Data?.dispatchPrint === true && ( + <> +
    +
    +
    + Dispatch No #:{table2Data?.DispatchId} +
    +
    +
    + Dispatch Date :{formatDate(table2Data?.CreatedDate)} +
    +
    +
    + + )} + {table2Data?.ToBranchDtl?.length > 0 && ( + <> +
    +
    + Delivery To : +
    +
    +
    + {table2Data?.ToBranchDtl?.[0]?.BranchName} +
    + {table2Data?.ToBranchDtl?.[0]?.Address1 && ( +
    + {table2Data?.ToBranchDtl?.[0]?.Address1}
    -
    - {(table2Data?.CustMobile || table2Data?.CustName || table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && - <> -
    -
    - {(table2Data?.CustMobile || table2Data?.CustName) && -
    -
    Delivery Details
    - {table2Data?.CustMobile &&
    Mobile NO :{table2Data?.CustMobile}
    } - {table2Data?.CustName &&
    Name:{table2Data?.CustName}
    } -
    + )} + {(table2Data?.ToBranchDtl?.[0]?.City || + table2Data?.ToBranchDtl?.[0]?.Dist || + table2Data?.ToBranchDtl?.[0]?.Zip) && ( +
    {`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
    + )} + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN && ( +
    + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN} +
    + )} +
    +
    + + )} +
    +
    + {(table2Data?.CustMobile || + table2Data?.CustName || + table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( + <> +
    +
    + {(table2Data?.CustMobile || table2Data?.CustName) && ( +
    +
    + Delivery Details +
    + {table2Data?.CustMobile && ( +
    + {' '} + Mobile NO :{table2Data?.CustMobile}{' '} +
    + )} + {table2Data?.CustName && ( +
    + {' '} + Name:{table2Data?.CustName} +
    + )} +
    + )} + {(table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( +
    +
    + Vehicle Details +
    + {table2Data?.VehicleNo && ( +
    + {' '} + Vehicle No :{table2Data?.VehicleNo} +
    + )} + {table2Data?.TransporterId && ( +
    + {' '} + Transporter Id :{table2Data?.TransporterId} +
    + )} + {table2Data?.TransporterName && ( +
    + {' '} + Transporter Name :{table2Data?.TransporterName} +
    + )} +
    + )} +
    +
    + + )} +
    +
    + {(table2Data?.ProductDetails?.length > 0 || + GlobaldummyData) && ( +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + + + + {dataChunk?.map((item, index) => { + return ( + -
    Vehicle Details
    - {table2Data?.VehicleNo &&
    Vehicle No :{table2Data?.VehicleNo}
    } - {table2Data?.TransporterId &&
    Transporter Id :{table2Data?.TransporterId}
    } - {table2Data?.TransporterName &&
    Transporter Name :{table2Data?.TransporterName}
    } - - } - -
    - - } -
    -
    - {(table2Data?.ProductDetails?.length > 0 || GlobaldummyData) && -
    - -
    + S.No + + S.No + ItemItem + Qty + + Qty +
    - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } */} - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {/* {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalAmount && : Amount && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalRate && : Rate && } */} - - - - {dataChunk?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - - } - {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } */} - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {/* {GlobaldummyData ? GlobalMRP && : MRP && } + : {} + } + > + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && ( + + )} + {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } */} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {/* {GlobaldummyData ? GlobalMRP && : MRP && } {GlobaldummyData ? GlobalAmount && : Amount && } {GlobaldummyData ? GlobalDiscount && : Discount && } {GlobaldummyData ? GlobalRate && : Rate && } */} - - ) - })} - -
    S.NoS.NoItemItemHSNHSNQtyQtyMRPMRPAmtAmtDis Dis RateRate
    {index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName}({item?.Size + item?.UomName}) -
    {item?.ProdName}
    - {!(item?.ProdVariantName || item?.RequestVariantName)?.toLowerCase()?.includes('variant') && Variant:{item?.ProdVariantName || item?.RequestVariantName} } -
    {item?.HSN}{item?.HSN}{item?.SalesQty}{item?.Qty || item?.DispatchedQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} + {index + 1} + + {chunkIndex * chunkSize + index + 1} + + {item?.ProdName}( + {item?.Size + item?.UomName}) + +
    {item?.ProdName}
    + {!( + item?.ProdVariantName || + item?.RequestVariantName + ) + ?.toLowerCase() + ?.includes('variant') && ( + + Variant: + {item?.ProdVariantName || + item?.RequestVariantName}{' '} + + )} +
    {item?.HSN}{item?.HSN} + {item?.SalesQty} + + {item?.Qty || item?.DispatchedQty} + {item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.TotalAmt} {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}{item?.discount} {item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.Rate}{item?.Rate}
    -
    - } - -
    - -
    -
    - - {((chunkIndex === paginatedChunks.length - 1)) && - - <> - - - - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - -
    -
    ) - } - - -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    ) - } - - {GlobaldummyData ? GlobalSignature && (
    -

    Signature

    - -
    ) : Signature == true && (
    -

    Signature

    - -
    )} - -
    -
    - - {PrintGreeting?.SettingValue === "Y" && -
    - Thank You Visit Again -
    - } - - - - - } + + ); + })} + +
    - ))} - - - - + )} +
    +
    + {chunkIndex === paginatedChunks.length - 1 && ( + <> +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    - - ) -} +
    +
    + ) + : Notestext && ( +
    +

    {Notestext}

    -export default DCPrintstyle2 +
    +
    + )} + +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not exchangeable + or refundable. +
    2. +
    3. + Please check the product before leaving the + counter. +
    4. +
    +
    + ) + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && ( +
    +

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    + )} + + {GlobaldummyData + ? GlobalSignature && ( +
    +

    + Signature +

    + +
    + ) + : Signature == true && ( +
    +

    + Signature +

    + +
    + )} +
    +
    + + {PrintGreeting?.SettingValue === 'Y' && ( +
    + Thank You Visit Again +
    + )} + + )} +
    + ))} +
    + + ); +}; + +export default DCPrintstyle2; diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle3.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle3.jsx index 2862325..bba185b 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle3.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle3.jsx @@ -23,6 +23,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableBodyColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedFooterFontColor, + GlobalSelectedFooterColor, + GlobalRowType, } from '../../../../Features/ThemeChange/ThemeChange'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.scss'; import QRCode from 'react-qr-code'; @@ -232,6 +241,70 @@ const DCPrintStyle3 = ({ lastChunkRows > (!isMobile ? 10 : PageSize == 'A5' ? 5 : 10); console.log(paginatedChunks, dataSource, 'dataSourcedataSource'); + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + return ( <>
    -
    +
    {GlobaldummyData ? 'XYZ Shop' : BranchName}
    @@ -473,6 +546,7 @@ const DCPrintStyle3 = ({ width: '100%', fontweight: '600', gap: '0.2rem', + ...tableHeaderStyle, }} > {GlobaldummyData @@ -559,6 +633,11 @@ const DCPrintStyle3 = ({ justifyContent: 'space-between', width: '100%', gap: '0.2rem', + ...(index % 2 !== 1 && rowtypeStyle === 'even' + ? { ...tableBodyStyle } + : index % 2 === 1 && rowtypeStyle === 'odd' + ? { ...tableBodyStyle } + : {}), }} > {GlobaldummyData @@ -688,6 +767,7 @@ const DCPrintStyle3 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle4.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle4.jsx index 8731029..c585bde 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle4.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle4.jsx @@ -17,19 +17,25 @@ import { GlobalprintQrcodet, GlobalPritdummyData, changeReprintDataFound, - GloabalFieldDetails, GlobalprintSignature, GlobalprinttermsAndConditions, GlobalSignatureImage, Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.scss'; -import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import QRCode from 'react-qr-code'; import signature from '../../../../Images/signatureimage.jpg'; -import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; import { isMobile } from 'react-device-detect'; const DCPrintstyle4 = ({ @@ -219,6 +225,71 @@ const DCPrintstyle4 = ({ ? paginatedChunks[paginatedChunks.length - 1].length : 0; const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 11 : 20); + + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + return ( <>
    {GlobaldummyData ? GlobalSlNo && ( - S.No + + S.No + ) - : SLNO && S.No} + : SLNO && ( + + S.No + + )} {GlobaldummyData - ? GlobalItem && Item - : Item && Item} + ? GlobalItem && ( + Item + ) + : Item && ( + Item + )} {GlobaldummyData ? GlobalQuantity && ( Qty ) : Quantity && ( Qty )} - {/* {GlobaldummyData ? GlobalHsnCode && HSN : HsnCode && HSN} - {GlobaldummyData ? GlobalMRP && MRP : MRP && MRP} - {GlobaldummyData ? GlobalDiscount && Dis : Discount && Dis } - {GlobaldummyData ? GlobalRate && Rate : Rate && Rate} - {GlobaldummyData ? GlobalAmount && Amt : Amount && Amt} */} {dataChunk?.map((item, index) => { return ( - + {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( @@ -547,11 +649,6 @@ const DCPrintstyle4 = ({ {item?.Qty || item?.DispatchedQty} )} - {/* {GlobaldummyData ? GlobalHsnCode && {item?.HSN} : HsnCode && {item?.HSN}} - {GlobaldummyData ? GlobalMRP && {item?.MRP} : MRP && {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}} - {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount && {item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}} - {GlobaldummyData ? GlobalRate && {item?.Rate} : Rate && {item?.Rate}} - {GlobaldummyData ? GlobalAmount && {item?.TotalAmt} : Amount && {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}} */} ); })} @@ -604,6 +701,7 @@ const DCPrintstyle4 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle5.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle5.jsx index 7b955ef..d808a8f 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle5.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle5.jsx @@ -24,6 +24,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedFooterFontColor, + GlobalSelectedFooterColor, + GlobalRowType, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.scss'; @@ -203,6 +212,74 @@ const DCPrintStyle5 = ({ : 0; const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 15 : 15); + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + const netAmtColor = printColors?.find((obj) => obj.netAmtColor)?.netAmtColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + return ( <>
    -
    +
    {GlobaldummyData @@ -502,10 +580,6 @@ const DCPrintStyle5 = ({ QTY
    )} - {/* {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } - {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } - {GlobaldummyData ? GlobalAmount &&
    Amt
    : Amount &&
    AMT
    } */}

    @@ -521,6 +595,15 @@ const DCPrintStyle5 = ({ fontWeight: '600', width: '95%', gap: '0.5rem', + ...(index % 2 !== 1 && rowtypeStyle === 'even' + ? { + ...tableBodyStyle, + } + : index % 2 === 1 && rowtypeStyle === 'odd' + ? { + ...tableBodyStyle, + } + : {}), }} > {GlobaldummyData @@ -576,31 +659,6 @@ const DCPrintStyle5 = ({ item?.RequestVariantName}{' '} )} - {/*
    - { - (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(",")} -
    - ); - }) || "") + - "-" + (GlobaldummyData ? (GlobalQuantity && item?.SalesQty) : item?.SalesQty) - } -
    */} }
    @@ -617,9 +675,6 @@ const DCPrintStyle5 = ({ {item?.Qty || item?.DispatchedQty}
    )} - {/* {GlobaldummyData ? GlobalRate &&
    {item?.Rate}
    : Rate &&
    {item?.Rate}
    } - {GlobaldummyData ? GlobalDiscount &&
    {item?.discount}
    : Discount &&
    {item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}
    } - {GlobaldummyData ? GlobalAmount &&
    {item?.TotalAmt}
    : Amount &&
    {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    } */}
    ))} @@ -666,6 +721,7 @@ const DCPrintStyle5 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle6.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle6.jsx index 3be9a9c..1428629 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle6.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle6.jsx @@ -24,6 +24,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalSelectedFooterFontColor, + GlobalSelectedFooterColor, + GlobalRowType, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.scss'; @@ -219,6 +228,72 @@ const DCPrintstyle6 = ({ : 0; const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 20 : 24); + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + return ( <>
    -
    +
    - + {GlobaldummyData ? GlobalSlNo && ( - + ) : SLNO && ( )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( - ) ) : ( - ) : Quantity && ( @@ -557,7 +650,20 @@ const DCPrintstyle6 = ({ {dataChunk?.map((item, index) => { return ( - + {GlobaldummyData ? GlobalSlNo && : SLNO && ( @@ -749,6 +855,7 @@ const DCPrintstyle6 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle7.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle7.jsx index e3eec62..8442e79 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle7.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle7.jsx @@ -21,6 +21,15 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.scss'; @@ -246,6 +255,73 @@ const DCPrintStyle7 = ({ : 0; const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 10); console.log(BranchName, 'paginatedChunks'); + + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + return ( <>

    -
    +
    {' '} {GlobaldummyData ? 'XYZ Shop' : BranchName} @@ -524,31 +600,71 @@ const DCPrintStyle7 = ({
    {GlobaldummyData ? GlobalSlNo && ( - + ) : SLNO == true && ( - + )} {GlobaldummyData - ? GlobalItem && - : Item == true && } - {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } */} + ? GlobalItem && ( + + ) + : Item == true && ( + + )} {GlobaldummyData ? GlobalQuantity && ( - + ) : Quantity == true && ( - + )} - {/* {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } */} {dataChunk?.map((item, index) => ( - + {GlobaldummyData ? GlobalSlNo && ( )} - {/* {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } */} ))} @@ -672,6 +784,7 @@ const DCPrintStyle7 = ({ ? 'space-between' : 'flex-end', alignItems: 'center', + ...footerColorStyle, }} > {GlobaldummyData diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle8.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle8.jsx index 0157a6d..b2efa52 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle8.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle8.jsx @@ -1,358 +1,884 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import QrImage from '../../../../Images/QRcode.png'; -import { extractLastNumber, extractLastNumberOrderId } from '../../../../Services/Others'; import { - GlobalprintSlNo, - GlobalprintItem, - GlobalprintMRP, - GlobalprintDiscount, - GlobalprintQuantity, - GlobalprintRate, - GlobalprintAmount, - GlobalprintHsnCode, - GlobalprintQrcodet, - GlobalPritdummyData, - changeReprintDataFound, - GloabalFieldDetails, - GlobalprintSignature, - GlobalprinttermsAndConditions, - GlobalSignatureImage, - Globalnotes, - GlobalthemeFormat, - GlobalBillName, + extractLastNumber, + extractLastNumberOrderId, +} from '../../../../Services/Others'; +import { + GlobalprintSlNo, + GlobalprintItem, + GlobalprintMRP, + GlobalprintDiscount, + GlobalprintQuantity, + GlobalprintRate, + GlobalprintAmount, + GlobalprintHsnCode, + GlobalprintQrcodet, + GlobalPritdummyData, + changeReprintDataFound, + GloabalFieldDetails, + GlobalprintSignature, + GlobalprinttermsAndConditions, + GlobalSignatureImage, + Globalnotes, + GlobalthemeFormat, + GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.scss'; import QRCode from 'react-qr-code'; -import signature from "../../../../Images/signatureimage.jpg" +import signature from '../../../../Images/signatureimage.jpg'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; import { isMobile } from 'react-device-detect'; -const DCPrintstyle8 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, BranchZip, Date1, - table2Data, PaymentStatus, PrintGreeting, printDatas, DCPrintTemplateDtl }) => { - const formatDate = (dateString = '') => { - const date = new Date(dateString); - const day = date.getDate().toString().padStart(2, '0'); - const months = [ - 'Jan', - 'Feb', - 'Mar', - 'Apr', - 'May', - 'Jun', - 'Jul', - 'Aug', - 'Sep', - 'Oct', - 'Nov', - 'Dec', - ]; - const month = months[date.getMonth()]; - const year = date.getFullYear(); - return day && month && year ? `${day}-${month}-${year}` : '-'; - } - const dispatch = useDispatch(); - let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { - acc[item.ConfigName] = true; - return acc; - }, {}); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const Discount = FieldDetails?.["Discount"]; - const Quantity = FieldDetails?.["Quantity"]; - const GlobalSlNo = useSelector(GlobalprintSlNo); - const GlobalItem = useSelector(GlobalprintItem); - const GlobalDiscount = useSelector(GlobalprintDiscount); - const GlobalQuantity = useSelector(GlobalprintQuantity); - const GlobaldummyData = useSelector(GlobalPritdummyData); - const GlobalSignature = useSelector(GlobalprintSignature); - const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); - const GlobalSignatureImages = useSelector(GlobalSignatureImage); - const GlobalIsnotes = useSelector(Globalnotes); - - console.log(GlobalDiscount, Discount, "Discount"); - - let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions - let SignatureImg = DCPrintTemplateDtl?.Signature - let Notestext = DCPrintTemplateDtl?.Notes - let BillName = DCPrintTemplateDtl?.PrintHdrName - let FormatTheme = DCPrintTemplateDtl?.PrintType == "S" ? true : false - let PageSize = DCPrintTemplateDtl?.PageSize; - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - - - const keysLength = Object.keys(table2Data ?? {}).length; - if (keysLength > 0) { - dispatch(changeReprintDataFound(true)); - } - - - - - const productsData = table2Data?.productDetails || []; - const offers = table2Data?.OrderOfferDetails || []; - - let TotalOfferAmount = 0; - - // Calculate SalesWiseOffers total amount - offers.forEach(offer => { - if (offer.TableName === 'SalesWiseOffers') { - TotalOfferAmount += offer.OfferAmount; - } - }); - const hasMappedOffer = offers.some(offer => - ["ItemWiseOffers", "BundleOffers", "QuantityWiseOffers"].includes(offer.TableName) - ); - - if (hasMappedOffer) { - - const productTotal = productsData?.reduce((acc, item) => acc + (item?.Type != "C" ? item.OfferAmt : item.OfferValue || 0), 0); - TotalOfferAmount += productTotal; - } else { - const Combothere = productsData?.filter(item => item?.Type == "C") - const CombothereTotal = Combothere?.reduce((acc, item) => acc + (item.OfferValue || 0), 0); - TotalOfferAmount += CombothereTotal; - } - const products = [ - { ProdName: 'ITEM 1', Rate: 88.00, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g' }, +const DCPrintstyle8 = ({ + BranchName, + BranchDetails, + BranchAddress, + BranchCity, + BranchZip, + Date1, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + DCPrintTemplateDtl, +}) => { + const formatDate = (dateString = '') => { + const date = new Date(dateString); + const day = date.getDate().toString().padStart(2, '0'); + const months = [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', ]; + const month = months[date.getMonth()]; + const year = date.getFullYear(); + return day && month && year ? `${day}-${month}-${year}` : '-'; + }; + const dispatch = useDispatch(); + let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { + acc[item.ConfigName] = true; + return acc; + }, {}); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const Discount = FieldDetails?.['Discount']; + const Quantity = FieldDetails?.['Quantity']; + const GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalQuantity = useSelector(GlobalprintQuantity); + const GlobaldummyData = useSelector(GlobalPritdummyData); + const GlobalSignature = useSelector(GlobalprintSignature); + const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); + const GlobalSignatureImages = useSelector(GlobalSignatureImage); + const GlobalIsnotes = useSelector(Globalnotes); - console.log(printDatas, "printDatasjk") - const chunkSize = PageSize == "A5" ? 10 : 16; - let dataSource = table2Data?.ProductDetails || []; + console.log(GlobalDiscount, Discount, 'Discount'); + let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions; + let SignatureImg = DCPrintTemplateDtl?.Signature; + let Notestext = DCPrintTemplateDtl?.Notes; + let BillName = DCPrintTemplateDtl?.PrintHdrName; + let FormatTheme = DCPrintTemplateDtl?.PrintType == 'S' ? true : false; + let PageSize = DCPrintTemplateDtl?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + const keysLength = Object.keys(table2Data ?? {}).length; + if (keysLength > 0) { + dispatch(changeReprintDataFound(true)); + } - // Paginate the data - const paginatedChunks = []; - for (let i = 0; i < dataSource.length; i += chunkSize) { - paginatedChunks.push(dataSource.slice(i, i + chunkSize)); + const productsData = table2Data?.productDetails || []; + const offers = table2Data?.OrderOfferDetails || []; + + let TotalOfferAmount = 0; + + // Calculate SalesWiseOffers total amount + offers.forEach((offer) => { + if (offer.TableName === 'SalesWiseOffers') { + TotalOfferAmount += offer.OfferAmount; } - const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; - const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == "A5" ? 5 : 13); + }); + const hasMappedOffer = offers.some((offer) => + ['ItemWiseOffers', 'BundleOffers', 'QuantityWiseOffers'].includes( + offer.TableName + ) + ); - return ( - <> -
    - {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    0 ? ' print-page-break' : ''}`} style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> + if (hasMappedOffer) { + const productTotal = productsData?.reduce( + (acc, item) => + acc + (item?.Type != 'C' ? item.OfferAmt : item.OfferValue || 0), + 0 + ); + TotalOfferAmount += productTotal; + } else { + const Combothere = productsData?.filter((item) => item?.Type == 'C'); + const CombothereTotal = Combothere?.reduce( + (acc, item) => acc + (item.OfferValue || 0), + 0 + ); + TotalOfferAmount += CombothereTotal; + } + const products = [ + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + }, + ]; -
    {GlobaldummyData ? 'Cash Bill' : BillName ? BillName : "Delivery Challan"}
    -
    -
    - {/*

    {table2Data?.BrName}

    */} -
    {GlobaldummyData ? "XYZ Shop" : BranchName}
    -
    - {GlobaldummyData - ? "BranchAddress, Town- 635XXX City - State" - : (BranchAddress || "") + - (BranchCity - ? (BranchAddress && BranchCity ? "-" : "") + BranchCity - : "") + - (BranchZip - ? (BranchCity && - BranchZip - ? "-" - : "") + BranchZip - : "")} -
    - {BranchDetails?.BrMobile &&
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile}
    } -
    - {BranchDetails?.BrGSTIN &&
    GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : BranchDetails?.BrGSTIN}, CIN :u00045hhsgbubufsdug
    } - {/* {BranchDetails?.BrMobile && + console.log(printDatas, 'printDatasjk'); + const chunkSize = PageSize == 'A5' ? 10 : 16; + let dataSource = table2Data?.ProductDetails || []; + + // Paginate the data + const paginatedChunks = []; + for (let i = 0; i < dataSource.length; i += chunkSize) { + paginatedChunks.push(dataSource.slice(i, i + chunkSize)); + } + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 13); + + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; + + return ( + <> +
    + {paginatedChunks.map((dataChunk, chunkIndex) => ( +
    0 ? ' print-page-break' : ''}`} + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: FormatTheme ? (PageSize == 'A5' ? '170mm' : '257mm') : '', + }} + key={chunkIndex} + > +
    + {GlobaldummyData + ? 'Cash Bill' + : BillName + ? BillName + : 'Delivery Challan'}{' '} +
    +
    +
    + {/*

    {table2Data?.BrName}

    */} +
    + {' '} + {GlobaldummyData ? 'XYZ Shop' : BranchName} +
    +
    + {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +
    + {BranchDetails?.BrMobile && ( +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile} +
    + )} +
    + {BranchDetails?.BrGSTIN && ( +
    + GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : BranchDetails?.BrGSTIN} + , CIN :u00045hhsgbubufsdug +
    + )} + {/* {BranchDetails?.BrMobile &&
    {" "} Mobile : +91 {GlobaldummyData ? "986XXXXXXX" : BranchDetails?.BrMobile}
    } */} - {table2Data?.ToBranchDtl?.length > 0 && <> -
    -
    -
    Delivery To :
    -
    -
    {table2Data?.ToBranchDtl?.[0]?.BranchName}
    - {table2Data?.ToBranchDtl?.[0]?.Address1 &&
    {table2Data?.ToBranchDtl?.[0]?.Address1}
    } - {(table2Data?.ToBranchDtl?.[0]?.City || table2Data?.ToBranchDtl?.[0]?.Dist || table2Data?.ToBranchDtl?.[0]?.Zip) &&
    {`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
    } - {table2Data?.ToBranchDtl?.[0]?.BrGSTIN &&
    {table2Data?.ToBranchDtl?.[0]?.BrGSTIN}
    } -
    -
    -
    - } - - {table2Data?.dispatchPrint !== true &&
    -
    - Delivery ChallanNo: - {GlobaldummyData - ? "121" - : table2Data?.DCNo} -
    -
    } - {table2Data?.dispatchPrint === true &&
    -
    -
    - Dispatch No #:{table2Data?.DispatchId} -
    -
    Dispatch Date:{formatDate(table2Data?.CreatedDate)}
    -
    -
    -
    - Ref No #:{table2Data?.RequestId} -
    -
    Requested Date:{formatDate(table2Data?.RequestedDate)}
    -
    -
    } -
    - {(table2Data?.CustMobile || table2Data?.CustName || table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && - <> -
    - {(table2Data?.CustMobile || table2Data?.CustName) && -
    -
    Delivery Details
    - {table2Data?.CustMobile &&
    Mobile NO :{table2Data?.CustMobile}
    } - {table2Data?.CustName &&
    Name:{table2Data?.CustName}
    } -
    - } - {(table2Data?.VehicleNo || table2Data?.TransporterId || table2Data?.TransporterName) && -
    -
    Vehicle Details
    - {table2Data?.VehicleNo &&
    Vehicle No :{table2Data?.VehicleNo}
    } - {table2Data?.TransporterId &&
    Transporter Id :{table2Data?.TransporterId}
    } - {table2Data?.TransporterName &&
    Transporter Name :{table2Data?.TransporterName}
    } -
    - } -
    -
    - - } + {table2Data?.ToBranchDtl?.length > 0 && ( + <> +
    +
    +
    + Delivery To : +
    +
    +
    + {table2Data?.ToBranchDtl?.[0]?.BranchName} +
    + {table2Data?.ToBranchDtl?.[0]?.Address1 && ( +
    + {table2Data?.ToBranchDtl?.[0]?.Address1}
    + )} + {(table2Data?.ToBranchDtl?.[0]?.City || + table2Data?.ToBranchDtl?.[0]?.Dist || + table2Data?.ToBranchDtl?.[0]?.Zip) && ( +
    {`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
    + )} + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN && ( +
    + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN} +
    + )} +
    +
    +
    + + )} + {table2Data?.dispatchPrint !== true && ( +
    +
    + Delivery ChallanNo: + {GlobaldummyData ? '121' : table2Data?.DCNo} +
    +
    + )} + {table2Data?.dispatchPrint === true && ( +
    +
    +
    + Dispatch No #:{table2Data?.DispatchId} +
    +
    + Dispatch Date:{formatDate(table2Data?.CreatedDate)} +
    +
    +
    +
    + Ref No #:{table2Data?.RequestId} +
    +
    + Requested Date:{formatDate(table2Data?.RequestedDate)} +
    +
    +
    + )} +
    + {(table2Data?.CustMobile || + table2Data?.CustName || + table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( + <> +
    + {(table2Data?.CustMobile || table2Data?.CustName) && ( +
    +
    + Delivery Details +
    + {table2Data?.CustMobile && ( +
    + {' '} + Mobile NO :{table2Data?.CustMobile}{' '} +
    + )} + {table2Data?.CustName && ( +
    + {' '} + Name:{table2Data?.CustName} +
    + )} +
    + )} + {(table2Data?.VehicleNo || + table2Data?.TransporterId || + table2Data?.TransporterName) && ( +
    +
    + Vehicle Details +
    + {table2Data?.VehicleNo && ( +
    + {' '} + Vehicle No :{table2Data?.VehicleNo} +
    + )} + {table2Data?.TransporterId && ( +
    + {' '} + Transporter Id :{table2Data?.TransporterId} +
    + )} + {table2Data?.TransporterName && ( +
    + {' '} + Transporter Name :{table2Data?.TransporterName} +
    + )} +
    + )} +
    +
    + + )} +
    -
    - {(table2Data?.ProductDetails?.length > 0 || GlobaldummyData) && - <> -
    -
    S.No + S.No + S.No + {GlobaldummyData ? GlobalItem && 'ITEM /DES' : 'ITEM /DES'}{' '} + {GlobaldummyData ? GlobalItem && 'ITEM /DES' : Item && 'ITEM /DES'}{' '} @@ -500,14 +585,22 @@ const DCPrintstyle6 = ({ {GlobaldummyData ? GlobalQuantity && ( QTY QTY
    {index + 1}
    S.No + S.No + S.No + S.No + ItemItemHSNHSNItemItemQty + Qty + Qty + Qty + MRPMRPRateRateDis Dis AmtAmt
    @@ -598,10 +714,6 @@ const DCPrintStyle7 = ({ {item?.Qty || item?.DispatchedQty} {item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } */} - {/* {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } */} - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {/* {GlobaldummyData ? GlobalAmount && : Amount && } */} - - - - {dataChunk?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } */} - {/* {GlobaldummyData ? GlobalMRP && : MRP && } +
    + {(table2Data?.ProductDetails?.length > 0 || GlobaldummyData) && ( + <> +
    +
    S.NoS.NoItemItemHSNHSNMRPMRPRateRt(%)(%)QtyQtyAmtAmt
    {chunkIndex * chunkSize + index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.RequestVariantName ? `${item?.RequestVariantName}` : ''}
    -
    {item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}
    + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + + + + {dataChunk?.map((item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } */} + {/* {GlobaldummyData ? GlobalMRP && : MRP && } {GlobaldummyData ? GlobalRate && : Rate && } {GlobaldummyData ? GlobalDiscount && : Discount && } */} - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {/* {GlobaldummyData ? GlobalAmount && : Amount && } */} - - ) - })} - -
    + S.No + + S.No + Item + Item + + Qty + + Qty +
    + {chunkIndex * chunkSize + index + 1} + + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.RequestVariantName + ? `${item?.RequestVariantName}` + : ''} +
    +
    {item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.SalesQty}{item?.Qty || item?.DispatchedQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - - } - -
    - - {(chunkIndex === paginatedChunks.length - 1) && - - <> -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - -
    -
    ) - } - - -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    ) - } - - {GlobaldummyData ? GlobalSignature && (
    -

    Signature

    - -
    ) : Signature == true && (
    -

    Signature

    - -
    )} - -
    -
    - - - {PrintGreeting?.SettingValue === "Y" && -
    - Thank You Visit Again -
    - } - - } -
    - ))} - - - + {GlobaldummyData + ? GlobalQuantity && ( + + {item?.SalesQty} + + ) + : Quantity && ( + + {item?.Qty || item?.DispatchedQty} + + )} + {/* {GlobaldummyData ? GlobalAmount && {item?.TotalAmt} : Amount && {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}} */} + + ); + })} + + +
    + + )}
    - - ) -} -export default DCPrintstyle8 + {chunkIndex === paginatedChunks.length - 1 && ( + <> +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : Notestext && ( +
    +

    {Notestext}

    + +
    +
    + )} + +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not exchangeable + or refundable. +
    2. +
    3. + Please check the product before leaving the + counter. +
    4. +
    +
    + ) + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && ( +
    +

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    + )} + + {GlobaldummyData + ? GlobalSignature && ( +
    +

    + Signature +

    + +
    + ) + : Signature == true && ( +
    +

    + Signature +

    + +
    + )} +
    +
    + + {PrintGreeting?.SettingValue === 'Y' && ( +
    + Thank You Visit Again +
    + )} + + )} +
    + ))} +
    + + ); +}; + +export default DCPrintstyle8; diff --git a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle9.jsx b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle9.jsx index 0c4ef4f..e78ab8c 100644 --- a/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle9.jsx +++ b/src/Pages/DeliveryChallan/DCPrintTemplates/DCThermalPrinter/DCPrintStyle9.jsx @@ -1,7 +1,10 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import Qrcode from '../../../../Images/Qrcode.png' -import { extractLastNumber, extractLastNumberOrderId } from "../../../../Services/Others"; +import Qrcode from '../../../../Images/Qrcode.png'; +import { + extractLastNumber, + extractLastNumberOrderId, +} from '../../../../Services/Others'; import { GlobalprintSlNo, GlobalprintItem, @@ -21,16 +24,36 @@ import { Globalnotes, GlobalthemeFormat, GlobalBillName, + GlobalSelectedPrintHeaderColor, + GlobalSelectedPrintHeaderFontColor, + GlobalSelectedTableHeaderColor, + GlobalSelectedTableHeaderFontColor, + GlobalSelectedTableBodyColor, + GlobalSelectedTableBodyFontColor, + GlobalRowType, + GlobalSelectedFooterColor, + GlobalSelectedFooterFontColor, } from '../../../../Features/ThemeChange/ThemeChange'; import { GlobalUpiIDprint } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.scss'; import QRCode from 'react-qr-code'; -import signature from "../../../../Images/signatureimage.jpg" +import signature from '../../../../Images/signatureimage.jpg'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin'; import { isMobile } from 'react-device-detect'; -const DCPrintStyle9 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, BranchZip, Date1, - table2Data, PaymentStatus, PrintGreeting, printDatas, DCPrintTemplateDtl }) => { +const DCPrintStyle9 = ({ + BranchName, + BranchDetails, + BranchAddress, + BranchCity, + BranchZip, + Date1, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + DCPrintTemplateDtl, +}) => { const formatDate = (dateString = '') => { const date = new Date(dateString); const day = date.getDate().toString().padStart(2, '0'); @@ -51,35 +74,37 @@ const DCPrintStyle9 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, B const month = months[date.getMonth()]; const year = date.getFullYear(); return day && month && year ? `${day}-${month}-${year}` : '-'; - } + }; const dispatch = useDispatch(); let FieldDetails = DCPrintTemplateDtl?.FieldDetails?.reduce((acc, item) => { acc[item.ConfigName] = true; return acc; }, {}); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const Quantity = FieldDetails?.["Quantity"]; - const GlobalSlNo = useSelector(GlobalprintSlNo) - const GlobalItem = useSelector(GlobalprintItem) - const GlobalQuantity = useSelector(GlobalprintQuantity) - const GlobaldummyData = useSelector(GlobalPritdummyData) + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const Quantity = FieldDetails?.['Quantity']; + const GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalQuantity = useSelector(GlobalprintQuantity); + const GlobaldummyData = useSelector(GlobalPritdummyData); const GlobalSignature = useSelector(GlobalprintSignature); const GlobaltermsAndConditions = useSelector(GlobalprinttermsAndConditions); const GlobalSignatureImages = useSelector(GlobalSignatureImage); const GlobalIsnotes = useSelector(Globalnotes); - const GlobalthemeFormatr = useSelector(GlobalthemeFormat) + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); - let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions - let SignatureImg = DCPrintTemplateDtl?.Signature - let Notestext = DCPrintTemplateDtl?.Notes - let BillName = DCPrintTemplateDtl?.PrintHdrName - let FormatTheme = DCPrintTemplateDtl?.PrintType == "S" ? true : false - let PageSize = DCPrintTemplateDtl?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; + let TermsAndConditions = DCPrintTemplateDtl?.TermsandConditions; + let SignatureImg = DCPrintTemplateDtl?.Signature; + let Notestext = DCPrintTemplateDtl?.Notes; + let BillName = DCPrintTemplateDtl?.PrintHdrName; + let FormatTheme = DCPrintTemplateDtl?.PrintType == 'S' ? true : false; + let PageSize = DCPrintTemplateDtl?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); const keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); @@ -87,7 +112,20 @@ const DCPrintStyle9 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, B const currentDate = new Date(); const day = currentDate.getDate().toString().padStart(2, '0'); - const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; + const monthNames = [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', + ]; const monthIndex = currentDate.getMonth(); const year = currentDate.getFullYear().toString().slice(-2); @@ -99,179 +137,478 @@ const DCPrintStyle9 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, B let TotalOfferAmount = 0; // Calculate SalesWiseOffers total amount - offers.forEach(offer => { + offers.forEach((offer) => { if (offer.TableName === 'SalesWiseOffers') { TotalOfferAmount += offer.OfferAmount; } }); - const hasMappedOffer = offers.some(offer => - ["ItemWiseOffers", "BundleOffers", "QuantityWiseOffers"].includes(offer.TableName) + const hasMappedOffer = offers.some((offer) => + ['ItemWiseOffers', 'BundleOffers', 'QuantityWiseOffers'].includes( + offer.TableName + ) ); if (hasMappedOffer) { - - const productTotal = productsData?.reduce((acc, item) => acc + (item?.Type != "C" ? item.OfferAmt : item.OfferValue || 0), 0); + const productTotal = productsData?.reduce( + (acc, item) => + acc + (item?.Type != 'C' ? item.OfferAmt : item.OfferValue || 0), + 0 + ); TotalOfferAmount += productTotal; } else { - const Combothere = productsData?.filter(item => item?.Type == "C") - const CombothereTotal = Combothere?.reduce((acc, item) => acc + (item.OfferValue || 0), 0); + const Combothere = productsData?.filter((item) => item?.Type == 'C'); + const CombothereTotal = Combothere?.reduce( + (acc, item) => acc + (item.OfferValue || 0), + 0 + ); TotalOfferAmount += CombothereTotal; } const products = [ - { ProdName: 'ITEM 1', Rate: 88.00, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g' }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g' }, + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + }, ]; - const chunkSize = PageSize == "A5" ? 10 : 16; + const chunkSize = PageSize == 'A5' ? 10 : 16; let dataSource = table2Data?.ProductDetails || []; - // Paginate the data const paginatedChunks = []; for (let i = 0; i < dataSource.length; i += chunkSize) { paginatedChunks.push(dataSource.slice(i, i + chunkSize)); } - const lastChunkRows = paginatedChunks.length > 0 ? paginatedChunks[paginatedChunks.length - 1].length : 0; - const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == "A5" ? 5 : 10); + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + const shouldFooterBeOnNewPage = lastChunkRows > (PageSize == 'A5' ? 5 : 10); + + // + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + const SelectedHeaderFontColor = useSelector( + GlobalSelectedPrintHeaderFontColor + ); + const SelectedTableHeaderColor = useSelector(GlobalSelectedTableHeaderColor); + const SelectedTableHeaderFontColor = useSelector( + GlobalSelectedTableHeaderFontColor + ); + const SelectedTableBodyColor = useSelector(GlobalSelectedTableBodyColor); + const SelectedTableBodyFontColor = useSelector( + GlobalSelectedTableBodyFontColor + ); + const SelectedRowType = useSelector(GlobalRowType); + const SelectedTableFooterColor = useSelector(GlobalSelectedFooterColor); + const SelectedTableFooterFontColor = useSelector( + GlobalSelectedFooterFontColor + ); + + // + let printColors = DCPrintTemplateDtl?.PrintColors; + const headerColor = printColors?.find((obj) => obj.headerColor)?.headerColor; + const tableHeaderColor = printColors?.find( + (obj) => obj.tableHeaderColor + )?.tableHeaderColor; + const tableBodyColor = printColors?.find( + (obj) => obj.tableBodyColor + )?.tableBodyColor; + const footerColor = printColors?.find((obj) => obj.footerColor)?.footerColor; + + // + const headerStyle = { + backgroundColor: GlobaldummyData + ? SelectedHeaderColor + : headerColor?.background, + + color: GlobaldummyData ? SelectedHeaderFontColor : headerColor?.font, + }; + const tableHeaderStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableHeaderColor + : tableHeaderColor?.background, + + color: GlobaldummyData + ? SelectedTableHeaderFontColor + : tableHeaderColor?.font, + }; + + const tableBodyStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableBodyColor + : tableBodyColor?.background, + color: GlobaldummyData ? SelectedTableBodyFontColor : tableBodyColor?.font, + }; + + const rowtypeStyle = GlobaldummyData + ? SelectedRowType + : tableBodyColor?.rowType; + + const footerColorStyle = { + backgroundColor: GlobaldummyData + ? SelectedTableFooterColor + : footerColor?.background, + color: GlobaldummyData ? SelectedTableFooterFontColor : footerColor?.font, + }; return ( <> - -
    +
    {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    0 ? ' print-page-break' : ''}`} style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> - +
    0 ? ' print-page-break' : ''}`} + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: FormatTheme ? (PageSize == 'A5' ? '170mm' : '257mm') : '', + }} + key={chunkIndex} + >
    -
    {GlobaldummyData ? 'Cash Bill' : BillName ? BillName : "Delivery Challan"}
    - +
    + {GlobaldummyData + ? 'Cash Bill' + : BillName + ? BillName + : 'Delivery Challan'}{' '} +
    -
    -
    -
    {GlobaldummyData ? "XYZ Shop" : BranchName}
    -
    Low Prices... Love the Saving...
    - -
    - {GlobaldummyData - ? "BranchAddress, Town- 635XXX City - State" - : (BranchAddress || "") + - (BranchCity - ? (BranchAddress && BranchCity ? "-" : "") + BranchCity - : "") + - (BranchZip - ? (BranchCity && - BranchZip - ? "-" - : "") + BranchZip - : "")} -
    - - {BranchDetails?.BrGSTIN &&
    GST NO :{GlobaldummyData ? '334bhbsagbysfgbfgbu' : BranchDetails?.BrGSTIN}, CIN :u00045hhsgbubufsdug
    } - {BranchDetails?.BrMobile && -
    - {" "} - Mobile : +91 {GlobaldummyData ? "986XXXXXXX" : BranchDetails?.BrMobile} +
    +
    +
    +
    + {GlobaldummyData ? 'XYZ Shop' : BranchName}
    - } +
    + Low Prices... Love the Saving... +
    + +
    + {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +
    + + {BranchDetails?.BrGSTIN && ( +
    + GST NO : + {GlobaldummyData + ? '334bhbsagbysfgbfgbu' + : BranchDetails?.BrGSTIN} + , CIN :u00045hhsgbubufsdug +
    + )} + {BranchDetails?.BrMobile && ( +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : BranchDetails?.BrMobile} +
    + )} +

    - {table2Data?.ToBranchDtl?.length > 0 && <> -
    Delivery To :
    -
    -
    {table2Data?.ToBranchDtl?.[0]?.BranchName}
    - {table2Data?.ToBranchDtl?.[0]?.Address1 &&
    {table2Data?.ToBranchDtl?.[0]?.Address1}
    } - {(table2Data?.ToBranchDtl?.[0]?.City || table2Data?.ToBranchDtl?.[0]?.Dist || table2Data?.ToBranchDtl?.[0]?.Zip) &&
    {`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
    } - {table2Data?.ToBranchDtl?.[0]?.BrGSTIN &&
    {table2Data?.ToBranchDtl?.[0]?.BrGSTIN}
    } -
    + {table2Data?.ToBranchDtl?.length > 0 && ( + <> +
    + Delivery To : +
    +
    +
    + {table2Data?.ToBranchDtl?.[0]?.BranchName} +
    + {table2Data?.ToBranchDtl?.[0]?.Address1 && ( +
    + {table2Data?.ToBranchDtl?.[0]?.Address1} +
    + )} + {(table2Data?.ToBranchDtl?.[0]?.City || + table2Data?.ToBranchDtl?.[0]?.Dist || + table2Data?.ToBranchDtl?.[0]?.Zip) && ( +
    {`${table2Data?.ToBranchDtl?.[0]?.City}, ${table2Data?.ToBranchDtl?.[0]?.Dist} - ${table2Data?.ToBranchDtl?.[0]?.Zip}`}
    + )} + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN && ( +
    + {table2Data?.ToBranchDtl?.[0]?.BrGSTIN} +
    + )} +
    -
    - } +
    + + )} {/* orderdetails */} - {table2Data?.dispatchPrint !== true &&
    -
    -
    - {" "} - Delivery ChallanNo: - {GlobaldummyData - ? "121" - : table2Data?.DCNo} -
    -
    - -
    -
    - {" "} - Date : {GlobaldummyData ? formattedDate : Date1}{" "} -
    -
    -
    } - {table2Data?.dispatchPrint === true &&
    + {table2Data?.dispatchPrint !== true && (
    -
    - {" "} - Dispatch No #: - {table2Data?.DispatchId} +
    + {' '} + Delivery ChallanNo: + {GlobaldummyData ? '121' : table2Data?.DCNo}
    -
    - {" "} - Dispatched Date : {formatDate(table2Data?.CreatedDate)}{" "} +
    + {' '} + Date : {GlobaldummyData ? formattedDate : Date1}{' '}
    -
    -
    -
    - {" "} - Ref No #: - {table2Data?.RequestId} + )} + {table2Data?.dispatchPrint === true && ( +
    +
    +
    +
    + {' '} + Dispatch No #: + {table2Data?.DispatchId} +
    -
    -
    -
    - {" "} - Requested Date : {formatDate(table2Data?.RequestedDate)}{" "} +
    +
    + {' '} + Dispatched Date :{' '} + {formatDate(table2Data?.CreatedDate)}{' '} +
    +
    +
    +
    +
    +
    + {' '} + Ref No #: + {table2Data?.RequestId} +
    +
    + +
    +
    + {' '} + Requested Date :{' '} + {formatDate(table2Data?.RequestedDate)}{' '} +
    -
    } + )} {/* orderdetails */}
    - -
    -
    - {(table2Data?.ProductDetails?.length > 0) && +
    + {table2Data?.ProductDetails?.length > 0 && ( <> - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} {/* {GlobaldummyData ? GlobalHsnCode && : HsnCode && } {GlobaldummyData ? GlobalMRP && : MRP && } {GlobaldummyData ? GlobalDiscount && : Discount && } @@ -279,151 +616,283 @@ const DCPrintStyle9 = ({ BranchName, BranchDetails, BranchAddress, BranchCity, B {GlobaldummyData ? GlobalAmount && : Amount && } */} - {console.log(FieldDetails, "paginatedChunks")} + {console.log(FieldDetails, 'paginatedChunks')} {dataChunk?.map((item, index) => { return ( - + {GlobaldummyData ? GlobalSlNo && ( - - ) + + ) : SLNO == true && ( - - )} + + )} {GlobaldummyData ? GlobalItem && : Item == true && ( - - )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - ) + + ) : Quantity == true && ( - - )} + + )} - ) + ); })}
    S.NoS.NoItemItemQtyQty + S.No + + S.No + + Item + + Item + + Qty + + Qty + HSNHSNMRPMRPDis Dis AmtAmt
    - {index + 1} - + {index + 1} + - {chunkIndex * chunkSize + index + 1} - + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} -
    {item?.ProdName}
    - {!(item?.ProdVariantName || item?.RequestVariantName)?.toLowerCase()?.includes( - 'variant' - ) && Variant:{item?.ProdVariantName || item?.RequestVariantName} } -  {" "} - -   - - -
    +
    {item?.ProdName}
    + {!( + item?.ProdVariantName || + item?.RequestVariantName + ) + ?.toLowerCase() + ?.includes('variant') && ( + + Variant: + {item?.ProdVariantName || + item?.RequestVariantName}{' '} + + )} +     +
    - {item?.SalesQty} - + {item?.SalesQty} + - {item?.Qty || item?.DispatchedQty} - + {item?.Qty || item?.DispatchedQty} +
    - } - + )}
    - {(chunkIndex === paginatedChunks.length - 1) && + {chunkIndex === paginatedChunks.length - 1 && ( <>
    - - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    -
    -
    ) : - Notestext && (
    -

    {Notestext}

    +
    +
    + ) + : Notestext && ( +
    +

    {Notestext}

    -
    -
    ) - } +
    +
    + )} +
    + {GlobaldummyData + ? GlobaltermsAndConditions && ( +
    +

    + Terms & Conditions +

    +
      +
    1. + Once goods are sold, they are not exchangeable + or refundable. +
    2. +
    3. + Please check the product before leaving the + counter. +
    4. +
    +
    + ) + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && ( +
    +

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    + )} -
    - {GlobaldummyData ? GlobaltermsAndConditions && - (
    -

    - Terms & Conditions -

    -
      -
    1. Once goods are sold, they are not exchangeable or refundable.
    2. -
    3. Please check the product before leaving the counter.
    4. -
    -
    ) - : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    ) - } - - {GlobaldummyData ? GlobalSignature && (
    -

    Signature

    - -
    ) : Signature == true && (
    -

    Signature

    - -
    )} - + {GlobaldummyData + ? GlobalSignature && ( +
    +

    + Signature +

    + +
    + ) + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && + {PrintGreeting?.SettingValue === 'Y' && ( <>
    -
    Thank You Visit Again
    +
    + Thank You Visit Again +
    - - } + )}
    - - } + )}
    ))} - -
    - - - ); -} +}; -export default DCPrintStyle9; \ No newline at end of file +export default DCPrintStyle9; diff --git a/src/Pages/DeliveryChallan/DeliveryPrint.jsx b/src/Pages/DeliveryChallan/DeliveryPrint.jsx index bbcd6f5..6eae3ac 100644 --- a/src/Pages/DeliveryChallan/DeliveryPrint.jsx +++ b/src/Pages/DeliveryChallan/DeliveryPrint.jsx @@ -7,6 +7,7 @@ import moment from 'moment'; import DCPrintA4Style11 from './DCPrintTemplates/DCA4/DCPrintA4Style11'; import { useSelector } from 'react-redux'; import { GlobalDCPrintTemplate } from '../../Features/ThemeChange/ThemeChange'; +import DCPrintStyle1 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle1'; import DCPrintstyle2 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle2'; import DCPrintStyle3 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle3'; import DCPrintstyle4 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle4'; @@ -20,32 +21,13 @@ import DCPrintStyle11 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle11'; import DCPrintstyle12 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle12'; import DCPrintStyleA5 from './DCPrintTemplates/DCA4/DCPrintStyleA5'; import DCA4Standard from './DCPrintTemplates/DCA4/DCA4Standard'; -import DCPrintStyle1 from './DCPrintTemplates/DCThermalPrinter/DCPrintStyle1'; import DCInvicePrint from './DCPrintTemplates/DCThermalPrinter/DCInvicePrint'; -// const PrintStyles = ` -// @media print { -// @page { -// size: A4; -// margin: 0; -// } -// body { -// margin: 1.6cm; -// } -// .Quo-Print-Body { -// padding: 20px; -// page-break-after: always; -// } -// .Quo-Print-Content { -// break-inside: avoid; -// } -// .no-print { -// display: none; -// } -// } -// `; - -const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateDtl }) => { +const DeliveryPrint = ({ + PrintingData1, + DCprinterTemplateStyle, + DCPrintTemplateDtl, +}) => { const PrintingData = PrintingData1?.[0]; console.log(PrintingData, 'PrintingData'); const dispatch = useDispatch(); @@ -159,20 +141,29 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD {/*
    Gst No:33AAACH7409R1Z8
    */}
    - {PrintingData?.[0]?.DCNo &&
    - Delivery Challan No: {PrintingData?.[0]?.DCNo} -
    } - {PrintingData?.[0]?.RequestId &&
    - Ref No #: {PrintingData?.[0]?.RequestId} -
    } - {PrintingData?.[0]?.DCDate &&
    - Order Date:{' '} - {dateFormatChange1(PrintingData?.[0]?.DCDate)} -
    } - {PrintingData?.[0]?.RequestedDate &&
    - Requested Date:{' '} - {dateFormatChange1(PrintingData?.[0]?.RequestedDate)} -
    } + {PrintingData?.[0]?.DCNo && ( +
    + Delivery Challan No: {PrintingData?.[0]?.DCNo} +
    + )} + {PrintingData?.[0]?.RequestId && ( +
    + Ref No #:{' '} + {PrintingData?.[0]?.RequestId} +
    + )} + {PrintingData?.[0]?.DCDate && ( +
    + Order Date:{' '} + {dateFormatChange1(PrintingData?.[0]?.DCDate)} +
    + )} + {PrintingData?.[0]?.RequestedDate && ( +
    + Requested Date: + {dateFormatChange1(PrintingData?.[0]?.RequestedDate)} +
    + )} {PrintingData?.[0]?.ModeOfTransport && (
    Transport Mode: {PrintingData?.[0]?.ModeOfTransport} @@ -193,41 +184,66 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD Vehicle No: {PrintingData?.[0]?.VehicleNo}
    )} -
    - {PrintingData?.[0]?.ToBranchDtl?.length > 0 &&
    -
    -
    Delivery To :
    -
    -
    {PrintingData?.[0]?.ToBranchDtl?.[0]?.BranchName}
    - {PrintingData?.[0]?.ToBranchDtl?.[0]?.Address1 &&
    {PrintingData?.[0]?.ToBranchDtl?.[0]?.Address1}
    } - {(PrintingData?.[0]?.ToBranchDtl?.[0]?.City || PrintingData?.[0]?.ToBranchDtl?.[0]?.Dist || PrintingData?.[0]?.ToBranchDtl?.[0]?.Zip) &&
    {`${PrintingData?.[0]?.ToBranchDtl?.[0]?.City}, ${PrintingData?.[0]?.ToBranchDtl?.[0]?.Dist} - ${PrintingData?.[0]?.ToBranchDtl?.[0]?.Zip}`}
    } - {PrintingData?.[0]?.ToBranchDtl?.[0]?.BrGSTIN &&
    {PrintingData?.[0]?.ToBranchDtl?.[0]?.BrGSTIN}
    } - {/*
    Gst No:33AAACH7409R1Z8
    */} + {PrintingData?.[0]?.ToBranchDtl?.length > 0 && ( +
    +
    +
    + Delivery To : +
    +
    +
    + {PrintingData?.[0]?.ToBranchDtl?.[0]?.BranchName} +
    + {PrintingData?.[0]?.ToBranchDtl?.[0]?.Address1 && ( +
    + {PrintingData?.[0]?.ToBranchDtl?.[0]?.Address1} +
    + )} + {(PrintingData?.[0]?.ToBranchDtl?.[0]?.City || + PrintingData?.[0]?.ToBranchDtl?.[0]?.Dist || + PrintingData?.[0]?.ToBranchDtl?.[0]?.Zip) && ( +
    {`${PrintingData?.[0]?.ToBranchDtl?.[0]?.City}, ${PrintingData?.[0]?.ToBranchDtl?.[0]?.Dist} - ${PrintingData?.[0]?.ToBranchDtl?.[0]?.Zip}`}
    + )} + {PrintingData?.[0]?.ToBranchDtl?.[0]?.BrGSTIN && ( +
    + {PrintingData?.[0]?.ToBranchDtl?.[0]?.BrGSTIN} +
    + )} + {/*
    Gst No:33AAACH7409R1Z8
    */} +
    +
    +
    + {PrintingData?.[0]?.DispatchId && ( +
    + Dispatch No #:{' '} + {PrintingData?.[0]?.DispatchId} +
    + )} + {PrintingData?.[0]?.CreatedDate && ( +
    + Dispatch Date: + {dateFormatChange1(PrintingData?.[0]?.CreatedDate)} +
    + )}
    -
    - {PrintingData?.[0]?.DispatchId &&
    - Dispatch No #: {PrintingData?.[0]?.DispatchId} -
    } - {PrintingData?.[0]?.CreatedDate &&
    - Dispatch Date:{' '} - {dateFormatChange1(PrintingData?.[0]?.CreatedDate)} -
    } -
    -
    } + )}
    -
    Delivery Details
    - {PrintingData?.[0]?.CustName &&
    - Name: {PrintingData?.[0]?.CustName} -
    } +
    Delivery Details
    + {PrintingData?.[0]?.CustName && ( +
    + Name: {PrintingData?.[0]?.CustName} +
    + )} {/* {PrintingData?.[0]?.CustMobile && ( */} - {PrintingData?.[0]?.CustMobile &&
    - Mobile: {PrintingData?.[0]?.CustMobile} -
    } - + {PrintingData?.[0]?.CustMobile && ( +
    + Mobile: {PrintingData?.[0]?.CustMobile} +
    + )}
    @@ -270,12 +286,18 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD Variant: {item?.ProdVariantName}
    )} */} - {(item?.ProdVariantName || item?.RequestVariantName) && ( - (item?.RequestVariantName || item?.ProdVariantName) !== 'Variant 1' && -
    - Variant: {item?.RequestVariantName || item?.ProdVariantName} -
    - )} + {(item?.ProdVariantName || + item?.RequestVariantName) && + (item?.RequestVariantName || + item?.ProdVariantName) !== 'Variant 1' && ( +
    + Variant:{' '} + {item?.RequestVariantName || + item?.ProdVariantName} +
    + )}
    -
    ))}
    {DCprinterTemplateStyle === 'Style 1' && ( )} {DCprinterTemplateStyle === 'Style 2' && ( @@ -342,11 +362,11 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData?.[0]} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - // printDatas={printDatas} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + // printDatas={printDatas} /> )} {DCprinterTemplateStyle === 'Style 3' && ( @@ -366,16 +386,15 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData?.[0]} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - // printDatas={printDatas} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + // printDatas={printDatas} /> )} {DCprinterTemplateStyle === 'Style 4' && ( )} {DCprinterTemplateStyle === 'Style 5' && ( )} {DCprinterTemplateStyle === 'Style 6' && ( @@ -440,11 +458,11 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData?.[0]} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - // printDatas={printDatas} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + // printDatas={printDatas} /> )} {DCprinterTemplateStyle === 'Style 7' && ( @@ -458,18 +476,17 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD BranchName={BranchName} BranchZip={BranchZip} BranchDetails={BranchDetails} - // CashierName={CashierName} // totalQuantity={totalQuantity} // OrderDetailGST={OrderDetailGST} // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData?.[0]} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - // printDatas={printDatas} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + // printDatas={printDatas} /> )} {DCprinterTemplateStyle === 'Style 8' && ( @@ -489,16 +506,15 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData?.[0]} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - // printDatas={printDatas} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + // printDatas={printDatas} /> )} {DCprinterTemplateStyle === 'Style 9' && ( )} {DCprinterTemplateStyle === 'Style 10' && ( )} {DCprinterTemplateStyle === 'Style 11' && ( @@ -563,16 +578,15 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData?.[0]} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - // printDatas={printDatas} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + // printDatas={printDatas} /> )} {DCprinterTemplateStyle === 'Style 12' && ( )} {DCprinterTemplateStyle === 'A4' && ( )} {DCprinterTemplateStyle === 'A5' && ( )} {DCprinterTemplateStyle === 'A4Standard' && ( )} @@ -688,11 +699,11 @@ const DeliveryPrint = ({ PrintingData1, DCprinterTemplateStyle, DCPrintTemplateD // OrderDetailIGST={OrderDetailIGST} // OrderDetailVAT={OrderDetailVAT} table2Data={PrintingData} - // totalQuantityFilter={totalQuantityFilter} - // PaymentStatus={PaymentStatus} - // PrintLogo={PrintLogo} - // PrintGreeting={PrintGreeting} - printDatas={DCPrintTemplateDtl} + // totalQuantityFilter={totalQuantityFilter} + // PaymentStatus={PaymentStatus} + // PrintLogo={PrintLogo} + // PrintGreeting={PrintGreeting} + printDatas={DCPrintTemplateDtl} /> )}
    diff --git a/src/Pages/Kiosk/CardPage/CardPage1.jsx b/src/Pages/Kiosk/CardPage/CardPage1.jsx index ad6a3a0..bb3cbed 100644 --- a/src/Pages/Kiosk/CardPage/CardPage1.jsx +++ b/src/Pages/Kiosk/CardPage/CardPage1.jsx @@ -35,6 +35,7 @@ const CardPage1 = (props) => { const [QtyIndex, setQtyIndex] = useState(0); const [ConfigDataList, setConfigDataList] = useState([]); const [maxLimitExceeded, setMaxLimitExceeded] = useState(false); + const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null); const kioskTemplateData = props?.data; const SettingDataSelector = useSelector(settingDataSelector); const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter( @@ -60,20 +61,6 @@ const CardPage1 = (props) => { //Card on click function const CardOnClick = async (item, Parameter) => { - if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) { - if (overAllLimitPreferenece) { - const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails); - if ((calculatedOverAllQty + 1) > maxQtyLimit) { - setMaxLimitExceeded(true); - // Reset after 3 seconds - setTimeout(() => { - setMaxLimitExceeded(false); - }, 2000); - - return; - } - } - } setOnePeiceFlow(Parameter === 'OnePeiceProduct'); const transformedItem = { @@ -321,6 +308,61 @@ const CardPage1 = (props) => { }; // add Product in cart state const AddOrderDetails = (item) => { + if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) { + if (overAllLimitPreferenece) { + const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails); + if ((calculatedOverAllQty + 1) > maxQtyLimit) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); + + return; + } + } else if (itemWiseLimitPreferenece) { + + const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => { + const inwardId = curr?.InwardDtlId; + const qty = Number(curr?.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log("Final InwardDtlId Qty Map:", inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); + return; + } + } + } const isItemInCart = KioskOrderDetails?.find( (cartItem) => cartItem.ProdId === item.ProdId && @@ -792,7 +834,7 @@ const CardPage1 = (props) => { />

    - Maximum Quantity ({maxQtyLimit}) Reached + {maxLimitExceededMessage}

    diff --git a/src/Pages/Kiosk/CardPage/CardPage2.jsx b/src/Pages/Kiosk/CardPage/CardPage2.jsx index 0c058ea..75c7b7a 100644 --- a/src/Pages/Kiosk/CardPage/CardPage2.jsx +++ b/src/Pages/Kiosk/CardPage/CardPage2.jsx @@ -28,6 +28,7 @@ const CardPage2 = (props) => { const BookingType = useSelector(GlobalBookingTypeKiosk); const kioskTemplateData = props?.data; const [maxLimitExceeded, setMaxLimitExceeded] = useState(false); + const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null); const [openQuantity, setopenQuantity] = useState(false); const [VariantOpen, setVariantOpen] = useState(false); const [onePeiceFlow, setOnePeiceFlow] = useState(false); @@ -59,20 +60,6 @@ const CardPage2 = (props) => { //Card on click function const CardOnClick = async (item, Parameter) => { - if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) { - if (overAllLimitPreferenece) { - const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails); - if ((calculatedOverAllQty + 1) > maxQtyLimit) { - setMaxLimitExceeded(true); - // Reset after 3 seconds - setTimeout(() => { - setMaxLimitExceeded(false); - }, 2000); - return; - } - } - } - setOnePeiceFlow(Parameter === 'OnePeiceProduct'); const transformedItem = { @@ -321,6 +308,61 @@ const CardPage2 = (props) => { }; // add Product in cart state const AddOrderDetails = (item) => { + if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) { + if (overAllLimitPreferenece) { + const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails); + if ((calculatedOverAllQty + 1) > maxQtyLimit) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); + + return; + } + } else if (itemWiseLimitPreferenece) { + + const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => { + const inwardId = curr?.InwardDtlId; + const qty = Number(curr?.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log("Final InwardDtlId Qty Map:", inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); + return; + } + } + } const isItemInCart = KioskOrderDetails?.find( (cartItem) => cartItem.ProdId === item.ProdId && @@ -601,7 +643,7 @@ const CardPage2 = (props) => { )}

    - Maximum Quantity ({maxQtyLimit}) Reached + {maxLimitExceededMessage}

    { const getKioskLightColourdata = useSelector(getKioskLightColour); const BookingType = useSelector(GlobalBookingTypeKiosk); const [maxLimitExceeded, setMaxLimitExceeded] = useState(false); + const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null); const [openQuantity, setopenQuantity] = useState(false); const [VariantOpen, setVariantOpen] = useState(false); const [onePeiceFlow, setOnePeiceFlow] = useState(false); @@ -58,19 +59,6 @@ const CardPage3 = (props) => { }, []); //Card on click function const CardOnClick = async (item, Parameter) => { - if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) { - if (overAllLimitPreferenece) { - const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails); - if ((calculatedOverAllQty + 1) > maxQtyLimit) { - setMaxLimitExceeded(true); - // Reset after 3 seconds - setTimeout(() => { - setMaxLimitExceeded(false); - }, 2000); - return; - } - } - } setOnePeiceFlow(Parameter === 'OnePeiceProduct'); const transformedItem = { @@ -318,6 +306,61 @@ const CardPage3 = (props) => { }; // add Product in cart state const AddOrderDetails = (item) => { + if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) { + if (overAllLimitPreferenece) { + const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails); + if ((calculatedOverAllQty + 1) > maxQtyLimit) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); + + return; + } + } else if (itemWiseLimitPreferenece) { + + const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => { + const inwardId = curr?.InwardDtlId; + const qty = Number(curr?.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log("Final InwardDtlId Qty Map:", inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); + return; + } + } + } const isItemInCart = KioskOrderDetails?.find( (cartItem) => cartItem.ProdId === item.ProdId && @@ -604,7 +647,7 @@ const CardPage3 = (props) => { )}

    - Maximum Quantity ({maxQtyLimit}) Reached + {maxLimitExceededMessage}

    { const getKioskLightColourdata = useSelector(getKioskLightColour); const BookingType = useSelector(GlobalBookingTypeKiosk); const [maxLimitExceeded, setMaxLimitExceeded] = useState(false); + const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null); const [quantities, setQuantities] = useState({}); const [openQuantity, setopenQuantity] = useState(false); const [VariantOpen, setVariantOpen] = useState(false); @@ -89,19 +90,6 @@ const CardPage4 = (props) => { //Card on click function const CardOnClick = async (item, Parameter) => { - if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) { - if (overAllLimitPreferenece) { - const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails); - if ((calculatedOverAllQty + 1) > maxQtyLimit) { - setMaxLimitExceeded(true); - // Reset after 3 seconds - setTimeout(() => { - setMaxLimitExceeded(false); - }, 2000); - return; - } - } - } setOnePeiceFlow(Parameter === 'OnePeiceProduct'); const transformedItem = { @@ -342,6 +330,61 @@ const CardPage4 = (props) => { }; // add Product in cart state const AddOrderDetails = (item) => { + if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) { + if (overAllLimitPreferenece) { + const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails); + if ((calculatedOverAllQty + 1) > maxQtyLimit) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); + + return; + } + } else if (itemWiseLimitPreferenece) { + + const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => { + const inwardId = curr?.InwardDtlId; + const qty = Number(curr?.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log("Final InwardDtlId Qty Map:", inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); + return; + } + } + } const isItemInCart = KioskOrderDetails?.find( (cartItem) => cartItem.ProdId === item.ProdId && @@ -625,7 +668,7 @@ const CardPage4 = (props) => { )}

    - Maximum Quantity ({maxQtyLimit}) Reached + {maxLimitExceededMessage}

    { const dispatch = useDispatch(); const kioskTemplateData = useSelector(getKioskTemplateData); + console.log(kioskTemplateData, 'kioskTemplateData'); const [devicePresent, setDevicePresent] = useState(false); const [deviceAccess, setDeviceAccess] = useState(true); const [deviceAddress, setDeviceAddress] = useState(null); diff --git a/src/Pages/Kiosk/OrderCart/OrderCart1.jsx b/src/Pages/Kiosk/OrderCart/OrderCart1.jsx index ac6b5d1..1db6a1c 100644 --- a/src/Pages/Kiosk/OrderCart/OrderCart1.jsx +++ b/src/Pages/Kiosk/OrderCart/OrderCart1.jsx @@ -9,9 +9,11 @@ import { PreferenceData } from '../../../Features/BookingScreen/BookingData/Book import { calculateOverAllQtyLimit } from '../../../utils/calculations'; import { IoIosWarning } from 'react-icons/io'; import { useState } from 'react'; +import { message } from 'antd'; const KisokOrderCart1 = (props) => { const dispatch = useDispatch(); + const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null); const [maxLimitExceeded, setMaxLimitExceeded] = useState(false); const preferenceDatas = useSelector(PreferenceData); const overAllLimitPreferenece = @@ -45,10 +47,51 @@ const KisokOrderCart1 = (props) => { if ((calculatedOverAllQty + 1) > maxQtyLimit) { setMaxLimitExceeded(true); // Reset after 3 seconds + setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`); setTimeout(() => { setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); }, 2000); + return; + } + } else if (itemWiseLimitPreferenece) { + + const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => { + const inwardId = curr?.InwardDtlId; + const qty = Number(curr?.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log("Final InwardDtlId Qty Map:", inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); return; } } @@ -209,13 +252,14 @@ const KisokOrderCart1 = (props) => { remove
    -
    -

    - Maximum Quantity ({maxQtyLimit}) Reached -

    -
    +
    ))} +
    +

    + {maxLimitExceededMessage} +

    +
    ); diff --git a/src/Pages/Kiosk/OrderCart/OrderCart2.jsx b/src/Pages/Kiosk/OrderCart/OrderCart2.jsx index 697d723..c7092cc 100644 --- a/src/Pages/Kiosk/OrderCart/OrderCart2.jsx +++ b/src/Pages/Kiosk/OrderCart/OrderCart2.jsx @@ -17,6 +17,7 @@ const KisokOrderCart2 = (props) => { const dispatch = useDispatch(); const preferenceDatas = useSelector(PreferenceData); const [maxLimitExceeded, setMaxLimitExceeded] = useState(false); + const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null); const overAllLimitPreferenece = preferenceDatas?.[0]?.['SettingDtlDetails']?.find( (item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y'); @@ -49,8 +50,50 @@ const KisokOrderCart2 = (props) => { if ((calculatedOverAllQty + 1) > maxQtyLimit) { setMaxLimitExceeded(true); // Reset after 3 seconds + setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`); setTimeout(() => { setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); + + return; + } + } else if (itemWiseLimitPreferenece) { + + const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => { + const inwardId = curr?.InwardDtlId; + const qty = Number(curr?.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log("Final InwardDtlId Qty Map:", inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); }, 2000); return; } @@ -232,7 +275,7 @@ const KisokOrderCart2 = (props) => {

    - Maximum Quantity ({maxQtyLimit}) Reached + {maxLimitExceededMessage}

    diff --git a/src/Pages/Kiosk/OrderCart/OrderCart3.jsx b/src/Pages/Kiosk/OrderCart/OrderCart3.jsx index 3fd5c13..f3a3824 100644 --- a/src/Pages/Kiosk/OrderCart/OrderCart3.jsx +++ b/src/Pages/Kiosk/OrderCart/OrderCart3.jsx @@ -19,6 +19,7 @@ const KisokOrderCart3 = (props) => { const [maxLimitExceeded, setMaxLimitExceeded] = useState(false); const getKioskDarkColourdata = useSelector(getKioskDarkColour); const preferenceDatas = useSelector(PreferenceData); + const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null); const overAllLimitPreferenece = preferenceDatas?.[0]?.['SettingDtlDetails']?.find( (item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y'); @@ -52,8 +53,50 @@ const KisokOrderCart3 = (props) => { if ((calculatedOverAllQty + 1) > maxQtyLimit) { setMaxLimitExceeded(true); // Reset after 3 seconds + setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`); setTimeout(() => { setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); + + return; + } + } else if (itemWiseLimitPreferenece) { + + const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => { + const inwardId = curr?.InwardDtlId; + const qty = Number(curr?.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log("Final InwardDtlId Qty Map:", inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); }, 2000); return; } @@ -245,7 +288,7 @@ const KisokOrderCart3 = (props) => {

    - Maximum Quantity ({maxQtyLimit}) Reached + {maxLimitExceededMessage}

    diff --git a/src/Pages/Kiosk/OrderView/OrderView1.jsx b/src/Pages/Kiosk/OrderView/OrderView1.jsx index c3d39bc..80f2e2d 100644 --- a/src/Pages/Kiosk/OrderView/OrderView1.jsx +++ b/src/Pages/Kiosk/OrderView/OrderView1.jsx @@ -27,6 +27,7 @@ const OrderView1 = (props) => { : null; const dispatch = useDispatch(); const [maxLimitExceeded, setMaxLimitExceeded] = useState(false); + const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null); const KioskOrderDetails = useSelector(GlobalKioskOrderDetails); const getKioskLightColourdata = useSelector(getKioskLightColour); const preferenceDatas = useSelector(PreferenceData); @@ -57,16 +58,56 @@ const OrderView1 = (props) => { ); }; const increase = async (item) => { - - if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) { if (overAllLimitPreferenece) { const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails); if ((calculatedOverAllQty + 1) > maxQtyLimit) { setMaxLimitExceeded(true); // Reset after 3 seconds + setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`); setTimeout(() => { setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); + + return; + } + } else if (itemWiseLimitPreferenece) { + + const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => { + const inwardId = curr?.InwardDtlId; + const qty = Number(curr?.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log("Final InwardDtlId Qty Map:", inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); }, 2000); return; } @@ -258,13 +299,14 @@ const OrderView1 = (props) => { remove
    -
    -

    - Maximum Quantity ({maxQtyLimit}) Reached -

    -
    +
    ))} +
    +

    + {maxLimitExceededMessage} +

    +
    { : null; const dispatch = useDispatch(); const preferenceDatas = useSelector(PreferenceData); + const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null); const [maxLimitExceeded, setMaxLimitExceeded] = useState(false); const overAllLimitPreferenece = preferenceDatas?.[0]?.['SettingDtlDetails']?.find( @@ -73,8 +74,50 @@ const KioskOrderView2 = (props) => { if ((calculatedOverAllQty + 1) > maxQtyLimit) { setMaxLimitExceeded(true); // Reset after 3 seconds + setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`); setTimeout(() => { setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); + + return; + } + } else if (itemWiseLimitPreferenece) { + + const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => { + const inwardId = curr?.InwardDtlId; + const qty = Number(curr?.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log("Final InwardDtlId Qty Map:", inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); }, 2000); return; } @@ -339,7 +382,7 @@ const KioskOrderView2 = (props) => {

    - Maximum Quantity ({maxQtyLimit}) Reached + {maxLimitExceededMessage}

    diff --git a/src/Pages/Kiosk/OrderView/OrderView3.jsx b/src/Pages/Kiosk/OrderView/OrderView3.jsx index f9ff4a5..be6f334 100644 --- a/src/Pages/Kiosk/OrderView/OrderView3.jsx +++ b/src/Pages/Kiosk/OrderView/OrderView3.jsx @@ -32,6 +32,7 @@ const KioskOrderView = (props) => { const KioskOrderDetails = useSelector(GlobalKioskOrderDetails); const getKioskLightColourdata = useSelector(getKioskLightColour); const preferenceDatas = useSelector(PreferenceData); + const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null); const [maxLimitExceeded, setMaxLimitExceeded] = useState(false); const overAllLimitPreferenece = preferenceDatas?.[0]?.['SettingDtlDetails']?.find( @@ -60,15 +61,56 @@ const KioskOrderView = (props) => { ); }; const increase = async (item) => { - if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) { if (overAllLimitPreferenece) { const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails); if ((calculatedOverAllQty + 1) > maxQtyLimit) { setMaxLimitExceeded(true); // Reset after 3 seconds + setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`); setTimeout(() => { setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); + }, 2000); + + return; + } + } else if (itemWiseLimitPreferenece) { + + const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => { + const inwardId = curr?.InwardDtlId; + const qty = Number(curr?.OrderQty) || 0; + + if (acc[inwardId]) { + acc[inwardId] += qty; + } else { + acc[inwardId] = qty; + } + + return acc; + }, {}); + + const currentInwardId = item?.InwardDtlId; + const addQty = 1; + + if (inwardQtyMap[currentInwardId]) { + inwardQtyMap[currentInwardId] += addQty; + } else { + inwardQtyMap[currentInwardId] = addQty; + } + + console.log("Final InwardDtlId Qty Map:", inwardQtyMap); + const isExceeded = Object.values(inwardQtyMap).some( + (qty) => qty > maxQtyLimit + ); + + if (isExceeded) { + setMaxLimitExceeded(true); + // Reset after 3 seconds + setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); + setTimeout(() => { + setMaxLimitExceeded(false); + setMaxLimitExceededMessage(null); }, 2000); return; } @@ -331,7 +373,7 @@ const KioskOrderView = (props) => {

    - Maximum Quantity ({maxQtyLimit}) Reached + {maxLimitExceededMessage}

    diff --git a/src/Pages/Kiosk/Payment/KioskPaymentWithModal.jsx b/src/Pages/Kiosk/Payment/KioskPaymentWithModal.jsx index 6275047..3329419 100644 --- a/src/Pages/Kiosk/Payment/KioskPaymentWithModal.jsx +++ b/src/Pages/Kiosk/Payment/KioskPaymentWithModal.jsx @@ -968,16 +968,6 @@ const KioskPayment = (props) => { }; await dispatch(sendSms(postData)); } - const goFullScreen = () => { - const elem = document.documentElement; - - if (!document.fullscreenElement) { - elem.requestFullscreen?.().catch((err) => { - console.log("Fullscreen error:", err); - }); - } - }; - goFullScreen(); clearAllStates(); } else { if ( @@ -1954,7 +1944,7 @@ const KioskPayment = (props) => { open={open} handleCancel={!selectedPaymentOption && HandleCloseModal} footer={false} - width={width > 768 ? 900 : 700} + width={width > 768 ? 800 : 600} children={ showPaymentGatewayOptions ? (
    diff --git a/src/Pages/Kiosk/Payment/KioskPaymentWithModal.scss b/src/Pages/Kiosk/Payment/KioskPaymentWithModal.scss index 0e9d260..9e27acb 100644 --- a/src/Pages/Kiosk/Payment/KioskPaymentWithModal.scss +++ b/src/Pages/Kiosk/Payment/KioskPaymentWithModal.scss @@ -560,4 +560,5 @@ } } } -} \ No newline at end of file +} + diff --git a/src/Pages/Payment/PaymentDetails/PaymentDetailsList.jsx b/src/Pages/Payment/PaymentDetails/PaymentDetailsList.jsx index ba1ed67..5eda141 100644 --- a/src/Pages/Payment/PaymentDetails/PaymentDetailsList.jsx +++ b/src/Pages/Payment/PaymentDetails/PaymentDetailsList.jsx @@ -31,6 +31,7 @@ import { DefaultModal } from '../../../Components/Modal/DefaultModal.jsx'; import { DropDowns } from '../../../Components/Forms/DropDown.jsx'; import { useAuth } from '../../../AuthContext.jsx'; import { FeatureAddon } from '../../../Features/BookingScreen/BookingData/BookingData.js'; + import "../../../Pages/openingStock/openingStockForm.scss" const PaymentDetailsList = () => { const { SadminuserAccess } = useAuth(); diff --git a/src/Pages/Preference/PreferenceList.jsx b/src/Pages/Preference/PreferenceList.jsx index 25a14aa..e056ba1 100644 --- a/src/Pages/Preference/PreferenceList.jsx +++ b/src/Pages/Preference/PreferenceList.jsx @@ -67,6 +67,7 @@ const PreferenceList = () => { dashboard: allSettingsMap['dashboard']?.value === 'Y', shortcutkeys: allSettingsMap['shortcutkeys']?.value === 'Y', autoreceivestock: allSettingsMap['autoreceivestock']?.value === 'Y', + salespageaskiosk: allSettingsMap['salespageaskiosk']?.value === 'Y', kioskotp: allSettingsMap['kioskotp']?.value === 'Y', decimal: allSettingsMap['decimal']?.value === 'Y', enabledModules: [ @@ -119,7 +120,7 @@ const PreferenceList = () => { ], scanlayout: allSettingsMap['scanlayout']?.value === 'Y', verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y', - imeidetails:allSettingsMap['imeidetails']?.value === 'Y', + imeidetails: allSettingsMap['imeidetails']?.value === 'Y', customisedbillnumber: allSettingsMap['customisedbillnumber']?.value === 'Y', upiqr: allSettingsMap['upiqr']?.value === 'Y', lowstockreport: allSettingsMap['lowstockreport']?.value === 'Y', @@ -308,6 +309,7 @@ const PreferenceList = () => { dashboard: values.dashboard, shortcutkeys: values.shortcutkeys, autoreceivestock: values.autoreceivestock, + salespageaskiosk: values.salespageaskiosk, kioskotp: values.kioskotp, decimal: values.decimal, searchfocus: values.searchfocus, @@ -323,7 +325,7 @@ const PreferenceList = () => { mobilea4: values.mobilea4, scanlayout: values.scanlayout, verifyproduct: values.verifyproduct, - imeidetails:values.imeidetails, + imeidetails: values.imeidetails, customisedbillnumber: values.customisedbillnumber, upiqr: values.upiqr, lowstockreport: values.lowstockreport, @@ -512,6 +514,10 @@ const PreferenceList = () => { {renderCheckbox( 'decimal', 'Display values with 2 decimal places throughout the app?' + )} + {renderCheckbox( + 'salespageaskiosk', + 'Do you want to open sales page as kiosk layout?' )} {(allSettingsMap['onlineindividualslots'] !== undefined || allSettingsMap['allow individual booking'] !== undefined || @@ -549,8 +555,12 @@ const PreferenceList = () => { <> formRef.current?.setFieldsValue({ maxtime: undefined })}> - Minutes - Hours + {allSettingsMap['minutes'] !== undefined && ( + Minutes + )} + {allSettingsMap['hours'] !== undefined && ( + Hours + )} @@ -739,8 +749,12 @@ const PreferenceList = () => { <> formRef.current?.setFieldsValue({ maxquantity: undefined })}> - Overall Order Quantity - Item-wise Quantity + {allSettingsMap['overalllimit'] !== undefined && ( + Overall Order Quantity + )} + {allSettingsMap['itemwiselimit'] !== undefined && ( + Item-wise Quantity + )} diff --git a/src/Pages/Preference/PreferenceList.scss b/src/Pages/Preference/PreferenceList.scss index f8f0ccf..5078ee6 100644 --- a/src/Pages/Preference/PreferenceList.scss +++ b/src/Pages/Preference/PreferenceList.scss @@ -166,7 +166,6 @@ display: flex; align-items: flex-start; justify-content: flex-end; - width: 100%; margin-top: 1rem; position: fixed; bottom: 1.3rem; diff --git a/src/Pages/UpiDetails/UpiDetailslist.jsx b/src/Pages/UpiDetails/UpiDetailslist.jsx index 68a4cb5..5feeaae 100644 --- a/src/Pages/UpiDetails/UpiDetailslist.jsx +++ b/src/Pages/UpiDetails/UpiDetailslist.jsx @@ -23,6 +23,7 @@ import { } from '../../Features/UpiDetails/UpiDetails.js'; import { changeBreadCrumb } from '../../Features/AppPage/CenterPage.js'; import { DefaultModal } from '../../Components/Modal/DefaultModal.jsx'; + import "../../Pages/openingStock/openingStockForm.scss" const UpiDetailslist = () => { const navigateTo = useNavigate(); diff --git a/src/Pages/openingStock/openingStockForm.scss b/src/Pages/openingStock/openingStockForm.scss index 338ade5..a791dfa 100644 --- a/src/Pages/openingStock/openingStockForm.scss +++ b/src/Pages/openingStock/openingStockForm.scss @@ -299,3 +299,12 @@ .purchase-entry-form { width: 100%; } +.otpInput { + width: 2.5rem !important; + height: 2.5rem; + margin: 0 0.14rem; + font-size: 1rem; + text-align: center; + border-radius: 4px; + border: 1px solid rgba(0, 0, 0, 0.3); +} \ No newline at end of file diff --git a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBPayment.scss b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBPayment.scss index b8d1122..749f34d 100644 --- a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBPayment.scss +++ b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBPayment.scss @@ -144,7 +144,7 @@ input::-webkit-inner-spin-button { justify-content: center; gap: 0.2rem; background-color: #dbdbdb; - font-family: "Poppins", sans-serif; + font-family: 'Poppins', sans-serif; } .payment-div-0-userplus { @@ -243,6 +243,7 @@ input::-webkit-inner-spin-button { background-color: var(--DEFAULT_SELECTED_COLOR); font-size: 14px; font-weight: 500; + border: none; height: 40px; width: 75px; border-radius: 7.2px; @@ -251,17 +252,20 @@ input::-webkit-inner-spin-button { display: flex; gap: 0.2rem; align-items: center; - font-family: "Poppins"; + font-family: 'Poppins'; justify-content: center; cursor: pointer; text-transform: capitalize; + outline: none; } .Btn-payment-mode { background-color: var(--SELECTED_COLOR); font-size: 14px; + border: none; font-weight: 500; height: 40px; + outline: none; width: 75px; border-radius: 7.2px; color: #fff; @@ -269,8 +273,9 @@ input::-webkit-inner-spin-button { display: flex; gap: 0.2rem; align-items: center; - font-family: "Poppins"; + font-family: 'Poppins'; justify-content: center; cursor: pointer; text-transform: capitalize; + outline: none; } diff --git a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.scss b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.scss index 55e5bde..9356a46 100644 --- a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.scss +++ b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.scss @@ -205,8 +205,9 @@ input::-webkit-inner-spin-button { .Btn-payment-mode { background-color: var(--SELECTED_COLOR); font-size: 13px !important; - font-weight: 500; + font-weight: 500;border: none; height: 40px; + outline: none; flex-grow: 1; flex: 1; width: max-content !important; @@ -242,6 +243,7 @@ input::-webkit-inner-spin-button { background-color: var(--DEFAULT_SELECTED_COLOR); font-size: 13px !important; font-weight: 500; + outline: none;border: none; height: 40px; width: max-content !important; flex: 1; diff --git a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss index 6abc975..ad64d5c 100644 --- a/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss +++ b/src/Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss @@ -109,6 +109,7 @@ .Btn-payment-mode { background-color: var(--SELECTED_COLOR); color: #ffffff; + outline: none;border: none; font-size: 12px; display: flex; flex-direction: row; @@ -126,6 +127,8 @@ background-color: var(--DEFAULT_SELECTED_COLOR); color: rgb(255, 255, 255); font-size: 12px; + outline: none; + border: none; cursor: pointer; display: flex; flex-direction: row; diff --git a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss index 3816df2..db0b57b 100644 --- a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss +++ b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar1.scss @@ -514,6 +514,7 @@ position: absolute; z-index: 10; left: 6px; + background-color: unset !important; } .custom-input { padding: 10px 30px 10px 30px; @@ -522,3 +523,28 @@ top: 53%; } } +.BsNavbar1FullScreen { + background-color: #1292ee; + height: 28px; + width: 28px; + display: flex; + align-items: center; + justify-content: center; + border-radius: 4px; + cursor: pointer; + font-size: 18px; + color: #fff; +} + +.BsNavbar1FullScreenExit { + background-color: #ef4444; + height: 28px; + width: 28px; + display: flex; + align-items: center; + justify-content: center; + border-radius: 4px; + color: #fff; + font-size: 18px; + cursor: pointer; +} diff --git a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar2.scss b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar2.scss index fc0ce5f..2b902ef 100644 --- a/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar2.scss +++ b/src/Styles/BookingScreen/Components/BSNavbar/BSNavbar2.scss @@ -423,3 +423,29 @@ left: 11px; top: 10px; } + +.BsNavbar1FullScreen { + background-color: #1292ee; + height: 28px; + width: 28px; + display: flex; + align-items: center; + justify-content: center; + border-radius: 4px; + cursor: pointer; + font-size: 18px; + color: #fff; +} + +.BsNavbar1FullScreenExit { + background-color: #ef4444; + height: 28px; + width: 28px; + display: flex; + align-items: center; + justify-content: center; + border-radius: 4px; + color: #fff; + font-size: 18px; + cursor: pointer; +} diff --git a/src/Styles/Payment/PaymentDetails/PaymentDetails.scss b/src/Styles/Payment/PaymentDetails/PaymentDetails.scss index a295e1f..0627393 100644 --- a/src/Styles/Payment/PaymentDetails/PaymentDetails.scss +++ b/src/Styles/Payment/PaymentDetails/PaymentDetails.scss @@ -30,6 +30,7 @@ display: flex; flex-direction: row; column-gap: 0.5rem; + margin-top: 10px; } .defaultandCustomisedTheme { diff --git a/src/Styles/UpiDetails/upidetails.scss b/src/Styles/UpiDetails/upidetails.scss index 8789f38..3ff2191 100644 --- a/src/Styles/UpiDetails/upidetails.scss +++ b/src/Styles/UpiDetails/upidetails.scss @@ -27,8 +27,8 @@ display: flex; flex-direction: row; column-gap: 0.5rem; + margin-top: 10px; } - // Branch Login Design by Vicky .branchLoginMaster {