From 817b4331ac97d231b225ce38c247fa923f5b9b77 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 Feb 2026 18:10:12 +0530 Subject: [PATCH 1/5] sales-bill-edit-flow-added --- src/Components/Menu/SideMenuPozo.jsx | 11 +- .../BookingScreen/BookingData/BookingData.js | 35 +- .../BSBillingTable1/BST1Payment.jsx | 507 +- .../BSBillingTable1/BalanceAndReceived.jsx | 29 +- .../BSBillingTable2/BSBillingTable2.jsx | 178 +- .../BSBillingTable3/BSBillingTable3pay.jsx | 175 +- .../BSBillingTable4/BSBilling4Payment.jsx | 182 +- .../BSBillingTable5/BSBillingTable5.jsx | 183 +- .../BSBillingTable6/BST6Payment.jsx | 178 +- .../BSBillingTable7/BSBilling7Payment.jsx | 182 +- .../StandardTable/StandardTable.jsx | 401 +- .../StandardTable/StandardTable.scss | 58 +- .../StandardTable/StandardTablePayment.jsx | 216 +- .../Components/BSCombo/BSC1Payment.jsx | 374 +- .../Components/BSItemCards/BSItemCard.jsx | 11 +- .../FeaturesFunctionalities.jsx | 440 +- .../BookingFunctionality/SplitPayment.jsx | 251 +- .../OtherConponents/Reprint/BSReprint.jsx | 225 +- .../PrintMainPage/PrintPreviewpage.jsx | 196 +- .../UtillComponents/BSCreditCustomer.jsx | 1 - .../BSNavbarSearchStandard.jsx | 4 +- .../UtillComponents/BSPrinterSetting.jsx | 6 +- .../PrintTemplates/A4/A4Standard.jsx | 141 +- .../PrintTemplates/A4/PrintA4Style11.jsx | 178 +- .../PrintTemplates/A4/PrintStyleA5.jsx | 259 +- .../ThermalPrinter/PrintStyle1.jsx | 3195 +++++---- .../ThermalPrinter/PrintStyle10.jsx | 231 +- .../ThermalPrinter/PrintStyle11.jsx | 5377 ++++++++++---- .../ThermalPrinter/PrintStyle12.jsx | 5359 ++++++++++---- .../ThermalPrinter/PrintStyle2.jsx | 3526 +++++----- .../ThermalPrinter/PrintStyle3.jsx | 155 +- .../ThermalPrinter/PrintStyle4.jsx | 3444 ++++----- .../ThermalPrinter/PrintStyle5.jsx | 2639 +++---- .../ThermalPrinter/PrintStyle6.jsx | 2917 ++++---- .../ThermalPrinter/PrintStyle7.jsx | 5699 +++++++++++---- .../ThermalPrinter/PrintStyle8.jsx | 6218 +++++++++++++---- .../ThermalPrinter/PrintStyle9.jsx | 3233 +++++---- src/Pages/DashBoard/RetailDashboard.jsx | 1 - src/Pages/Kiosk/CardPage/SelfCardPage1.jsx | 209 +- src/Pages/Preference/PreferenceList.jsx | 3 + src/Pages/Tablebooking/TableBooking.jsx | 1 - .../paymentpdfPage/PaymentPdfBooking.jsx | 158 +- 42 files changed, 31261 insertions(+), 15525 deletions(-) diff --git a/src/Components/Menu/SideMenuPozo.jsx b/src/Components/Menu/SideMenuPozo.jsx index c60cd0c..bbd38dd 100644 --- a/src/Components/Menu/SideMenuPozo.jsx +++ b/src/Components/Menu/SideMenuPozo.jsx @@ -56,6 +56,9 @@ import { changeBtoBQuickProductTransfer, changeTipAmount, GlobalDineinDefault, + changePreviousOrderOfferDetail, + changePreviousOrderPayment, + changeBillEditingMode, } from '../../Features/BookingScreen/BookingData/BookingData'; import { changeWholeSaleAuctionSelectedData, @@ -262,6 +265,9 @@ const SideMenuPozo = ({ items = [] }) => { dispatch(ChangeTotalAmount([])); dispatch(ChangeFullFreeProductList([])); dispatch(changeFullOfferAppliedProducts([])); + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeLoyaltyConsumedQuantities({})); } if (e == `${subDirectory}sales`) { @@ -285,6 +291,9 @@ const SideMenuPozo = ({ items = [] }) => { dispatch(Offer.changeCoupenCodeAmount(0)); dispatch(ChangeFullFreeProductList([])); dispatch(changeFullOfferAppliedProducts([])); + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(ChangeTotalAmount([])); dispatch(changeLoyaltyConsumedQuantities({})); } @@ -382,7 +391,7 @@ const SideMenuPozo = ({ items = [] }) => { e.stopPropagation(); handleMenuClick(item, parentKeys, e, level); }} - // style={{ paddingLeft: `${level * 10 + 1}px` }} + // style={{ paddingLeft: `${level * 10 + 1}px` }} > {item.icon && level === 0 && ( { + return await axiosRetailInstanceData.put(`/SalesBillEdit`, putData); + } +); + export const getEstimateDatewiseReport = createAsyncThunk( 'BookingData/getEstimateDatewiseReport', async (data) => { @@ -1423,7 +1431,7 @@ export const getMissedOrderids = createAsyncThunk( export const CustomerOrderList = createAsyncThunk( 'CustomerOrderList/LastBuyProductList', async (data) => { - const { AppId, CompId, BranchId, MobileNo,FromDate,ToDate } = data; + const { AppId, CompId, BranchId, MobileNo, FromDate, ToDate } = data; if ( AppId != null && AppId != undefined && @@ -1596,6 +1604,9 @@ const initialState = { AddBookingDetailsTrigger: false, CurrentOrderId: null, productCardTrigger: 0, + salesBillEdit: false, + previousOrderPayment: [], + previousOrderOfferDetails: [], }; const BookingData = createSlice({ @@ -1921,6 +1932,15 @@ const BookingData = createSlice({ triggerProductCard: (state) => { state.productCardTrigger += 1; }, + changeBillEditingMode: (state, action) => { + state.salesBillEdit = action?.payload; + }, + changePreviousOrderPayment: (state, action) => { + state.previousOrderPayment = action?.payload; + }, + changePreviousOrderOfferDetail: (state, action) => { + state.previousOrderOfferDetails = action?.payload; + }, }, extraReducers: (builder) => { @@ -1968,8 +1988,8 @@ const BookingData = createSlice({ } }), - builder.addCase(getProductsearch.fulfilled, (state, action) => { - console.log(action?.payload,"mohanaacacacca") + builder.addCase(getProductsearch.fulfilled, (state, action) => { + console.log(action?.payload, "mohanaacacacca") if (action?.payload?.statusCode === 1) { state.SelectedDatas = action?.payload?.data; } else { @@ -2189,6 +2209,9 @@ export const { changeAddBookingDetailsTrigger, changeCurrentOrderId, triggerProductCard, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail } = BookingData.actions; export const GlobalComboRedirectionToDefaultLayoutForParking = (state) => @@ -2357,5 +2380,11 @@ export const GlobalAddBookingDetailsTrigger = (state) => state?.BookingData?.AddBookingDetailsTrigger; export const GlobalCurrentOrderId = (state) => state?.BookingData?.CurrentOrderId; +export const GlobalSalesBillEdit = (state) => + state?.BookingData?.salesBillEdit; +export const GlobalPreviousOrderPayment = (state) => + state?.BookingData?.previousOrderPayment; +export const GlobalPreviousOrderOfferDetails = (state) => + state?.BookingData?.previousOrderOfferDetails; export default BookingData.reducer; diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx index bd078f5..05f774e 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx @@ -117,6 +117,15 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, + GlobalSalesBillEdit, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalpaymentOptionData, + getPaymentOptions, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; import { @@ -235,6 +244,10 @@ export default function BST1Payment() { ); const dispatch = useDispatch(); const navigate = useNavigate(); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const Discount = useSelector(GlobalOverAllOfferAmt); const defaultBookingType = useSelector(GlobalDefaultBookingType); const globalTipAmount = useSelector(GlobaltipAmount); @@ -323,6 +336,12 @@ export default function BST1Payment() { const [defaultEnabled, setDefaultEnabled] = useState(false); const [SelectedUpiOption, setSelectedUpiOption] = useState(); const [hold, setHold] = useState(false); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); + console.log(currentOrderNetAmount, 'currentOrderNetAmount', previousNetAmount, salesBillEdit); const [addcustomer, setAddCustomer] = useState(false); const [PrintOrderDetails, setPrintOrderDetails] = useState([]); //Total calculation @@ -540,6 +559,27 @@ export default function BST1Payment() { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + // let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0)); let withdiscTotal = Total - @@ -547,19 +587,17 @@ export default function BST1Payment() { (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( - formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - ); + const currentOrderNetAmount = formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) + + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); - dispatch( - changeSummeryTotalAmount( - formatAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) - ) - ); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -621,6 +659,31 @@ export default function BST1Payment() { fetchApi(); } }, [UserType]); + + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) useEffect(() => { let hasAccess = false; @@ -828,7 +891,7 @@ export default function BST1Payment() { const selectedStyle = stylesMap[ - printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle + printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle ]; if (selectedStyle) { @@ -1182,7 +1245,7 @@ export default function BST1Payment() { await Promise.all( PrintOrderDetails?.[0]?.OrderDetails?.map( async (orderDetail, index) => { - const groupedTokens = orderDetail?.productDetails?.reduce( + const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -1263,6 +1326,10 @@ export default function BST1Payment() { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1535,6 +1602,12 @@ export default function BST1Payment() { setCardoptionnotSelected(false); } }; + + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1736,6 +1809,9 @@ export default function BST1Payment() { ParkingClaimed: false, }) ); + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeLoyaltyConsumedQuantities({})); dispatch(changeFullOfferAppliedProducts([])); @@ -1752,6 +1828,8 @@ export default function BST1Payment() { setPaybtnselected(PaymentOptionsModeId); setQrCode(false); setUpinotSelected(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); getHolddata(); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -1928,15 +2006,15 @@ export default function BST1Payment() { OrderStatus: 'O', OrderType: BookingType === 'Dine In' || - BookingTypeBoth || - Estimation?.SettingValue == 'N' + BookingTypeBoth || + Estimation?.SettingValue == 'N' ? 'S' : GlobEstBooking === 'OvrAllEst' ? 'E' : GlobEstBooking === 'ParEst' ? GlobProdwisedata?.includes( - a.InwardDtlId + ' ' + a?.BookingTypeName - ) + a.InwardDtlId + ' ' + a?.BookingTypeName + ) ? 'E' : 'S' : 'S', @@ -2026,7 +2104,7 @@ export default function BST1Payment() { : Paybtnnameselected?.toLowerCase() === 'credit' ? 'S' : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', OrderDtlDetails: @@ -2043,15 +2121,15 @@ export default function BST1Payment() { ? globalTipAmount === 0 ? SelectedTableDetails : SelectedTableDetails?.map((item) => ({ - ...item, - TipsAmount: globalTipAmount, - })) + ...item, + TipsAmount: globalTipAmount, + })) : null, SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2059,20 +2137,20 @@ export default function BST1Payment() { ? PaymentgatewayUPI?.[0]?.ModeId : SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find( - (busupi) => busupi?.ModeId === UpiId - )?.ModeId + (busupi) => busupi?.ModeId === UpiId + )?.ModeId : paybtnselected : paybtnselected ? paybtnselected : null, - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'business' + SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) - ?.MerchantId + ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2086,42 +2164,42 @@ export default function BST1Payment() { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) - ?.UPIDetailId + ?.UPIDetailId : SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) - ?.MerchantUPIId + ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( - (upipay) => upipay?.UPIId === UpiId - ) + (upipay) => upipay?.UPIId === UpiId + ) : (Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'pd') || - (Paybtnnameselected?.toLowerCase() === 'card' && - SelectedCardOption?.toLowerCase() === 'pd') + SelectedUPIPayOption?.toLowerCase() === 'pd') || + (Paybtnnameselected?.toLowerCase() === 'card' && + SelectedCardOption?.toLowerCase() === 'pd') ? useOptions?.[0]?.PaymentDetails?.PaymentDevice : (Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'pg') || - (Paybtnnameselected?.toLowerCase() === 'card' && - SelectedCardOption?.toLowerCase() === 'pg') + SelectedUPIPayOption?.toLowerCase() === 'pg') || + (Paybtnnameselected?.toLowerCase() === 'card' && + SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' ? 'S' : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2190,14 +2268,14 @@ export default function BST1Payment() { setMessageType('success'); setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); response?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([response?.data]); @@ -2326,7 +2404,12 @@ export default function BST1Payment() { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -2349,14 +2432,14 @@ export default function BST1Payment() { setMessageType('success'); setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); response?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([response?.data]); @@ -2457,14 +2540,14 @@ export default function BST1Payment() { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -2639,14 +2722,14 @@ export default function BST1Payment() { setMessageType('success'); setMessageData( bookingpaymentupdate?.data?.response + - ' ' + - (bookingpaymentupdate?.data?.OrderDetails?.length > 0 - ? bookingpaymentupdate?.data?.OrderId && - extractLastNumberOrderId( - bookingpaymentupdate?.data?.OrderId, - bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus - ) - : '') + ' ' + + (bookingpaymentupdate?.data?.OrderDetails?.length > 0 + ? bookingpaymentupdate?.data?.OrderId && + extractLastNumberOrderId( + bookingpaymentupdate?.data?.OrderId, + bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus + ) + : '') ); bookingpaymentupdate?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([bookingpaymentupdate?.data]); @@ -2664,7 +2747,7 @@ export default function BST1Payment() { if ( Date.now() - startTime > useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes * - 60000 + 60000 ) { // 60,000 ms = 1 minute @@ -3098,7 +3181,7 @@ export default function BST1Payment() { }; const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3108,6 +3191,11 @@ export default function BST1Payment() { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3437,30 +3525,30 @@ export default function BST1Payment() { (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 'none' : 'auto', opacity: (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 0.5 : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (
)) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
+ +
+ )) ) : (
0 && 'not-allowed', color: OrderCardDetail?.length > 0 || - (selOption?.value === undefined && - GlobalAddCustomerDetails1?.length === 0 && - GetCustId?.CustMobile === undefined) + (selOption?.value === undefined && + GlobalAddCustomerDetails1?.length === 0 && + GetCustId?.CustMobile === undefined) ? 'gray' : 'rgb(18, 146, 238)', fontSize: '28px', @@ -3626,16 +3750,16 @@ export default function BST1Payment() { (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 'none' : 'auto', opacity: (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 0.5 : 1, }} @@ -3654,14 +3778,14 @@ export default function BST1Payment() { width: '1.5rem', cursor: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'not-allowed' : 'pointer', color: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'gray' : 'rgb(18, 146, 238)', display: 'flex', @@ -3727,14 +3851,14 @@ export default function BST1Payment() { width: '1.5rem', cursor: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'not-allowed' : 'pointer', color: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'gray' : 'rgb(18, 146, 238)', display: 'flex', @@ -3816,58 +3940,58 @@ export default function BST1Payment() {
{unpaidFlow == false ? holdCheckedSalesSetup && - BookingType !== 'Dine In' && - !BookingTypeBoth && - OrderCardDetail?.length != 0 && - CheckOrderType?.length === 0 && - OrderType != 'Failed' && - CheckBookingStatus != 'Close' && - paybtns?.length > 0 && - !addnewAccess && ( - - {' '} - AddBookingDetails('Hold')} - style={{ - fontSize: '30px', - cursor: 'pointer', - color: '' ? '#52c41a' : '#1292EE', - }} - /> - - ) + BookingType !== 'Dine In' && + !BookingTypeBoth && + OrderCardDetail?.length != 0 && + CheckOrderType?.length === 0 && + OrderType != 'Failed' && + CheckBookingStatus != 'Close' && + paybtns?.length > 0 && + !addnewAccess && ( + + {' '} + AddBookingDetails('Hold')} + style={{ + fontSize: '30px', + cursor: 'pointer', + color: '' ? '#52c41a' : '#1292EE', + }} + /> + + ) : ''} {unpaidFlow == false ? holdCheckedSalesSetup && - paybtns?.length > 0 && - BookingType !== 'Dine In' && - !BookingTypeBoth && - Holddata?.length > 0 && - OrderCardDetail?.length == 0 && - CheckBookingStatus != 'Close' && - !addnewAccess && ( - - {' '} - - HandleholdModelOpen()} - style={{ - fontSize: '28px', - cursor: 'pointer', - color: Holddata ? '#52c41a' : 'default', - pointerEvents: - OrderType === 'Failed' ? 'none' : 'auto', - }} - /> - - - ) + paybtns?.length > 0 && + BookingType !== 'Dine In' && + !BookingTypeBoth && + Holddata?.length > 0 && + OrderCardDetail?.length == 0 && + CheckBookingStatus != 'Close' && + !addnewAccess && ( + + {' '} + + HandleholdModelOpen()} + style={{ + fontSize: '28px', + cursor: 'pointer', + color: Holddata ? '#52c41a' : 'default', + pointerEvents: + OrderType === 'Failed' ? 'none' : 'auto', + }} + /> + + + ) : ''}
)} @@ -3896,6 +4020,11 @@ export default function BST1Payment() { } BillingTableName="BillingTable1" CheckBookingStatus={CheckBookingStatus} + salesBillEdit={salesBillEdit} + currentOrderNetAmount={currentOrderNetAmount} + previousNetAmount={previousNetAmount} + credit={credit} + overAllBal={overAllBal} /> ) : ( @@ -3905,11 +4034,12 @@ export default function BST1Payment() { addnewAccess ? 'price-button-disabled' : FirstPaymentclick === false && - OrderCardDetail?.length > 0 && - paybtnselected && - CheckBookingStatus != 'Close' - ? !OrderStatus - ? 'price-button' + OrderCardDetail?.length > 0 && + paybtnselected && + CheckBookingStatus != 'Close' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'price-button' + : 'price-button' : 'price-button Order' : 'price-button-disabled' } @@ -3924,7 +4054,7 @@ export default function BST1Payment() { > {' '} {isMobile ? ( - !OrderStatus ? ( + !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
: ( `₹ ${Math.round( OrderType === 'Failed' ? FailedTotalAmt @@ -3935,7 +4065,7 @@ export default function BST1Payment() { ) : ( 'ORDER' ) - ) : !OrderStatus ? ( + ) : !OrderStatus ? (salesBillEdit && (currentOrderNetAmount < previousNetAmount)) ? (
Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
) : (
₹{' '} data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> @@ -4266,9 +4399,9 @@ export default function BST1Payment() { const qty = isGroup ? OrderCardDetail.filter((o) => o.id === groupKey).reduce( - (sum, o) => sum + (o.OrderQty || 1), - 0 - ) + (sum, o) => sum + (o.OrderQty || 1), + 0 + ) : item.OrderQty || 1; return ( @@ -4383,24 +4516,24 @@ export default function BST1Payment() { Do you want to cancel the payment? )} - - {customerPreviesOrders && ( - setCustomerPreviesOrders(false)} - footer={false} - width={700} - className={'ModalPaymentGatewayEmbedded'} - children={ - <> - setCustomerPreviesOrders(false)} - /> - - } + + {customerPreviesOrders && ( + setCustomerPreviesOrders(false)} + footer={false} + width={700} + className={'ModalPaymentGatewayEmbedded'} + children={ + <> + setCustomerPreviesOrders(false)} /> - )} + + } + /> + )} ); } diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BalanceAndReceived.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BalanceAndReceived.jsx index 5d037c2..5911b82 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BalanceAndReceived.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BalanceAndReceived.jsx @@ -32,6 +32,11 @@ const PaymentInput = ({ handleButtonClick, BillingTableName, CheckBookingStatus, + salesBillEdit = false, + currentOrderNetAmount = 0, + previousNetAmount = 0, + credit = false, + overAllBal = 0, }) => { const { SadminuserAccess } = useAuth(); let SAAccessCommonMaster = SadminuserAccess?.find( @@ -133,9 +138,9 @@ const PaymentInput = ({ addnewAccess ? 'price-button-disabled' : FirstPaymentclick === false && - OrderCardDetail?.length > 0 && - paybtnselected && - CheckBookingStatus != 'Close' + OrderCardDetail?.length > 0 && + paybtnselected && + CheckBookingStatus != 'Close' ? !OrderStatus ? 'price-button' : 'price-button Order' @@ -152,13 +157,15 @@ const PaymentInput = ({ style={{ fontFamily: FontFamily['head'] }} > {isMobile && - (!OrderStatus - ? `₹ ${Math.round( - OrderType === 'Failed' ? failedTotalAmt : totalAmount - )}` + (!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
: + `₹ ${Math.round( + OrderType === 'Failed' ? failedTotalAmt : credit && overAllBal >= 0 + ? Math.max(0, totalAmount - overAllBal) + : totalAmount + )}` : 'ORDER')} - {!isMobile && !OrderStatus && ( + {!isMobile && !OrderStatus && ((salesBillEdit && (currentOrderNetAmount < previousNetAmount)) ?
Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
: ( <> ₹{' '} {/* */} {OrderType === 'Failed' ? failedTotalAmt - : safeRound(totalAmount)} + : safeRound((credit && overAllBal >= 0) + ? Math.max(0, totalAmount - overAllBal) + : totalAmount)} - )} + ))} {!isMobile && OrderStatus && 'ORDER'} diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx index 3c8e9c0..caa8639 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx @@ -124,6 +124,15 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, + GlobalSalesBillEdit, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalpaymentOptionData, + getPaymentOptions, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import { gettinghold, @@ -242,6 +251,10 @@ const BSBillingTable2 = () => { const SessionMobileNo = SessionData?.SessionMobileNo; const dispatch = useDispatch(); const navigate = useNavigate(); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const defaultBookingType = useSelector(GlobalDefaultBookingType); const globalTipAmount = useSelector(GlobaltipAmount); const OtherServiceTicketClaim = useSelector(GlobalOtherServiceTicketClaim); @@ -319,6 +332,11 @@ const BSBillingTable2 = () => { const [overAllBal, setOverAllBal] = useState(0); const [creditCustomerOpen, setcreditCustomerOpen] = useState(false); const [hold, setHold] = useState(false); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const [addcustomer, setAddCustomer] = useState(false); const [paybtns, setpaybtns] = useState([]); const tableOptions = templateData?.BookingBilling?.[1]; @@ -452,6 +470,7 @@ const BSBillingTable2 = () => { item.SettingIdName.toLowerCase() === 'shortcutkeys' && item.SettingValue === 'Y' ); + useEffect(() => { const fetchCreditCustomer = async () => { const selectedMode = paybtns?.find( @@ -491,6 +510,31 @@ const BSBillingTable2 = () => { fetchCreditCustomer(); }, [paybtnselected, selOption, paybtns]); + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) + useEffect(() => { if (!preOrder) { const totalSum = OrderCardDetail?.reduce( @@ -546,23 +590,43 @@ const BSBillingTable2 = () => { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( + const currentOrderNetAmount = formatAmount( withdiscTotal >= 0 ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ); + ) - dispatch( - changeSummeryTotalAmount( - withdiscTotal > 0 ? withdiscTotal : Number(Total) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -767,6 +831,10 @@ const BSBillingTable2 = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1240,6 +1308,11 @@ const BSBillingTable2 = () => { } }; + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1776,6 +1849,9 @@ const BSBillingTable2 = () => { } else { dispatch(changeOrderCardDetails([])); } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeFullOfferAppliedProducts([])); dispatch(ChangeFullFreeProductList([])); @@ -1792,6 +1868,8 @@ const BSBillingTable2 = () => { setPaybtnnameselected(PaymentOptionsModeName); setQrCode(false); setUpinotSelected(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); getHolddata(); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -2093,7 +2171,7 @@ const BSBillingTable2 = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2107,15 +2185,14 @@ const BSBillingTable2 = () => { : paybtnselected ? paybtnselected : null, - // SelectedUPIPayOption?.toLowerCase() === "pg" ? - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2129,7 +2206,7 @@ const BSBillingTable2 = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2137,7 +2214,7 @@ const BSBillingTable2 = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2154,7 +2231,7 @@ const BSBillingTable2 = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2163,8 +2240,8 @@ const BSBillingTable2 = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2372,7 +2449,12 @@ const BSBillingTable2 = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -3201,7 +3283,7 @@ const BSBillingTable2 = () => { // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3211,6 +3293,11 @@ const BSBillingTable2 = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3820,7 +3907,7 @@ const BSBillingTable2 = () => { : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (
)) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
+ +
+ )) ) : (
{ OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? 'billing-btn' + ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'billing-btn' + : 'billing-btn' : 'billing-btn-deactive' } // onClick={() => { @@ -4142,7 +4267,9 @@ const BSBillingTable2 = () => { handleButtonClick } > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
: ( <>

Total

@@ -4363,7 +4490,10 @@ const BSBillingTable2 = () => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> @@ -4578,7 +4708,7 @@ const BSBillingTable2 = () => {
} /> - + setShowCancelConfirm(true)} diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx index 1de2de5..217a778 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx @@ -131,6 +131,15 @@ import { GlobalCombocarddata, getCreditCustomer, GlobalSummeryTotalItems, + GlobalSalesBillEdit, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalpaymentOptionData, + getPaymentOptions, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; @@ -225,6 +234,10 @@ const BSBillingTable3Pay = () => { ); const dispatch = useDispatch(); const navigate = useNavigate(); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const FreeProdList = useSelector(GlobalFreeProdList); const offerAppliedProducts = useSelector( GlobalOfferAppliedProducts, @@ -332,11 +345,16 @@ const BSBillingTable3Pay = () => { const [SelectedUPIPayOption, setSelectedUPIPayOption] = useState('Default'); const [SelectedUpiOption, setSelectedUpiOption] = useState(''); const [hold, setHold] = useState(false); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const [addcustomer, setAddCustomer] = useState(false); const [PrintOrderDetails, setPrintOrderDetails] = useState([]); const OrderCardDetail = useSelector(GlobalOrderCardDetails); const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false); - + console.log(OrderCardDetail, 'OrderCardDetail'); //Total calculation const TotalItems = OrderCardDetail?.length; @@ -568,23 +586,43 @@ const BSBillingTable3Pay = () => { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( + const currentOrderNetAmount = formatAmount( withdiscTotal >= 0 ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ); + ) - dispatch( - changeSummeryTotalAmount( - formatAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -693,6 +731,31 @@ const BSBillingTable3Pay = () => { // } }, []); + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) + useEffect(() => { if (UserType === 'Employee') { fetchApi(); @@ -1424,6 +1487,10 @@ const BSBillingTable3Pay = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1705,6 +1772,11 @@ const BSBillingTable3Pay = () => { } }; + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1912,6 +1984,9 @@ const BSBillingTable3Pay = () => { // } else { dispatch(changeOrderCardDetails([])); // } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeLoyaltyConsumedQuantities({})); dispatch(changeFullOfferAppliedProducts([])); dispatch(ChangeFullFreeProductList([])); @@ -1927,6 +2002,8 @@ const BSBillingTable3Pay = () => { setPaybtnnameselected(PaymentOptionsModeName); setPaybtnselected(PaymentOptionsModeId); setQrCode(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); setUpinotSelected(false); getHolddata(); if (defaultBookingType === 'Both') { @@ -2239,7 +2316,7 @@ const BSBillingTable3Pay = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2253,14 +2330,14 @@ const BSBillingTable3Pay = () => { : paybtnselected ? paybtnselected : null, - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2274,7 +2351,7 @@ const BSBillingTable3Pay = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2282,7 +2359,7 @@ const BSBillingTable3Pay = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2299,7 +2376,7 @@ const BSBillingTable3Pay = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2308,8 +2385,8 @@ const BSBillingTable3Pay = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2519,7 +2596,12 @@ const BSBillingTable3Pay = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -3218,7 +3300,7 @@ const BSBillingTable3Pay = () => { }; // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3228,6 +3310,11 @@ const BSBillingTable3Pay = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3954,7 +4041,7 @@ const BSBillingTable3Pay = () => { : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (
)) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
+ +
+ )) ) : (
{ OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus - ? 'BSBillingTable3-paybtn' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'BSBillingTable3-paybtn' + : 'BSBillingTable3-paybtn' : 'BSBillingTable3-paybtn Order' : 'BSBillingTable3-paybtn-deactive' } @@ -4292,7 +4416,7 @@ const BSBillingTable3Pay = () => { } //dhana > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?

Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}

: ( <>

{' '} @@ -4504,7 +4628,10 @@ const BSBillingTable3Pay = () => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx index b6d962c..e74dd18 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx @@ -118,6 +118,14 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, + GlobalSalesBillEdit, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalpaymentOptionData, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import { globalExtraTotalAmount, @@ -231,6 +239,10 @@ const BSBilling4Payment = () => { ); const dispatch = useDispatch(); const navigate = useNavigate(); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const FreeProdList = useSelector(GlobalFreeProdList); const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts); // const applyOffer = useApplyOfferto_CardDetail(); @@ -329,6 +341,11 @@ const BSBilling4Payment = () => { const UserType = SessionData?.UserType; const AuthToken = SessionData?.AuthToken; const SessionMobileNo = SessionData?.SessionMobileNo; + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const [PaymentgatewayCard, setPaymentgatewayCard] = useState([]); const [PaymentDeviceCard, setPaymentDeviceCard] = useState([]); const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]); @@ -506,6 +523,32 @@ const BSBilling4Payment = () => { const Data1 = { AppId, CompId, BranchId }; dispatch(getPrintSelectionComponentData(Data1)).unwrap(); }, []); + + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) + useEffect(() => { const fetchCreditCustomer = async () => { const selectedMode = paybtns?.find( @@ -602,25 +645,43 @@ const BSBilling4Payment = () => { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( - formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - ); + const currentOrderNetAmount = formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) - dispatch( - changeSummeryTotalAmount( - formatAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -1307,6 +1368,10 @@ const BSBilling4Payment = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1610,6 +1675,12 @@ const BSBilling4Payment = () => { setCardoptionnotSelected(false); } }; + + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1806,6 +1877,9 @@ const BSBilling4Payment = () => { // } else { dispatch(changeOrderCardDetails([])); // } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeLoyaltyConsumedQuantities({})); dispatch(changeFullOfferAppliedProducts([])); dispatch(ChangeFullFreeProductList([])); @@ -1821,6 +1895,8 @@ const BSBilling4Payment = () => { setPaybtnnameselected(PaymentOptionsModeName); setPaybtnselected(PaymentOptionsModeId); setQrCode(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); setUpinotSelected(false); getHolddata(); if (defaultBookingType === 'Both') { @@ -2123,7 +2199,7 @@ const BSBilling4Payment = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2137,14 +2213,14 @@ const BSBilling4Payment = () => { : paybtnselected ? paybtnselected : null, - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2158,7 +2234,7 @@ const BSBilling4Payment = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2166,7 +2242,7 @@ const BSBilling4Payment = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2183,7 +2259,7 @@ const BSBilling4Payment = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2192,8 +2268,8 @@ const BSBilling4Payment = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2402,7 +2478,12 @@ const BSBilling4Payment = () => { putdata['PrintType'] = 'Y'; } console.log(putdata, 'putdataputdata'); - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter( (item) => item?.PaymentOptionType?.toLowerCase() === 'pc' ); @@ -3061,7 +3142,7 @@ const BSBilling4Payment = () => { } }; const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3071,6 +3152,11 @@ const BSBilling4Payment = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3934,7 +4020,7 @@ const BSBilling4Payment = () => { : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (

)) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
+ +
+ )) ) : (
{ OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus - ? 'Table4-Btn-final-price' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'Table4-Btn-final-price' + : 'Table4-Btn-final-price' : 'Table4-Btn-final-price order' : 'Table4-Btn-final-price-disabled' } @@ -4263,7 +4386,7 @@ const BSBilling4Payment = () => { handleButtonClick } > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?

Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}

: (
{ SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx index afa9d03..e95245f 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx @@ -121,6 +121,15 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, + GlobalSalesBillEdit, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalpaymentOptionData, + getPaymentOptions, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayth Date:27/12/2023 import { @@ -236,6 +245,10 @@ const BSBillingTable5 = () => { const UserType = SessionData?.UserType; const AuthToken = SessionData?.AuthToken; const SessionMobileNo = SessionData?.SessionMobileNo; + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const Discount = useSelector(GlobalOverAllOfferAmt); const FreeProdList = useSelector(GlobalFreeProdList); const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts); @@ -316,6 +329,11 @@ const BSBillingTable5 = () => { const printDatas = useSelector(GlobalprintDatas); const PrinterDetails = useSelector(GlobalPrinterMappingDtls); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const [paybtnselected, setPaybtnselected] = useState(); const [Paybtnnameselected, setPaybtnnameselected] = useState(); const [SelectedBookingType, setSelectedBookingType] = useState(null); @@ -466,6 +484,31 @@ const BSBillingTable5 = () => { // for customised invoice number const { invoiceDate, clearInvoiceDate } = useDateStore(); const CurrentOrderId = useSelector(GlobalCurrentOrderId); + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) + useEffect(() => { if ( OrderCardDetail?.length === 1 && @@ -589,25 +632,44 @@ const BSBillingTable5 = () => { ); } + + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( - formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - ); + const currentOrderNetAmount = formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) - dispatch( - changeSummeryTotalAmount( - formatAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -844,6 +906,10 @@ const BSBillingTable5 = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1679,6 +1745,12 @@ const BSBillingTable5 = () => { setCardoptionnotSelected(false); } }; + + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1820,6 +1892,9 @@ const BSBillingTable5 = () => { } else { dispatch(changeOrderCardDetails([])); } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeLoyaltyConsumedQuantities({})); await dispatch(ChangeTotalAmount([])); @@ -1836,6 +1911,8 @@ const BSBillingTable5 = () => { setPaybtnselected(PaymentOptionsModeId); setQrCode(false); setUpinotSelected(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); getHolddata(); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -2134,7 +2211,7 @@ const BSBillingTable5 = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2148,14 +2225,14 @@ const BSBillingTable5 = () => { : paybtnselected ? paybtnselected : null, - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2169,7 +2246,7 @@ const BSBillingTable5 = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2177,7 +2254,7 @@ const BSBillingTable5 = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2194,7 +2271,7 @@ const BSBillingTable5 = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2203,8 +2280,8 @@ const BSBillingTable5 = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2410,7 +2487,12 @@ const BSBillingTable5 = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -3182,7 +3264,7 @@ const BSBillingTable5 = () => { // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3192,6 +3274,11 @@ const BSBillingTable5 = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3605,7 +3692,7 @@ const BSBillingTable5 = () => { : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (
)) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
+ +
+ )) ) : (
{ OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus - ? 'BSBIllingTable5-paybtn-noitems' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'BSBIllingTable5-paybtn-noitems' + : 'BSBIllingTable5-paybtn-noitems' : 'BSBIllingTable5-paybtn-noitems Order' : 'BSBIllingTable5-paybtn-noitems-disable' } @@ -4167,7 +4291,7 @@ const BSBillingTable5 = () => { handleButtonClick } > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
: ( <> {/* ₹ {Math.round(TotalAmount)} */} {isMobile ? ( @@ -4376,7 +4500,10 @@ const BSBillingTable5 = () => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx index 1baef7e..c8bfad8 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx @@ -120,6 +120,15 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, + GlobalSalesBillEdit, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalpaymentOptionData, + getPaymentOptions, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; import { @@ -240,6 +249,10 @@ const BST6Payment = () => { type?.PreferredSubCatName?.toLowerCase() === 'dine in' && type?.PreferredStatus === 'Y' ); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const screenwidth = useSelector(GlobalScreenSize); const printerTemplateStyle = useSelector(SelectedPrintTemplate); const RetailWSSalesType = useSelector(GlobalRetailWSSalesType); @@ -336,6 +349,11 @@ const BST6Payment = () => { const UserType = SessionData?.UserType; const AuthToken = SessionData?.AuthToken; const SessionMobileNo = SessionData?.SessionMobileNo; + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const [FirstPaymentclick, setFirstPaymentclick] = useState(false); const [open, setOpen] = useState(false); const [unpaidopen, setUnpaidOpen] = useState(false); @@ -459,6 +477,30 @@ const BST6Payment = () => { setPrintOrderDetails([]); } }, [OrderCardDetail]); + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) console.log(PrintOrderDetails, 'PrintOrderDetails'); useEffect(() => { if (selOption) { @@ -563,25 +605,43 @@ const BST6Payment = () => { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( - formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - ); + const currentOrderNetAmount = formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) - dispatch( - changeSummeryTotalAmount( - formatAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -1174,6 +1234,10 @@ const BST6Payment = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1634,6 +1698,11 @@ const BST6Payment = () => { } }; + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1718,7 +1787,7 @@ const BST6Payment = () => { setCardOptionOpen(visible); }; const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -1728,6 +1797,11 @@ const BST6Payment = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -1861,6 +1935,9 @@ const BST6Payment = () => { } else { dispatch(changeOrderCardDetails([])); } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeLoyaltyConsumedQuantities({})); await dispatch(ChangeTotalAmount([])); @@ -1877,6 +1954,8 @@ const BST6Payment = () => { setPaybtnselected(PaymentOptionsModeId); setQrCode(false); setUpinotSelected(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); getHolddata(); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -2173,7 +2252,7 @@ const BST6Payment = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2187,14 +2266,14 @@ const BST6Payment = () => { : paybtnselected ? paybtnselected : null, - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2208,7 +2287,7 @@ const BST6Payment = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2216,7 +2295,7 @@ const BST6Payment = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2233,7 +2312,7 @@ const BST6Payment = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2242,8 +2321,8 @@ const BST6Payment = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2451,7 +2530,12 @@ const BST6Payment = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter( (item) => item?.PaymentOptionType?.toLowerCase() === 'pc' ); @@ -3678,7 +3762,7 @@ const BST6Payment = () => { : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (
)) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
+ +
+ )) ) : (
{ OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus - ? 'BST6Payment-Button-pay' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'BST6Payment-Button-pay' + : 'BST6Payment-Button-pay' : 'BST6Payment-Button-pay Order' : 'BST6Payment-Button-pay-disabled' } @@ -3798,7 +3917,7 @@ const BST6Payment = () => { handleButtonClick } > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
: ( <>

{isMobile ? ( @@ -4317,7 +4436,10 @@ const BST6Payment = () => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx index 59df9c9..6464813 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx @@ -110,6 +110,15 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, + GlobalSalesBillEdit, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalpaymentOptionData, + getPaymentOptions, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData.js'; import { globalExtraTotalAmount, @@ -225,6 +234,10 @@ const BSBilling7Payment = () => { ); const dispatch = useDispatch(); const navigate = useNavigate(); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const Discount = useSelector(GlobalOverAllOfferAmt); const screenwidth = useSelector(GlobalScreenSize); const defaultBookingType = useSelector(GlobalDefaultBookingType); @@ -327,6 +340,11 @@ const BSBilling7Payment = () => { const [SelectedUPIPayOption, setSelectedUPIPayOption] = useState('Default'); const [SelectedUpiOption, setSelectedUpiOption] = useState(); const [hold, setHold] = useState(false); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const [addcustomer, setAddCustomer] = useState(false); const [PrintOrderDetails, setPrintOrderDetails] = useState([]); const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false); const OverAllSales = useSelector(GlobalOverAllDiscSales); @@ -348,7 +366,7 @@ const BSBilling7Payment = () => { return acc + Math.round(Number(item?.OrderQty || 0)); }, 0); - + console.log(salesBillEdit, currentOrderNetAmount, previousNetAmount, "previousNetAmount") const [UpiOption, setUpiOption] = useState(''); const [BusinessPayOption, setBusinessPayoption] = useState([]); const [paymentSucess, setPaymentSuccess] = useState(false); @@ -482,6 +500,33 @@ const BSBilling7Payment = () => { setMobileNoWhatsApp(selOption); } }, [selOption]); + + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) + + // Usage useEffect(() => { const fetchCreditCustomer = async () => { @@ -579,23 +624,44 @@ const BSBilling7Payment = () => { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( + const currentOrderNetAmount = formatAmount( withdiscTotal >= 0 ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ); + ) + console.log(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount, "totalPreviouspayment") - dispatch( - changeSummeryTotalAmount( - withdiscTotal > 0 ? withdiscTotal : Number(Total) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -819,7 +885,7 @@ const BSBilling7Payment = () => { async (orderDetail, index) => { await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print if (orderDetail?.BookingTypeName !== 'Dine In') { - const groupedTokens = orderDetail?.productDetails?.reduce( + const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -899,12 +965,17 @@ const BSBilling7Payment = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) : AddBookingDetails(BookingType, true); } }; + const financialYearError = async () => { setMessageType('error'); setMessageData('Financial Year-Based Sales Not Yet Started'); @@ -1637,6 +1708,12 @@ const BSBilling7Payment = () => { setCardoptionnotSelected(false); } }; + + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1833,6 +1910,9 @@ const BSBilling7Payment = () => { } else { dispatch(changeOrderCardDetails([])); } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeFullOfferAppliedProducts([])); dispatch(changeLoyaltyConsumedQuantities({})); @@ -1848,6 +1928,8 @@ const BSBilling7Payment = () => { setPaybtnnameselected(PaymentOptionsModeName); setPaybtnselected(PaymentOptionsModeId); setQrCode(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); setUpinotSelected(false); getHolddata(); if (defaultBookingType === 'Both') { @@ -2139,7 +2221,7 @@ const BSBilling7Payment = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2153,14 +2235,14 @@ const BSBilling7Payment = () => { : paybtnselected ? paybtnselected : null, - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2174,7 +2256,7 @@ const BSBilling7Payment = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2182,7 +2264,7 @@ const BSBilling7Payment = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2199,7 +2281,7 @@ const BSBilling7Payment = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2208,8 +2290,8 @@ const BSBilling7Payment = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2416,7 +2498,12 @@ const BSBilling7Payment = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -3126,7 +3213,7 @@ const BSBilling7Payment = () => { }; // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3136,6 +3223,11 @@ const BSBilling7Payment = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3840,7 +3932,7 @@ const BSBilling7Payment = () => { : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (

)) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
+ +
+ )) ) : (
{ OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus - ? 'Table4-Btn-final-price' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'Table4-Btn-final-price' + : 'Table4-Btn-final-price' : 'Table4-Btn-final-price Order' : 'Table4-Btn-final-price-disabled' } @@ -4168,7 +4297,7 @@ const BSBilling7Payment = () => { handleButtonClick } > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?

Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}

: ( <>
{ SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx index 7c71170..706af57 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx @@ -63,6 +63,9 @@ import { PostBlockSlots, changeCustomerID, changeSelectedCustId, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import './StandardTable.scss'; import { IoClose } from 'react-icons/io5'; @@ -148,8 +151,8 @@ const StandardTable = () => { OrderType === 'Hold' ? OrderCardDetail?.filter((a, b) => a.BookingTypeName === 'TakeAway') : OrderCardDetail?.filter( - (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId - ); + (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId + ); console.log('HoldOrderDtl', OrderCardDetail); const OldtableDataDinein = OrderCardDetail?.filter( (a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId @@ -157,8 +160,8 @@ const StandardTable = () => { const OldtableDataTakeAway = OrderType != 'Hold' ? OrderCardDetail?.filter( - (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId - ) + (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId + ) : []; const [EditQuantity, setEditQuantity] = useState(false); @@ -291,9 +294,9 @@ const StandardTable = () => { AppId: AppId, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; await dispatch(getSelectedFavItems(data)).unwrap(); @@ -305,9 +308,9 @@ const StandardTable = () => { ProdSubCat: ProdSubCat, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; @@ -318,9 +321,9 @@ const StandardTable = () => { prodCat: prodCat, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; @@ -413,6 +416,9 @@ const StandardTable = () => { await dispatch(ChangeTotalAmount([])); await dispatch(changeOrderType(null)); await dispatch(changeReorderHoldDetails({})); + await dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); } else if (OrderType === 'Reorder') { const UpdatedData = OrderCardDetail?.filter( (cartItem) => cartItem?.SalesId @@ -438,6 +444,9 @@ const StandardTable = () => { await dispatch(ChangeTotalAmount([])); await dispatch(changeUnpaidData(false)); await dispatch(changeReorderHoldDetails({})); + await dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); await dispatch(changeReorderProductDetails([])); await dispatch(ChangeSelectedCustDisable(false)); @@ -1124,9 +1133,9 @@ const StandardTable = () => { )?.map((item, idx) => idx === 0 ? { - ...item, - FreeQty, - } + ...item, + FreeQty, + } : item ), }; @@ -2510,11 +2519,10 @@ const StandardTable = () => { {OldtableDataTakeAway?.map((item, index) => ( { ? item?.SalesId && OrderType !== 'Hold' ? 'rgb(243, 248, 213)' : triggerAnimation && - index === 0 && - !item?.SalesId && - tableDataTakeAway?.length >= PreviousdataLength + index === 0 && + !item?.SalesId && + tableDataTakeAway?.length >= PreviousdataLength ? 'wheat' : triggerAnimation && - index === 0 && - tableDataTakeAway?.length >= - PreviousdataLength && - !HoldOrderDtl && - !UnpaidData + index === 0 && + tableDataTakeAway?.length >= + PreviousdataLength && + !HoldOrderDtl && + !UnpaidData ? 'wheat' : 'inherit' : 'none', @@ -2541,9 +2549,9 @@ const StandardTable = () => { item?.SalesId && OrderType !== 'Hold' ? 'rgb(243, 248, 213)' : GlobEstBooking === 'ParEst' && - GlobProdwisedata?.includes( - item?.InwardDtlId + ' ' + item?.BookingTypeName - ) + GlobProdwisedata?.includes( + item?.InwardDtlId + ' ' + item?.BookingTypeName + ) ? '#b2d1f7' : index % 2 === 0 ? 'white' @@ -2606,7 +2614,7 @@ const StandardTable = () => { }} onClick={() => item.FullProductIdentifierDtls?.length > 0 || - item.ProductIdentifierDtls?.length > 0 + item.ProductIdentifierDtls?.length > 0 ? handleImeiDetails(item) : editField && handleEditQuantity(item) } @@ -2675,21 +2683,21 @@ const StandardTable = () => { {productBasedExtraCharges?.find( (find) => find.ProdId === item.ProdId ) !== undefined && ( -
- Extra Charges :{' '} - { - productBasedExtraCharges?.find( - (find) => find.ProdId === item.ProdId - )?.TotalAmt - } -
- )} +
+ Extra Charges :{' '} + { + productBasedExtraCharges?.find( + (find) => find.ProdId === item.ProdId + )?.TotalAmt + } +
+ )} )} @@ -2784,7 +2792,7 @@ const StandardTable = () => { } }} > - {safeRound(item?.TotalAmt)} + {safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} )} {tableitem.OptionName == 'Delete' && ( @@ -2828,11 +2836,10 @@ const StandardTable = () => { {OldtableDataDinein?.map((item, index) => ( { ? item?.SalesId ? 'rgb(243, 248, 213)' : BookingType === 'Dine In' && - triggerAnimation && - OldtableDataTakeAway?.length + index === 0 && - !item?.SalesId && - tableDataDinein?.length >= PreviousdataLength + triggerAnimation && + OldtableDataTakeAway?.length + index === 0 && + !item?.SalesId && + tableDataDinein?.length >= PreviousdataLength ? 'wheat' : BookingType !== 'Dine In' && - triggerAnimation && - OldtableDataTakeAway?.length + index === 0 && - tableDataDinein?.length >= - PreviousdataLength && - !HoldOrderDtl && - !UnpaidData + triggerAnimation && + OldtableDataTakeAway?.length + index === 0 && + tableDataDinein?.length >= + PreviousdataLength && + !HoldOrderDtl && + !UnpaidData ? 'wheat' : 'inherit' : 'none', background: item?.SalesId ? 'rgb(243, 248, 213)' : GlobEstBooking === 'ParEst' && - GlobProdwisedata?.includes( - item?.InwardDtlId + ' ' + item?.BookingTypeName - ) + GlobProdwisedata?.includes( + item?.InwardDtlId + ' ' + item?.BookingTypeName + ) ? '#b2d1f7' : (OldtableDataTakeAway?.length + index) % 2 === 0 ? 'white' @@ -2991,21 +2998,21 @@ const StandardTable = () => { {productBasedExtraCharges?.find( (find) => find.ProdId === item.ProdId ) !== undefined && ( -
- Extra Charges :{' '} - { - productBasedExtraCharges?.find( - (find) => find.ProdId === item.ProdId - )?.TotalAmt - } -
- )} +
+ Extra Charges :{' '} + { + productBasedExtraCharges?.find( + (find) => find.ProdId === item.ProdId + )?.TotalAmt + } +
+ )} )} @@ -3099,7 +3106,7 @@ const StandardTable = () => { } }} > - {safeRound(item?.TotalAmt)} + {safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} )} @@ -3148,11 +3155,10 @@ const StandardTable = () => { OldtableDataTakeAway?.length + index } - className={`${ - BookingType === 'Dine In' && item?.SalesId - ? 'booking-billing-table-row-disabled' - : 'booking-billing-table-row' - } + className={`${BookingType === 'Dine In' && item?.SalesId + ? 'booking-billing-table-row-disabled' + : 'booking-billing-table-row' + } `} style={{ @@ -3161,43 +3167,43 @@ const StandardTable = () => { ? BookingType === 'Dine In' && item?.SalesId ? 'rgb(243, 248, 213)' : BookingType === 'Dine In' && - triggerAnimation && - OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index === - 0 && - !item?.SalesId && - tableDataTakeAway?.length >= PreviousdataLength + triggerAnimation && + OldtableDataDinein?.length + + OldtableDataTakeAway?.length + + index === + 0 && + !item?.SalesId && + tableDataTakeAway?.length >= PreviousdataLength ? 'wheat' : BookingType !== 'Dine In' && - triggerAnimation && - OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index === - 0 && - tableDataTakeAway?.length >= - PreviousdataLength && - !HoldOrderDtl && - !UnpaidData + triggerAnimation && + OldtableDataDinein?.length + + OldtableDataTakeAway?.length + + index === + 0 && + tableDataTakeAway?.length >= + PreviousdataLength && + !HoldOrderDtl && + !UnpaidData ? 'wheat' : (OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index) % - 2 === - 0 + OldtableDataTakeAway?.length + + index) % + 2 === + 0 ? 'white' : SelectedBillColor?.[ - 'OverallBackgroundColor' - ] + 'OverallBackgroundColor' + ] ? SelectedBillColor?.[ - 'OverallBackgroundColor' - ] + 'OverallBackgroundColor' + ] : '#d6d6d6' : (OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index) % - 2 === - 0 + OldtableDataTakeAway?.length + + index) % + 2 === + 0 ? 'white' : SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.['OverallBackgroundColor'] @@ -3206,15 +3212,15 @@ const StandardTable = () => { BookingType === 'Dine In' && item?.SalesId ? 'rgb(243, 248, 213)' : GlobEstBooking === 'ParEst' && - GlobProdwisedata?.includes( - item?.InwardDtlId + ' ' + item?.BookingTypeName - ) + GlobProdwisedata?.includes( + item?.InwardDtlId + ' ' + item?.BookingTypeName + ) ? '#b2d1f7' : (OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index) % - 2 === - 0 + OldtableDataTakeAway?.length + + index) % + 2 === + 0 ? 'white' : SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.['OverallBackgroundColor'] @@ -3223,9 +3229,9 @@ const StandardTable = () => { BillOrderPre === 'Y' && !BookingTypeBoth ? triggerAnimation && OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index === - 0 && + OldtableDataTakeAway?.length + + index === + 0 && !item?.SalesId && tableDataTakeAway?.length >= PreviousdataLength && !HoldOrderDtl && @@ -3278,7 +3284,7 @@ const StandardTable = () => { }} onClick={() => item.FullProductIdentifierDtls?.length > 0 || - item.ProductIdentifierDtls?.length > 0 + item.ProductIdentifierDtls?.length > 0 ? handleImeiDetails(item) : editField && handleEditQuantity(item) } @@ -3302,8 +3308,8 @@ const StandardTable = () => { {!item?.ProdVariantName?.toLowerCase()?.includes( 'variant' ) && ( - {item?.ProdVariantName} - )} + {item?.ProdVariantName} + )} {AvailableDate ? ( <> {' '} @@ -3353,21 +3359,21 @@ const StandardTable = () => { {productBasedExtraCharges?.find( (find) => find.ProdId === item.ProdId ) !== undefined && ( -
- Extra Charges :{' '} - { - productBasedExtraCharges?.find( - (find) => find.ProdId === item.ProdId - )?.TotalAmt - } -
- )} +
+ Extra Charges :{' '} + { + productBasedExtraCharges?.find( + (find) => find.ProdId === item.ProdId + )?.TotalAmt + } +
+ )} )} @@ -3462,7 +3468,7 @@ const StandardTable = () => { } }} > - {safeRound(item?.TotalAmt)} + {safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} )} @@ -3511,11 +3517,10 @@ const StandardTable = () => { tableDataTakeAway?.length + index } - className={`${ - BookingType === 'Dine In' && item?.SalesId - ? 'booking-billing-table-row-disabled' - : 'booking-billing-table-row' - } + className={`${BookingType === 'Dine In' && item?.SalesId + ? 'booking-billing-table-row-disabled' + : 'booking-billing-table-row' + } `} style={{ @@ -3526,45 +3531,45 @@ const StandardTable = () => { !BookingTypeBoth ? 'rgb(243, 248, 213)' : BookingType === 'Dine In' && - triggerAnimation && - OldtableDataTakeAway?.length + - OldtableDataDinein?.length + - tableDataTakeAway?.length + - index === - 0 && - !item?.SalesId && - tableDataDinein?.length >= PreviousdataLength + triggerAnimation && + OldtableDataTakeAway?.length + + OldtableDataDinein?.length + + tableDataTakeAway?.length + + index === + 0 && + !item?.SalesId && + tableDataDinein?.length >= PreviousdataLength ? 'wheat' : BookingType !== 'Dine In' && - triggerAnimation && - OldtableDataTakeAway?.length + - OldtableDataDinein?.length + - tableDataTakeAway?.length + - index === - 0 && - tableDataDinein?.length >= - PreviousdataLength && - !HoldOrderDtl && - !UnpaidData + triggerAnimation && + OldtableDataTakeAway?.length + + OldtableDataDinein?.length + + tableDataTakeAway?.length + + index === + 0 && + tableDataDinein?.length >= + PreviousdataLength && + !HoldOrderDtl && + !UnpaidData ? 'wheat' : 'inherit' : 'none', background: BookingType === 'Dine In' && - item?.SalesId && - !BookingTypeBoth + item?.SalesId && + !BookingTypeBoth ? 'rgb(243, 248, 213)' : GlobEstBooking === 'ParEst' && - GlobProdwisedata?.includes( - item?.InwardDtlId + ' ' + item?.BookingTypeName - ) + GlobProdwisedata?.includes( + item?.InwardDtlId + ' ' + item?.BookingTypeName + ) ? '#b2d1f7' : (OldtableDataTakeAway?.length + - OldtableDataDinein?.length + - tableDataTakeAway?.length + - index) % - 2 === - 0 + OldtableDataDinein?.length + + tableDataTakeAway?.length + + index) % + 2 === + 0 ? 'white' : SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.['OverallBackgroundColor'] @@ -3573,10 +3578,10 @@ const StandardTable = () => { BillOrderPre === 'Y' && !BookingTypeBoth ? triggerAnimation && OldtableDataTakeAway?.length + - OldtableDataDinein?.length + - tableDataTakeAway?.length + - index === - 0 && + OldtableDataDinein?.length + + tableDataTakeAway?.length + + index === + 0 && !item?.SalesId && tableDataDinein?.length >= PreviousdataLength && !HoldOrderDtl && @@ -3698,21 +3703,21 @@ const StandardTable = () => { {productBasedExtraCharges?.find( (find) => find.ProdId === item.ProdId ) !== undefined && ( -
- Extra Charges :{' '} - { - productBasedExtraCharges?.find( - (find) => find.ProdId === item.ProdId - )?.TotalAmt - } -
- )} +
+ Extra Charges :{' '} + { + productBasedExtraCharges?.find( + (find) => find.ProdId === item.ProdId + )?.TotalAmt + } +
+ )} )} @@ -3806,7 +3811,7 @@ const StandardTable = () => { } }} > - {safeRound(item?.TotalAmt)} + {safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} )} diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.scss b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.scss index d48be0c..fed10fe 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.scss +++ b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.scss @@ -47,7 +47,7 @@ height: 2rem; font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; - > th { + >th { font-size: 10px !important; font-weight: 400 !important; -webkit-text-stroke-width: 0.2px; @@ -1116,19 +1116,20 @@ @media (max-width: 500px) { padding: 5px 10px; } + .ShoppingCartMain-left { display: flex; align-items: center; gap: 1rem; white-space: nowrap; - > div { + >div { font-size: 1rem; font-weight: 500; font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; } - > p { + >p { background-color: #fff3; font-size: 10px; padding: 1px 6px; @@ -1153,11 +1154,9 @@ z-index: 10; @media (max-width: 768px) { - background-color: linear-gradient( - to bottom right, - #1e2536, - #2a3447 - ) !important; + background-color: linear-gradient(to bottom right, + #1e2536, + #2a3447) !important; background: linear-gradient(to bottom right, #1e2536, #2a3447) !important; display: flex !important; } @@ -1172,13 +1171,13 @@ gap: 1rem; white-space: nowrap; - > div { + >div { font-size: 1.125rem; font-weight: 500; font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; } - > p { + >p { background-color: #fff3; font-size: small; padding: 1px 6px; @@ -1194,11 +1193,11 @@ padding: 12px 16px; .ShoppingCartMain-left { - > div { + >div { font-size: 1rem; } - > p { + >p { font-size: 0.75rem; } } @@ -1209,11 +1208,11 @@ align-items: flex-start; .ShoppingCartMain-left { - > div { + >div { font-size: 0.875rem; } - > p { + >p { font-size: 0.7rem; } } @@ -1269,6 +1268,27 @@ } } +.standard-pay-btn-refund { + padding: 0.9rem 0.75rem; + font-size: 1.125rem; + font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; + border: none; + border-radius: 4px; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + // justify-content: space-around; + gap: 0.5rem; + opacity: 1; + background-color: #0d9488; + color: #fff; + + @media (max-width: 500px) { + padding: 0.75rem; + } +} + .standard-pay-btn { padding: 0.9rem 0.75rem; font-size: 1.125rem; @@ -1538,7 +1558,7 @@ .paybutton { padding: 10px 12px; - > svg { + >svg { display: none !important; } } @@ -1557,9 +1577,7 @@ display: flex !important; } - .booking-billing-table-container - .shoppingCartLeft - .payment-buttons-container { + .booking-billing-table-container .shoppingCartLeft .payment-buttons-container { display: flex !important; padding: 0 10px; align-items: flex-start; @@ -1596,7 +1614,7 @@ .standard-pay-btns { flex: 1; - > button { + >button { width: 100%; } } @@ -1650,4 +1668,4 @@ @media (max-width: 768px) { display: flex; } -} +} \ No newline at end of file diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx index 86e1761..40c81a2 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx @@ -12,6 +12,7 @@ import Credit from '../../UtillComponents/Pozo retail icons/credit.svg'; import { FaCreditCard } from 'react-icons/fa6'; import { changeAddBookingDetailsTrigger, + changeBillEditingMode, changeBookingType, ChangeComboCarddata, changeCurrentOrderId, @@ -25,6 +26,8 @@ import { ChangeOverAllDiscSales, changePaymentloader, changePaymentTransactionNumber, + changePreviousOrderOfferDetail, + changePreviousOrderPayment, changeReorderHoldDetails, changeReorderProductDetails, changeSelectChair, @@ -50,6 +53,7 @@ import { getCurrentOrderid, getLayoutproductCard, GetPaymentdeviceResponse, + getPaymentOptions, getSalesDetailData, getSelectedFavItems, getUnpaidData, @@ -72,11 +76,15 @@ import { GlobalOverAllDiscEstimate, GlobalOverAllDiscSales, GlobalPayementloader, + GlobalpaymentOptionData, GlobalPaymentTrigger, + GlobalPreviousOrderOfferDetails, + GlobalPreviousOrderPayment, GlobalProductCategorie, GlobalProductSubCategorie, GlobalReorderHoldDetails, GlobalRetailWSSalesType, + GlobalSalesBillEdit, GlobalSelCustId, GlobalSelectedTableDetails, GlobalSelOption, @@ -93,6 +101,7 @@ import { PutBookingData, PutBookingPaymentStatusChange, PutPendingPaymentList, + putSalesBillEdit, putSplitpaymentStatus, SendPaymentLink, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; @@ -267,6 +276,10 @@ const StandardTablePayment = () => { const GlobProdwisedata = useSelector(GlobalSelProdWiseEst); const GlobEstBooking = useSelector(GlobalEstimateBooking); const OtherServicesglobal = useSelector(GlobalOtherSevices); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const OrderType = useSelector(GlobalOrderType); const unpaidFlow = useSelector(Globalunpaidflow); const selOption = useSelector(GlobalSelOption); @@ -354,6 +367,11 @@ const StandardTablePayment = () => { const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]); const [ConfigDataList, setConfigDataList] = useState([]); const [TotalAmount, setTotalAmount] = useState(0); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const [FirstPaymentclick, setFirstPaymentclick] = useState(false); const [UpinotSelected, setUpinotSelected] = useState(false); const [brachName, setbrachName] = useState(''); @@ -486,6 +504,12 @@ const StandardTablePayment = () => { ); }, [GlobalExtraCharge]); + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + const customerNameOrMobile = MobileNoWhatsApp?.CustName?.trim() ? `Dear ${MobileNoWhatsApp?.CustName}` : `Dear ${MobileNoWhatsApp?.value}`; @@ -706,7 +730,6 @@ const StandardTablePayment = () => { CheckBookingStatus, addnewAccess, preferenceshortcutkey, - unpaidFlow, ]); @@ -809,7 +832,13 @@ const StandardTablePayment = () => { }, [paybtnselected, selOption, payBtns]); useEffect(() => { - orderCardDetail?.length == 0 ? dispatch(changeunpaidflow(false)) : ''; + if (orderCardDetail?.length == 0) { + dispatch(changeunpaidflow(false)); + // dispatch(changePreviousOrderPayment([])); + // dispatch(changePreviousOrderOfferDetail([])); + // dispatch(changeBillEditingMode(false)); + } + if (!preOrder) { const totalSum = orderCardDetail?.reduce( (acc, card) => acc + parseFloat(card.OrderRate * card.OrderQty || 0), @@ -866,29 +895,45 @@ const StandardTablePayment = () => { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( - formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - ); + const currentOrderNetAmount = formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) + console.log(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount, "totalPreviouspayment") - dispatch( - changeSummeryTotalAmount( - formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); // dispatch( // changeSummeryTotalAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) // ); @@ -1016,6 +1061,25 @@ const StandardTablePayment = () => { } }, [PaymentUpiOptions, PaymentOptions, SelCustId]); + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) + useEffect(() => { if ( (BookingType === 'Dine In' || @@ -1112,6 +1176,10 @@ const StandardTablePayment = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1490,7 +1558,7 @@ const StandardTablePayment = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -1504,14 +1572,14 @@ const StandardTablePayment = () => { : paybtnselected ? paybtnselected : null, - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -1525,7 +1593,7 @@ const StandardTablePayment = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -1533,7 +1601,7 @@ const StandardTablePayment = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -1550,7 +1618,7 @@ const StandardTablePayment = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -1559,8 +1627,8 @@ const StandardTablePayment = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -1793,7 +1861,12 @@ const StandardTablePayment = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -1845,6 +1918,7 @@ const StandardTablePayment = () => { if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); } + ClearAllGlobalStateDatas(); console.log('more pg data'); } @@ -1858,6 +1932,7 @@ const StandardTablePayment = () => { await dispatch(changeOrderCardDetails([])); await dispatch(changeReorderHoldDetails({})); await dispatch(changeReorderProductDetails([])); + setFirstPaymentclick(false); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -1959,6 +2034,10 @@ const StandardTablePayment = () => { } }; + const handleSalesBillEdit = async (putdatas, value, pay) => { + console.log(putdatas, value, pay, "handleSalesBillEdit") + } + const OtherServicePostBooking = async (PostData, value) => { console.log(PostData, value, 'PostData, value'); @@ -2703,6 +2782,11 @@ const StandardTablePayment = () => { } }; + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -2733,6 +2817,9 @@ const StandardTablePayment = () => { ParkingClaimed: false, }) ); + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeFullOfferAppliedProducts([])); dispatch(ChangeFullFreeProductList([])); @@ -2752,6 +2839,8 @@ const StandardTablePayment = () => { setQrCode(false); setUpinotSelected(false); getHolddata(); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); } @@ -2893,7 +2982,7 @@ const StandardTablePayment = () => { async (orderDetail, index) => { await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print if (orderDetail?.BookingTypeName !== 'Dine In') { - const groupedTokens = orderDetail?.productDetails?.reduce( + const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -2938,7 +3027,7 @@ const StandardTablePayment = () => { await Promise.all( PrintOrderDetails?.[0]?.OrderDetails?.map( async (orderDetail, index) => { - const groupedTokens = orderDetail?.productDetails?.reduce( + const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -2974,7 +3063,7 @@ const StandardTablePayment = () => { ); } else { await Promise.all( - PrintOrderDetails?.[0]?.OrderDetails?.map( + PrintOrderDetails?.[0]?.OrderDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.map( async (orderDetail, index) => { await TokenPrint(`${index}-${orderDetail?.OrderId}`); } @@ -3188,7 +3277,7 @@ const StandardTablePayment = () => { }; const SplitPaymentOpen = () => { - if (orderCardDetail?.length > 0) { + if (orderCardDetail?.length > 0 && TotalAmount > 0) { // const updatedData = { // userData: OrderCardDetail, // ExtraCharges: GlobalExtraCharge, @@ -3198,6 +3287,11 @@ const StandardTablePayment = () => { // setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3610,7 +3704,7 @@ const StandardTablePayment = () => { opacity: isDisabled ? 0.5 : 1, }} > - {payBtns?.length > 0 ? ( + {payBtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( payBtns.map((payment) => { const mode = payment?.ModeName?.toLowerCase(); const isSelected = paybtnselected === payment?.ModeId; @@ -3700,6 +3794,55 @@ const StandardTablePayment = () => {
); }) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => { + const mode = payment?.ConfigName?.toLowerCase(); + const isSelected = refundPaySelected === payment?.ConfigId; + const buttonClass = isSelected + ? 'paybutton-selected' + : 'paybutton'; + + return ( +
+ +
+ ); + }) ) : (
{ orderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus !== 'Close' - ? !OrderStatus - ? 'standard-pay-btn' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'standard-pay-btn-refund' + : 'standard-pay-btn' : 'standard-pay-btn order-complete' : 'standard-pay-btn-disabled' } onClick={handleButtonClick} > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?

Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}

: ( <>

{ const dispatch = useDispatch(); const navigate = useNavigate(); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const SessionData = useSelector(StoredSessionData); const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus); const globalTipAmount = useSelector(GlobaltipAmount); @@ -321,6 +339,11 @@ const BSC1Payment = (props) => { const [UpiOption, setUpiOption] = useState(''); const [UpiId, setUpiId] = useState(); const [hold, setHold] = useState(false); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const appPreferences = useSelector(ApplicationPreferences); const commonModulePreference = appPreferences?.find( (preference) => preference?.PreferredCatName === 'Common Module' @@ -429,6 +452,14 @@ const BSC1Payment = (props) => { const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]); const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]); const [UpiPayOption, setUpiPayOption] = useState([]); + const [BusinessPayOption, setBusinessPayoption] = useState([]); + const [paymentSucess, setPaymentSuccess] = useState(false); + const [businessUPI, setBusinessUPI] = useState(false); + const [businessUPIOrderId, setBusinessUPIOrderId] = useState(null); + const [businessUPILink, setBusinessUPILink] = useState(null); + const defaultPaymentTrigger = useSelector(GlobalPaymentTrigger); + const [defaultPaymentMode, setDefaultPaymentMode] = useState([]); + const [defaultEnabled, setDefaultEnabled] = useState(false); const [CardPayOption, setCardPayOption] = useState([]); const [PaymentUpiOptions, setPaymentUpiOptions] = useState([]); const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions); @@ -461,6 +492,7 @@ const BSC1Payment = (props) => { const printDatas = useSelector(GlobalprintDatas); const PrinterDetails = useSelector(GlobalPrinterMappingDtls); const [addnewAccess, setaddnewAccess] = useState(true); + const [showCancelConfirm, setShowCancelConfirm] = useState(false); const BookingStatus = useSelector(GlobalBookingStatus); const PaymentOptionsModeName = @@ -529,6 +561,79 @@ const BSC1Payment = (props) => { '11111111111111' ); // Usage + useEffect(() => { + const setDefaultPaymentOption = async () => { + const res = await dispatch( + getDefaultPaymentOptions({ AppId, CompId, BranchId }) + )?.unwrap(); + const defaultDetail = res?.data?.data?.[0]?.DefaultDetails?.[0]; + if (res?.data?.data?.length > 0 && defaultDetail) { + setDefaultEnabled(true); + setDefaultPaymentMode(defaultDetail); + const { option, card } = defaultDetail; + if (option?.value) setSelectedUPIPayOption(option.value); + if (card) { + const isDefault = + String(option?.value ?? '').toLowerCase() === 'default'; + const idToUse = isDefault ? card?.UPIId : card?.ModeId; + + if (idToUse) { + addUpiOption(card?.Mode, card?.ModeName, idToUse); + } + } + } else { + setDefaultEnabled(false); + setDefaultPaymentMode([]); + } + }; + setDefaultPaymentOption(); + }, [defaultPaymentTrigger]); + + useEffect(() => { + const getPrintData = async () => { + try { + const data = { + AppId, + CompId, + BranchId, + OrderId: businessUPIOrderId, + }; + + const res = await dispatch(ReprintDetails(data)).unwrap(); + + if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) { + const orderData = [{ OrderDetails: res.data.data }]; + + // Reset states first + setBusinessUPIOrderId(null); + setBusinessUPI(false); + setPaymentSuccess(false); + + // Then set new data and trigger side effects + setPrintOrderDetails(orderData); + CustomerDisplay(); + ClearAllGlobalStateDatas(); + filteredSettingNames?.includes('whatsapp') && + MobileNoWhatsApp?.value && + handleURL(orderData); + } + } catch (error) { + console.error('Failed to fetch print data:', error); + // Reset states even on error + setBusinessUPI(false); + setPaymentSuccess(false); + } + }; + + if (paymentSucess && businessUPIOrderId) { + const timer = setTimeout(() => { + getPrintData(); + }, 3000); + + return () => clearTimeout(timer); + } + }, [paymentSucess, businessUPIOrderId, AppId, CompId, BranchId, dispatch]); + useEffect(() => { const fetchCreditCustomer = async () => { const selectedMode = paybtns?.find( @@ -567,6 +672,32 @@ const BSC1Payment = (props) => { fetchCreditCustomer(); }, [paybtnselected, selOption, paybtns]); + + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) + useEffect(() => { if (!preOrder) { const totalSum = OrderCardDetail?.reduce( @@ -624,22 +755,41 @@ const BSC1Payment = (props) => { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - - setTotalAmount( + const currentOrderNetAmount = formatAmount( withdiscTotal >= 0 ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ); + ) - dispatch( - changeSummeryTotalAmount( - withdiscTotal > 0 ? withdiscTotal : Number(Total) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -1080,6 +1230,10 @@ const BSC1Payment = (props) => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default') { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1155,6 +1309,9 @@ const BSC1Payment = (props) => { const filterpaymentdevice = FiltersalesPayment?.[0]?.OptionDetails?.filter( (item) => item?.OptionName?.toLowerCase() === 'payment device' ); + const filterBusinessUpi = FiltersalesPayment?.[0]?.OptionDetails?.filter( + (item) => item?.OptionName?.toLowerCase() === 'business upi' + ); const cardinpaymentgateway = filterpaymentgateway?.[0]?.ModeDetails?.filter((item) => item?.ModeName?.toLowerCase()?.includes('card') @@ -1197,7 +1354,6 @@ const BSC1Payment = (props) => { } setCardPayOption(cardoptions); const options = []; - if (FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter?.length > 0) { options.push({ label: 'Personal UPI', @@ -1205,6 +1361,16 @@ const BSC1Payment = (props) => { imgSrc: defaultupi, }); } + if (filterBusinessUpi?.[0]?.ModeDetails?.length > 0) { + options.push({ + label: 'Business UPI', + value: 'Business', + imgSrc: pozologoimg, + PaymentOptionId: filterBusinessUpi?.[0]?.PaymentOptionId, + PaymentFlowId: filterBusinessUpi?.[0]?.PaymentFlowId, + OptionId: filterBusinessUpi?.[0]?.OptionId, + }); + } if (upiinpaymentgateway?.length > 0) { options.push({ label: 'Payment Gateway', value: 'PG', imgSrc: paygate }); @@ -1214,6 +1380,7 @@ const BSC1Payment = (props) => { options.push({ label: 'Payment Device', value: 'PD', imgSrc: paydevice }); } setUpiPayOption(options); + setBusinessPayoption(filterBusinessUpi?.[0]?.ModeDetails || []); // } }; @@ -1252,12 +1419,17 @@ const BSC1Payment = (props) => { } }; + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const AddCardOption = (data) => { setSelectedCardOption(data); setCardOptionOpen(false); setCardoptionnotSelected(false); }; - const AddUPIPaymentOption = async (data) => { + const AddUPIPaymentOption = async (data, mode = false) => { setSelectedUpiOption(''); setUpiOption(''); setUpiId(''); @@ -1267,7 +1439,7 @@ const BSC1Payment = (props) => { setSelectedUPIPayOption(data); setUpinotSelected(false); setCardoptionnotSelected(false); - if (data !== 'Default') { + if (data !== 'Default' && data !== 'Business' && !mode) { setUpiOptionOpen(false); } }; @@ -1647,6 +1819,18 @@ const BSC1Payment = (props) => { } }; + const businessUPIFlow = async ( + businessUPIfilter, + OrderId, + PaymentStatusLink + ) => { + // Implement your business UPI flow here + // You can add similar logic as PaymentDeviceFlow or PaymentGatewayFlow based on your requirements + setBusinessUPILink(PaymentStatusLink); + setBusinessUPI(true); + setBusinessUPIOrderId(OrderId); + }; + function safeRound(amountStr) { if (amountStr == null) return '0.00'; @@ -1794,6 +1978,9 @@ const BSC1Payment = (props) => { } else { dispatch(changeOrderCardDetails([])); } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); await dispatch(ChangeTotalAmount([])); await dispatch(changeReorderHoldDetails({})); @@ -1807,6 +1994,8 @@ const BSC1Payment = (props) => { setPaybtnselected(PaymentOptionsModeId); setQrCode(false); setUpinotSelected(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); getHolddata(); getUnpaiddatas(); await dispatch(changeBookingType('TakeAway')); @@ -1843,7 +2032,8 @@ const BSC1Payment = (props) => { ); if ( OnUpiSelected?.ModeName?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + (SelectedUPIPayOption?.toLowerCase() === 'default' || + SelectedUPIPayOption?.toLowerCase() === 'business') ) { SetSuccess(false); setTimeout(function () { @@ -2096,19 +2286,28 @@ const BSC1Payment = (props) => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId : SelectedUPIPayOption?.toLowerCase() === 'pg' ? PaymentgatewayUPI?.[0]?.ModeId - : paybtnselected + : SelectedUPIPayOption?.toLowerCase() === 'business' + ? BusinessPayOption?.find( + (busupi) => busupi?.ModeId === UpiId + )?.ModeId + : paybtnselected : paybtnselected ? paybtnselected : null, - // SelectedUPIPayOption?.toLowerCase() === "pg" ? - Amount: Math.round(TotalAmount), - PaymentOptionType: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + Paybtnnameselected?.toLowerCase() === 'upi' && + SelectedUPIPayOption?.toLowerCase() === 'business' + ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) + ?.MerchantId + : null, + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2118,14 +2317,19 @@ const BSC1Payment = (props) => { : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'default' ? 'PC' - : SelectedUPIPayOption + : SelectedUPIPayOption?.toLowerCase() === 'business' + ? 'BU' + : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId - : null, - AccountDtl: + : SelectedUPIPayOption?.toLowerCase() === 'business' + ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) + ?.MerchantUPIId + : null, + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2142,7 +2346,7 @@ const BSC1Payment = (props) => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2151,8 +2355,8 @@ const BSC1Payment = (props) => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2206,6 +2410,11 @@ const BSC1Payment = (props) => { let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter( (item) => item?.PaymentOptionType?.toLowerCase() === 'pc' ); + let businessUPIfilter = response?.data?.PaymentOrderDtl?.filter( + (item) => + item?.PaymentOptionType?.toLowerCase() === 'bu' && + item?.PaymentStatus === 'P' + ); if ( PayatCounterfilter?.length === 1 || response?.data?.PaymentOrderDtl?.length === 0 @@ -2310,6 +2519,13 @@ const BSC1Payment = (props) => { } else { console.log('more pg data'); } + if (businessUPIfilter?.length === 1) { + businessUPIFlow( + businessUPIfilter, + response?.data?.OrderId, + response?.data?.PaymentPageLink + ); + } dispatch(triggerCustomerRefresh()); } else { setMessageType('error'); @@ -2341,10 +2557,16 @@ const BSC1Payment = (props) => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter( (item) => item?.PaymentOptionType?.toLowerCase() === 'pc' ); + if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -2358,8 +2580,7 @@ const BSC1Payment = (props) => { item?.PaymentStatus === 'P' ); - if ( - PayatCounterfilter?.length === 1 || + if (PayatCounterfilter?.length === 1 || response?.data?.PaymentOrderDtl?.length === 0 ) { setMessageType('success'); @@ -2391,6 +2612,8 @@ const BSC1Payment = (props) => { if (PaymentGatewayfilter?.length === 1) { await PaymentGatewayFlow(PaymentGatewayfilter); } else { + setPrintOrderDetails([response?.data]); + ClearAllGlobalStateDatas(); console.log('more pg data'); } } else { @@ -3084,7 +3307,7 @@ const BSC1Payment = (props) => { }; // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3094,6 +3317,11 @@ const BSC1Payment = (props) => { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3631,7 +3859,7 @@ const BSC1Payment = (props) => { : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (

)) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
+ +
+ )) ) : (
{ OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus - ? 'BSC1Payment-div4-button' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'BSC1Payment-div4-button' + : 'BSC1Payment-div4-button' : 'BSC1Payment-div4-button Order' : 'BSC1Payment-div4-button-disable' } @@ -4242,7 +4510,7 @@ const BSC1Payment = (props) => { onClick={handleButtonClick} style={{ borderRadius: '6px 0 0 6px' }} > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
: ( <> {isMobile ? ( `₹ ${safeRound( @@ -4491,7 +4759,10 @@ const BSC1Payment = (props) => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> @@ -4569,6 +4840,43 @@ const BSC1Payment = (props) => {
} /> + setShowCancelConfirm(true)} + footer={false} + width={500} + children={ + <> + + + } + /> + {showCancelConfirm && ( + { + setBusinessUPI(false); + setShowCancelConfirm(false); + ClearAllGlobalStateDatas(); + CustomerDisplay(); + }} + onCancel={() => setShowCancelConfirm(false)} + okText="Yes" + cancelText="No" + > + Do you want to cancel the payment? + + )} ); }; diff --git a/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx b/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx index 3172ee0..541cc13 100644 --- a/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx +++ b/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx @@ -2432,7 +2432,9 @@ const BSItemCard = (props) => { const isItemInCartHold = CartOrderDetails?.find( (cartItem) => itemMatchCondition(cartItem) && - (cartItem?.OfferMode !== 'B' && + ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' + ? true + : cartItem?.OfferMode !== 'B') && cartItem?.OfferMode !== 'P' && cartItem?.OfferMode !== 'C' && cartItem?.OfferMode !== 'O' && cartItem?.OfferMode !== 'L' @@ -2461,7 +2463,9 @@ const BSItemCard = (props) => { (cartItem) => !( itemMatchCondition(cartItem) && - (cartItem?.OfferMode !== 'B' && + ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' + ? true + : cartItem?.OfferMode !== 'B') && cartItem?.OfferMode !== 'P' && cartItem?.OfferMode !== 'C' && cartItem?.OfferMode !== 'O' && cartItem?.OfferMode !== 'L' @@ -2865,7 +2869,6 @@ const BSItemCard = (props) => { OfferId: offer?.OfferId || '', OfferAmount: change?.discount || 0, OfferType: offer?.OfferType || '', // I / Q / B - OfferCode: PromoCodeOffersDatas?.OfferCode, ActualOfferAmount: offer?.OfferAmt || 0, OfferValue: offer?.OfferAmt || 0, TableName: change?.TableName || '', @@ -2873,7 +2876,7 @@ const BSItemCard = (props) => { TableUniqueId: change?.TableUniqueId || '', // OfferType: offer?.ValueType || "", // F / P Detail: offer?.Detail || [], - OfferCode: offer?.OfferCode || '', + OfferCode: offer?.OfferCode || PromoCodeOffersDatas?.OfferCode || '', CustId: offer?.CustId || '', UsedCount: offer?.UsedCount || 0, AppliesTo: offer?.AppliesTo || '', diff --git a/src/Pages/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.jsx b/src/Pages/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.jsx index a9c0d18..ce5e6ca 100644 --- a/src/Pages/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.jsx +++ b/src/Pages/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.jsx @@ -126,7 +126,7 @@ import { MdHome, MdLocationOn } from 'react-icons/md'; import { RadioGrpButton } from '../../../../Components/Forms/RadioGroup.jsx'; const FeaturesFunctionalities = (props) => { - const { closeModal = () => {} } = props; + const { closeModal = () => { } } = props; const applyOffer = useApplyOfferto_CardDetail(); const EditableContext = React.createContext(null); const EditableContext1 = React.createContext(null); @@ -367,30 +367,30 @@ const FeaturesFunctionalities = (props) => { const options = suggestions ? suggestions - ?.filter((item) => - selectedSearchValue === 'CustName' ? item.CustName !== null : item - ) - .map((item) => ({ - value: item?.CustMobile, - label: - selectedSearchValue === 'CustMobile' - ? `${item?.CustMobile} - ${item?.CustName ? item?.CustName : ''} ${item?.CustName ? ' - ' : ''} ${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}` - : selectedSearchValue === 'CustId' - ? `${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}${item?.CustName ? ' - ' : ''} ${item?.CustName ? item?.CustName : ''} - ${item?.CustMobile}` - : selectedSearchValue === 'CustName' && - item?.CustName !== null && - `${item?.CustName ? item?.CustName : ''} ${item?.CustName ? ' - ' : ''} ${item?.CustMobile} - ${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}`, - CustMobile: item?.CustMobile, - CustId: item?.CustId?.match(/-(\d+)$/)?.[1], - CustName: item?.CustName, - })) - : GlobalAddCustomerDetails1?.map((item) => ({ - value: item.CustMobile, - label: `${item?.CustName} ${item?.CustMobile}`, + ?.filter((item) => + selectedSearchValue === 'CustName' ? item.CustName !== null : item + ) + .map((item) => ({ + value: item?.CustMobile, + label: + selectedSearchValue === 'CustMobile' + ? `${item?.CustMobile} - ${item?.CustName ? item?.CustName : ''} ${item?.CustName ? ' - ' : ''} ${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}` + : selectedSearchValue === 'CustId' + ? `${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}${item?.CustName ? ' - ' : ''} ${item?.CustName ? item?.CustName : ''} - ${item?.CustMobile}` + : selectedSearchValue === 'CustName' && + item?.CustName !== null && + `${item?.CustName ? item?.CustName : ''} ${item?.CustName ? ' - ' : ''} ${item?.CustMobile} - ${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}`, CustMobile: item?.CustMobile, - CustId: item?.CustId, + CustId: item?.CustId?.match(/-(\d+)$/)?.[1], CustName: item?.CustName, - })); + })) + : GlobalAddCustomerDetails1?.map((item) => ({ + value: item.CustMobile, + label: `${item?.CustName} ${item?.CustMobile}`, + CustMobile: item?.CustMobile, + CustId: item?.CustId, + CustName: item?.CustName, + })); const handleYesOrNoChange = (value) => { setSelectedValue(value); formRef.current?.setFieldsValue({ OfferActiveStatus: value }); @@ -453,34 +453,34 @@ const FeaturesFunctionalities = (props) => { }, ...(sportsAppPreference ? [ - { - title: 'Subcategory', - key: 'productDetails', - dataIndex: 'productDetails', - align: 'center', - width: '150px', - onCell: (record) => { - const productDetails = record?.productDetails; - const Combodtl = - record?.productDetails?.[0]?.comboDtl?.[0] - ?.ComboInwardDetails?.[0]?.ComboDetails; + { + title: 'Subcategory', + key: 'productDetails', + dataIndex: 'productDetails', + align: 'center', + width: '150px', + onCell: (record) => { + const productDetails = record?.productDetails; + const Combodtl = + record?.productDetails?.[0]?.comboDtl?.[0] + ?.ComboInwardDetails?.[0]?.ComboDetails; - return { - onClick: () => { - HoldPutfun(productDetails, record, Combodtl); - }, - }; - }, - render: (productDetails, record) => ( - HoldPutfun(productDetails, record)} - > - {record?.productDetails?.[0]?.ProdSubCatName} - - ), + return { + onClick: () => { + HoldPutfun(productDetails, record, Combodtl); + }, + }; }, - ] + render: (productDetails, record) => ( + HoldPutfun(productDetails, record)} + > + {record?.productDetails?.[0]?.ProdSubCatName} + + ), + }, + ] : []), { title: 'Orders', @@ -758,7 +758,7 @@ const FeaturesFunctionalities = (props) => { TaxAmt: formatAmount( ((record.Price * record.TaxPercentage) / (100 + record.TaxPercentage)) * - record.QTY + record.QTY ), TaxId: record.TaxId, TaxPercentage: record.TaxPercentage, @@ -785,11 +785,11 @@ const FeaturesFunctionalities = (props) => { const isDuplicate = TableName?.some( (item) => item.InwardDtlId + - ' ' + - item.BookingTypeName + - ' ' + - item.SinglePc === - selectedProduct && item.UniqueId === record.UniqueId + ' ' + + item.BookingTypeName + + ' ' + + item.SinglePc === + selectedProduct && item.UniqueId === record.UniqueId ); if (!isDuplicate) { @@ -807,7 +807,7 @@ const FeaturesFunctionalities = (props) => { TaxAmt: formatAmount( ((record.Price * record.TaxPercentage) / (100 + record.TaxPercentage)) * - record.QTY + record.QTY ), TaxId: record?.TaxId, TaxPercentage: record.TaxPercentage, @@ -1054,7 +1054,7 @@ const FeaturesFunctionalities = (props) => { ...record, ...values, }); - } catch (errInfo) {} + } catch (errInfo) { } }; let childNode = children; @@ -1106,7 +1106,7 @@ const FeaturesFunctionalities = (props) => { return ( record.Price * record.QTY - ((record.Price * record.TaxPercentage) / (100 + record.TaxPercentage)) * - record.QTY + record.QTY ); }; const WithTaxAmountTaxAmount = (record) => { @@ -1179,10 +1179,10 @@ const FeaturesFunctionalities = (props) => { onClick={() => addeddata(record)} disabled={ Object.keys(ReorderHoldDetails).length !== 0 && - BookingType === 'Dine In' && - GlobalExtraCharge.some( - (item) => item.ExtraChargeId === record.UniqueId - ) + BookingType === 'Dine In' && + GlobalExtraCharge.some( + (item) => item.ExtraChargeId === record.UniqueId + ) ? true : false } @@ -1278,7 +1278,7 @@ const FeaturesFunctionalities = (props) => { QTY: parseInt(row.QTY), TaxAmt: formatAmount( ((row.Price * row.TaxPercentage) / (100 + row.TaxPercentage)) * - row.QTY + row.QTY ), TotalAmt: row.Price * row.QTY, // ((row.Price * row.TaxPercentage) / (100 + row.TaxPercentage) *row.QTY ).toFixed(2), @@ -1427,12 +1427,12 @@ const FeaturesFunctionalities = (props) => { {Object.keys(ReorderHoldDetails).length !== 0 && - BookingType === 'Dine In' && - GlobalExtraCharge?.some( - (item) => - item.ExtraChargeId === record.UniqueId && - item.InwardDtlId === record.InwardDtlId - ) ? ( + BookingType === 'Dine In' && + GlobalExtraCharge?.some( + (item) => + item.ExtraChargeId === record.UniqueId && + item.InwardDtlId === record.InwardDtlId + ) ? ( { dispatch( changeCustomerID( response?.data?.CustomerDetails?.[ - response?.data?.CustomerDetails.length - 1 + response?.data?.CustomerDetails.length - 1 ] ) ); @@ -2186,9 +2186,9 @@ const FeaturesFunctionalities = (props) => { AppId: AppId, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; await dispatch(getSelectedFavItems(data)).unwrap(); @@ -2200,9 +2200,9 @@ const FeaturesFunctionalities = (props) => { ProdSubCat: ProdSubCat, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; @@ -2213,9 +2213,9 @@ const FeaturesFunctionalities = (props) => { prodCat: prodCat, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; @@ -2588,7 +2588,7 @@ const FeaturesFunctionalities = (props) => { e?.stopPropagation(); removeAll(); }} - // onClick={() => statusFormatter(record,index)} + // onClick={() => statusFormatter(record,index)} > Clear All @@ -2715,7 +2715,7 @@ const FeaturesFunctionalities = (props) => { : selectedSearchValue == 'CustName' ? 'Please Enter Valid Name' : selectedSearchValue == 'CustId' && - 'Please EnterCustomer Id', + 'Please EnterCustomer Id', }, ]} > @@ -2804,7 +2804,7 @@ const FeaturesFunctionalities = (props) => { : selectedSearchValue == 'CustName' ? 'Enter Name' : selectedSearchValue == 'CustId' && - 'Enter Customer Id' + 'Enter Customer Id' : ' Mobile Number'} } @@ -2986,7 +2986,7 @@ const FeaturesFunctionalities = (props) => { autocomplete="off" isOnChange={ formRef.current?.getFieldsValue()?.CustName || - inputValue + inputValue ? true : false } @@ -3052,9 +3052,9 @@ const FeaturesFunctionalities = (props) => {

Upload Profile

- // formType === 'edit' ? editstate?.EmpPhotoLink : e - // } + // getValueFromEvent={(e) => + // formType === 'edit' ? editstate?.EmpPhotoLink : e + // } > {
-
-
- - handleAddressTypeChange( - idx, - 'Delivery Address', - e.target.checked - ) - } +
+
- Delivery Address - - - handleAddressTypeChange( - idx, - 'Billing Address', - e.target.checked - ) - } - > - Billing Address - - - handleAddressTypeChange( - idx, - 'Both Address', - e.target.checked - ) - } - > - Both Address - -
-
- -
-
-
- {addr?.Address1 || ''} + + handleAddressTypeChange( + idx, + 'Delivery Address', + e.target.checked + ) + } + > + Delivery Address + + + handleAddressTypeChange( + idx, + 'Billing Address', + e.target.checked + ) + } + > + Billing Address + + + handleAddressTypeChange( + idx, + 'Both Address', + e.target.checked + ) + } + > + Both Address +
-
-
- {addr?.Address2 || ''} -
-
- -
-
- {addr?.Zip || ''} -
-
- -
-
- {addr?.City || ''} -
-
- -
-
- {addr?.Dist || ''} -
-
- -
-
- {addr?.State || ''} -
-
- - {addr?.Latitude && ( -
-
- {' '} - {addr?.Latitude || ''},{' '} - {addr?.Longitude || ''} +
+
+
+ {addr?.Address1 || ''}
- )} -
-
- - handleRemoveAddress(idx)} - okText="Yes, Remove" - cancelText="Cancel" - okType="danger" - > +
+
+ {addr?.Address2 || ''} +
+
+ +
+
+ {addr?.Zip || ''} +
+
+ +
+
+ {addr?.City || ''} +
+
+ +
+
+ {addr?.Dist || ''} +
+
+ +
+
+ {addr?.State || ''} +
+
+ + {addr?.Latitude && ( +
+
+ {' '} + {addr?.Latitude || ''},{' '} + {addr?.Longitude || ''} +
+
+ )} +
+
- + + handleRemoveAddress(idx)} + okText="Yes, Remove" + cancelText="Cancel" + okType="danger" + > + + +
-
- )) + )) ) : (
@@ -3484,7 +3484,7 @@ const FeaturesFunctionalities = (props) => { { style={ offerType == 'P' ? { - opacity: '1', - boxShadow: - 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', - margin: '3px', - padding: '5px', - backgroundColor: '#fff', - } + opacity: '1', + boxShadow: + 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', + margin: '3px', + padding: '5px', + backgroundColor: '#fff', + } : { opacity: '0.6', boxShadow: 'none' } } onClick={() => { @@ -3549,13 +3549,13 @@ const FeaturesFunctionalities = (props) => { style={ offerType == 'F' ? { - opacity: '1', - boxShadow: - 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', - margin: '3px', - padding: '5px', - backgroundColor: '#fff', - } + opacity: '1', + boxShadow: + 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', + margin: '3px', + padding: '5px', + backgroundColor: '#fff', + } : { opacity: '0.6', boxShadow: 'none' } } onClick={() => { @@ -3652,7 +3652,7 @@ const FeaturesFunctionalities = (props) => { } isOnChange={ formRef.current?.getFieldsValue()?.CustEmail || - inputValue + inputValue ? true : false } @@ -3680,7 +3680,7 @@ const FeaturesFunctionalities = (props) => { autocomplete="off" isOnChange={ formRef.current?.getFieldsValue()?.CreditLimit || - inputValue + inputValue ? true : false } @@ -4027,7 +4027,7 @@ const FeaturesFunctionalities = (props) => { buttonText="SAVE" color="901D77" icon={} - // handleSubmit={() => { globalamount1() }} + // handleSubmit={() => { globalamount1() }} />
@@ -4041,7 +4041,7 @@ const FeaturesFunctionalities = (props) => { bordered dataSource={TableName} width={'120px'} - //pagination={column2?.length < "11" ? false : true} + //pagination={column2?.length < "11" ? false : true} >
)} diff --git a/src/Pages/BookingScreen/Components/BookingFunctionality/SplitPayment.jsx b/src/Pages/BookingScreen/Components/BookingFunctionality/SplitPayment.jsx index b1610d0..a99cd9a 100644 --- a/src/Pages/BookingScreen/Components/BookingFunctionality/SplitPayment.jsx +++ b/src/Pages/BookingScreen/Components/BookingFunctionality/SplitPayment.jsx @@ -51,7 +51,14 @@ import { GlobalOverAllDiscSales, GlobalOverAllDiscEstimate, GlobaltipAmount, - GlobalRetailWSSalesType + GlobalRetailWSSalesType, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalSalesBillEdit, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail } from '../../../../Features/BookingScreen/BookingData/BookingData'; import { Form, Radio } from 'antd'; import { @@ -98,6 +105,7 @@ import { gettinghold } from '../../../../Features/BookingScreen/HoldOption/HoldO import { Global_OrderOfferDetail } from '../../../../Features/Offer/Offer.js'; import { useApplyOfferto_CardDetail } from '../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js'; +import { ChangeFullFreeProductList, changeFullOfferAppliedProducts, GlobalOfferAppliedProducts } from '../../../../Features/Offer/Offernew/BookingOffernew.js'; const subDirectory = import.meta.env.BASE_URL; const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL; @@ -114,7 +122,7 @@ const SplitPayment = (props) => { const applyOffer = useApplyOfferto_CardDetail(); const globalTipAmount = useSelector(GlobaltipAmount); - const TotalAmount = (props.hasOwnProperty('TotalNetAmount') + const TotalNetAmount = (props.hasOwnProperty('TotalNetAmount') ? props['TotalNetAmount'] : null); const TableOrderId = props.hasOwnProperty('TableBookingOrderId') @@ -128,7 +136,23 @@ const SplitPayment = (props) => { : null; const OrderCardDetail = useSelector(GlobalOrderCardDetails); const SelCustId = useSelector(GlobalSelCustId); - + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); const [paybtns, setpaybtns] = useState([]); const [PaymentOptions, setPaymentOptions] = useState([]); const [PaymentUpiOptions, setPaymentUpiOptions] = useState([]); @@ -140,6 +164,9 @@ const SplitPayment = (props) => { const [SplitSelPayMode, setSplitSelPayMode] = useState({}); const [TotalSplitAmount, setTotalSplitAmount] = useState(0); const [SalesOrderId, setSalesOrderId] = useState(); + const [beforeAdjAmount, setBeforeAdjAmount] = useState(null); + const [afterAdjAmount, setAfterAdjAmount] = useState(null); + const [adjustmentType, setAdjustmentType] = useState(null); const [PaymentgatewayCard, setPaymentgatewayCard] = useState([]); const [PaymentDeviceCard, setPaymentDeviceCard] = useState([]); const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]); @@ -154,7 +181,7 @@ const SplitPayment = (props) => { const GlobProdwisedata = useSelector(GlobalSelProdWiseEst); const prodCat = useSelector(GlobalProductCategorie); const ProdSubCat = useSelector(GlobalProductSubCategorie); - const RetailWSSalesType= useSelector(GlobalRetailWSSalesType, shallowEqual); + const RetailWSSalesType = useSelector(GlobalRetailWSSalesType, shallowEqual); const selOption = useSelector(GlobalSelOption); const ReportholdData = useSelector(GlobalReorderHoldDetails); const GlobalExtraCharge = useSelector(globalExtraTotalAmount); @@ -177,6 +204,7 @@ const SplitPayment = (props) => { (i) => i.SettingIdName === 'AllProductindividualToken' )?.[0]; const OrderOfferDetail = useSelector(Global_OrderOfferDetail, shallowEqual); + const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts); const [SelectedBookingType, setSelectedBookingType] = useState(null); const [ConfigDataList, setConfigDataList] = useState([]); const [formattedDate, setFormattedDate] = useState(''); @@ -194,6 +222,8 @@ const SplitPayment = (props) => { const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some( (item) => item?.OptionName == 'Offer' ); + const [TotalAmount, setTotalAmount] = useState(0); + console.log(TotalAmount, "TotalSplitAmount", TotalSplitAmount) const preferenceOffer = SettingDataSelector?.[0]?.['SettingDtlDetails']?.find( (item) => item.SettingIdName === 'Offer' @@ -206,6 +236,21 @@ const SplitPayment = (props) => { getPaymentOptionFeature(); }, []); + useEffect(() => { + + if (salesBillEdit) { + const previousNetAmount = (totalPreviouspayment || 0); + if (TotalNetAmount > previousNetAmount) { + setTotalAmount(TotalNetAmount - previousNetAmount); + } else { + setTotalAmount(0); + } + } else { + setTotalAmount(TotalNetAmount); + } + + }, [totalPreviousOfferAmount, totalPreviouspayment, TotalNetAmount]) + useEffect(() => { if (SelCustId) { setpaybtns(PaymentOptions); @@ -227,8 +272,11 @@ const SplitPayment = (props) => { }, [Splitpayment]); useEffect(() => { const totalPayAmount = Object.keys(SplitSelPayMode) - .filter((key) => key.startsWith('PayAmount-')) // Filter keys that start with "PayAmount-" - .reduce((sum, key) => sum + parseInt(SplitSelPayMode[key]), 0); + .filter(key => key.startsWith('PayAmount-')) + .reduce((sum, key) => { + const value = parseInt(SplitSelPayMode[key], 10); + return sum + (isNaN(value) ? 0 : value); + }, 0); setTotalSplitAmount(totalPayAmount); }, [SplitSelPayMode]); useEffect(() => { @@ -522,7 +570,7 @@ const SplitPayment = (props) => { await Promise.all( PrintOrderDetails?.[0]?.OrderDetails?.map( async (orderDetail, index) => { - const groupedTokens = orderDetail?.productDetails?.reduce( + const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -557,7 +605,7 @@ const SplitPayment = (props) => { ); } else { await Promise.all( - PrintOrderDetails?.[0]?.OrderDetails?.map( + PrintOrderDetails?.[0]?.OrderDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.map( async (orderDetail, index) => { await TokenPrint(`${index}-${orderDetail?.OrderId}`); } @@ -585,6 +633,10 @@ const SplitPayment = (props) => { 'Style 11': 'PrintStyle11', 'Style 12': 'PrintStyle12', 'Style 13': 'RePrint', + A4: 'PrintStyleA4', + A5: 'PrintStyleA5', + A4Standard: 'A4Standard', + TaxInvoice: 'TaxInvoice', }; const selectedStyle = @@ -598,7 +650,7 @@ const SplitPayment = (props) => { async (orderDetail, index) => { await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print if (orderDetail?.BookingTypeName !== 'Dine In') { - const groupedTokens = orderDetail?.productDetails?.reduce( + const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -981,11 +1033,11 @@ const SplitPayment = (props) => { @@ -1240,7 +1292,12 @@ const SplitPayment = (props) => { } else { dispatch(changeOrderCardDetails([])); } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); await dispatch(ChangeTotalAmount([])); + dispatch(changeFullOfferAppliedProducts([])); + dispatch(ChangeFullFreeProductList([])); await dispatch(changeReorderHoldDetails({})); await dispatch(changeReorderProductDetails([])); await dispatch(ChangeNavHoldData(false)); @@ -1308,8 +1365,8 @@ const SplitPayment = (props) => { ? 'E' : GlobEstBooking === 'ParEst' ? GlobProdwisedata?.includes( - a.InwardDtlId + ' ' + a?.BookingTypeName - ) + a.InwardDtlId + ' ' + a?.BookingTypeName + ) ? 'E' : 'S' : 'S', @@ -1318,6 +1375,8 @@ const SplitPayment = (props) => { OfferValue: a?.Type === 'C' ? a?.OfferValue : a.Offer, OfferAmt: a?.Type === 'C' ? a?.TotalAmt : a.Offer, OfferType: a?.Type === 'C' ? a?.OfferType : '', + OfferMode: a?.OfferMode, + OfferMessage: a?.OfferMessage, CounterName: a?.TokenAvailable === 'Y' ? a?.CounterName : null, ProductIdentifierDtls: a.ProductIdentifierDtls, ModelNumber: a.ModelNumber, @@ -1326,9 +1385,9 @@ const SplitPayment = (props) => { const NotSlectedTypeFind = temporderdetail?.find( (a) => a?.BookingType != SelectedBookingType ); - let updatedOfferDetails = OrderOfferDetail; + let updatedOfferDetails = offerAppliedProducts; if (GlobEstBooking !== 'Sales') { - updatedOfferDetails = OrderOfferDetail?.filter( + updatedOfferDetails = offerAppliedProducts?.filter( (item) => !( item.TableName === 'LoyaltyPoints' && @@ -1339,7 +1398,7 @@ const SplitPayment = (props) => { } let temppostdata = { CompId: CompId, - SalesMode:RetailWSSalesType || 'R', + SalesMode: RetailWSSalesType || 'R', BranchId: BranchId, AppId: AppId, OrderDate: formattedDate, @@ -1413,37 +1472,37 @@ const SplitPayment = (props) => { : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' ? SplitSelPayMode[`CardSelection-${i}`] : SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'default' + 'default' ? 'PC' : SplitSelPayMode[`UPISelection-${i}`], ModeOfPayment: SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' ? PaymentUpiOptions?.find( - (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] - )?.UPIDetailId + (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] + )?.UPIDetailId : null, AccountDtl: SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( - (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] - ) + (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] + ) : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'pd') || + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'pd') || + (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === + 'card' && + SplitSelPayMode[`CardSelection-${i}`]?.toLowerCase() === + 'pd') + ? useOptions?.[0]?.PaymentDetails?.PaymentDevice + : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === + 'upi' && + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'pg') || (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' && SplitSelPayMode[`CardSelection-${i}`]?.toLowerCase() === - 'pd') - ? useOptions?.[0]?.PaymentDetails?.PaymentDevice - : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === - 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'pg') || - (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === - 'card' && - SplitSelPayMode[`CardSelection-${i}`]?.toLowerCase() === - 'pg') + 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], PaymentStatus: @@ -1452,9 +1511,9 @@ const SplitPayment = (props) => { : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'credit' ? 'S' : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === - 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'default' + 'upi' && + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'default' ? 'S' : 'P', Debit: 0, @@ -1468,7 +1527,7 @@ const SplitPayment = (props) => { }; let PostData = temppostdata; (i === 0 && SplitSelPayMode[`PaymentStatus-${i}`] === 'F') || - (i === 0 && props.hasOwnProperty('TableBookingOrderId')) + (i === 0 && props.hasOwnProperty('TableBookingOrderId')) ? PutSplitPayment(i) : i === 0 ? Object.keys(ReportholdData)?.length > 0 @@ -1517,14 +1576,14 @@ const SplitPayment = (props) => { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -1566,11 +1625,23 @@ const SplitPayment = (props) => { : ReportholdData?.OrderId; putdata['SalesId'] = ReportholdData?.SalesId; putdata['UpdatedBy'] = UserId; + let response = null; - let response = await dispatch(PutBookingData(putdata)).unwrap(); + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (response?.data?.statusCode == 1) { setSalesOrderId(response?.data?.OrderId); + const salesEditAmount = response?.data?.PaymentOrderDtl?.find(payment => + payment?.LastOrderTran === 'Y' && payment?.AdjustmentType && + payment?.AdjustmentType != null && payment?.AfterAdjustment && payment?.BeforeAdjustment && payment?.AfterAdjustment != null && payment?.BeforeAdjustment != null + ) + setBeforeAdjAmount(salesEditAmount?.BeforeAdjustment || null); + setAfterAdjAmount(salesEditAmount?.AfterAdjustment || null); + setAdjustmentType(salesEditAmount?.AdjustmentType || null); let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( (item) => item?.PaymentOptionType?.toLowerCase() === 'pd' && @@ -1606,14 +1677,14 @@ const SplitPayment = (props) => { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -1672,32 +1743,32 @@ const SplitPayment = (props) => { : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' ? SplitSelPayMode[`CardSelection-${i}`] : SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'default' + 'default' ? 'PC' : SplitSelPayMode[`UPISelection-${i}`], ModeOfPayment: SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' ? PaymentUpiOptions?.find( - (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] - )?.UPIDetailId + (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] + )?.UPIDetailId : null, AccountDtl: SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( - (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] - ) + (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] + ) : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd') || - (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd') + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd') || + (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' && + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd') ? useOptions?.[0]?.PaymentDetails?.PaymentDevice : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'pg') || - (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === - 'card' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pg') + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'pg') || + (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === + 'card' && + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], PaymentStatus: @@ -1706,8 +1777,8 @@ const SplitPayment = (props) => { : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'credit' ? 'S' : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'default' + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'default' ? 'S' : 'P', Debit: 0, @@ -1715,6 +1786,10 @@ const SplitPayment = (props) => { SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'credit' ? SplitSelPayMode[`PayAmount-${i}`] : 0, + BeforeAdjAmount: beforeAdjAmount || null, + AfterAdjAmount: afterAdjAmount || null, + AdjustmentType: adjustmentType || null, + }; let response = await dispatch( @@ -1761,14 +1836,14 @@ const SplitPayment = (props) => { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -1870,14 +1945,14 @@ const SplitPayment = (props) => { }); setMessageData( bookingpaymentupdate?.data?.response + - ' ' + - (bookingpaymentupdate?.data?.OrderDetails?.length > 0 - ? bookingpaymentupdate?.data?.OrderId && - extractLastNumberOrderId( - bookingpaymentupdate?.data?.OrderId, - bookingpaymentupdate?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (bookingpaymentupdate?.data?.OrderDetails?.length > 0 + ? bookingpaymentupdate?.data?.OrderId && + extractLastNumberOrderId( + bookingpaymentupdate?.data?.OrderId, + bookingpaymentupdate?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (bookingpaymentupdate?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([bookingpaymentupdate?.data]); @@ -1895,7 +1970,7 @@ const SplitPayment = (props) => { if ( Date.now() - startTime > useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes * - 60000 + 60000 ) { // 60,000 ms = 1 minute diff --git a/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx b/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx index 2a3abf5..61056a2 100644 --- a/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx +++ b/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx @@ -41,7 +41,26 @@ import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx'; import '../../../../../Styles/BookingScreen/Components/OtherConponents/Reprint/BSReprint.scss'; import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking.jsx'; import { + changeBillEditingMode, + changeEstimateBooking, + changeHoldOrderDtl, + changeOrderCardDetails, + changeOrderType, + ChangeOverAllDiscEstimate, + ChangeOverAllDiscSales, + changePreviousOrderOfferDetail, + changePreviousOrderPayment, + changeReorderHoldDetails, + changeReorderProductDetails, + ChangeSelectedCustDisable, + changeSelectedCustId, + changeSelectedOption, + changeSelProdWiseEst, + getAllCustomer, getConfigType, + getCustomerForHold, + GlobalSalesBillEdit, + GlobalSelectedCustDisable, PreferenceData, } from '../../../../../Features/BookingScreen/BookingData/BookingData.js'; import { DatePicker, Form } from 'antd'; @@ -63,10 +82,15 @@ import { import { TbSettingsCog } from 'react-icons/tb'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import { axiosRetailInstanceData } from '../../../../../Features/AuthenicationToken/AuthenticationToken.js'; +import { MdEdit } from "react-icons/md"; +import { v4 as uuidv4 } from 'uuid'; +import { changeOrderOfferDetail } from '../../../../../Features/Offer/Offer.js'; +import { ChangeFullFreeProductList, changeFullOfferAppliedProducts, changeLoyaltyConsumedQuantities } from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; +import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; const RetailApiurl = import.meta.env.ENV_API_URL; -function BSReprint() { +function BSReprint({ setOpenModel = () => { } }) { const dispatch = useDispatch(); const queryClient = useQueryClient(); const appPreferences = useSelector(ApplicationPreferences); @@ -100,24 +124,31 @@ function BSReprint() { const [page, setpage] = useState(1); const [itemsPerPage] = useState(10); const [DefReason, setDefReason] = useState({}); - console.log(DefReason, 'DefReason'); const SettingDataSelector = useSelector(PreferenceData); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const custDisable = useSelector(GlobalSelectedCustDisable); + console.log(SettingDataSelector, 'SettingDataSelector'); const MobileA4Print = SettingDataSelector?.[0]?.SettingDtlDetails?.find( (setting) => setting?.SettingIdName?.toLowerCase() === 'mobilea4' && setting?.SettingValue === 'Y' ); + const editBill = SettingDataSelector?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'editbill' && + setting?.SettingValue === 'Y' + ); const TokenOnly = SettingDataSelector?.[0]?.SettingDtlDetails?.filter( (i) => i.SettingIdName === 'TokenOnly' )?.[0]; const IndividualToken = SettingDataSelector?.[0]?.SettingDtlDetails?.filter( (i) => i.SettingIdName === 'AllProductindividualToken' )?.[0]; - const Weightasquantity = SettingDataSelector?.[0]?.SettingDtlDetails?.some( - (setting) => - setting?.SettingIdName?.toLowerCase() === 'weightasquantity' && - setting?.SettingValue === 'Y' - ); + const Weightasquantity = SettingDataSelector?.[0]?.SettingDtlDetails?.some( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'weightasquantity' && + setting?.SettingValue === 'Y' + ); const printDatas = useSelector(GlobalprintDatas); console.log(printDatas, 'GlobalprintDatas'); const PrinterDetails = useSelector(GlobalPrinterMappingDtls); @@ -560,7 +591,7 @@ function BSReprint() { const selectedStyle = stylesMap[ - printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle + printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle ]; if (selectedStyle) { if (data === 'without') { @@ -784,7 +815,6 @@ function BSReprint() {
{(page - 1) * 10 + index + 1} ), }, - { title: 'Bill No', dataIndex: 'BillNo', @@ -895,6 +925,21 @@ function BSReprint() { /> ), }, + // ...(editBill ? [ + { + title: 'Edit Bill', + key: 'EditBill', + dataIndex: 'EditBill', + align: 'center', + render: (text, row) => ( + await handleEditBill(e, row)} + /> + ), + } + // ] : []) + , { title: () => (
{ - const isWeightScale = item?.ScaleType === 'weight'; + const isWeightScale = item?.ScaleType === 'weight'; - if (isWeightScale) { - return acc + ( - Weightasquantity - ? Math.round(Number(item?.SalesQty || item?.OrderQty || 0)) - : 1 - ); - } + if (isWeightScale) { + return acc + ( + Weightasquantity + ? Math.round(Number(item?.SalesQty || item?.OrderQty || 0)) + : 1 + ); + } - return acc + Math.round(Number(item?.SalesQty || item?.OrderQty|| 0)); - }, 0) + return acc + Math.round(Number(item?.SalesQty || item?.OrderQty || 0)); + }, 0) const widthOutTexAmt = table2Data?.[0]?.TaxDetails?.reduce( (sum, item) => sum + (item?.WithOutTaxAmount || 0), 0 ); + const handleEditBill = async (e, orderDtls) => { + setOpenModel(e); + dispatch(changeBillEditingMode(true)); + const { + productDetails, + ExtraChargeDetails, + CustSuppId, + OrderOfferDetails, + RefDetails, + OrderId, + OrderType, + OverallDisc, + OrderPaymentDtl, + } = orderDtls; + const updated = productDetails?.map((item) => ({ + ...item, + Offer: item?.OfferAmt, + localId: uuidv4(), + OfferMode: item?.OfferMode ? item?.OfferMode?.trim() : null, + VariantAvailableFrom: item?.AvailableFrom || null, + VariantAvailableTo: item?.AvailableTo || null, + OrderQty: item?.SalesQty, + OrderRate: item?.Rate, + // TotalAmt: formatAmount((item.TotalAmt - item.OfferValue)), + })); + + if (RefDetails?.[0]?.FreeProdList) { + dispatch(ChangeFullFreeProductList(RefDetails[0]?.FreeProdList)); + } + + if (RefDetails?.[0]?.OfferAppliedProductList) { + dispatch( + changeFullOfferAppliedProducts( + RefDetails[0]?.OfferAppliedProductList + ) + ); + } + + + + if (CustSuppId) { + let res = await dispatch( + getCustomerForHold({ + CompId: CompId, + AppId: AppId, + branchId: BranchId, + OrderId: OrderId, + }) + ).unwrap(); + + if (res?.data?.statusCode !== 1) { + res = await dispatch( + getAllCustomer({ + CompId: CompId, + AppId: AppId, + branchId: BranchId, + }) + ).unwrap(); + } + + if (res?.data?.statusCode === 1) { + + const loyaltyFreeProductOfferApplied = (RefDetails?.[0]?.OfferAppliedProductList || [])?.filter( + (off) => + off?.FreeProductsList?.OfferMode === 'L' && + off?.TableUniqueName === 'FreeProduct' + ); + + const customerDetails = res?.data?.data?.find( + (item) => item.CustId === CustSuppId + ); + + if (customerDetails) { + const { CustId, CustName, CustMobile, LoyaltyPointsDetail, TotalLoyaltyPoints } = customerDetails; + const data = { + CustId: CustId, + CustName: CustName, + label: CustName ? CustName : CustMobile, + value: CustMobile, + LoyaltyPointsDetail: LoyaltyPointsDetail, + TotalLoyaltyPoints: TotalLoyaltyPoints + }; + + dispatch(changeOrderOfferDetail([...OrderOfferDetails])); + dispatch(changeSelectedOption(data)); + await dispatch(ChangeSelectedCustDisable(true)); + + if (loyaltyFreeProductOfferApplied?.length > 0) { + const loyaltyProdQuantities = {}; + + loyaltyFreeProductOfferApplied.forEach((off) => { + const freeProdDtls = off?.FreeProductsList; + const freeProdOfferId = + freeProdDtls?.ProdVariantDetails?.[0]?.StockDetails?.[0] + ?.ProdOfferId; + + const key = [ + freeProdDtls?.OfferId, + freeProdDtls?.FreeProdId, + freeProdDtls?.FreeProdVariantName, + freeProdOfferId, + ].join('|'); + + loyaltyProdQuantities[key] = freeProdDtls?.FreeQty || 0; + }); + + if (Object.keys(loyaltyProdQuantities).length > 0) { + dispatch(changeLoyaltyConsumedQuantities(loyaltyProdQuantities)); + } + + console.log(loyaltyProdQuantities, 'loyaltyProdQuantities'); + } + } + + } + } + await dispatch(changeOrderType('Hold')); + await dispatch(changeHoldOrderDtl(true)); + await dispatch(changeReorderHoldDetails(orderDtls)); + await dispatch(changeReorderProductDetails(updated)); + await dispatch(changeSelectedCustId(CustSuppId)); + await dispatch(ChangeTotalAmount(ExtraChargeDetails)); + await dispatch(changePreviousOrderPayment(OrderPaymentDtl)); + await dispatch(changePreviousOrderOfferDetail(OrderOfferDetails)); + dispatch(changeOrderCardDetails(updated)); + let temp = updated?.filter((item) => item.OrderType === 'E') + .map((item) => item.InwardDtlId + ' ' + item.BookingTypeName); + await dispatch(changeSelProdWiseEst(temp)); + + if (OrderType === 'E') { + await dispatch(changeEstimateBooking('OvrAllEst')); + await dispatch(ChangeOverAllDiscEstimate(parseFloat(OverallDisc))); + } else { + await dispatch(changeEstimateBooking('Sales')); + await dispatch(ChangeOverAllDiscSales(parseFloat(OverallDisc))); + } + } + return ( <>
@@ -1237,7 +1420,7 @@ function BSReprint() { CreatedDate={orderDetail?.CreatedDate} PaymentStatus={reprintData?.[0]?.OrderPaymentDtl} Preference={SettingDataSelector} - + />
))} @@ -1295,7 +1478,7 @@ function BSReprint() { {countOfProduct > 10 && ( { carouselRef.current.goTo(index); } }; - const goToPrintSetup = () => { - navigate(`${subDirectory}saleslayouts/print-selection`); -}; + const goToPrintSetup = () => { + navigate(`${subDirectory}saleslayouts/print-selection`); + }; const getStyleNote = (value) => { if (!GlobaldummyData) return false; const isAnyTableOptionTrue = @@ -385,7 +385,6 @@ const PrintPreviewPage = (props) => { // (item) => item.StyleName === selectedStyleName // ); - // debugger // // Only one "Sales" style should have SetasDefault: "Y" // const updatedTemplates = SizeOptionData.map((item) => { // if ( @@ -401,7 +400,7 @@ const PrintPreviewPage = (props) => { // }); // console.log(updatedTemplates,'ngfjbknbfgjbgfjn'); - + // let TemplateDetails = updatedTemplates.map((item) => ({ // SizeId: null, @@ -451,78 +450,79 @@ const PrintPreviewPage = (props) => { // }; -const onfinish = async (values) => { - if (!SizeOptionData || SizeOptionData.length === 0) { - setMessageType('error'); - setMessageData('Please Setup the Screen'); - return; - } - - const selectedStyle = SizeOptionData.find( - (item) => item.StyleName === selectedStyleName - ); + const onfinish = async (values) => { + if (!SizeOptionData || SizeOptionData.length === 0) { + setMessageType('error'); + setMessageData('Please Setup the Screen'); + return; + } - if (!selectedStyle) { - setMessageType('error'); - setMessageData('Selected style not found'); - return; - } - // Update all templates, ensuring only the selected style has SetasDefault: "Y" - const updatedTemplates = SizeOptionData.map((item) => { - return { - ...item, - SetasDefault: item.StyleName === selectedStyleName ? "Y" : "N", + const selectedStyle = SizeOptionData.find( + (item) => item.StyleName === selectedStyleName + ); + + if (!selectedStyle) { + setMessageType('error'); + setMessageData('Selected style not found'); + return; + } + // Update all templates, ensuring only the selected style has SetasDefault: "Y" + const updatedTemplates = SizeOptionData.map((item) => { + return { + ...item, + SetasDefault: item.StyleName === selectedStyleName ? "Y" : "N", + }; + }); + + console.log(updatedTemplates, 'ngfjbknbfgjbgfjn'); + + let TemplateDetails = updatedTemplates.map((item) => ({ + SizeId: null, + StyleId: item.StyleId, + SetasDefault: item.SetasDefault, + SetasDefaultInvoice: item.SetasDefaultInvoice, + PrintTypeId: item?.PrintTypeId, + SizeDetails: item.OptionDetails.map((opt) => ({ + OptionId: opt.ConfigId, + })), + ...(item?.TermsandConditions?.length > 0 + ? { + PrintTermsandConditions: (item?.TermsandConditions + ? item?.TermsandConditions + : [] + )?.map((tc) => ({ + TermsandConditions: tc, + })), + } + : {}), + ...(item?.Notes ? { Notes: item.Notes } : {}), + ...(item?.PageSize ? { PageSize: item.PageSize } : {}), + ...(item?.PrintHdrName ? { PrintHdrName: item.PrintHdrName } : {}), + ...(item?.Signature ? { Signature: item?.Signature } : {}), + PrintType: item?.PrintType, + })); + + const Data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + TemplateDetails: TemplateDetails, + CreatedBy: UserId, }; - }); - console.log(updatedTemplates, 'ngfjbknbfgjbgfjn'); + const response = await dispatch( + putPrintSelectionComponentData(Data) + ).unwrap(); - let TemplateDetails = updatedTemplates.map((item) => ({ - SizeId: null, - StyleId: item.StyleId, - SetasDefault: item.SetasDefault, - SetasDefaultInvoice: item.SetasDefaultInvoice, - PrintTypeId: item?.PrintTypeId, - SizeDetails: item.OptionDetails.map((opt) => ({ - OptionId: opt.ConfigId, - })), - ...(item?.TermsandConditions?.length > 0 - ? { - PrintTermsandConditions: (item?.TermsandConditions - ? item?.TermsandConditions - : [] - )?.map((tc) => ({ - TermsandConditions: tc, - })), - } - : {}), - ...(item?.Notes ? { Notes: item.Notes } : {}), - ...(item?.PageSize ? { PageSize: item.PageSize } : {}), - ...(item?.PrintHdrName ? { PrintHdrName: item.PrintHdrName } : {}), - ...(item?.Signature ? { Signature: item?.Signature } : {}), - PrintType: item?.PrintType, - })); - - const Data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - TemplateDetails: TemplateDetails, - CreatedBy: UserId, + if (response?.data?.statusCode === 1) { + dispatch(changeSelectedPrintdummyData(false)); + await GetPrintData(); + setMessageType('success'); + setMessageData(response?.data?.response); + if (onClose) onClose(); // Call the onClose callback after success + } }; - - const response = await dispatch( - putPrintSelectionComponentData(Data) - ).unwrap(); - - if (response?.data?.statusCode === 1) { - dispatch(changeSelectedPrintdummyData(false)); - await GetPrintData(); - setMessageType('success'); - setMessageData(response?.data?.response); - if (onClose) onClose(); // Call the onClose callback after success - } -}; + return (
{
{style.component}
- )):( -
- Please set up Print form to view or change here. -
- - Click here to go there - -
- )} + )) : ( +
+ Please set up Print form to view or change here. +
+ + Click here to go there + +
+ )}
diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSCreditCustomer.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSCreditCustomer.jsx index 695433f..29e64ad 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSCreditCustomer.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSCreditCustomer.jsx @@ -1752,7 +1752,6 @@ const BSCreditCustomer = (props) => { } onChange={(e) => { - // debugger const value = parseFloat(e?.target?.value) || 0; if (value <= SelectedBillData?.OrderPendingAmount) { HandleAmount(e?.target?.value); diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSNavbarSearchStandard.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSNavbarSearchStandard.jsx index 531a853..35671ac 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSNavbarSearchStandard.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSNavbarSearchStandard.jsx @@ -35,7 +35,7 @@ const BSNavbarSearchStandard = ({ inputRef }) => { const ProdName = useSelector(GlobalSearchData); const templateData = useSelector(getTemplateData); const appPreferences = useSelector(ApplicationPreferences); - + console.log(ProdName, "ProdName") const [preFocus, setPreFocus] = useState(false); const [screenWidth, setScreenWidth] = useState(window.innerWidth); const [check, setCheck] = useState(false); @@ -92,7 +92,7 @@ const BSNavbarSearchStandard = ({ inputRef }) => { if (debounceTimeoutRef.current) clearTimeout(debounceTimeoutRef.current); debounceTimeoutRef.current = setTimeout(async () => { - + const hasSearch = (Array?.isArray(ProdName) && ProdName?.length === 0 ? "" : ProdName)?.trim()?.length > 0; if (hasSearch) { diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx index 876f7fe..e6ef940 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx @@ -30,7 +30,7 @@ const BSPrinterSetting = ({ IconComponent = PozoReprintIcon, ClassName = 'BSBillingNav-icon', drawerOpen = false, - setDrawerOpen = () => {}, + setDrawerOpen = () => { }, }) => { const CompId = getSession('CompId'); const BranchId = getSession('BranchId'); @@ -57,7 +57,7 @@ const BSPrinterSetting = ({ const [receiptReprintShow, setReceiptReprintShow] = useState(false); const SettingDataSelector = useSelector(PreferenceData); const [KioskPrintersetupShow, setKioskPrintersetupShow] = useState(false); - + console.log(OpenModel, "OpenModel") const dispatch = useDispatch(); const printmodelOpen = () => { setOpenModel(true); @@ -266,7 +266,7 @@ const BSPrinterSetting = ({ className="printer-settings-tabs" > - {reprintShow && } + {reprintShow && } {receiptReprintShow && } diff --git a/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx b/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx index b293a10..993b6a0 100644 --- a/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx @@ -134,6 +134,17 @@ const InvoiceTemplate = ({ index, let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === "S" ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, 0 @@ -306,7 +317,7 @@ const InvoiceTemplate = ({ index, 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 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; @@ -760,7 +771,7 @@ const InvoiceTemplate = ({ index,

{GlobaldummyData ? "Company Name" : companyName}

{companyAddress}

-
Phone: {GlobaldummyData ? "999999XXXX" : companyPhone}
+ {(companyPhone || GlobaldummyData) &&
Phone: {GlobaldummyData ? "999999XXXX" : companyPhone}
}
Email: {companyEmail}
{companyGSTIN || GlobaldummyData &&
GSTIN: {GlobaldummyData ? "XXTTHJJF7679" : companyGSTIN}
}
@@ -890,7 +901,7 @@ const InvoiceTemplate = ({ index, {GlobaldummyData ? GlobalQuantity && Qty - : Quantity == true && { WeightasKg ?'Qty/Kg' :'Qty'}} + : Quantity == true && {WeightasKg ? 'Qty/Kg' : 'Qty'}} {/* UOM UOM */} @@ -1251,6 +1262,46 @@ const InvoiceTemplate = ({ index,
{Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)}
+ {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )} {/*
Total Amount Payable @@ -1476,6 +1527,46 @@ const InvoiceTemplate = ({ index,
{Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)}
+ {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )}
}
@@ -1569,7 +1660,7 @@ const InvoiceTemplate = ({ index,

{GlobaldummyData ? "Company Name" : companyName}

{companyAddress}

-
Phone: {GlobaldummyData ? "999999XXXX" : companyPhone}
+ {(companyPhone || GlobaldummyData) &&
Phone: {GlobaldummyData ? "999999XXXX" : companyPhone}
}
Email: {companyEmail}
{companyGSTIN || GlobaldummyData &&
GSTIN: {GlobaldummyData ? "XXTTHJJF7679" : companyGSTIN}
}
@@ -1684,7 +1775,7 @@ const InvoiceTemplate = ({ index, {GlobaldummyData ? GlobalQuantity && Qty - : Quantity == true && { WeightasKg ?'Qty/Kg' :'Qty'}} + : Quantity == true && {WeightasKg ? 'Qty/Kg' : 'Qty'}} {/* UOM UOM */} @@ -1998,6 +2089,46 @@ const InvoiceTemplate = ({ index,
{Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)}
+ {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )}
}
diff --git a/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx b/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx index 73fe486..67c12c8 100644 --- a/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx @@ -137,6 +137,18 @@ const PrintA4Style11 = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) + const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, 0 @@ -546,7 +558,7 @@ const PrintA4Style11 = ({ textAlign: 'center', }} > - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -932,6 +944,46 @@ const PrintA4Style11 = ({ + {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )} {GlobaldummyData ? GlobalCredit && (
- { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -1872,6 +1924,46 @@ const PrintA4Style11 = ({
+ {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )} {GlobaldummyData ? GlobalCredit && (
- {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

Split Payment:

*/} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2424,6 +2516,46 @@ const PrintA4Style11 = ({
+ {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )} {GlobaldummyData ? GlobalCredit && (
+ {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )} {GlobaldummyData ? GlobalCredit && (
ps.PaymentStatus === 'S' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) const PackageDetails = table2Data?.PackageDtl; const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, @@ -548,7 +559,7 @@ const PrintA5Style11 = ({ textAlign: 'center', }} > - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -936,6 +947,46 @@ const PrintA5Style11 = ({
+ {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )} {GlobaldummyData ? GlobalCredit && (
- { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -1876,6 +1927,46 @@ const PrintA5Style11 = ({
+ {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )} {GlobaldummyData ? GlobalCredit && (
- {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

Split Payment:

*/} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2428,6 +2519,86 @@ const PrintA5Style11 = ({
+ {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )} + {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )} {GlobaldummyData ? GlobalCredit && (
+ {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )} + {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )} {GlobaldummyData ? GlobalCredit && (
{ + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) if (keysLength > 0) { dispatch(changeReprintDataFound(true)); @@ -378,8 +389,8 @@ const PrintStyle1 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: FormatTheme @@ -445,24 +456,24 @@ const PrintStyle1 = ({ {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 + : '')}
-
+ {(GlobaldummyData || table2Data?.BrMobile) &&
{' '} Mobile : +91{' '} {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} -
+
} {table2Data?.OrderType === 'E' && (
@@ -632,80 +643,80 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO == true && ( - S.No - )} + S.No + )} {GlobaldummyData ? GlobalItem && Item : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - MRP - ) + MRP + ) : MRP == true && ( - MRP - )} + MRP + )} {GlobaldummyData ? GlobalRate && ( - Rate - ) + Rate + ) : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && ( - Tax % - ) + Tax % + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -713,176 +724,175 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
{item?.ProdName}
- {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
- {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
- ) : ( -
- ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} + +
{item?.ProdName}
+ {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
+ {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
+ ) : ( +
+ ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
+ )} + {sportsAppPreference && + `${item?.BookingDate?.trim() + ? `(${dateFormatChange(item.BookingDate)})` + : '' + } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} +  {' '} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null ) -
- )} - {sportsAppPreference && - `${ - item?.BookingDate?.trim() - ? `(${dateFormatChange(item.BookingDate)})` - : '' - } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} -  {' '} - {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(',')} -
- ); - }) - : ''} - - )} + )?.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(',')} +
+ ); + }) + : ''} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {' '} - {item?.Rate} - - )} + + {' '} + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage || 0} - - ) + + {item?.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ))} @@ -911,80 +921,80 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO == true && ( - S.No - )} + S.No + )} {GlobaldummyData ? GlobalItem && Item : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - MRP - ) + MRP + ) : MRP == true && ( - MRP - )} + MRP + )} {GlobaldummyData ? GlobalRate && ( - Rate - ) + Rate + ) : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && ( - Tax % - ) + Tax % + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -992,125 +1002,124 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
{item?.ProdName}
-
- ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
- {sportsAppPreference && - `${ - item?.BookingDate?.trim() - ? `(${dateFormatChange(item.BookingDate)})` - : '' - } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} - - )} + +
{item?.ProdName}
+
+ ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
+ {sportsAppPreference && + `${item?.BookingDate?.trim() + ? `(${dateFormatChange(item.BookingDate)})` + : '' + } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {' '} - {item?.Rate} - - )} + + {' '} + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage} - - ) + + {item.ProdTaxPercentage} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ))} @@ -1164,21 +1173,21 @@ const PrintStyle1 = ({ {(TotalOfferAmount > 0 || table2Data?.OverallDisc > 0) && ( -

- Off : - {( - Number(TotalOfferAmount || 0) + - Number(table2Data?.OverallDisc || 0) - ).toFixed(2)} -

- )} +

+ Off : + {( + Number(TotalOfferAmount || 0) + + Number(table2Data?.OverallDisc || 0) + ).toFixed(2)} +

+ )}
)} - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

Split Payment:

*/} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -1222,6 +1231,46 @@ const PrintStyle1 = ({ ))} )} + {isEditedBill && lastTransaction && ( +
+
+
+ Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
+
+ {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
+
+ Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
+
+
+ )} {table2Data?.OrderType === 'E' ? ( '' ) : ( @@ -1529,103 +1578,103 @@ const PrintStyle1 = ({
{table2Data?.SalesTableLinkDetails?.[0] ?.WaiterName && ( -
- Captain:{' '} - { - table2Data?.SalesTableLinkDetails?.[0] - ?.WaiterName - } -
- )} +
+ Captain:{' '} + { + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName + } +
+ )}
)} {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed( - 2 - ), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

- )); - })()} -
- )} + 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} + +

+ )); + })()} +
+ )}
+ {/* QRcode */} + +
Scan to Pay
+
+ ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
+
+ ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && (
- {/* QRcode */} -
Scan to Pay
-
+
+ Scan to Pay{' '} +
+
₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
- ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
- -
- Scan to Pay{' '} -
-
- ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
-
- )} + )}
@@ -1738,30 +1787,30 @@ const PrintStyle1 = ({ > {GlobaldummyData ? GlobalIsnotes && ( +
+

+ Notes : 10 days Return policy +

+ +
+
+ ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Notestext && (
-

- Notes : 10 days Return policy +

+ {Notestext}


- ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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. +
+
+ ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && (

-

  • - Once goods are sold, they are not - exchangeable or refundable. -
  • -
  • - Please check the product before leaving the - counter. -
  • + {TermsAndConditions?.map((item) => ( +
  • + {item?.TermsandConditions} +
  • + ))} + {/*
  • Please check the product before leaving the counter.
  • */}
    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : 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 +

    + +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : Signature == true && (
    @@ -1874,45 +1956,12 @@ const PrintStyle1 = ({ Signature

    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} + )}
    {PrintGreeting?.SettingValue === 'Y' && (
    )} - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill)( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2045,6 +2094,46 @@ const PrintStyle1 = ({ ))} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {table2Data?.OrderType === 'E' ? ( '' ) : ( @@ -2363,81 +2452,81 @@ const PrintStyle1 = ({ )} {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )}
    + {/* QRcode */} + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && (
    - {/* QRcode */} -
    Scan to Pay
    -
    +
    Scan to Pay
    +
    ₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} + )}
    @@ -2549,30 +2638,30 @@ const PrintStyle1 = ({ > {GlobaldummyData ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Notestext && (
    -

    - Notes : 10 days Return policy +

    + {Notestext}


    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && (

    -

  • - Once goods are sold, they are not exchangeable - or refundable. -
  • -
  • - Please check the product before leaving the - counter. -
  • + {TermsAndConditions?.map((item) => ( +
  • + {item?.TermsandConditions} +
  • + ))} + {/*
  • Please check the product before leaving the counter.
  • */}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && (
    @@ -2684,44 +2805,12 @@ const PrintStyle1 = ({ Signature

    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} + )}
    {PrintGreeting?.SettingValue === 'Y' && (
    )} - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2833,6 +2922,46 @@ const PrintStyle1 = ({ ))} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {table2Data?.OrderType === 'E' ? ( '' ) : ( @@ -3149,79 +3278,79 @@ const PrintStyle1 = ({ {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )}
    + {/* QRcode */} + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && (
    - {/* QRcode */} -
    Scan to Pay
    -
    +
    Scan to Pay
    +
    ₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} + )}
    @@ -3332,35 +3461,35 @@ const PrintStyle1 = ({ > {GlobaldummyData ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Notestext && (

    - Notes : 10 days Return policy + {Notestext}


    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && (

    -

  • - Once goods are sold, they are not exchangeable or - refundable. -
  • -
  • - Please check the product before leaving the - counter. -
  • + {TermsAndConditions?.map((item) => ( +
  • + {item?.TermsandConditions} +
  • + ))} + {/*
  • Please check the product before leaving the counter.
  • */}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && (
    @@ -3472,44 +3633,12 @@ const PrintStyle1 = ({ Signature

    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} + )}
    {PrintGreeting?.SettingValue === 'Y' && (
    )} -
    +
    ) : (
    -
    + {(GlobaldummyData || table2Data?.BrMobile) &&
    {' '} Mobile : +91{' '} {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} -
    +
    } {table2Data?.OrderType === 'E' && (
    @@ -3738,61 +3867,61 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && S.No : SLNO == true && ( - S.No - )} + S.No + )} {GlobaldummyData ? GlobalItem && ( - Item - ) + Item + ) : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && MRP : MRP == true && MRP} {GlobaldummyData ? GlobalRate && Rate : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && Tax % : Tax == true && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -3801,175 +3930,174 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} + {sportsAppPreference && + `${item?.BookingDate?.trim() + ? `(${dateFormatChange(item.BookingDate)})` + : '' + } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} +  {' '} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null ) -
    - )} - {sportsAppPreference && - `${ - item?.BookingDate?.trim() - ? `(${dateFormatChange(item.BookingDate)})` - : '' - } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} -  {' '} - {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(',')} -
    - ); - }) - : ''} - - )} + )?.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(',')} +
    + ); + }) + : ''} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {' '} - {item?.Rate} - - )} + + {' '} + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ) )} @@ -4000,59 +4128,59 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && S.No : SLNO == true && ( - S.No - )} + S.No + )} {GlobaldummyData ? GlobalItem && Item : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && MRP : MRP == true && MRP} {GlobaldummyData ? GlobalRate && Rate : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && Tax % : Tax == true && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -4061,124 +4189,123 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - {sportsAppPreference && - `${ - item?.BookingDate?.trim() - ? `(${dateFormatChange(item.BookingDate)})` - : '' - } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + {sportsAppPreference && + `${item?.BookingDate?.trim() + ? `(${dateFormatChange(item.BookingDate)})` + : '' + } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {' '} - {item?.Rate} - - )} + + {' '} + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ) )} @@ -4266,7 +4393,7 @@ const PrintStyle1 = ({ )} )} - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4279,6 +4406,46 @@ const PrintStyle1 = ({ ))} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {table2Data?.OrderType === 'E' ? ( '' ) : ( @@ -4586,76 +4753,76 @@ const PrintStyle1 = ({ )} {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} +

    + )); + })()} +
    + )}
    + {/* QRcode */} + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && (
    - {/* QRcode */} -
    Scan to Pay
    -
    +
    Scan to Pay
    +
    ₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} + )}
    @@ -4758,28 +4925,28 @@ const PrintStyle1 = ({ > {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : !estimatePrintHeader && table2Data?.OrderType === 'E' ? '' : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && (

    -

  • - Once goods are sold, they are not exchangeable or - refundable. -
  • -
  • - Please check the product before leaving the counter. -
  • + {TermsAndConditions?.map((item) => ( +
  • + {item?.TermsandConditions} +
  • + ))} + {/*
  • Please check the product before leaving the counter.
  • */}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && (
    @@ -4890,44 +5089,12 @@ const PrintStyle1 = ({ Signature

    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} + )}
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx index 79de332..424951b 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx @@ -122,6 +122,18 @@ const PrintStyle10 = ({ (ps) => ps.PaymentTypeName === 'UPI' ); + const isEditedBill = PaymentStatus?.some((payment) => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ); + let TermsAndConditions = printDatas?.TermsandConditions; let SignatureImg = printDatas?.Signature; let Notestext = printDatas?.Notes; @@ -529,7 +541,7 @@ const PrintStyle10 = ({ - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -904,7 +916,7 @@ const PrintStyle10 = ({ - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -1646,7 +1658,7 @@ const PrintStyle10 = ({ table2Data?.FYStatus )}{' '}
    - {PaymentStatusSuccess?.length > 1 && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1793,6 +1805,77 @@ const PrintStyle10 = ({ )}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} + +
    +
    +
    + )} +
    - {PaymentStatusSuccess?.length > 1 && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -2671,6 +2754,75 @@ const PrintStyle10 = ({ )}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -3356,7 +3508,7 @@ const PrintStyle10 = ({ ) : Quantity && ( - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -4035,7 +4187,7 @@ const PrintStyle10 = ({ table2Data?.FYStatus )}{' '}
    - {PaymentStatusSuccess?.length > 1 && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4153,6 +4305,71 @@ const PrintStyle10 = ({ )}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    { - +const PrintStyle11 = ({ + index, + ExtraChargeTotal, + Date1, + base64Image, + PrintLogo, + totalQuantityFilter, + BranchCity, + BranchZip, + CashierName, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + OrderDetailVAT, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + isPdf, + SalesModePref, + sportsAppPreference, + MembershipApplied = null, +}) => { const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint) + const GlobalUpiID = useSelector(GlobalUpiIDprint); const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Tax = FieldDetails?.["Tax"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const CashierNameField = FieldDetails?.["CashierName"]; - const LogoField = FieldDetails?.["Logo"]; - const CreditDetails = FieldDetails?.["Credit details"]; + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Tax = FieldDetails?.['Tax']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const CashierNameField = FieldDetails?.['CashierName']; + const LogoField = FieldDetails?.['Logo']; + const CreditDetails = FieldDetails?.['Credit details']; const WeightasKg = FieldDetails?.['Weight']; - const GlobalSlNo = useSelector(GlobalprintSlNo) - const GlobalItem = useSelector(GlobalprintItem) - const GlobalMRP = useSelector(GlobalprintMRP) - const GlobalDiscount = useSelector(GlobalprintDiscount) - const GlobalTax = useSelector(GlobalprintTax) - 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 GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalMRP = useSelector(GlobalprintMRP); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalTax = useSelector(GlobalprintTax); + 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) + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); + const GlobalBilltext = useSelector(GlobalBillName); const appPreferences = useSelector(ApplicationPreferences); const SettingData = useSelector(PreferenceData); const GlobalCashierName = useSelector(GlobalprintCashierName); const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); - const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' - const bookingTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Booking Type')?.PreferenceCatDetails - const dinePreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "dine in" && type?.PreferredStatus === 'Y') - const takeAwayPreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "take away" && type?.PreferredStatus === 'Y') - const paymentTypeUPI = PaymentStatus?.find((ps) => ps.PaymentTypeName === "UPI") + const estimatePrintHeader = + SettingData?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' + )?.SettingValue === 'Y'; + const bookingTypePreference = appPreferences?.find( + (preference) => preference?.PreferredCatName === 'Booking Type' + )?.PreferenceCatDetails; + const dinePreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'dine in' && + type?.PreferredStatus === 'Y' + ); + const takeAwayPreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'take away' && + type?.PreferredStatus === 'Y' + ); + const paymentTypeUPI = PaymentStatus?.find( + (ps) => ps.PaymentTypeName === 'UPI' + ); - let TermsAndConditions = printDatas?.TermsandConditions - let SignatureImg = printDatas?.Signature - let Notestext = printDatas?.Notes - let BillName = printDatas?.PrintHdrName - let FormatTheme = printDatas?.PrintType == "S" ? true : false - let PageSize = printDatas?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; + const isEditedBill = PaymentStatus?.some((payment) => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ); + + let TermsAndConditions = printDatas?.TermsandConditions; + let SignatureImg = printDatas?.Signature; + let Notestext = printDatas?.Notes; + let BillName = printDatas?.PrintHdrName; + let FormatTheme = printDatas?.PrintType == 'S' ? true : false; + let PageSize = printDatas?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; const PackageDetails = table2Data?.PackageDtl; const keysLength = Object.keys(table2Data ?? {}).length; - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } - const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") - const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") + const TakeawayData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' + ); + const DineInData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' + ); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); const DineInTotal = DineInData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); - const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); + const aggregatedPayments = PaymentStatusSuccess?.reduce( + (acc, paymentdata) => { + const paymentType = paymentdata?.PaymentTypeName; + const amount = Number(paymentdata?.Amount); - if (acc[paymentType]) { - acc[paymentType] += amount; - } else { - acc[paymentType] = amount; - } + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } - return acc; - }, {}); + return acc; + }, + {} + ); const productsData = table2Data?.productDetails || []; const offers = table2Data?.OrderOfferDetails || []; 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', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 18, + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 40, + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, ]; - const chunkSize = PageSize == "A5" ? 8 : 11; + const chunkSize = PageSize == 'A5' ? 8 : 11; let dataSource = []; if (GlobaldummyData || TakeawayData?.length > 0) { @@ -172,1313 +318,4212 @@ const PrintStyle11 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 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); return ( <> - {FormatTheme ? -
    {paginatedChunks.map((dataChunk, chunkIndex) => (
    0 ? ' print-page-break' : ''}`} - style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: isMobile ? "295mm" : FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> - - + className={ + isMobile + ? `invoice-wrapper container pdf-page` + : `invoice-wrapper container print-chunk${chunkIndex > 0 ? ' print-page-break' : ''}` + } + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: isMobile + ? '295mm' + : FormatTheme + ? PageSize == 'A5' + ? '170mm' + : '257mm' + : '', + }} + key={chunkIndex} + > {/*
    */} -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    -
    - {(GlobalLogo && GlobaldummyData) ? image : null} - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    -
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    - {/*
    +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {GlobalLogo && GlobaldummyData ? ( + image + ) : null} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    + {/*
    Save green | Save nature
    */} +
    +
    +
    +
    +
    + {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 + : '')} +
    +
    + {' '} + MOBILE NO :{table2Data?.BrMobile} +
    +
    +
    +
    + {GlobaldummyData + ? 'CASH' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`} +
    +
    + Bill No :{' '} + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    -
    -
    -
    - {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 : '')} -
    -
    MOBILE NO :{table2Data?.BrMobile}
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`}
    -
    -
    {GlobaldummyData ? 'CASH' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""} {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`}
    -
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`}
    } + )}
    - -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference &&
    Take Away
    } + {takeAwayPreference && ( +
    + Take Away +
    + )} - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && } + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} {dataChunk?.map((item, index) => { return ( - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - ) + ); })}
    S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmtS.NS.NItemItem + Qty + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + HSN + + HSN + + MRP + + MRP + + Dis{' '} + + Dis{' '} + + Tax %{' '} + + Tax %{' '} + + Rate + + Rate + + Amt + + Amt +
    {index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
    {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?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}{index + 1} + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > + 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return ( +
    {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?.SalesQty} + + {item?.SalesQty} + + {item?.HSN} + + {item?.HSN} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.Rate} + + {item?.Rate} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    - } - {(DineInData?.length > 0 && dinePreference) && + )} + {DineInData?.length > 0 && dinePreference && ( <> -
    Dine In
    +
    + Dine In +
    - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && } + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} {dataChunk?.map((item, index) => { return ( - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - ) + ); })}
    S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmtS.NS.NItemItem + Qty + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + HSN + + HSN + + MRP + + MRP + + Dis{' '} + + Dis{' '} + + Tax %{' '} + + Tax %{' '} + + Rate + + Rate + + Amt + + Amt +
    {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?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}{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?.SalesQty} + + {item?.SalesQty} + + {item?.HSN} + + {item?.HSN} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.Rate} + + {item?.Rate} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    - } + )}
    - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - <> -
    -
    -
    -
    -
    -
    Qty
    -
    Items
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    Off
    - } - {/*
    SUB TOTAL
    + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> +
    +
    +
    +
    +
    +
    + Qty +
    +
    + Items +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + Off +
    + )} + {/*
    SUB TOTAL
    ROUND OFF
    */} +
    +
    +
    {GlobaldummyData ? '9' : totalQuantity}
    +
    + {GlobaldummyData + ? '8' + : totalQuantityFilter?.length} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + {GlobaldummyData + ? '8' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} + {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} + {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */} +
    -
    -
    {GlobaldummyData ? '9' : totalQuantity}
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    {GlobaldummyData ? '8' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    - } - {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} - {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + TakeAway :{Number(TakeawayTotal).toFixed(2)}/- +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + DineIn :{Number(DineInTotal).toFixed(2)}/- +
    + )} +
    + Amount : + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} + /-
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    TakeAway :{Number(TakeawayTotal).toFixed(2)}/-
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    DineIn :{Number(DineInTotal).toFixed(2)}/-
    - } -
    Amount :{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}/-
    -
    -
    - {(table2Data?.OrderType === "E") ? '' : -
    -
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    +
    +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    +
    +

    + --------- GST Breakup Details + ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + )} -
    -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    +
    + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number( + item.TaxAmt + ).toFixed(2)} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    + Taxable Amount + + VAT +
    - - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } + + Total Amount + + + {OrderDetailVAT?.map((item) => ( + + + {item?.TaxPercentage || 0}% + + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + + {Number( + item.TaxAmt + ).toFixed(2)} + - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - } + + {Number( + item.TotalAmt + ).toFixed(2)} + + + ))} + + + )} +
    +
    + + )} +
    -
    - } -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    + )} +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '}
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    +
    + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    ) : null} +
    + )} + +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} - -
    - -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} + {GlobaldummyData && GlobalCashierName && ( +
    + {' '} + Cashier : Cashier Name +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName}
    - ))} - - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    + )} - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName && ( +
    + Captain :{' '} + { + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName + } +
    + )} + +
    + {Date1}
    - } +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    +
    - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} + +
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - -
    {Date1}
    -
    YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    +
    + )} +
    + YOUR ORDER NO:{' '} + {table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)}
    - {GlobaldummyData ? GlobalQrcodet &&
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. +
    +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )} +
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    -
    - - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - 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. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (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

    - -
    ) : - (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - Signature == true && (
    -

    Signature

    - -
    )} - -
    -
    - - {PrintGreeting?.SettingValue === "Y" && -
    -
    Thank You Visit Again
    -
    - } - - - } + {PrintGreeting?.SettingValue === 'Y' && ( +
    +
    + Thank You Visit Again +
    +
    + )} + + )}
    ))} - {shouldFooterBeOnNewPage && FormatTheme && + {shouldFooterBeOnNewPage && FormatTheme && (
    -
    <>
    -
    +
    -
    -
    -
    Qty
    -
    Items
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    Off
    - } +
    +
    +
    + Qty +
    +
    + Items +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + Off +
    + )} {/*
    SUB TOTAL
    ROUND OFF
    */}
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    {GlobaldummyData ? '8' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    - } +
    + {GlobaldummyData + ? '8' + : totalQuantityFilter?.length} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + {GlobaldummyData + ? '8' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */}
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    TakeAway :{Number(TakeawayTotal).toFixed(2)}/-
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    DineIn :{Number(DineInTotal).toFixed(2)}/-
    - } -
    Amount :{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}/-
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + TakeAway :{Number(TakeawayTotal).toFixed(2)}/- +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + DineIn :{Number(DineInTotal).toFixed(2)}/- +
    + )} +
    + Amount : + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} + /- +

    - {(table2Data?.OrderType === "E") ? '' : -
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    - -
    +
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - {OrderDetailIGST?.map((item) => + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    - Taxable Amount - - IGST - - Total Amount -
    - - - + - - ) - } -
    - {item?.TaxPercentage || 0}% + + Taxable Amount - {Number(item.WithOutTaxAmount).toFixed(2)} + + CGST - {Number(item.TaxAmt).toFixed(2)} + + SGST + + Total Amount {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + )} - - - - - Taxable Amount - - - VAT - - - Total Amount - - - {OrderDetailVAT?.map((item) => - - - {item?.TaxPercentage || 0}% - - - {Number(item.WithOutTaxAmount).toFixed(2)} - - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} - - ) - } - - - } - -
    -
    - - } + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed( + 2 + )} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed( + 2 + )} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} +
    +
    + + )}
    - } -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) )} -
    - -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} -
    - } - - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} -
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - -
    {Date1}
    -
    YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    -
    - {GlobaldummyData ? GlobalQrcodet &&
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    -
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    -
    - - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} -
    -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - 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. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal}

    -
      - {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    ) - } + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} + + )} + {GlobaldummyData && GlobalCashierName && ( +
    + {' '} + Cashier : Cashier Name +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} - {GlobaldummyData ? GlobalSignature && (
    -

    Signature

    - -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - Signature == true && (
    -

    Signature

    - -
    )} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + +
    + {Date1} +
    +
    + + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    +
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    + YOUR ORDER NO:{' '} + {table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    + +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && -
    -
    Thank You Visit Again
    + {PrintGreeting?.SettingValue === 'Y' && ( +
    +
    + Thank You Visit Again +
    - } - + )}
    - } -
    - : -
    + ) : ( +
    - - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - -
    - {(GlobalLogo && GlobaldummyData) ? image : null} - {base64Image && (base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    -
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    - {/*
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {GlobalLogo && GlobaldummyData ? ( + image + ) : null} + {base64Image && + base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    + {/*
    Save green | Save nature
    */} +
    +
    +
    +
    +
    + {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 + : '')} +
    +
    + {' '} + MOBILE NO :{table2Data?.BrMobile} +
    +
    +
    +
    + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`} +
    +
    + Bill No :{' '} + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    -
    -
    -
    - {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 : '')} -
    -
    MOBILE NO :{table2Data?.BrMobile}
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`}
    -
    -
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`}
    -
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`}
    } + )}
    - {(TakeawayData?.length > 0 || GlobaldummyData) && + {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference &&
    Take Away
    } + {takeAwayPreference && ( +
    + Take Away +
    + )} - +
    - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} + {(GlobaldummyData ? products : TakeawayData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )}
    S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmtS.NS.NItemItem + Qty + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + HSN + + HSN + + MRP + + MRP + + Dis{' '} + + Dis{' '} + + Tax %{' '} + + Tax %{' '} + + Rate + + Rate + + Amt + + Amt +
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
    {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?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return ( +
    {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?.SalesQty} + + {item?.SalesQty} + + {item?.HSN} + + {item?.HSN} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.Rate} + + {item?.Rate} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    - } - {(DineInData?.length > 0 && dinePreference) && + )} + {DineInData?.length > 0 && dinePreference && ( <> -
    Dine In
    +
    + Dine In +
    - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - {(GlobaldummyData ? products : DineInData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} + {(GlobaldummyData ? products : DineInData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )}
    S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmtS.NS.NItemItem + Qty + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + HSN + + HSN + + MRP + + MRP + + Dis{' '} + + Dis{' '} + + Tax %{' '} + + Tax %{' '} + + Rate + + Rate + + Amt + + Amt +
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    -
    {item?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    +
    + {item?.SalesQty} + + {item?.SalesQty} + + {item?.HSN} + + {item?.HSN} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.Rate} + + {item?.Rate} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    - } - - - + )}
    -
    +
    -
    -
    -
    Qty
    -
    Items
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    Off
    - } +
    +
    +
    + Qty +
    +
    + Items +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    + Off +
    + )} {/*
    SUB TOTAL
    ROUND OFF
    */}
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    {GlobaldummyData ? '8' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    - } +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    + {GlobaldummyData + ? '8' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */}
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    TakeAway :{Number(TakeawayTotal).toFixed(2)}/-
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    DineIn :{Number(DineInTotal).toFixed(2)}/-
    - } -
    Amount :{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}/-
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + TakeAway :{Number(TakeawayTotal).toFixed(2)}/- +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + DineIn :{Number(DineInTotal).toFixed(2)}/- +
    + )} +
    + Amount : + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} + /- +

    - {(table2Data?.OrderType === "E") ? '' : -
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    - -
    +
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    - - Taxable Amount - - IGST - - Total Amount -
    - + - - + - - ) - } -
    - {item?.TaxPercentage || 0}% + + Taxable Amount - {Number(item.WithOutTaxAmount).toFixed(2)} + + CGST - {Number(item.TaxAmt).toFixed(2)} + + SGST + + Total Amount {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} - - - Taxable Amount - - - VAT - - - Total Amount - - - {OrderDetailVAT?.map((item) => - - - {item?.TaxPercentage || 0}% - - - {Number(item.WithOutTaxAmount).toFixed(2)} - - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} - - ) - } - - - } - -
    -
    - - } + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )} +
    +
    + + )}
    - } -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    + )} +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} -
    +
    {/*
    CARD : *********12
    CARD HOLDER : CARD HOLDER NAME
    TOTAL SAVING : 0.00
    */} -
    - {PaymentStatusSuccess?.length > 1 && +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)}
    ))} - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} + )} + {GlobaldummyData && GlobalCashierName && ( +
    + {' '} + Cashier : Cashier Name
    - } + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name
    - } + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - -
    {Date1}
    -
    YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    +
    + {Date1} +
    - {GlobaldummyData ? GlobalQrcodet &&
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    -
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}

    - -
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - 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. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions + YOUR ORDER NO:{' '} + {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)} +

    +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy

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

    Signature

    - -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - Signature == true && (
    -

    Signature

    - -
    )} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && -
    + {PrintGreeting?.SettingValue === 'Y' && ( +
    {/*
    Terms & Condition
    Xxxx Yyyy Xxxx Yyyy Xxxx Yyyy Xxxx Yyyy
    */} -
    Thank You Visit Again
    +
    + Thank You Visit Again +
    - } - + )}
    - - - -
    - } - +
    + )} ); }; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx index 48226a3..e23e409 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx @@ -1,8 +1,12 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import QrImage from '../../../../Images/qrcode.jpg'; -import Logo from '../../../../Images/Logo.jpg' -import { extractLastNumber, extractLastNumberOrderId, printDiv } from '../../../../Services/Others'; +import Logo from '../../../../Images/Logo.jpg'; +import { + extractLastNumber, + extractLastNumberOrderId, + printDiv, +} from '../../../../Services/Others'; import { GlobalprintSlNo, GlobalprintItem, @@ -26,145 +30,285 @@ import { GlobalprintLogo, GlobalprintCredit, GlobalprintTax, -} from '../../../../Features/ThemeChange/ThemeChange' -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; -import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.scss' +} from '../../../../Features/ThemeChange/ThemeChange'; +import { + GlobalUpiIDprint, + PreferenceData, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.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'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; - - -const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, totalQuantityFilter, CashierName, totalQuantity, OrderDetailGST, OrderDetailIGST, - OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, printDatas, isPdf, sportsAppPreference, SalesModePref, - MembershipApplied = null }) => { - +const Printstyle12 = ({ + index, + ExtraChargeTotal, + Date1, + base64Image, + PrintLogo, + totalQuantityFilter, + CashierName, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + OrderDetailVAT, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + isPdf, + sportsAppPreference, + SalesModePref, + MembershipApplied = null, +}) => { const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint) + const GlobalUpiID = useSelector(GlobalUpiIDprint); const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Tax = FieldDetails?.["Tax"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const CashierNameField = FieldDetails?.["CashierName"]; - const LogoField = FieldDetails?.["Logo"]; - const CreditDetails = FieldDetails?.["Credit details"]; + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Tax = FieldDetails?.['Tax']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const CashierNameField = FieldDetails?.['CashierName']; + const LogoField = FieldDetails?.['Logo']; + const CreditDetails = FieldDetails?.['Credit details']; const WeightasKg = FieldDetails?.['Weight']; - const GlobalSlNo = useSelector(GlobalprintSlNo) - const GlobalItem = useSelector(GlobalprintItem) - const GlobalMRP = useSelector(GlobalprintMRP) - const GlobalDiscount = useSelector(GlobalprintDiscount) - const GlobalTax = useSelector(GlobalprintTax) - 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 GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalMRP = useSelector(GlobalprintMRP); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalTax = useSelector(GlobalprintTax); + 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) + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); + const GlobalBilltext = useSelector(GlobalBillName); const appPreferences = useSelector(ApplicationPreferences); const GlobalCashierName = useSelector(GlobalprintCashierName); const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); const SettingData = useSelector(PreferenceData); - const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' - const bookingTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Booking Type')?.PreferenceCatDetails - const dinePreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "dine in" && type?.PreferredStatus === 'Y') - const takeAwayPreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "take away" && type?.PreferredStatus === 'Y') - const paymentTypeUPI = PaymentStatus?.find((ps) => ps.PaymentTypeName === "UPI") + const estimatePrintHeader = + SettingData?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' + )?.SettingValue === 'Y'; + const bookingTypePreference = appPreferences?.find( + (preference) => preference?.PreferredCatName === 'Booking Type' + )?.PreferenceCatDetails; + const dinePreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'dine in' && + type?.PreferredStatus === 'Y' + ); + const takeAwayPreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'take away' && + type?.PreferredStatus === 'Y' + ); + const paymentTypeUPI = PaymentStatus?.find( + (ps) => ps.PaymentTypeName === 'UPI' + ); - let TermsAndConditions = printDatas?.TermsandConditions - let SignatureImg = printDatas?.Signature - let Notestext = printDatas?.Notes - let BillName = printDatas?.PrintHdrName - let FormatTheme = printDatas?.PrintType == "S" ? true : false - let PageSize = printDatas?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; + const isEditedBill = PaymentStatus?.some((payment) => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ); + + let TermsAndConditions = printDatas?.TermsandConditions; + let SignatureImg = printDatas?.Signature; + let Notestext = printDatas?.Notes; + let BillName = printDatas?.PrintHdrName; + let FormatTheme = printDatas?.PrintType == 'S' ? true : false; + let PageSize = printDatas?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; const PackageDetails = table2Data?.PackageDtl; const keysLength = Object.keys(table2Data ?? {}).length; - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); const printDocument = () => { window.print(); - } + }; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } - const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") - const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") + const TakeawayData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' + ); + const DineInData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' + ); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); const DineInTotal = DineInData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); - const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); + const aggregatedPayments = PaymentStatusSuccess?.reduce( + (acc, paymentdata) => { + const paymentType = paymentdata?.PaymentTypeName; + const amount = Number(paymentdata?.Amount); - if (acc[paymentType]) { - acc[paymentType] += amount; - } else { - acc[paymentType] = amount; - } + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } - return acc; - }, {}); + return acc; + }, + {} + ); const productsData = table2Data?.productDetails || []; const offers = table2Data?.OrderOfferDetails || []; 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', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 18, + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 40, + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, ]; - const chunkSize = PageSize == "A5" ? 8 : 11; + const chunkSize = PageSize == 'A5' ? 8 : 11; let dataSource = []; if (GlobaldummyData || TakeawayData?.length > 0) { @@ -178,8 +322,11 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 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 style12 = ``; const PrintA4 = async () => { - - await printDiv("PrintStyle12", style12, 'FontApply'); + await printDiv('PrintStyle12', style12, 'FontApply'); }; - return ( <> - {FormatTheme ? -
    - + {FormatTheme ? ( +
    {paginatedChunks.map((dataChunk, chunkIndex) => (
    0 ? ' print-page-break' : ''}`} - style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: isMobile ? "295mm" : FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> - - + className={ + isMobile + ? `invoice-wrapper container pdf-page` + : `invoice-wrapper container print-chunk${chunkIndex > 0 ? ' print-page-break' : ''}` + } + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: isMobile + ? '295mm' + : FormatTheme + ? PageSize == 'A5' + ? '170mm' + : '257mm' + : '', + }} + key={chunkIndex} + > {/*
    */} -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    -
    -
    +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    +
    -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    - {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 : '')} +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    +
    + {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 + : '')} +
    +
    + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + + ' Bill' + : ''} +
    +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} +
    + {GlobaldummyData && GlobalCashierName && ( +

    + {' '} + Cashier : Cashier Name +

    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + {table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} +
    + )}
    -
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""}
    -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    - {GlobaldummyData && GlobalCashierName &&

    Cashier : Cashier Name

    } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName}
    } - {GlobaldummyData && -
    Customer : Customer Name
    } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} -
    } - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - {table2Data?.OrderType === "E" &&
    Estimate
    } + {GlobalLogo && GlobaldummyData && ( +
    + {' '} + image +
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( +
    + {' '} + image +
    + ) : null} +
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} +
    + )} +
    +
    + Bill No :{' '} + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    + {Date1}
    - {(GlobalLogo && GlobaldummyData) &&
    image
    } - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : (base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ?
    image
    : null} - -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate
    } -
    -
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {Date1}
    -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference &&
    Take Away
    } + {takeAwayPreference && ( +
    + Take Away +
    + )}
    - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} {dataChunk?.map((item, index) => { return ( - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - ) + ); })}
    S.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateHSNHSN(%)(%) + Tax (%) + + Tax (%) + AmtAmt
    {index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
    {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?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}{index + 1} + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls + ?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == + '' || + items.SerialNumber == null + ) + )?.map((a) => { + return ( +
    {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?.SalesQty} + + {item?.SalesQty} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item?.Rate} + + {item?.Rate} + + {item?.HSN} + + {item?.HSN} + + {item?.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    - } - {(DineInData?.length > 0 && dinePreference) && + )} + {DineInData?.length > 0 && dinePreference && ( <> -
    Dine In
    +
    + Dine In +
    - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} {dataChunk?.map((item, index) => { return ( - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - ) + ); })}
    S.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateHSNHSN(%)(%) + Tax (%) + + Tax (%) + AmtAmt
    {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?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}{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?.SalesQty} + + {item?.SalesQty} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item?.Rate} + + {item?.Rate} + + {item?.HSN} + + {item?.HSN} + + {item?.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    - } + )}
    - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - <> - -
    -
    -
    -
    -
    - Items -
    -
    :
    -
    - {GlobaldummyData ? '8' : totalQuantityFilter?.length} -
    -
    -
    -
    - Qty -
    -
    :
    -
    - {GlobaldummyData ? '9' : totalQuantity} -
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    - Off -
    + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> +
    +
    +
    +
    +
    Items
    :
    -
    - {GlobaldummyData ? '9' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)} +
    + {GlobaldummyData + ? '8' + : totalQuantityFilter?.length}
    - } - {/*
    +
    +
    Qty
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '9' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    +
    + )} + {/*
    Extra Charges
    @@ -533,188 +1317,447 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo,
    */} -
    - - {(DineInData?.length > 0 && TakeawayData?.length > 0) && - <> - {takeAwayPreference &&
    -
    - TakeAway -
    -
    :
    -
    - {Number(TakeawayTotal).toFixed(2)} -
    -
    } - {dinePreference &&
    -
    - Dine In -
    -
    :
    -
    - {Number(DineInTotal).toFixed(2)} -
    -
    } - - } -
    -
    - Amount -
    -
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} -
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - {(table2Data?.OrderType === "E") ? '' : -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && - <> -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } +
    + {DineInData?.length > 0 && TakeawayData?.length > 0 && ( + <> + {takeAwayPreference && ( +
    +
    + TakeAway +
    +
    :
    +
    + {Number(TakeawayTotal).toFixed(2)} +
    - - } + )} + {dinePreference && ( +
    +
    + Dine In +
    +
    :
    +
    + {Number(DineInTotal).toFixed(2)} +
    +
    + )} + + )} +
    +
    + Amount +
    +
    :
    +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    - } -
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} + + )} -
    -
    - {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}   Payment + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( + <> +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} +
    + + )} +
    + )} +
    + +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +   Payment +
    +
    :
    +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    -
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} -
    -
    - {/*
    + + {/*
    Recived Amt
    @@ -732,193 +1775,535 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 0.00
    */} - -
    -
    - - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} -
    - -
    - -
    -
    Your Order No: {GlobaldummyData ? '53' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    -
    - {GlobaldummyData ? GlobalQrcodet && -
    - image -
    Scan to Pay:
    -
    - ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} + +
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && + )} -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} -
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} +
    +
    +
    +
    + Your Order No:{' '} + {GlobaldummyData + ? '53' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    +
    -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - 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. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (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

    - -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - Signature == true && (
    -

    Signature

    - -
    )} - + {GlobaldummyData + ? GlobalQrcodet && ( +
    + image +
    + {' '} + Scan to Pay:{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    -
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} - {PrintGreeting?.SettingValue === "Y" && -
    - Thank You Visit Again +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. +
    +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )} +
    - } - - } + {PrintGreeting?.SettingValue === 'Y' && ( +
    + Thank You Visit Again +
    + )} + + )}
    ))} - - {shouldFooterBeOnNewPage && FormatTheme && + {shouldFooterBeOnNewPage && FormatTheme && (
    -
    <> -
    -
    -
    -
    -
    - Items -
    +
    +
    +
    +
    Items
    :
    -
    +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    - Qty -
    +
    +
    Qty
    :
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    - Off -
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    +
    Off
    :
    -
    - {GlobaldummyData ? '9' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)} +
    + {GlobaldummyData + ? '9' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    - } + )} {/*
    Extra Charges @@ -929,185 +2314,435 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo,
    */} -
    +
    - {(DineInData?.length > 0 && TakeawayData?.length > 0) && + {DineInData?.length > 0 && TakeawayData?.length > 0 && ( <> - {takeAwayPreference &&
    -
    - TakeAway + {takeAwayPreference && ( +
    +
    + TakeAway +
    +
    :
    +
    + {Number(TakeawayTotal).toFixed(2)} +
    -
    :
    -
    - {Number(TakeawayTotal).toFixed(2)} + )} + {dinePreference && ( +
    +
    + Dine In +
    +
    :
    +
    + {Number(DineInTotal).toFixed(2)} +
    -
    } - {dinePreference &&
    -
    - Dine In -
    -
    :
    -
    - {Number(DineInTotal).toFixed(2)} -
    -
    } + )} - } -
    -
    + )} +
    +
    Amount
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    - {PaymentStatusSuccess?.length > 1 && + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} - } - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : (
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( <>
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    - - Taxable Amount - - CGST - - SGST - - Total Amount -
    - - - - - - - ) - } -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - + - - + - {OrderDetailIGST?.map((item) => + {OrderDetailGST?.map((item) => ( - - - + + - - ) - } + ))}
    - + Taxable Amount - IGST + + CGST + + SGST + Total Amount
    + {item?.TaxPercentage || 0}% - {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} - {Number(item.TaxAmt).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - + )} - - - - - - - {OrderDetailVAT?.map((item) => + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    +
    - - Taxable Amount - - VAT - - Total Amount -
    - + - - - - ) - } -
    - {item?.TaxPercentage || 0}% + + Taxable Amount - {Number(item.WithOutTaxAmount).toFixed(2)} + + IGST - {Number(item.TaxAmt).toFixed(2)} + + Total Amount {Number(item.TotalAmt).toFixed(2)}
    - - } - + {OrderDetailIGST?.map((item) => ( + + + {item?.TaxPercentage || 0}% + + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + + {Number(item.TaxAmt).toFixed(2)} + + + {Number(item.TotalAmt).toFixed(2)} + + + ))} + + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )}
    - } + )}
    - } -
    + )} +
    -
    -
    - {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}   Payment +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +   Payment
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    {/*
    @@ -1128,339 +2763,1140 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 0.00
    */} -
    - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} -
    - -
    - -
    -
    Your Order No: {GlobaldummyData ? '53' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - -
    - - {GlobaldummyData ? GlobalQrcodet && -
    - image -
    Scan to Pay:
    -
    - ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && +
    + )} -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} +
    + +
    +
    +
    + Your Order No:{' '} + {GlobaldummyData + ? '53' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    +
    + + {GlobaldummyData + ? GlobalQrcodet && ( +
    + image +
    + {' '} + Scan to Pay:{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - 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. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions + {GlobaldummyData + ? GlobalIsnotes && ( +

    +

    + Notes : 10 days Return policy

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

    Signature

    - -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - Signature == true && (
    -

    Signature

    - -
    )} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && -
    + {PrintGreeting?.SettingValue === 'Y' && ( +
    Thank You Visit Again
    - } + )}
    - } - + )}
    + ) : ( +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {/*

    {table2Data?.BrName}

    */} +
    +
    +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    +
    + {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 + : '')} +
    +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} +
    + {GlobaldummyData && GlobalCashierName && ( +

    + {' '} + Cashier : Cashier Name +

    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} - : -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} - {/*

    {table2Data?.BrName}

    */} -
    -
    - -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    - {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?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + {table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} +
    + )}
    -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    - {GlobaldummyData && GlobalCashierName && -

    Cashier : Cashier Name

    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} + {GlobalLogo && GlobaldummyData && ( +
    + {' '} + image
    - } - - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} + )} + {base64Image && (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( +
    + {' '} + image
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - {table2Data?.OrderType === "E" &&
    Estimate
    } + ) : null}
    - {(GlobalLogo && GlobaldummyData) &&
    image
    } - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ?
    image
    : null} -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate
    } + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} +
    + )} {/*

    {table2Data?.PaymentTypeName}  Payment :  {Number(table2Data?.NetAmount).toFixed(2)}/-

    */} -
    -
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {Date1}
    +
    +
    + Bill No :{' '} + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    + {Date1} +
    {/*
    */} - {(TakeawayData?.length > 0 || GlobaldummyData) && + {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference &&
    Take Away
    } + {takeAwayPreference && ( +
    + Take Away +
    + )}
    - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && } + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && } - {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} + {(GlobaldummyData ? products : TakeawayData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )}
    S.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
    {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?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return ( +
    {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?.SalesQty} + + {item?.SalesQty} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item?.Rate} + + {item?.Rate} + + {item?.HSN} + + {item?.HSN} + + {item?.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    - } - {(DineInData?.length > 0 && dinePreference) && + )} + {DineInData?.length > 0 && dinePreference && ( <> -
    Dine In
    +
    + Dine In +
    - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && } + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && } - {(GlobaldummyData ? products : DineInData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} + {(GlobaldummyData ? products : DineInData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )}
    S.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    -
    {item?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    +
    + {item?.SalesQty} + + {item?.SalesQty} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item?.Rate} + + {item?.Rate} + + {item?.HSN} + + {item?.HSN} + + {item?.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    - } + + )}
    -
    -
    -
    -
    - Items -
    +
    +
    +
    +
    Items
    :
    -
    +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    - Qty -
    +
    +
    Qty
    :
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    - Off -
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    +
    Off
    :
    -
    - {GlobaldummyData ? '9' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)} +
    + {GlobaldummyData + ? '9' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    - } + )} {/*
    Extra Charges @@ -1471,187 +3907,412 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo,
    */} -
    +
    - {(DineInData?.length > 0 && TakeawayData?.length > 0) && + {DineInData?.length > 0 && TakeawayData?.length > 0 && ( <> - {takeAwayPreference &&
    -
    - TakeAway + {takeAwayPreference && ( +
    +
    + TakeAway +
    +
    :
    +
    + {Number(TakeawayTotal).toFixed(2)} +
    -
    :
    -
    - {Number(TakeawayTotal).toFixed(2)} + )} + {dinePreference && ( +
    +
    + Dine In +
    +
    :
    +
    + {Number(DineInTotal).toFixed(2)} +
    -
    } - {dinePreference &&
    -
    - Dine In -
    -
    :
    -
    - {Number(DineInTotal).toFixed(2)} -
    -
    } + )} - } -
    -
    - Amount -
    + )} +
    +
    Amount
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    - {PaymentStatusSuccess?.length > 1 && + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)}
    ))} - } - {(table2Data?.OrderType === "E") ? '' : + )} + + {table2Data?.OrderType === 'E' ? ( + '' + ) : (
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( <>
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - - - - - - - ) - } -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - + - - + - {OrderDetailIGST?.map((item) => + {OrderDetailGST?.map((item) => ( - - - + + - - - ) - } + ))}
    - + Taxable Amount - IGST + + CGST + + SGST + Total Amount
    + {item?.TaxPercentage || 0}% + {Number(item.WithOutTaxAmount).toFixed(2)} - {Number(item.TaxAmt).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - + )} - - - - - - - {OrderDetailVAT?.map((item) => + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    +
    - - Taxable Amount - - VAT - - Total Amount -
    - + - - - - ) - } -
    - {item?.TaxPercentage || 0}% + + Taxable Amount - {Number(item.WithOutTaxAmount).toFixed(2)} + + IGST - {Number(item.TaxAmt).toFixed(2)} + + Total Amount {Number(item.TotalAmt).toFixed(2)}
    - - } + {OrderDetailIGST?.map((item) => ( + + + {item?.TaxPercentage || 0}% + + + {Number(item.WithOutTaxAmount).toFixed(2)} + + + {Number(item.TaxAmt).toFixed(2)} + + + {Number(item.TotalAmt).toFixed(2)} + + + ))} + + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )}
    - } + )}
    - } -
    + )} +
    -
    -
    - {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}   Payment +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +   Payment
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    {/*
    @@ -1672,10 +4333,73 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 0.00
    */} -
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} + {/*
    */} {/*
    @@ -1692,137 +4416,346 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo,
    */} - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} +

    + ) : null} + + )} - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} +

    + ) : null} +
    + )}
    -
    - -
    -
    Your Order No: {GlobaldummyData ? '53' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - +
    +
    +
    + Your Order No:{' '} + {GlobaldummyData + ? '53' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    - {GlobaldummyData ? GlobalQrcodet && -
    - image -
    Scan to Pay:
    -
    - ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} -
    -
    - : - (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && - -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } - + {GlobaldummyData + ? GlobalQrcodet && ( +
    + image +
    + {' '} + Scan to Pay:{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - 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. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions + {GlobaldummyData + ? GlobalIsnotes && ( +

    +

    + Notes : 10 days Return policy

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

    Signature

    - -
    ) : - (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - Signature == true && (
    -

    Signature

    - -
    )} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && -
    - Thank You Visit Again -
    - } + {PrintGreeting?.SettingValue === 'Y' && ( +
    Thank You Visit Again
    + )} {/*
    print
    */}
    - } - + )} - ) -} + ); +}; -export default Printstyle12 +export default Printstyle12; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx index be9e6c8..0da37c3 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx @@ -137,6 +137,18 @@ const Printstyle2 = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) + const keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); @@ -339,8 +351,8 @@ const Printstyle2 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: FormatTheme @@ -407,18 +419,18 @@ const Printstyle2 = ({ {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 + : '')}
    @@ -477,10 +489,10 @@ const Printstyle2 = ({ {GlobaldummyData ? 'A22' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    @@ -512,124 +524,124 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} @@ -638,214 +650,214 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && ( - - {item?.ProdName} - - ) + + {item?.ProdName} + + ) : Item && ( - -
    {item?.ProdName}
    -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => - pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} + +
    {item?.ProdName}
    +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +  {' '} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > + 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null ) -
    - )} -  {' '} - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > + )?.map((a) => { + return ( +
    {a.SerialNumber}
    + ); + }) + : ''}{' '} + {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?.ProductIdentifierDtls.filter( + (item1) => + item1.IMEI1 !== '' || + item1.IMEI2 !== '' + )?.map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) + : ''} +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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 ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage || 0} - - ) + + {item?.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} ); })} @@ -870,124 +882,124 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} @@ -996,155 +1008,155 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && ( - - {item?.ProdName} - - ) + + {item?.ProdName} + + ) : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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 ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} ); })} @@ -1266,12 +1278,12 @@ const Printstyle2 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off -
    - )} +
    + Off +
    + )}
    Amount
    @@ -1298,16 +1310,16 @@ const Printstyle2 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - {GlobaldummyData - ? '100' - : Number( +
    + {GlobaldummyData + ? '100' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )}
    @@ -1646,7 +1658,7 @@ const Printstyle2 = ({
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1666,6 +1678,46 @@ const Printstyle2 = ({ )} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData && GlobalCashierName && (
    Cashier : Cashier Name
    )} @@ -1712,141 +1764,141 @@ const Printstyle2 = ({ {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed( - 2 - ), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0] + ?.PaymentTypeName === 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs( - c.CurrentCreditBal - ).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed( + 2 + ), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )} {!estimatePrintHeader && - table2Data?.OrderType === 'E' ? ( + table2Data?.OrderType === 'E' ? ( '' ) : (
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} -
    +
    + QRcode +
    + 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 + )} +
    +
    + )}
    )} @@ -1872,7 +1924,7 @@ const Printstyle2 = ({ )} {!estimatePrintHeader && - table2Data?.OrderType === 'E' ? ( + table2Data?.OrderType === 'E' ? ( '' ) : (
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : 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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )} @@ -2108,10 +2160,10 @@ const Printstyle2 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off -
    - )} +
    + Off +
    + )}
    Amount
    @@ -2132,16 +2184,16 @@ const Printstyle2 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - {GlobaldummyData - ? '100' - : Number( +
    + {GlobaldummyData + ? '100' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )}
    {GlobaldummyData ? '1,066' @@ -2477,7 +2529,7 @@ const Printstyle2 = ({
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -2497,6 +2549,46 @@ const Printstyle2 = ({ )} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData && GlobalCashierName && (
    Cashier : Cashier Name
    )} @@ -2543,139 +2635,139 @@ const Printstyle2 = ({ {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed( - 2 - ), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed( + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed( 2 ), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )} {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} -
    +
    + QRcode +
    + 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 + )} +
    +
    + )}
    )} @@ -2714,23 +2806,23 @@ const Printstyle2 = ({ > {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : 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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )} @@ -2945,18 +3037,18 @@ const Printstyle2 = ({ {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 + : '')}
    @@ -3016,10 +3108,10 @@ const Printstyle2 = ({ {GlobaldummyData ? 'A22' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    @@ -3052,82 +3144,82 @@ const Printstyle2 = ({ : Item && Item} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} @@ -3137,208 +3229,208 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && ( - - {item?.ProdName} - - ) + + {item?.ProdName} + + ) : Item && ( - -
    {item?.ProdName}
    -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} + +
    {item?.ProdName}
    +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +  {' '} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null ) -
    - )} -  {' '} - {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(',')} -
    - ); - }) - : ''} -
    - - )} + )?.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(',')} +
    + ); + }) + : ''} +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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 ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} ); } @@ -3370,82 +3462,82 @@ const Printstyle2 = ({ : Item && Item} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} @@ -3455,154 +3547,154 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && ( - - {item?.ProdName} - - ) + + {item?.ProdName} + + ) : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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 ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} ); } @@ -3660,8 +3752,8 @@ const Printstyle2 = ({ {GlobaldummyData ? '100' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )}
    @@ -3994,7 +4086,7 @@ const Printstyle2 = ({
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4008,6 +4100,46 @@ const Printstyle2 = ({ ))} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData && GlobalCashierName && (
    Cashier : Cashier Name
    )} @@ -4047,123 +4179,123 @@ const Printstyle2 = ({
    {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )} {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    +
    + QRcode +
    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)}
    - )} +
    + )}
    )} @@ -4201,26 +4333,26 @@ const Printstyle2 = ({ > {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : 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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} -
    2. - ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    - )} + 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/PrintTemplates/ThermalPrinter/PrintStyle3.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx index c124a12..b1a067d 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx @@ -105,6 +105,18 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) + 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']; @@ -240,7 +252,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } + {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ? 'QTY/KG' : 'QTY'}
    } {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} @@ -302,7 +314,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } + {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ? 'QTY/KG' : 'QTY'}
    } {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} @@ -494,11 +506,51 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    {GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )}
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -507,7 +559,8 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    ))} - } + )} + {GlobaldummyData && GlobalCashierName &&
    Cashier : Cashier Name
    @@ -851,11 +904,52 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    {GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} +
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -864,7 +958,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    ))} - } + )} {GlobaldummyData && GlobalCashierName &&
    Cashier : Cashier Name
    @@ -1077,7 +1171,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } + {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ? 'QTY/KG' : 'QTY'}
    } {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} @@ -1139,7 +1233,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } + {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ? 'QTY/KG' : 'QTY'}
    } {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} @@ -1327,6 +1421,46 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    {GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData ? ( GlobalCredit && ( @@ -1385,7 +1519,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -1394,7 +1528,8 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    ))} - } + )} + {GlobaldummyData && GlobalCashierName &&
    Cashier : Cashier Name
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx index 43b0472..c164376 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx @@ -146,6 +146,17 @@ const Printstyle4 = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) const keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { @@ -244,7 +255,7 @@ const Printstyle4 = ({ TotalAmt: 176, discount: 0, HSN: '01', - }, + }, { ProdName: 'ITEM 2', Rate: 300.0, @@ -253,7 +264,7 @@ const Printstyle4 = ({ TotalAmt: 300, discount: 0, HSN: '02', - }, + }, { ProdName: 'ITEM 3', Rate: 200.0, @@ -347,8 +358,8 @@ const Printstyle4 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -398,7 +409,7 @@ const Printstyle4 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    {' '} @@ -470,10 +481,10 @@ const Printstyle4 = ({ {GlobaldummyData ? '51' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    {/*
    {GlobaldummyData ? formattedDate : Date1}
    */}
    @@ -535,138 +546,138 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalSlNo && ( - # - ) + # + ) : SLNO && #} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -676,187 +687,187 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => - pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} - {( - (item?.ProductIdentifierDtls - ?.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, index) => { - const imei1 = - item2.IMEI1 || ''; - const imei2 = - item2.IMEI2 || ''; - return ` ${[imei1, imei2].filter(Boolean).join(',')}`; - }) - .join('') - : '') - ).trim()} -
    - ) : ( -
    - {( - (item?.Size || '1') + - (item?.SinglePc === 'Y' - ? ' PCS' - : item?.Type !== 'C' - ? ` ${item?.UomName}` - : ' COMBO') + - (item?.BrandName - ? ` ${item?.BrandName}` - : '') + - (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, index) => { - const imei1 = - item2.IMEI1 || ''; - const imei2 = - item2.IMEI2 || ''; - return ` ${[imei1, imei2].filter(Boolean).join(',')}`; - }) - .join('') - : '') - ).trim()} -
    - )} - - )} + {( + (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, index) => { + const imei1 = + item2.IMEI1 || ''; + const imei2 = + item2.IMEI2 || ''; + return ` ${[imei1, imei2].filter(Boolean).join(',')}`; + }) + .join('') + : '') + ).trim()} +
    + ) : ( +
    + {( + (item?.Size || '1') + + (item?.SinglePc === 'Y' + ? ' PCS' + : item?.Type !== 'C' + ? ` ${item?.UomName}` + : ' COMBO') + + (item?.BrandName + ? ` ${item?.BrandName}` + : '') + + (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, index) => { + const imei1 = + item2.IMEI1 || ''; + const imei2 = + item2.IMEI2 || ''; + return ` ${[imei1, imei2].filter(Boolean).join(',')}`; + }) + .join('') + : '') + ).trim()} +
    + )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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} + + )} ); })} @@ -883,138 +894,138 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalSlNo && ( - # - ) + # + ) : SLNO && #} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - Qty - - )} + + Qty + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -1024,117 +1035,117 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage || 0} - - ) + + {item?.ProdTaxPercentage || 0} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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} + + )} ); })} @@ -1403,17 +1414,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(); @@ -1632,86 +1643,126 @@ const Printstyle4 = ({ /-{' '}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed( - 2 - ), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )} {/*
    */}
    {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( @@ -1720,59 +1771,59 @@ 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 + )} +
    +
    + )}
    )} @@ -1784,7 +1835,7 @@ const Printstyle4 = ({ extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1804,6 +1855,7 @@ const Printstyle4 = ({ )} )} + {GlobaldummyData && GlobalCashierName && (
    {' '} @@ -1877,28 +1929,28 @@ const Printstyle4 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -1918,137 +1970,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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -2324,16 +2376,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(); @@ -2552,84 +2604,124 @@ const Printstyle4 = ({ /-{' '}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )}
    {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( @@ -2638,55 +2730,55 @@ 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)} +
    +
    + )}
    )}
    @@ -2697,7 +2789,7 @@ const Printstyle4 = ({ extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

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

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2831,137 +2923,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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -3044,18 +3136,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 + : '')}
    {' '} @@ -3087,10 +3179,10 @@ const Printstyle4 = ({ {GlobaldummyData ? '51' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    @@ -3153,48 +3245,48 @@ const Printstyle4 = ({ : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - Qty - - )} + + Qty + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {/* {GlobaldummyData ? GlobalTax && ( - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3252,114 +3344,114 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    - - )} + +
    {item?.ProdName}
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} + + {item?.SalesQty} +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} - {( - (item?.ProductIdentifierDtls - ?.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, index) => { - const imei1 = - item2.IMEI1 || ''; - const imei2 = - item2.IMEI2 || ''; - return ` ${[imei1, imei2].filter(Boolean).join(',')}`; - }) - .join('') - : '') - ).trim()} -
    - ) : ( -
    - {( - (item?.Size || '1') + - (item?.SinglePc === 'Y' - ? ' PCS' - : item?.Type !== 'C' - ? ` ${item?.UomName}` - : ' COMBO') + - (item?.BrandName - ? ` ${item?.BrandName}` - : '') + - (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, index) => { - const imei1 = - item2.IMEI1 || ''; - const imei2 = - item2.IMEI2 || ''; - return ` ${[imei1, imei2].filter(Boolean).join(',')}`; - }) - .join('') - : '') - ).trim()} -
    - )} -
    - - ) + {( + (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, index) => { + const imei1 = + item2.IMEI1 || ''; + const imei2 = + item2.IMEI2 || ''; + return ` ${[imei1, imei2].filter(Boolean).join(',')}`; + }) + .join('') + : '') + ).trim()} +
    + ) : ( +
    + {( + (item?.Size || '1') + + (item?.SinglePc === 'Y' + ? ' PCS' + : item?.Type !== 'C' + ? ` ${item?.UomName}` + : ' COMBO') + + (item?.BrandName + ? ` ${item?.BrandName}` + : '') + + (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, index) => { + const imei1 = + item2.IMEI1 || ''; + const imei2 = + item2.IMEI2 || ''; + return ` ${[imei1, imei2].filter(Boolean).join(',')}`; + }) + .join('') + : '') + ).trim()} +
    + )} +
    + + ) : Quantity && ( - - {item?.SalesQty} - {/*
    + + {item?.SalesQty} + {/*
    {PackageDetails?.filter( (pkg) => pkg.ProdId === item.ProdId ).length > 0 ? ( @@ -3448,119 +3540,119 @@ const Printstyle4 = ({
    )}
    */} - - )} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - {GlobaldummyData - ? GlobalTax && ( - - {/* */} - - GST:{' '} - {' '} - {item?.ProdTaxPercentage || 0} - - ) - : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {/* */} - - GST:{' '} - {' '} - {item?.ProdTaxPercentage || 0} - - )} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + {GlobaldummyData + ? GlobalTax && ( + + {/* */} + + GST:{' '} + {' '} + {item?.ProdTaxPercentage || 0} + + ) + : Tax == true && + table2Data?.OrderType !== 'E' && ( + + {/* */} + + GST:{' '} + {' '} + {item?.ProdTaxPercentage || 0} + + )} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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} + + )} ); } @@ -3594,48 +3686,48 @@ const Printstyle4 = ({ : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - Qty - - )} + + Qty + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {/* {GlobaldummyData ? GlobalTax && ( - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3693,118 +3785,118 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    - - )} + +
    {item?.ProdName}
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {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'} + ) +
    + + ) : Quantity && ( - - {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'} + ) +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage || 0} - - ) + + {item?.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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} + + )} ); } @@ -4041,14 +4133,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(); @@ -4263,81 +4355,121 @@ const Printstyle4 = ({ /-{' '}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} +

    + )); + })()} +
    + )}
    {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( @@ -4346,61 +4478,62 @@ 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 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4414,6 +4547,7 @@ const Printstyle4 = ({ ))} )} + {GlobaldummyData && GlobalCashierName && (
    {' '} @@ -4483,21 +4617,21 @@ const Printstyle4 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -4517,136 +4651,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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} -
    2. - ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    - )} + 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/PrintTemplates/ThermalPrinter/PrintStyle5.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx index ee2bed5..ec2633e 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx @@ -79,7 +79,7 @@ const PrintStyle5 = ({ const CashierNameField = FieldDetails?.['CashierName']; const LogoField = FieldDetails?.['Logo']; const CreditDetails = FieldDetails?.['Credit details']; - const WeightasKg = FieldDetails?.['Weight']; + const WeightasKg = FieldDetails?.['Weight']; const GlobalSlNo = useSelector(GlobalprintSlNo); const GlobalItem = useSelector(GlobalprintItem); const GlobalMRP = useSelector(GlobalprintMRP); @@ -138,6 +138,17 @@ const PrintStyle5 = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) const keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); @@ -323,8 +334,8 @@ const PrintStyle5 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -371,7 +382,7 @@ const PrintStyle5 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    {' '} @@ -466,10 +477,10 @@ const PrintStyle5 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )}{' '} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}{' '}
    {' '}
    @@ -507,15 +518,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - S.No -
    - ) +
    + S.No +
    + ) : SLNO && ( -
    - S.No -
    - )} +
    + S.No +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -536,78 +547,78 @@ const PrintStyle5 = ({ : Item && 'ITEM /DES /'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'QTY/Kg' :'QTY'}{' '} + : Quantity && WeightasKg ? 'QTY/Kg' : 'QTY'}{' '}
    )} {GlobaldummyData ? GlobalHsnCode && ( -
    - HSN -
    - ) +
    + HSN +
    + ) : HsnCode && ( -
    - HSN -
    - )} +
    + HSN +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - MRP -
    - ) +
    + MRP +
    + ) : MRP && ( -
    - MRP -
    - )} +
    + MRP +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - RATE -
    - ) +
    + RATE +
    + ) : Rate && ( -
    - RATE -
    - )} +
    + RATE +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - DIS{' '} -
    - ) +
    + DIS{' '} +
    + ) : Discount && ( -
    - DIS{' '} -
    - )} +
    + DIS{' '} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - TAX %{' '} -
    - ) +
    + TAX %{' '} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - TAX %{' '} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + TAX %{' '} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {' '} - Amt{' '} -
    - ) +
    + {' '} + Amt{' '} +
    + ) : Amount && ( -
    - {' '} - AMT{' '} -
    - )} +
    + {' '} + AMT{' '} +
    + )}

    @@ -627,19 +638,19 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - {index + 1} -
    - ) +
    + {index + 1} +
    + ) : SLNO && ( -
    - {chunkIndex * chunkSize + index + 1} -
    - )} +
    + {chunkIndex * chunkSize + index + 1} +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -761,102 +772,102 @@ const PrintStyle5 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( -
    - {item?.HSN} -
    - ) +
    + {item?.HSN} +
    + ) : HsnCode && ( -
    - {item?.HSN} -
    - )} +
    + {item?.HSN} +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - {item?.MRP} -
    - ) +
    + {item?.MRP} +
    + ) : MRP && ( -
    - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} -
    - )} +
    + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - {item?.Rate} -
    - ) +
    + {item?.Rate} +
    + ) : Rate && ( -
    - {item?.Rate} -
    - )} +
    + {item?.Rate} +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - {item?.discount} -
    - ) +
    + {item?.discount} +
    + ) : Discount && ( -
    - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} -
    - )} +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - {item?.ProdTaxPercentage} -
    - ) +
    + {item?.ProdTaxPercentage} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - {item?.ProdTaxPercentage || 0} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {item?.TotalAmt} -
    - ) +
    + {item?.TotalAmt} +
    + ) : Amount && ( -
    - {' '} - {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} +
    + )}
    ))} @@ -886,15 +897,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - S.No -
    - ) +
    + S.No +
    + ) : SLNO && ( -
    - S.No -
    - )} +
    + S.No +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -915,78 +926,78 @@ const PrintStyle5 = ({ : Item && 'ITEM /DES /'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'Qty/Kg' :'Qty'}{' '} + : Quantity && WeightasKg ? 'Qty/Kg' : 'Qty'}{' '}
    )} {GlobaldummyData ? GlobalHsnCode && ( -
    - HSN -
    - ) +
    + HSN +
    + ) : HsnCode && ( -
    - HSN -
    - )} +
    + HSN +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - MRP -
    - ) +
    + MRP +
    + ) : MRP && ( -
    - MRP -
    - )} +
    + MRP +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - RATE -
    - ) +
    + RATE +
    + ) : Rate && ( -
    - RATE -
    - )} +
    + RATE +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - DIS{' '} -
    - ) +
    + DIS{' '} +
    + ) : Discount && ( -
    - DIS{' '} -
    - )} +
    + DIS{' '} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - TAX %{' '} -
    - ) +
    + TAX %{' '} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - TAX %{' '} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + TAX %{' '} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {' '} - Amt{' '} -
    - ) +
    + {' '} + Amt{' '} +
    + ) : Amount && ( -
    - {' '} - AMT{' '} -
    - )} +
    + {' '} + AMT{' '} +
    + )}

    @@ -1006,19 +1017,19 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - {index + 1} -
    - ) +
    + {index + 1} +
    + ) : SLNO && ( -
    - {chunkIndex * chunkSize + index + 1} -
    - )} +
    + {chunkIndex * chunkSize + index + 1} +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -1074,102 +1085,102 @@ const PrintStyle5 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( -
    - {item?.HSN} -
    - ) +
    + {item?.HSN} +
    + ) : HsnCode && ( -
    - {item?.HSN} -
    - )} +
    + {item?.HSN} +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - {item?.MRP} -
    - ) +
    + {item?.MRP} +
    + ) : MRP && ( -
    - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} -
    - )} +
    + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - {item?.Rate} -
    - ) +
    + {item?.Rate} +
    + ) : Rate && ( -
    - {item?.Rate} -
    - )} +
    + {item?.Rate} +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - {item?.discount} -
    - ) +
    + {item?.discount} +
    + ) : Discount && ( -
    - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} -
    - )} +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - {item?.ProdTaxPercentage} -
    - ) +
    + {item?.ProdTaxPercentage} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - {item?.ProdTaxPercentage || 0} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {item?.TotalAmt} -
    - ) +
    + {item?.TotalAmt} +
    + ) : Amount && ( -
    - {' '} - {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} +
    + )}
    ))} @@ -1365,18 +1376,18 @@ const PrintStyle5 = ({ {/* {ExtraChargeTotal>0 &&
    Extra Charges :
    {ExtraChargeTotal}
    } */} {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - {' '} -
    Off :
    {' '} -
    - {GlobaldummyData - ? '100' - : Number( +
    + {' '} +
    Off :
    {' '} +
    + {GlobaldummyData + ? '100' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    {' '} -
    - )} +
    {' '} +
    + )}
    @@ -1453,36 +1464,76 @@ const PrintStyle5 = ({ /-{' '}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0] .OldCreditBal > 0 ? ( @@ -1494,7 +1545,7 @@ const PrintStyle5 = ({ }

    ) : table2Data.CustomerDetails[0] - .OldCreditBal < 0 ? ( + .OldCreditBal < 0 ? (

    {' '} Opening Balance:{' '} @@ -1507,30 +1558,30 @@ const PrintStyle5 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0] - .CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - { - table2Data.CustomerDetails[0] - .CurrentCreditBal - } -

    - ) : table2Data.CustomerDetails[0] - .CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0] - .CurrentCreditBal - )} -

    - ) : null} -
    - )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0] + .CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + { + table2Data.CustomerDetails[0] + .CurrentCreditBal + } +

    + ) : table2Data.CustomerDetails[0] + .CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0] + .CurrentCreditBal + )} +

    + ) : null} +
    + )}
    {/*
    TOTAL SAVING : 10.00
    */}
    @@ -1541,54 +1592,54 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalQrcodet && ( +
    -
    - {' '} - {' '} -
    -
    Scan to Pay
    -
    - {' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} -
    + {' '} + {' '}
    - ) +
    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 + )}
    - )} +
    + )}
    )}
    @@ -1598,7 +1649,7 @@ const PrintStyle5 = ({ extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1682,23 +1733,23 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -1718,138 +1769,138 @@ const PrintStyle5 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -2078,8 +2129,8 @@ const PrintStyle5 = ({ {GlobaldummyData ? '100' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    {' '}
    )} @@ -2153,39 +2204,79 @@ const PrintStyle5 = ({ /-{' '}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: { @@ -2194,7 +2285,7 @@ const PrintStyle5 = ({ }

    ) : table2Data.CustomerDetails[0] - .OldCreditBal < 0 ? ( + .OldCreditBal < 0 ? (

    {' '} Opening Balance:{' '} @@ -2207,30 +2298,30 @@ const PrintStyle5 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - { - table2Data.CustomerDetails[0] - .CurrentCreditBal - } -

    - ) : table2Data.CustomerDetails[0] - .CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0] - .CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + { + table2Data.CustomerDetails[0] + .CurrentCreditBal + } +

    + ) : table2Data.CustomerDetails[0] + .CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0] + .CurrentCreditBal + )} +

    + ) : null} +
    + )}
    {/*
    TOTAL SAVING : 10.00
    */}
    @@ -2241,47 +2332,47 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalQrcodet && ( +
    -
    - {' '} - {' '} -
    -
    Scan to Pay
    -
    - {' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    + {' '} + {' '}
    - ) +
    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)}
    - )} +
    + )}
    )}
    @@ -2291,7 +2382,7 @@ const PrintStyle5 = ({ extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2369,23 +2460,23 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2405,138 +2496,138 @@ const PrintStyle5 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -2583,7 +2674,7 @@ const PrintStyle5 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    {' '} @@ -2676,10 +2767,10 @@ const PrintStyle5 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )}{' '} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}{' '}
    {' '}
    @@ -2711,15 +2802,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - S.No -
    - ) +
    + S.No +
    + ) : SLNO && ( -
    - S.No -
    - )} +
    + S.No +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -2738,78 +2829,78 @@ const PrintStyle5 = ({ : Item && 'ITEM /DES /'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'Qty/Kg' :'Qty'}{' '} + : Quantity && WeightasKg ? 'Qty/Kg' : 'Qty'}{' '}
    )} {GlobaldummyData ? GlobalHsnCode && ( -
    - HSN -
    - ) +
    + HSN +
    + ) : HsnCode && ( -
    - HSN -
    - )} +
    + HSN +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - MRP -
    - ) +
    + MRP +
    + ) : MRP && ( -
    - MRP -
    - )} +
    + MRP +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - RATE -
    - ) +
    + RATE +
    + ) : Rate && ( -
    - RATE -
    - )} +
    + RATE +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - DIS{' '} -
    - ) +
    + DIS{' '} +
    + ) : Discount && ( -
    - DIS{' '} -
    - )} +
    + DIS{' '} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - TAX %{' '} -
    - ) +
    + TAX %{' '} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - TAX %{' '} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + TAX %{' '} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {' '} - Amt{' '} -
    - ) +
    + {' '} + Amt{' '} +
    + ) : Amount && ( -
    - {' '} - AMT{' '} -
    - )} +
    + {' '} + AMT{' '} +
    + )}

    @@ -2830,15 +2921,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - {index + 1} -
    - ) +
    + {index + 1} +
    + ) : SLNO && ( -
    - {index + 1} -
    - )} +
    + {index + 1} +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -2963,76 +3054,76 @@ const PrintStyle5 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( -
    - {item?.HSN} -
    - ) +
    + {item?.HSN} +
    + ) : HsnCode && ( -
    - {item?.HSN} -
    - )} +
    + {item?.HSN} +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - {item?.MRP} -
    - ) +
    + {item?.MRP} +
    + ) : MRP && ( -
    - {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} -
    - )} +
    + {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - {item?.Rate} -
    - ) +
    + {item?.Rate} +
    + ) : Rate && ( -
    - {item?.Rate} -
    - )} +
    + {item?.Rate} +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - {item?.discount} -
    - ) +
    + {item?.discount} +
    + ) : Discount && ( -
    - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} -
    - )} +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - {item?.ProdTaxPercentage} -
    - ) +
    + {item?.ProdTaxPercentage} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - {item?.ProdTaxPercentage || 0} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {item?.TotalAmt} -
    - ) +
    + {item?.TotalAmt} +
    + ) : Amount && ( -
    - {' '} - {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} +
    + )}
    ) )} @@ -3063,15 +3154,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - S.No -
    - ) +
    + S.No +
    + ) : SLNO && ( -
    - S.No -
    - )} +
    + S.No +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -3090,78 +3181,78 @@ const PrintStyle5 = ({ : Item && 'ITEM /DES /'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'Qty/Kg' :'Qty'}{' '} + : Quantity && WeightasKg ? 'Qty/Kg' : 'Qty'}{' '}
    )} {GlobaldummyData ? GlobalHsnCode && ( -
    - HSN -
    - ) +
    + HSN +
    + ) : HsnCode && ( -
    - HSN -
    - )} +
    + HSN +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - MRP -
    - ) +
    + MRP +
    + ) : MRP && ( -
    - MRP -
    - )} +
    + MRP +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - RATE -
    - ) +
    + RATE +
    + ) : Rate && ( -
    - RATE -
    - )} +
    + RATE +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - DIS{' '} -
    - ) +
    + DIS{' '} +
    + ) : Discount && ( -
    - DIS{' '} -
    - )} +
    + DIS{' '} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - TAX %{' '} -
    - ) +
    + TAX %{' '} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - TAX %{' '} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + TAX %{' '} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {' '} - Amt{' '} -
    - ) +
    + {' '} + Amt{' '} +
    + ) : Amount && ( -
    - {' '} - AMT{' '} -
    - )} +
    + {' '} + AMT{' '} +
    + )}

    @@ -3182,15 +3273,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - {index + 1} -
    - ) +
    + {index + 1} +
    + ) : SLNO && ( -
    - {index + 1} -
    - )} +
    + {index + 1} +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -3246,76 +3337,76 @@ const PrintStyle5 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( -
    - {item?.HSN} -
    - ) +
    + {item?.HSN} +
    + ) : HsnCode && ( -
    - {item?.HSN} -
    - )} +
    + {item?.HSN} +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - {item?.MRP} -
    - ) +
    + {item?.MRP} +
    + ) : MRP && ( -
    - {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} -
    - )} +
    + {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - {item?.Rate} -
    - ) +
    + {item?.Rate} +
    + ) : Rate && ( -
    - {item?.Rate} -
    - )} +
    + {item?.Rate} +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - {item?.discount} -
    - ) +
    + {item?.discount} +
    + ) : Discount && ( -
    - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} -
    - )} +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - {item?.ProdTaxPercentage} -
    - ) +
    + {item?.ProdTaxPercentage} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - {item?.ProdTaxPercentage || 0} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {item?.TotalAmt} -
    - ) +
    + {item?.TotalAmt} +
    + ) : Amount && ( -
    - {' '} - {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} +
    + )}
    ) )} @@ -3489,8 +3580,8 @@ const PrintStyle5 = ({ {GlobaldummyData ? '100' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    {' '}
    )} @@ -3567,36 +3658,76 @@ const PrintStyle5 = ({ /-{' '}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > 0 ? (

    @@ -3616,25 +3747,25 @@ const PrintStyle5 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    {/*
    TOTAL SAVING : 10.00
    */}
    @@ -3645,47 +3776,47 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalQrcodet && ( +
    -
    - {' '} - {' '} -
    -
    Scan to Pay
    -
    - {' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    + {' '} + {' '}
    - ) +
    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)}
    - )} +
    + )}
    )}
    @@ -3694,7 +3825,7 @@ const PrintStyle5 = ({ {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

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

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -3809,137 +3940,137 @@ const PrintStyle5 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} -
    2. - ))} -
    -
    - )} + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} +
    +
    + )} {GlobaldummyData ? GlobalSignature && ( -
    +

    -

    - Signature -

    - -
    - ) + Signature +

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

    -

    - Signature -

    - -
    - )} + Signature +

    + +
    + )}
    )}
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx index 2f03b14..fde7306 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx @@ -102,6 +102,7 @@ const Printstyle6 = ({ const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); const SettingData = useSelector(PreferenceData); + console.log(CashierNameField, "GlobaldummyData") const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find( (setting) => @@ -123,6 +124,17 @@ const Printstyle6 = ({ const paymentTypeUPI = PaymentStatus?.find( (ps) => ps.PaymentTypeName === 'UPI' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) console.log(GlobalDiscount, Discount, 'Discount'); @@ -335,8 +347,8 @@ const Printstyle6 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -391,7 +403,7 @@ const Printstyle6 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( -
    + {table2Data?.BrMobile &&
    Mobile : {table2Data?.BrMobile} -
    +
    } {table2Data?.OrderType === 'E' && (
    {Date1}
    @@ -523,8 +535,8 @@ const Printstyle6 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( @@ -544,136 +556,136 @@ const Printstyle6 = ({ : Item && 'ITEM /DES/'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'QTY/KG' :'QTY'} + : Quantity && WeightasKg ? 'QTY/KG' : 'QTY'} )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - AMt - - ) + + AMt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -683,10 +695,10 @@ const Printstyle6 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( {item?.ProdName}
    {item?.Size + - item?.UomName + - '-' + - GlobaldummyData + item?.UomName + + '-' + + GlobaldummyData ? GlobalQuantity && item?.SalesQty : item?.SalesQty}
    @@ -778,90 +790,90 @@ const Printstyle6 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); })} @@ -889,8 +901,8 @@ const Printstyle6 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( @@ -910,136 +922,136 @@ const Printstyle6 = ({ : Item && 'ITEM /DES/'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'QTY/KG' :'QTY'} + : Quantity && WeightasKg ? 'QTY/KG' : 'QTY'} )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - AMt - - ) + + AMt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -1049,10 +1061,10 @@ const Printstyle6 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( {item?.ProdName}
    {item?.Size + - item?.UomName + - '-' + - GlobaldummyData + item?.UomName + + '-' + + GlobaldummyData ? GlobalQuantity && item?.SalesQty : item?.SalesQty}
    @@ -1094,139 +1106,139 @@ const Printstyle6 = ({ > {(GlobaldummyData ? GlobalItem && - item?.ProdName + - `(${item?.Size + item?.UomName})` + item?.ProdName + + `(${item?.Size + item?.UomName})` : Item && - item?.ProdName + - `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})`) + + item?.ProdName + + `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})`) + item?.BrandName !== - null + null ? item?.BrandName : '' + - item?.ProductIdentifierDtls - ?.length > - 0 + item?.ProductIdentifierDtls + ?.length > + 0 ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return
    {a.SerialNumber}
    ; - }) + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return
    {a.SerialNumber}
    ; + }) : '' + - item?.ProductIdentifierDtls - ?.length > - 0 + 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(',')} -
    - ); - }) + (item1) => + item1.IMEI1 !== '' || + item1.IMEI2 !== '' + )?.map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) : '' + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : Quantity && item?.SalesQty)} + '-' + + (GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : Quantity && item?.SalesQty)} )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); })} @@ -1267,17 +1279,17 @@ const Printstyle6 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off :{' '} - {GlobaldummyData - ? '10' - : Number( +
    + Off :{' '} + {GlobaldummyData + ? '10' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} +
    -
    - )} + )}
    {table2Data?.OrderType === 'E' ? ( @@ -1649,41 +1661,80 @@ const Printstyle6 = ({ : Number(table2Data?.NetAmount).toFixed(2)}
    - + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -1701,28 +1752,28 @@ const Printstyle6 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} - {PaymentStatus?.length > 1 && ( + {(PaymentStatus?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -1746,48 +1797,48 @@ const Printstyle6 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} -
    +
    + QRcode +
    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 + )}
    - )} +
    + )}
    )}
    @@ -1810,7 +1861,7 @@ const Printstyle6 = ({
    {/*
    Card No
    */} - {GlobaldummyData && ( + {GlobaldummyData && GlobalCashierName && (
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2028,137 +2080,137 @@ const Printstyle6 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -2232,8 +2284,8 @@ const Printstyle6 = ({ {GlobaldummyData ? '10' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -2610,40 +2662,81 @@ const Printstyle6 = ({
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -2661,27 +2754,27 @@ const Printstyle6 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} - {PaymentStatus?.length > 1 && ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} + {(PaymentStatus?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2705,44 +2798,44 @@ const Printstyle6 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    +
    + QRcode +
    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)}
    - )} +
    + )}
    )}
    @@ -2765,7 +2858,7 @@ const Printstyle6 = ({
    {/*
    Card No
    */} - {GlobaldummyData && ( + {GlobaldummyData && GlobalCashierName && (
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2980,137 +3074,137 @@ const Printstyle6 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -3161,7 +3255,7 @@ const Printstyle6 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( -
    + {table2Data?.BrMobile &&
    Mobile : {table2Data?.BrMobile} -
    +
    } {table2Data?.OrderType === 'E' && (
    {Date1}
    @@ -3307,76 +3401,76 @@ const Printstyle6 = ({ : Item && 'ITEM /DES/'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'QTY/KG' :'QTY'} + : Quantity && WeightasKg ? 'QTY/KG' : 'QTY'} )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - AMt - - ) + + AMt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3409,9 +3503,9 @@ const Printstyle6 = ({
    {item?.ProdName}
    {item?.Size + - item?.UomName + - '-' + - GlobaldummyData + item?.UomName + + '-' + + GlobaldummyData ? GlobalQuantity && item?.SalesQty : item?.SalesQty}
    @@ -3472,89 +3566,89 @@ const Printstyle6 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3600,76 +3694,76 @@ const Printstyle6 = ({ : Item && 'ITEM /DES/'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'QTY/KG' :'QTY'} + : Quantity && WeightasKg ? 'QTY/KG' : 'QTY'} )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - AMt - - ) + + AMt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3702,9 +3796,9 @@ const Printstyle6 = ({
    {item?.ProdName}
    {item?.Size + - item?.UomName + - '-' + - GlobaldummyData + item?.UomName + + '-' + + GlobaldummyData ? GlobalQuantity && item?.SalesQty : item?.SalesQty}
    @@ -3719,133 +3813,133 @@ const Printstyle6 = ({ > {(GlobaldummyData ? GlobalItem && - item?.ProdName + - `(${item?.Size + item?.UomName})` + item?.ProdName + + `(${item?.Size + item?.UomName})` : Item && - item?.ProdName + - `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})`) + + item?.ProdName + + `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})`) + item?.BrandName !== - null + null ? item?.BrandName : '' + item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return
    {a.SerialNumber}
    ; - }) + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return
    {a.SerialNumber}
    ; + }) : '' + item?.ProductIdentifierDtls?.length > - 0 + 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(',')} -
    - ); - }) + (item1) => + item1.IMEI1 !== '' || + item1.IMEI2 !== '' + )?.map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) : '' + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : Quantity && item?.SalesQty)} + '-' + + (GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : Quantity && item?.SalesQty)} )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3884,8 +3978,8 @@ const Printstyle6 = ({ {GlobaldummyData ? '10' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -4242,70 +4336,110 @@ const Printstyle6 = ({ : Number(table2Data?.NetAmount).toFixed(2)}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} -

    - ) : null} - - )} + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} +

    + ) : null} + + )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} -

    - ) : null} -
    - )} - {PaymentStatus?.length > 1 && ( + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} +

    + ) : null} +
    + )} + {(PaymentStatus?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4328,44 +4462,44 @@ const Printstyle6 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    +
    + QRcode +
    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)}
    - )} +
    + )}
    )}
    @@ -4388,7 +4522,7 @@ const Printstyle6 = ({
    {/*
    Card No
    */} - {GlobaldummyData && ( + {GlobaldummyData && GlobalCashierName && (
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -4595,136 +4730,136 @@ const Printstyle6 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} -
    2. - ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    - )} + 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/PrintTemplates/ThermalPrinter/PrintStyle7.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx index 6ef6187..85ed1dd 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx @@ -1,1433 +1,4300 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import QRcode from '../../../../Images/QRcode.png' +import QRcode from '../../../../Images/QRcode.png'; import { extractLastNumberOrderId } from '../../../../Services/Others'; import { - GlobalprintSlNo, - GlobalprintItem, - GlobalprintMRP, - GlobalprintDiscount, - GlobalprintQuantity, - GlobalprintRate, - GlobalprintAmount, - GlobalprintHsnCode, - GlobalprintQrcodet, - GlobalPritdummyData, - GloabalFieldDetails, - changeReprintDataFound, - GlobalprintSignature, - GlobalprinttermsAndConditions, - GlobalSignatureImage, - Globalnotes, - GlobalthemeFormat, - GlobalBillName, - GlobalprintCashierName, - GlobalprintLogo, - GlobalprintCredit, - GlobalprintTax, + GlobalprintSlNo, + GlobalprintItem, + GlobalprintMRP, + GlobalprintDiscount, + GlobalprintQuantity, + GlobalprintRate, + GlobalprintAmount, + GlobalprintHsnCode, + GlobalprintQrcodet, + GlobalPritdummyData, + GloabalFieldDetails, + changeReprintDataFound, + GlobalprintSignature, + GlobalprinttermsAndConditions, + GlobalSignatureImage, + Globalnotes, + GlobalthemeFormat, + GlobalBillName, + GlobalprintCashierName, + GlobalprintLogo, + GlobalprintCredit, + GlobalprintTax, } from '../../../../Features/ThemeChange/ThemeChange'; -import Logo from '../../../../Images/Logo.jpg' -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; -import "../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.scss" +import Logo from '../../../../Images/Logo.jpg'; +import { + GlobalUpiIDprint, + PreferenceData, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.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'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; -const PrintStyle7 = ({ index, ExtraChargeTotal, Date1, totalQuantityFilter, CashierName, totalQuantity, OrderDetailGST, - OrderDetailIGST, OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, base64Image, PrintLogo, printDatas, isPdf, sportsAppPreference, SalesModePref, - MembershipApplied = null +const PrintStyle7 = ({ + index, + ExtraChargeTotal, + Date1, + totalQuantityFilter, + CashierName, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + OrderDetailVAT, + table2Data, + PaymentStatus, + PrintGreeting, + base64Image, + PrintLogo, + printDatas, + isPdf, + sportsAppPreference, + SalesModePref, + MembershipApplied = null, }) => { + const dispatch = useDispatch(); + const GlobalUpiID = useSelector(GlobalUpiIDprint); + const FieldDetails = useSelector(GloabalFieldDetails); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Tax = FieldDetails?.['Tax']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const CashierNameField = FieldDetails?.['CashierName']; + const LogoField = FieldDetails?.['Logo']; + const CreditDetails = FieldDetails?.['Credit details']; + const WeightasKg = FieldDetails?.['Weight']; + const GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalMRP = useSelector(GlobalprintMRP); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalTax = useSelector(GlobalprintTax); + 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); + const appPreferences = useSelector(ApplicationPreferences); + const GlobalCashierName = useSelector(GlobalprintCashierName); + const GlobalLogo = useSelector(GlobalprintLogo); + const GlobalCredit = useSelector(GlobalprintCredit); + const SettingData = useSelector(PreferenceData); + const estimatePrintHeader = + SettingData?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' + )?.SettingValue === 'Y'; + const bookingTypePreference = appPreferences?.find( + (preference) => preference?.PreferredCatName === 'Booking Type' + )?.PreferenceCatDetails; + const dinePreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'dine in' && + type?.PreferredStatus === 'Y' + ); + const takeAwayPreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'take away' && + type?.PreferredStatus === 'Y' + ); + const paymentTypeUPI = PaymentStatus?.find( + (ps) => ps.PaymentTypeName === 'UPI' + ); + console.log(GlobalDiscount, Discount, 'Discount'); + console.log(printDatas, 'printDatasjk'); - const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint) - const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Tax = FieldDetails?.["Tax"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const CashierNameField = FieldDetails?.["CashierName"]; - const LogoField = FieldDetails?.["Logo"]; - const CreditDetails = FieldDetails?.["Credit details"]; - const WeightasKg = FieldDetails?.['Weight']; - const GlobalSlNo = useSelector(GlobalprintSlNo); - const GlobalItem = useSelector(GlobalprintItem); - const GlobalMRP = useSelector(GlobalprintMRP); - const GlobalDiscount = useSelector(GlobalprintDiscount); - const GlobalTax = useSelector(GlobalprintTax); - 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) - const appPreferences = useSelector(ApplicationPreferences); - const GlobalCashierName = useSelector(GlobalprintCashierName); - const GlobalLogo = useSelector(GlobalprintLogo); - const GlobalCredit = useSelector(GlobalprintCredit); - const SettingData = useSelector(PreferenceData); - const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' - const bookingTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Booking Type')?.PreferenceCatDetails - const dinePreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "dine in" && type?.PreferredStatus === 'Y') - const takeAwayPreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "take away" && type?.PreferredStatus === 'Y') - const paymentTypeUPI = PaymentStatus?.find((ps) => ps.PaymentTypeName === "UPI") - console.log(GlobalDiscount, Discount, "Discount"); - console.log(printDatas, "printDatasjk") - let TermsAndConditions = printDatas?.TermsandConditions - let SignatureImg = printDatas?.Signature - let Notestext = printDatas?.Notes - let BillName = printDatas?.PrintHdrName - let FormatTheme = printDatas?.PrintType == "S" ? true : false - let PageSize = printDatas?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - const PackageDetails = table2Data?.PackageDtl; - - 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 formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; - const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") - const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") - - const TakeawayTotal = TakeawayData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, - ); - const DineInTotal = DineInData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, - ); - const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); - - if (acc[paymentType]) { - acc[paymentType] += amount; - } else { - acc[paymentType] = amount; - } - - return acc; - }, {}); - 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', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - ]; - - const chunkSize = PageSize == "A5" ? 8 : 11; - let dataSource = []; - - if (GlobaldummyData || TakeawayData?.length > 0) { - dataSource = GlobaldummyData ? products : TakeawayData; - } else if (DineInData?.length > 0) { - dataSource = DineInData; - } - - // 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 isEditedBill = PaymentStatus?.some((payment) => { + const type = payment?.AdjustmentType?.toLowerCase(); return ( - <> - {FormatTheme ? -
    - {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    0 ? ' print-page-break' : ''}`} - style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: isMobile ? "295mm" : FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> - - - {/*
    */} -
    -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {/*
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    */} -
    - {(GlobaldummyData && GlobalLogo) ? image : null} - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    -
    {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?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? 'Cash' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    - -
    -
    -
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    -
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    -
    - -
    -
    - -
    -
    - - {(TakeawayData?.length > 0 || GlobaldummyData) && - <> - {takeAwayPreference &&
    TakeAway
    } -
    - - - - - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - - - {dataChunk?.map((item, index) => ( - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && - : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - ))} - -
    SSItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) - - ))} - -
    - :
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    )} -
    {item?.HSN}{item?.HSN}{item?.SalesQty}{item?.SalesQty}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - } - {(DineInData?.length > 0 && dinePreference) && - <> -
    Dine In
    - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - - - {dataChunk?.map((item, index) => ( - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && - : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - ))} - -
    S.NoS.NOItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {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?.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}{item?.HSN}{item?.SalesQty}{item?.SalesQty}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - } -
    -
    - - - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - <> -
    -
    -
    Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    Qty : {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off : {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } -
    -
    - {(table2Data?.OrderType === "E") ? '' :
    - - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -
    - --------- GST Breakup Details -----------
    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - - } -
    } -
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    Take Away : ₹{Number(TakeawayTotal).toFixed(2)}
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    Dine In: ₹{Number(DineInTotal).toFixed(2)}
    - } -
    Amount : ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - -
    -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} - {(GlobaldummyData && GlobalCashierName) && -
    -
    Cashier : Cashier Name
    -
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    -
    Cashier : {CashierName}
    -
    - } - {GlobaldummyData && -
    -
    Customer : Customer Name
    -
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    -
    Customer : {table2Data?.CustSuppName}
    -
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet && -
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - : (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    } - -
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - -
    -
    ) - } -
    } - - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {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
    -
    - - } - - } -
    - ))} - - {shouldFooterBeOnNewPage && FormatTheme && -
    -
    - <> -
    -
    -
    Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    Qty : {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off : {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } -
    -
    - {(table2Data?.OrderType === "E") ? '' :
    - - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -
    - --------- GST Breakup Details -----------
    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - - } -
    } -
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    Take Away : ₹{Number(TakeawayTotal).toFixed(2)}
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    Dine In: ₹{Number(DineInTotal).toFixed(2)}
    - } -
    Amount : ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - -
    -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} - {(GlobaldummyData && GlobalCashierName) && -
    -
    Cashier : Cashier Name
    -
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    -
    Cashier : {CashierName}
    -
    - } - {GlobaldummyData && -
    -
    Customer : Customer Name
    -
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    -
    Customer : {table2Data?.CustSuppName}
    -
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet && -
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - : (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    } - -
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - -
    -
    ) - } -
    } - - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {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
    -
    - - } - -
    -
    - } -
    - - - : -
    -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    -
    - {(GlobaldummyData && GlobalLogo) ? image : null} - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    - -
    {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?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    - -
    -
    -
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    -
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    -
    - -
    - -
    - - - - {(TakeawayData?.length > 0 || GlobaldummyData) && - <> - {takeAwayPreference &&
    TakeAway
    } -
    - - - - - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - - - {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => ( - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && - : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - ))} - -
    S.NoS.NoItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) - - ))} -
    - :
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    )} -
    {item?.HSN}{item?.HSN}{item?.SalesQty}{item?.SalesQty}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - } - {(DineInData?.length > 0 && dinePreference) && - <> -
    Dine In
    - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - - - {(GlobaldummyData ? products : DineInData)?.map((item, index) => ( - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && - : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - ))} - -
    SSItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
    {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}{item?.HSN}{item?.SalesQty}{item?.SalesQty}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - } -
    - -
    -
    -
    Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    Qty : {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off : {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } -
    -
    - {(table2Data?.OrderType === "E") ? '' :
    - - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -
    - --------- GST Breakup Details -----------
    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - - } -
    } -
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    Take Away : ₹{Number(TakeawayTotal).toFixed(2)}
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    Dine In: ₹{Number(DineInTotal).toFixed(2)}
    - } -
    Amount : ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - -
    -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} - {(GlobaldummyData && GlobalCashierName) && -
    -
    Cashier : Cashier Name
    -
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    -
    Cashier : {CashierName}
    -
    - } - {GlobaldummyData && -
    -
    Customer : Customer Name
    -
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    -
    Customer : {table2Data?.CustSuppName}
    -
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet && -
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - : (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    } - -
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - -
    -
    ) - } -
    } - - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {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
    -
    - - } -
    - } - + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ); + + let TermsAndConditions = printDatas?.TermsandConditions; + let SignatureImg = printDatas?.Signature; + let Notestext = printDatas?.Notes; + let BillName = printDatas?.PrintHdrName; + let FormatTheme = printDatas?.PrintType == 'S' ? true : false; + let PageSize = printDatas?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + const PackageDetails = table2Data?.PackageDtl; + + 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 formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; + const TakeawayData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' + ); + const DineInData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' + ); + + const TakeawayTotal = TakeawayData?.reduce( + (accumulator, currentValue) => accumulator + currentValue.TotalAmt, + 0 + ); + const DineInTotal = DineInData?.reduce( + (accumulator, currentValue) => accumulator + currentValue.TotalAmt, + 0 + ); + const aggregatedPayments = PaymentStatusSuccess?.reduce( + (acc, paymentdata) => { + const paymentType = paymentdata?.PaymentTypeName; + const amount = Number(paymentdata?.Amount); + + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } + + return acc; + }, + {} + ); + 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.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 18, + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 40, + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + ]; + + const chunkSize = PageSize == 'A5' ? 8 : 11; + let dataSource = []; + + if (GlobaldummyData || TakeawayData?.length > 0) { + dataSource = GlobaldummyData ? products : TakeawayData; + } else if (DineInData?.length > 0) { + dataSource = DineInData; + } + + // 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); + + return ( + <> + {FormatTheme ? ( +
    + {paginatedChunks.map((dataChunk, chunkIndex) => ( +
    0 ? ' print-page-break' : ''}` + } + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: isMobile + ? '295mm' + : FormatTheme + ? PageSize == 'A5' + ? '170mm' + : '257mm' + : '', + }} + key={chunkIndex} + > + {/*
    */} +
    +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {/*
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    */} +
    + {GlobaldummyData && GlobalLogo ? ( + image + ) : null} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    + {' '} + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    +
    +
    + {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?.OrderType === 'E' && ( +
    + {' '} + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? 'Cash' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + {' '} + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    + +
    +
    +
    + Bill No : + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    +
    +
    + {GlobaldummyData ? formattedDate : Date1} +
    +
    +
    + +
    +
    + +
    +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( + <> + {takeAwayPreference && ( +
    + TakeAway +
    + )} +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + + + {dataChunk?.map((item, index) => ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + ))} + +
    SSItemItemHSNHSNQty + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateDis Dis Tax % Tax % + Amt + + Amt +
    + {index + 1} + + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +
    + {item?.HSN} + + {item?.HSN} + + {item?.SalesQty} + + {item?.SalesQty} + + {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    +
    + + )} + {DineInData?.length > 0 && dinePreference && ( + <> +
    + Dine In +
    + +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + + + {dataChunk?.map((item, index) => ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + ))} + +
    S.NoS.NOItemItemHSNHSNQty + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateDis Dis Tax % Tax % + Amt + + Amt +
    + {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?.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} + + {item?.HSN} + + {item?.SalesQty} + + {item?.SalesQty} + + {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    +
    + + )} +
    +
    + + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> +
    +
    +
    + Items :{' '} + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    + Qty : {GlobaldummyData ? '9' : totalQuantity} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + Off :{' '} + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} +
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +
    + --------- GST Breakup Details ----------- +
    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed( + 2 + )} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed( + 2 + )} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} +
    +
    + + )} +
    + )} +
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + Take Away : ₹{Number(TakeawayTotal).toFixed(2)} +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + Dine In: ₹{Number(DineInTotal).toFixed(2)} +
    + )} +
    + Amount : ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + +
    + + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} + +
    +
    +
    + )} +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + )} + + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} + {GlobaldummyData && GlobalCashierName && ( +
    +
    + Cashier : Cashier Name +
    +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    +
    + Cashier : {CashierName} +
    +
    + )} + {GlobaldummyData && ( +
    +
    + Customer : Customer Name +
    +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    +
    + Customer : {table2Data?.CustSuppName} +
    +
    + )} + + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + )} + +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

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

    + {Notestext} +

    + +
    +
    + )} +
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {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 +
    +
    + + )} + + )} +
    + ))} + + {shouldFooterBeOnNewPage && FormatTheme && ( +
    +
    + <> +
    +
    +
    + Items :{' '} + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    + Qty : {GlobaldummyData ? '9' : totalQuantity} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + Off :{' '} + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} +
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +
    + --------- GST Breakup Details ----------- +
    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} +
    +
    + + )} +
    + )} +
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + Take Away : ₹{Number(TakeawayTotal).toFixed(2)} +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + Dine In: ₹{Number(DineInTotal).toFixed(2)} +
    + )} +
    + Amount : ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + +
    + + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + )} + + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} + {GlobaldummyData && GlobalCashierName && ( +
    +
    + Cashier : Cashier Name +
    +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    +
    + Cashier : {CashierName} +
    +
    + )} + {GlobaldummyData && ( +
    +
    + Customer : Customer Name +
    +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    +
    + Customer : {table2Data?.CustSuppName} +
    +
    + )} + + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + )} + +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

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

    + {Notestext} +

    + +
    +
    + )} +
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {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 +
    +
    + + )} + +
    +
    + )} +
    + ) : ( +
    +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {GlobaldummyData && GlobalLogo ? ( + image + ) : null} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    + {' '} + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    +
    + +
    + {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?.OrderType === 'E' && ( +
    + {' '} + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + {' '} + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    + +
    +
    +
    + Bill No : + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    +
    +
    + {GlobaldummyData ? formattedDate : Date1} +
    +
    +
    + +
    + +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( + <> + {takeAwayPreference && ( +
    + TakeAway +
    + )} +
    + + + + {GlobaldummyData + ? GlobalSlNo && + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item == true && } + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + + + {(GlobaldummyData ? products : TakeawayData)?.map( + (item, index) => ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + ) + )} + +
    S.NoS.No + Item + ItemHSNHSNQty + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateDis Dis Tax % Tax % Amt + Amt +
    + {index + 1} + + {index + 1} + {item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +
    + {item?.HSN} + + {item?.HSN} + + {item?.SalesQty} + + {item?.SalesQty} + + {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    +
    + + )} + {DineInData?.length > 0 && dinePreference && ( + <> +
    + Dine In +
    + +
    + + + + {GlobaldummyData + ? GlobalSlNo && + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + + + {(GlobaldummyData ? products : DineInData)?.map( + (item, index) => ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + ) + )} + +
    SSItemItemHSNHSNQty + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateDis Dis Tax % Tax % + Amt + + Amt +
    + {index + 1} + + {index + 1} + {item?.ProdName} +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return
    {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} + + {item?.HSN} + + {item?.SalesQty} + + {item?.SalesQty} + + {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    +
    + + )} +
    + +
    +
    +
    + Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    + Qty : {GlobaldummyData ? '9' : totalQuantity} +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    + Off :{' '} + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} +
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +
    + --------- GST Breakup Details ----------- +
    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed( + 2 + )} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed( + 2 + )} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )} +
    +
    + + )} +
    + )} +
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + Take Away : ₹{Number(TakeawayTotal).toFixed(2)} +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + Dine In: ₹{Number(DineInTotal).toFixed(2)} +
    + )} +
    + Amount : ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + +
    + + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + )} + + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} +

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} +

    + ) : null} +
    + )} + {GlobaldummyData && GlobalCashierName && ( +
    +
    + Cashier : Cashier Name +
    +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    +
    + Cashier : {CashierName} +
    +
    + )} + {GlobaldummyData && ( +
    +
    + Customer : Customer Name +
    +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    +
    + Customer : {table2Data?.CustSuppName} +
    +
    + )} + + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + )} + +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    + +
    +
    + )} +
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {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 PrintStyle7; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx index 1838949..4a347d7 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx @@ -1,1517 +1,4771 @@ 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, - GlobalprintCashierName, - GlobalprintLogo, - GlobalprintCredit, - GlobalprintTax, + extractLastNumber, + extractLastNumberOrderId, +} from '../../../../Services/Others'; +import { + GlobalprintSlNo, + GlobalprintItem, + GlobalprintMRP, + GlobalprintDiscount, + GlobalprintQuantity, + GlobalprintRate, + GlobalprintAmount, + GlobalprintHsnCode, + GlobalprintQrcodet, + GlobalPritdummyData, + changeReprintDataFound, + GloabalFieldDetails, + GlobalprintSignature, + GlobalprinttermsAndConditions, + GlobalSignatureImage, + Globalnotes, + GlobalthemeFormat, + GlobalBillName, + GlobalprintCashierName, + GlobalprintLogo, + GlobalprintCredit, + GlobalprintTax, } from '../../../../Features/ThemeChange/ThemeChange'; -import Logo from '../../../../Images/Logo.jpg' -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import Logo from '../../../../Images/Logo.jpg'; +import { + GlobalUpiIDprint, + PreferenceData, +} 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'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; -const Printstyle8 = ({ index, ExtraChargeTotal, Date1, totalQuantityFilter, BranchAddress, BranchCity, BranchZip, CashierName, totalQuantity, OrderDetailGST, OrderDetailIGST, - OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, base64Image, PrintLogo, printDatas, isPdf, sportsAppPreference, SalesModePref, MembershipApplied = null }) => { +const Printstyle8 = ({ + index, + ExtraChargeTotal, + Date1, + totalQuantityFilter, + BranchAddress, + BranchCity, + BranchZip, + CashierName, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + OrderDetailVAT, + table2Data, + PaymentStatus, + PrintGreeting, + base64Image, + PrintLogo, + printDatas, + isPdf, + sportsAppPreference, + SalesModePref, + MembershipApplied = null, +}) => { + const dispatch = useDispatch(); + const GlobalUpiID = useSelector(GlobalUpiIDprint); + const FieldDetails = useSelector(GloabalFieldDetails); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Tax = FieldDetails?.['Tax']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const CashierNameField = FieldDetails?.['CashierName']; + const LogoField = FieldDetails?.['Logo']; + const CreditDetails = FieldDetails?.['Credit details']; + const WeightasKg = FieldDetails?.['Weight']; + const GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalMRP = useSelector(GlobalprintMRP); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalTax = useSelector(GlobalprintTax); + 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); + const appPreferences = useSelector(ApplicationPreferences); + const GlobalCashierName = useSelector(GlobalprintCashierName); + const GlobalLogo = useSelector(GlobalprintLogo); + const GlobalCredit = useSelector(GlobalprintCredit); + const SettingData = useSelector(PreferenceData); + const estimatePrintHeader = + SettingData?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' + )?.SettingValue === 'Y'; + const bookingTypePreference = appPreferences?.find( + (preference) => preference?.PreferredCatName === 'Booking Type' + )?.PreferenceCatDetails; + const dinePreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'dine in' && + type?.PreferredStatus === 'Y' + ); + const takeAwayPreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'take away' && + type?.PreferredStatus === 'Y' + ); + const paymentTypeUPI = PaymentStatus?.find( + (ps) => ps.PaymentTypeName === 'UPI' + ); - const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint) - const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Tax = FieldDetails?.["Tax"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const CashierNameField = FieldDetails?.["CashierName"]; - const LogoField = FieldDetails?.["Logo"]; - const CreditDetails = FieldDetails?.["Credit details"]; - const WeightasKg = FieldDetails?.['Weight']; - const GlobalSlNo = useSelector(GlobalprintSlNo); - const GlobalItem = useSelector(GlobalprintItem); - const GlobalMRP = useSelector(GlobalprintMRP); - const GlobalDiscount = useSelector(GlobalprintDiscount); - const GlobalTax = useSelector(GlobalprintTax); - 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) - const appPreferences = useSelector(ApplicationPreferences); - const GlobalCashierName = useSelector(GlobalprintCashierName); - const GlobalLogo = useSelector(GlobalprintLogo); - const GlobalCredit = useSelector(GlobalprintCredit); - const SettingData = useSelector(PreferenceData); - const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' - const bookingTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Booking Type')?.PreferenceCatDetails - const dinePreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "dine in" && type?.PreferredStatus === 'Y') - const takeAwayPreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "take away" && type?.PreferredStatus === 'Y') - const paymentTypeUPI = PaymentStatus?.find((ps) => ps.PaymentTypeName === "UPI") - - console.log(GlobalDiscount, Discount, "Discount"); - - let TermsAndConditions = printDatas?.TermsandConditions - let SignatureImg = printDatas?.Signature - let Notestext = printDatas?.Notes - let BillName = printDatas?.PrintHdrName - let FormatTheme = printDatas?.PrintType == "S" ? true : false - let PageSize = printDatas?.PageSize; - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") - const keysLength = Object.keys(table2Data ?? {}).length; - if (keysLength > 0) { - dispatch(changeReprintDataFound(true)); - } - const PackageDetails = table2Data?.PackageDtl; - 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 formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; - - const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") - const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") - - const TakeawayTotal = TakeawayData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, - ); - const DineInTotal = DineInData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, - ); - - const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); - - if (acc[paymentType]) { - acc[paymentType] += amount; - } else { - acc[paymentType] = amount; - } - - return acc; - }, {}); - 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', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - ]; - - console.log(printDatas, "printDatasjk") - const chunkSize = PageSize == "A5" ? 10 : 16; - let dataSource = []; - - if (GlobaldummyData || TakeawayData?.length > 0) { - dataSource = GlobaldummyData ? products : TakeawayData; - } else if (DineInData?.length > 0) { - dataSource = DineInData; - } - - // 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); + console.log(GlobalDiscount, Discount, 'Discount'); + const isEditedBill = PaymentStatus?.some((payment) => { + const type = payment?.AdjustmentType?.toLowerCase(); return ( - <> - {FormatTheme ? -
    - {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    0 ? ' print-page-break' : ''}`} - style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: isMobile ? "295mm" : FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> - - - {/*
    */} -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {/*

    {table2Data?.BrName}

    */} - -
    - {(GlobalLogo && GlobaldummyData) ? image : null} - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    - - -
    - {GlobaldummyData ? - 'BranchAddress, Town- 635XXX City - State' : - (BranchAddress || '') + (BranchCity ? (BranchAddress && BranchCity ? '-' : '') + BranchCity : '') + (BranchZip ? (BranchCity && BranchZip ? '-' : '') + BranchZip : '')} -
    -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    -
    )} - {table2Data?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? 'Cash' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - -
    -
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    - -
    -
    -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && - <> - {takeAwayPreference &&
    TakeAway
    } - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - - - {dataChunk?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} - -
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {chunkIndex * chunkSize + index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {( - PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount}PCS{item.ParcelQty}PACK({item.ParcelType}) - - ))} -
    - :
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    )} -
    {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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - - } - {(DineInData?.length > 0 && dinePreference) && - <> -
    Dine In
    - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - - - {dataChunk?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} - -
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {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?.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}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - - } -
    - - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - - <> -
    -
    -
    -
    Items
    -
    :
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    -
    Qty
    -
    :
    -
    {GlobaldummyData ? '9' : totalQuantity}
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    Off
    -
    :
    -
    {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    -
    Take Away
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(TakeawayTotal).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    -
    Dine In
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)}
    -
    - } -
    -
    Amount
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    -
    - -
    - - {(table2Data?.OrderType === "E") ? '' :
    -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - - } -
    -
    } - -
    - -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    -
    - - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} -
    - -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} -
    - } - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} -
    - } - - - {(table2Data?.BookingTypeName === "Dine In" && dinePreference) && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) &&
    Captain: {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } -
    - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet &&
    -
    - 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)}
    -
    } -
    } -
    - -
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - -
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - -
    -
    ) - } -
    } - - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {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 -
    - } - - } -
    - ))} - - {shouldFooterBeOnNewPage && FormatTheme && -
    -
    - <> -
    -
    -
    -
    Items
    -
    :
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    -
    Qty
    -
    :
    -
    {GlobaldummyData ? '9' : totalQuantity}
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    Off
    -
    :
    -
    {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    -
    Take Away
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(TakeawayTotal).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    -
    Dine In
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)}
    -
    - } -
    -
    Amount
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    -
    - -
    - - {(table2Data?.OrderType === "E") ? '' :
    -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - - } -
    -
    } - -
    - -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    -
    - - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} -
    - -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} -
    - } - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} -
    - } - {(table2Data?.BookingTypeName === "Dine In" && dinePreference) && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) &&
    Captain: {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } -
    - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet &&
    -
    - 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)}
    -
    } -
    } -
    - -
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - -
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - -
    -
    ) - } -
    } - - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {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 -
    - } - -
    -
    - } - + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ); + + let TermsAndConditions = printDatas?.TermsandConditions; + let SignatureImg = printDatas?.Signature; + let Notestext = printDatas?.Notes; + let BillName = printDatas?.PrintHdrName; + let FormatTheme = printDatas?.PrintType == 'S' ? true : false; + let PageSize = printDatas?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); + const keysLength = Object.keys(table2Data ?? {}).length; + if (keysLength > 0) { + dispatch(changeReprintDataFound(true)); + } + const PackageDetails = table2Data?.PackageDtl; + 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 formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; + + const TakeawayData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' + ); + const DineInData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' + ); + + const TakeawayTotal = TakeawayData?.reduce( + (accumulator, currentValue) => accumulator + currentValue.TotalAmt, + 0 + ); + const DineInTotal = DineInData?.reduce( + (accumulator, currentValue) => accumulator + currentValue.TotalAmt, + 0 + ); + + const aggregatedPayments = PaymentStatusSuccess?.reduce( + (acc, paymentdata) => { + const paymentType = paymentdata?.PaymentTypeName; + const amount = Number(paymentdata?.Amount); + + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } + + return acc; + }, + {} + ); + 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.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 18, + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 40, + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + ]; + + console.log(printDatas, 'printDatasjk'); + const chunkSize = PageSize == 'A5' ? 10 : 16; + let dataSource = []; + + if (GlobaldummyData || TakeawayData?.length > 0) { + dataSource = GlobaldummyData ? products : TakeawayData; + } else if (DineInData?.length > 0) { + dataSource = DineInData; + } + + // 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); + + return ( + <> + {FormatTheme ? ( +
    + {paginatedChunks.map((dataChunk, chunkIndex) => ( +
    0 ? ' print-page-break' : ''}` + } + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: isMobile + ? '295mm' + : FormatTheme + ? PageSize == 'A5' + ? '170mm' + : '257mm' + : '', + }} + key={chunkIndex} + > + {/*
    */} +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {/*

    {table2Data?.BrName}

    */} + +
    + {GlobalLogo && GlobaldummyData ? ( + image + ) : null} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    +
    + +
    + {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +
    +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} +
    +
    + )} + {table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? 'Cash' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + +
    +
    + Bill No : + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    + {GlobaldummyData ? formattedDate : Date1} +
    - : -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {/*

    {table2Data?.BrName}

    */} -
    - {(GlobalLogo && GlobaldummyData) ? image : null} - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    -
    - {GlobaldummyData ? - 'BranchAddress, Town- 635XXX City - State' : - (BranchAddress || '') + (BranchCity ? (BranchAddress && BranchCity ? '-' : '') + BranchCity : '') + (BranchZip ? (BranchCity && BranchZip ? '-' : '') + BranchZip : '')} -
    -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    -
    )} - {table2Data?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - -
    -
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    - -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && - <> - {takeAwayPreference &&
    TakeAway
    } - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - - - {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} - -
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount}PCS{item.ParcelQty}PACK({item.ParcelType}) - - ))} -
    - :
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    )} -
    {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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - - } - {(DineInData?.length > 0 && dinePreference) && - <> -
    Dine In
    - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - - - {(GlobaldummyData ? products : DineInData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} - -
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
    {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}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - - } -
    -
    -
    -
    Items
    -
    :
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    -
    Qty
    -
    :
    -
    {GlobaldummyData ? '9' : totalQuantity}
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    Off
    -
    :
    -
    {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    -
    Take Away
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(TakeawayTotal).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    -
    Dine In
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)}
    -
    - } -
    -
    Amount
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    -
    - -
    - - {(table2Data?.OrderType === "E") ? '' :
    -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - - } -
    -
    } - -
    - -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    -
    - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) +
    +
    +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( + <> + {takeAwayPreference && ( +
    + TakeAway +
    )} -
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + + + {dataChunk?.map((item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode && } + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + })} + +
    + S.No + + S.No + DisDes + HSN + + HSN + + MRP + + MRP + + Rate + + Rt + + (%) + + (%) + + Tax % + + Tax % + + Qty + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + Amt + + Amt +
    + {chunkIndex * chunkSize + index + 1} + + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount}PCS + {item.ParcelQty}PACK( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +
    {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.SalesQty} + + {item?.SalesQty} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    +
    + + )} + {DineInData?.length > 0 && dinePreference && ( + <> +
    + Dine In +
    + +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + + + {dataChunk?.map((item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode && } + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + })} + +
    + S.No + + S.No + DisDes + HSN + + HSN + + MRP + + MRP + + Rate + + Rt + + (%) + + (%) + + Tax % + + Tax % + + Qty + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + Amt + + Amt +
    + {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?.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(',')} +
    + ); + }) + : ''}
    - ))} - - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    +
    {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.SalesQty} + + {item?.SalesQty} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    +
    + + )} +
    - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} -
    - } - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} -
    - } - - - {table2Data?.BookingTypeName === "Dine In" && dinePreference && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) &&
    Captain: {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> +
    +
    +
    +
    Items
    +
    :
    +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    +
    +
    +
    Qty
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    +
    Take Away
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(TakeawayTotal).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    +
    Dine In
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(DineInTotal).toFixed(2)} +
    +
    + )} +
    +
    Amount
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    +
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet &&
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed( + 2 + )} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed( + 2 + )} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} +
    +
    + + )} +
    +
    + )} +
    + +
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {( + lastTransaction?.BeforeAdjustment || 0 + ).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {( + lastTransaction?.AfterAdjustment || 0 + ).toFixed(2)} + +
    +
    +
    + )} + +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    +
    + + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} + + )} + {GlobaldummyData && GlobalCashierName && ( +
    + {' '} + Cashier : Cashier Name +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + + {table2Data?.BookingTypeName === 'Dine In' && + dinePreference && + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName && ( +
    + Captain:{' '} + { + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName + } +
    + )} +
    + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    +
    + 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 + )} +
    +
    + )} +
    + )} +
    + +
    + Your Order No : + {GlobaldummyData + ? '01' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && (
    - image +

    + Notes : 10 days Return policy +

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

    + {Notestext} +

    + +
    +
    + )} +
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {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 +
    + )} + + )} +
    + ))} + + {shouldFooterBeOnNewPage && FormatTheme && ( +
    +
    + <> +
    +
    +
    +
    Items
    +
    :
    +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    +
    +
    Qty
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    +
    Take Away
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(TakeawayTotal).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    +
    Dine In
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(DineInTotal).toFixed(2)} +
    +
    + )} +
    +
    Amount
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    +
    + +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} +
    +
    + + )} +
    +
    + )} +
    + +
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} + +
    +
    +
    + )} +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    +
    + + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} + + )} + {GlobaldummyData && GlobalCashierName && ( +
    + {' '} + Cashier : Cashier Name +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + {table2Data?.BookingTypeName === 'Dine In' && + dinePreference && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain:{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} +
    + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    +
    + 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)}
    -
    } -
    } -
    +
    + {' '} + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + )} +
    -
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } +
    + Your Order No : + {GlobaldummyData + ? '01' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} -
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

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

    + {Notestext} +

    + +
    +
    + )} +
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    + > + {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. */} +
    +
    + )} -
    -
    ) : - Notestext && (
    -

    {Notestext}

    + {GlobaldummyData + ? GlobalSignature && ( +
    +

    + Signature +

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

    + Signature +

    + +
    + )} +
    + )} +
    -
    -
    ) - } -
    } - - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {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
    - - - {PrintGreeting?.SettingValue === "Y" && -
    - Thank You Visit Again -
    - } - {/*
    print
    */} + )} + +
    +
    + )} +
    + ) : ( +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {/*

    {table2Data?.BrName}

    */} +
    + {GlobalLogo && GlobaldummyData ? ( + image + ) : null} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    - } +
    - - ) -} +
    + {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +
    +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} +
    +
    + )} + {table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} -export default Printstyle8 + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + +
    +
    + Bill No : + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    + {GlobaldummyData ? formattedDate : Date1} +
    +
    + +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( + <> + {takeAwayPreference && ( +
    + TakeAway +
    + )} + +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + + + {(GlobaldummyData ? products : TakeawayData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode && } + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )} + +
    + S.No + + S.No + DisDes + HSN + + HSN + + MRP + + MRP + + Rate + + Rt + + (%) + + (%) + + Tax % + + Tax % + + Qty + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + Amt + + Amt +
    + {index + 1} + + {index + 1} + {item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount}PCS + {item.ParcelQty}PACK( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +
    {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.SalesQty} + + {item?.SalesQty} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    +
    + + )} + {DineInData?.length > 0 && dinePreference && ( + <> +
    + Dine In +
    + +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + + + {(GlobaldummyData ? products : DineInData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode && } + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )} + +
    + S.No + + S.No + DisDes + HSN + + HSN + + MRP + + MRP + + Rate + + Rt + + (%) + + (%) + + Tax % + + Tax % + + Qty + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + Amt + + Amt +
    + {index + 1} + + {index + 1} + {item?.ProdName} +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return
    {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}{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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.SalesQty} + + {item?.SalesQty} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    +
    + + )} +
    +
    +
    +
    Items
    +
    :
    +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    +
    +
    Qty
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    +
    Take Away
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(TakeawayTotal).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    +
    Dine In
    +
    :
    +
    + {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)} +
    +
    + )} +
    +
    Amount
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    +
    + +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed( + 2 + )} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed( + 2 + )} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )} +
    +
    + + )} +
    +
    + )} +
    + +
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    +
    + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} +

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} +

    + ) : null} +
    + )} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + )} + {GlobaldummyData && GlobalCashierName && ( +
    + {' '} + Cashier : Cashier Name +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + + {table2Data?.BookingTypeName === 'Dine In' && + dinePreference && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain:{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} +
    + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    +
    + 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)} +
    +
    + )} +
    + )} +
    + +
    + Your Order No : + {GlobaldummyData + ? '01' + : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)} +
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    + +
    +
    + )} +
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {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
    + )} + {/*
    print
    */} +
    + )} + + ); +}; + +export default Printstyle8; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx index 67d49e8..d7f4463 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx @@ -30,7 +30,10 @@ import { GlobalprintTax, } from '../../../../Features/ThemeChange/ThemeChange'; import Logo from '../../../../Images/Logo.jpg'; -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import { + GlobalUpiIDprint, + PreferenceData, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.scss'; import QRCode from 'react-qr-code'; import signature from '../../../../Images/signatureimage.jpg'; @@ -119,6 +122,19 @@ const PrintStyle9 = ({ const paymentTypeUPI = PaymentStatus?.find( (ps) => ps.PaymentTypeName === 'UPI' ); + + const isEditedBill = PaymentStatus?.some((payment) => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ); + let TermsAndConditions = printDatas?.TermsandConditions; let SignatureImg = printDatas?.Signature; let Notestext = printDatas?.Notes; @@ -230,7 +246,7 @@ const PrintStyle9 = ({ HSN: '01', Size: 250, UomName: 'g', - ProdTaxPercentage: 5 + ProdTaxPercentage: 5, }, { ProdName: 'ITEM 2', @@ -242,7 +258,7 @@ const PrintStyle9 = ({ HSN: '02', Size: 250, UomName: 'g', - ProdTaxPercentage: 5 + ProdTaxPercentage: 5, }, { ProdName: 'ITEM 3', @@ -254,7 +270,7 @@ const PrintStyle9 = ({ HSN: '03', Size: 250, UomName: 'g', - ProdTaxPercentage: 0 + ProdTaxPercentage: 0, }, { ProdName: 'ITEM 4', @@ -266,7 +282,7 @@ const PrintStyle9 = ({ HSN: '04', Size: 250, UomName: 'g', - ProdTaxPercentage: 18 + ProdTaxPercentage: 18, }, { ProdName: 'ITEM 5', @@ -278,7 +294,7 @@ const PrintStyle9 = ({ HSN: '05', Size: 250, UomName: 'g', - ProdTaxPercentage: 40 + ProdTaxPercentage: 40, }, { ProdName: 'ITEM 6', @@ -290,7 +306,7 @@ const PrintStyle9 = ({ HSN: '06', Size: 250, UomName: 'g', - ProdTaxPercentage: 0 + ProdTaxPercentage: 0, }, { ProdName: 'ITEM 7', @@ -302,7 +318,7 @@ const PrintStyle9 = ({ HSN: '08', Size: 250, UomName: 'g', - ProdTaxPercentage: 5 + ProdTaxPercentage: 5, }, ]; @@ -351,8 +367,8 @@ const PrintStyle9 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -399,7 +415,7 @@ const PrintStyle9 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    @@ -495,10 +511,10 @@ const PrintStyle9 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    {' '} @@ -551,114 +567,120 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && ( - Item - ) + Item + ) : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - { WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData ? - GlobalTax && - - Tax % - : - (Tax && table2Data?.OrderType !== 'E') && - - Tax % - - } + + Dis{' '} + + )} + {GlobaldummyData + ? GlobalTax && ( + + Tax % + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -668,205 +690,207 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount}PCS - {item.ParcelQty}PACK( - {item.ParcelType}) - - ))} - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount}PCS + {item.ParcelQty}PACK( + {item.ParcelType}) + + ))} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {a.SerialNumber}
    - ); - }) - : ''}{' '} - {item?.ProductIdentifierDtls?.length > + ? 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?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > + ? 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {a.SerialNumber}
    - ); - }) - : ''}{' '} - {item?.ProductIdentifierDtls?.length > + ? 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?.ProductIdentifierDtls.filter( + (item1) => + item1.IMEI1 !== '' || + item1.IMEI2 !== '' + )?.map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) + : ''} +
    + )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && - - {item?.ProdTaxPercentage} - : - (Tax && table2Data?.OrderType !== 'E') && - - {item?.ProdTaxPercentage || 0} - - } + ? GlobalTax && ( + + {item?.ProdTaxPercentage} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); })} @@ -893,114 +917,120 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && ( - Item - ) + Item + ) : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - { WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData ? - GlobalTax && - - Tax % - : - (Tax && table2Data?.OrderType !== 'E') && - - Tax % - - } + + Dis{' '} + + )} + {GlobaldummyData + ? GlobalTax && ( + + Tax % + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -1010,114 +1040,116 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && - - {item?.ProdTaxPercentage} - : - (Tax && table2Data?.OrderType !== 'E') && - - {item?.ProdTaxPercentage || 0} - - } + ? GlobalTax && ( + + {item?.ProdTaxPercentage} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); })} @@ -1162,25 +1194,25 @@ const PrintStyle9 = ({ )} {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off : -
    - {GlobaldummyData - ? '1,066' - : Number( +
    + Off : +
    + {GlobaldummyData + ? '1,066' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )}
    {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -1621,28 +1659,28 @@ const PrintStyle9 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    - {PaymentStatusSuccess?.length > 1 && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1747,64 +1785,142 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} +
    + QRcode +
    + 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 - )} -
    -
    - )} + )}
    )}
    -
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} + +
    +
    +
    + )} + +
    Your Order No : {GlobaldummyData ? '01' : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} + extractLastNumber(table2Data?.SalesId)}
    @@ -1833,23 +1949,23 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -1869,137 +1985,137 @@ const PrintStyle9 = ({ > {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 +

    + +
    + )}
    )}
    @@ -2097,8 +2213,8 @@ const PrintStyle9 = ({ {GlobaldummyData ? '1,066' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -2237,7 +2353,9 @@ const PrintStyle9 = ({ fontSize: '11px', textAlign: 'right', }} - >{item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -2530,28 +2652,28 @@ const PrintStyle9 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    - {PaymentStatusSuccess?.length > 1 && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2650,60 +2772,135 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} +
    + QRcode +
    + 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)} -
    -
    - )} + )}
    )}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} -
    +
    Your Order No : {GlobaldummyData ? '01' : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} + extractLastNumber(table2Data?.SalesId)}
    @@ -2732,23 +2929,23 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2768,137 +2965,137 @@ const PrintStyle9 = ({ > {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 +

    + +
    + )}
    )}
    @@ -2955,7 +3152,7 @@ const PrintStyle9 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    @@ -3060,10 +3257,10 @@ const PrintStyle9 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    {' '} @@ -3112,90 +3309,92 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && ( - - S.No - - ) + + S.No + + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - { WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData ? - GlobalTax && - - Tax % - : - (Tax && table2Data?.OrderType !== 'E') && - - Tax % - - } + + Dis{' '} + + )} + {GlobaldummyData + ? GlobalTax && ( + + Tax % + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3209,138 +3408,140 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return
    {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?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return
    {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(',')} +
    + ); + }) + : ''} +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && - - {item?.ProdTaxPercentage} - : - (Tax && table2Data?.OrderType !== 'E') && - - {item?.ProdTaxPercentage || 0} - - } + ? GlobalTax && ( + + {item?.ProdTaxPercentage} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3374,80 +3575,82 @@ const PrintStyle9 = ({ : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - { WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData ? - GlobalTax && - - Tax % - : - (Tax && table2Data?.OrderType !== 'E') && - - Tax % - - } + + Dis{' '} + + )} + {GlobaldummyData + ? GlobalTax && ( + + Tax % + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3461,106 +3664,108 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && - - {item?.ProdTaxPercentage} - : - (Tax && table2Data?.OrderType !== 'E') && - - {item?.ProdTaxPercentage || 0} - - } + ? GlobalTax && ( + + {item?.ProdTaxPercentage} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3613,8 +3818,8 @@ const PrintStyle9 = ({ {GlobaldummyData ? '1,066' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -3754,7 +3959,9 @@ const PrintStyle9 = ({ fontSize: '11px', textAlign: 'right', }} - >{item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > 0 ? (

    @@ -4040,26 +4251,26 @@ const PrintStyle9 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    - {PaymentStatusSuccess?.length > 1 && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4146,51 +4357,123 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹{' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} +
    + QRcode +
    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)} +
    -
    - )} + )}
    )}
    -
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} + +
    Your Order No : {GlobaldummyData ? '01' @@ -4229,26 +4512,26 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -4268,137 +4551,137 @@ const PrintStyle9 = ({ > {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/DashBoard/RetailDashboard.jsx b/src/Pages/DashBoard/RetailDashboard.jsx index 750e020..4a48c3d 100644 --- a/src/Pages/DashBoard/RetailDashboard.jsx +++ b/src/Pages/DashBoard/RetailDashboard.jsx @@ -264,7 +264,6 @@ const RetailDashboard = () => { useEffect(() => { if (isInitialLoad && CompId && AppId && selection === 'dashboard') { - // debugger if (dates && dates?.[0] && dates?.[1] && !initialDate) { onRangeChange(dates, [ dates?.[0]?.format('DD-MM-YYYY'), diff --git a/src/Pages/Kiosk/CardPage/SelfCardPage1.jsx b/src/Pages/Kiosk/CardPage/SelfCardPage1.jsx index 1f19cca..3fd8b34 100644 --- a/src/Pages/Kiosk/CardPage/SelfCardPage1.jsx +++ b/src/Pages/Kiosk/CardPage/SelfCardPage1.jsx @@ -257,29 +257,29 @@ const CardPage1 = (props) => { if (isItemInCart) { newOrderDetails = newOrderDetails.map((cartItem) => cartItem.ProdId === item.ProdId && - cartItem.InwardDtlId === item.InwardDtlId && - cartItem.OrderRate === item.OrderRate && - cartItem?.BookingTypeName === item?.BookingTypeName && - !cartItem?.disabled + cartItem.InwardDtlId === item.InwardDtlId && + cartItem.OrderRate === item.OrderRate && + cartItem?.BookingTypeName === item?.BookingTypeName && + !cartItem?.disabled ? { - ...cartItem, - OrderQty: cartItem.OrderQty + 1, - TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate, - TaxAmt: ( + ...cartItem, + OrderQty: cartItem.OrderQty + 1, + TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate, + TaxAmt: ( + ((cartItem.OrderQty + 1) * + cartItem.OrderRate * + cartItem.TaxPercentage) / + (100 + cartItem.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (cartItem.OrderQty + 1) * cartItem.OrderRate - + ( ((cartItem.OrderQty + 1) * cartItem.OrderRate * cartItem.TaxPercentage) / (100 + cartItem.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (cartItem.OrderQty + 1) * cartItem.OrderRate - - ( - ((cartItem.OrderQty + 1) * - cartItem.OrderRate * - cartItem.TaxPercentage) / - (100 + cartItem.TaxPercentage) - ).toFixed(2), - } + } : cartItem ); } else { @@ -360,11 +360,11 @@ const CardPage1 = (props) => { (cartItem) => cartItem?.ProdId === item?.ProductDetail?.[0]?.ProdId && cartItem?.InwardDtlId === - item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0] - ?.InwardDtlId && + item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0] + ?.InwardDtlId && cartItem?.OrderRate === - item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0] - ?.SellPrice + item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0] + ?.SellPrice ); if (Isincart && Isincart?.StockAvailable === 'Y') { if (Isincart?.BalanceQty > Isincart?.OrderQty) { @@ -419,13 +419,13 @@ const CardPage1 = (props) => { (cartItem) => cartItem?.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 ); console.log(Isincart, item, KioskOrderDetails, 'IsincartsingleVarient'); if (Isincart && Isincart?.StockAvailable === 'Y') { @@ -543,7 +543,7 @@ const CardPage1 = (props) => { SinglePc: onePcs ? 'Y' : 'N', NoOfPcs: onePcs ? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[stockIndex]?.NoOfPcs + ?.StockDetails?.[stockIndex]?.NoOfPcs : null, ProdVariantName: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] @@ -568,14 +568,14 @@ const CardPage1 = (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, SuppId: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] ?.StockDetails?.[stockIndex]?.SuppId, @@ -603,7 +603,6 @@ const CardPage1 = (props) => { }; // add Product in cart state const AddOrderDetails = async (item) => { - // debugger message.success(`${item?.ProdName} Added in the Cart`); const isItemInCart = KioskOrderDetails?.find( (cartItem) => @@ -619,29 +618,29 @@ const CardPage1 = (props) => { changeKioskOrderDetails( KioskOrderDetails?.map((cartItem) => cartItem.ProdId === item.ProdId && - cartItem.InwardDtlId === item.InwardDtlId && - cartItem.OrderRate === item.OrderRate && - cartItem?.BookingTypeName === item?.BookingTypeName && - !cartItem?.disabled + cartItem.InwardDtlId === item.InwardDtlId && + cartItem.OrderRate === item.OrderRate && + cartItem?.BookingTypeName === item?.BookingTypeName && + !cartItem?.disabled ? { - ...cartItem, - OrderQty: cartItem.OrderQty + 1, - TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate, - TaxAmt: ( + ...cartItem, + OrderQty: cartItem.OrderQty + 1, + TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate, + TaxAmt: ( + ((cartItem.OrderQty + 1) * + cartItem.OrderRate * + cartItem.TaxPercentage) / + (100 + cartItem.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (cartItem.OrderQty + 1) * cartItem.OrderRate - + ( ((cartItem.OrderQty + 1) * cartItem.OrderRate * cartItem.TaxPercentage) / (100 + cartItem.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (cartItem.OrderQty + 1) * cartItem.OrderRate - - ( - ((cartItem.OrderQty + 1) * - cartItem.OrderRate * - cartItem.TaxPercentage) / - (100 + cartItem.TaxPercentage) - ).toFixed(2), - } + } : cartItem ) ) @@ -862,7 +861,7 @@ const CardPage1 = (props) => { return (
    {/* Top area */}
    @@ -875,7 +874,7 @@ const CardPage1 = (props) => { ? props.class : 'KioskCard-card-main' } - // style={{ backgroundColor: getKioskLightColourdata }} + // style={{ backgroundColor: getKioskLightColourdata }} > {/* Mapping through kioskCategoriesCard */} {(selfBookingOption === 'Card Only' || @@ -891,9 +890,9 @@ const CardPage1 = (props) => { card?.OverAllQty, KioskOrderDetails ) > 0) || - card?.ProductDetail?.some( - (item) => item?.StockAvailable !== 'Y' - ) + card?.ProductDetail?.some( + (item) => item?.StockAvailable !== 'Y' + ) ? 'KioskCard-card' : 'KioskCard-card-dis' } @@ -923,9 +922,9 @@ const CardPage1 = (props) => { card?.OverAllQty, KioskOrderDetails ) > 0) || - card?.ProductDetail?.some( - (item) => item?.StockAvailable !== 'Y' - ) ? ( + card?.ProductDetail?.some( + (item) => item?.StockAvailable !== 'Y' + ) ? ( '' ) : (
    { {card?.ProductDetail?.filter( (item) => item.OnePcsAvailable == 'Y' ).length !== 0 && ( -
    { - e.stopPropagation(); // Stop event propagation to the parent div +
    { + e.stopPropagation(); // Stop event propagation to the parent div - if ( - !( - (card?.OverAllQty !== undefined && - returnOnepcCount( - card?.ProductDetail?.[0]?.ProdName, - card?.OverAllPcs, - CartOrderDetails - ) > 0) || - card?.ProductDetail?.some( - (item) => item?.StockAvailable !== 'Y' + if ( + !( + (card?.OverAllQty !== undefined && + returnOnepcCount( + card?.ProductDetail?.[0]?.ProdName, + card?.OverAllPcs, + CartOrderDetails + ) > 0) || + card?.ProductDetail?.some( + (item) => item?.StockAvailable !== 'Y' + ) ) - ) - ) { - return; // Don't proceed if the condition isn't met - } else { - CardOnClick(card, 'OnePeiceProduct'); // This only runs when you click the "One Piece" button - } - }} - style={{ - fontFamily: SelectedCardFont || '', - backgroundColor: - SelectedCardColor?.FontColor || '#f00000ff', - color: - returnOnepcCount( - card?.ProductDetail?.[0]?.ProdName, - card?.OverAllPcs, - CartOrderDetails - ) > 0 || - card?.ProductDetail?.some( - (product) => product?.StockAvailable !== 'Y' - ) - ? true - ? SelectedCardColor?.BackgroundColor || + ) { + return; // Don't proceed if the condition isn't met + } else { + CardOnClick(card, 'OnePeiceProduct'); // This only runs when you click the "One Piece" button + } + }} + style={{ + fontFamily: SelectedCardFont || '', + backgroundColor: + SelectedCardColor?.FontColor || '#f00000ff', + color: + returnOnepcCount( + card?.ProductDetail?.[0]?.ProdName, + card?.OverAllPcs, + CartOrderDetails + ) > 0 || + card?.ProductDetail?.some( + (product) => product?.StockAvailable !== 'Y' + ) + ? true + ? SelectedCardColor?.BackgroundColor || '#000000' - : '#fff' - : '#ff4d4f', - }} - > -
    - {' '} - {AppName?.toLowerCase() === 'sports' - ? 'Single' - : '1PCS'}{' '} + : '#fff' + : '#ff4d4f', + }} + > +
    + {' '} + {AppName?.toLowerCase() === 'sports' + ? 'Single' + : '1PCS'}{' '} +
    -
    - )} + )}
    ) )} diff --git a/src/Pages/Preference/PreferenceList.jsx b/src/Pages/Preference/PreferenceList.jsx index a966c06..9bb5ac1 100644 --- a/src/Pages/Preference/PreferenceList.jsx +++ b/src/Pages/Preference/PreferenceList.jsx @@ -108,6 +108,7 @@ const PreferenceList = () => { weeklysalesreport: allSettingsMap['weeklysalesreport'] === 'Y', notificationblink: allSettingsMap['notificationblink'] === 'Y', onlineindivdualslots: allSettingsMap['onlineindivdualslots'] === 'Y', + editbill: allSettingsMap['editbill'] === 'Y', notification: [ ...(allSettingsMap['onbilltime'] === 'Y' ? ['onbilltime'] : []), ...(allSettingsMap['1daybefore'] === 'Y' ? ['1daybefore'] : []), @@ -308,6 +309,7 @@ const PreferenceList = () => { lowstockreport: values.lowstockreport, weeklysalesreport: values.weeklysalesreport, notificationblink: values.notificationblink, + editbill: values.editbill, }; const arrayValues = { @@ -627,6 +629,7 @@ const PreferenceList = () => { 'Do you Want Customised Bill Number?' )} {renderCheckbox('upiqr', 'Do you want to show the UPI QR code?')} + {/* {renderCheckbox('editbill', 'Do you want to edit the previously created bill?')} */}
    diff --git a/src/Pages/Tablebooking/TableBooking.jsx b/src/Pages/Tablebooking/TableBooking.jsx index 3c03f1a..7568463 100644 --- a/src/Pages/Tablebooking/TableBooking.jsx +++ b/src/Pages/Tablebooking/TableBooking.jsx @@ -1034,7 +1034,6 @@ const TableBooking = ({ PaymentStatus }) => { ); const navigatetoBooking = async (data) => { - const OrderDetails = data?.OrderDetails?.[0]; const { OrderDtlDetails, diff --git a/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx b/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx index 5722742..a787009 100644 --- a/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx +++ b/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx @@ -49,6 +49,18 @@ const PaymentPdfBooking = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) + console.log(singleData2?.filter(data => data?.EditTokenAvailable !== 'N'), "singleData2") const ExtraChargeTotal = table2Data?.ExtraChargeDetails?.reduce( (accumulator, currentObject) => { return accumulator + currentObject.TotalAmt; @@ -80,6 +92,7 @@ const PaymentPdfBooking = ({ const [BranchZip, setBranchZip] = useState(); const CashierName = getSession('userName'); const printerTemplateStyle = useSelector(SelectedPrintTemplate); + console.log(printerTemplateStyle, "printerTemplateStyle") const appPreferences = useSelector(ApplicationPreferences); const SettingData = useSelector(PreferenceData); const estimatePrintHeader = @@ -297,6 +310,21 @@ const PaymentPdfBooking = ({ return `${h}:${m}${suffix}`; }; + const getAdjustmentLabel = (type) => { + switch (type?.toUpperCase()) { + case 'REFUND': + return 'Returned Item Amount'; + case 'EXTRA': + return 'Additional Amount'; + case 'DISCOUNT': + return 'Discount Applied'; + case 'ROUND_OFF': + return 'Round Off'; + default: + return 'Adjustment Amount'; + } + }; + return ( <>
    @@ -341,8 +369,8 @@ const PaymentPdfBooking = ({ {table2Data?.AddressDetails?.[0]?.City && table2Data?.AddressDetails?.[0]?.Zip && table2Data?.AddressDetails?.[0]?.City + - '- ' + - table2Data?.AddressDetails?.[0]?.Zip} + '- ' + + table2Data?.AddressDetails?.[0]?.Zip}

    )} @@ -358,9 +386,9 @@ const PaymentPdfBooking = ({ GSTIN: {table2Data?.BrGSTIN}

    )} -

    + {table2Data?.BrMobile &&

    Mobile:+91 {table2Data?.BrMobile} -

    +

    }
    @@ -435,7 +463,7 @@ const PaymentPdfBooking = ({
    - BillNo: + Bill No: {table2Data?.OrderId && extractLastNumberOrderId( table2Data?.OrderId, @@ -512,27 +540,27 @@ const PaymentPdfBooking = ({   {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (items) => - items.SerialNumber && - items.SerialNumber !== '' - ).map((a, i) => ( -
    {a.SerialNumber}
    - )) + (items) => + items.SerialNumber && + items.SerialNumber !== '' + ).map((a, i) => ( +
    {a.SerialNumber}
    + )) : ''} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (id) => id.IMEI1 !== '' || id.IMEI2 !== '' - ).map((id, i) => { - const imei1 = id.IMEI1 || ''; - const imei2 = id.IMEI2 || ''; - return ( -
    - {[imei1, imei2] - .filter(Boolean) - .join(',')} -
    - ); - }) + (id) => id.IMEI1 !== '' || id.IMEI2 !== '' + ).map((id, i) => { + const imei1 = id.IMEI1 || ''; + const imei2 = id.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) : ''}
    @@ -549,25 +577,25 @@ const PaymentPdfBooking = ({   {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (items) => - items.SerialNumber && - items.SerialNumber !== '' - ).map((a, i) => ( -
    {a.SerialNumber}
    - )) + (items) => + items.SerialNumber && + items.SerialNumber !== '' + ).map((a, i) => ( +
    {a.SerialNumber}
    + )) : ''} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (id) => id.IMEI1 !== '' || id.IMEI2 !== '' - ).map((id, i) => { - const imei1 = id.IMEI1 || ''; - const imei2 = id.IMEI2 || ''; - return ( -
    - {[imei1, imei2].filter(Boolean).join(',')} -
    - ); - }) + (id) => id.IMEI1 !== '' || id.IMEI2 !== '' + ).map((id, i) => { + const imei1 = id.IMEI1 || ''; + const imei2 = id.IMEI2 || ''; + return ( +
    + {[imei1, imei2].filter(Boolean).join(',')} +
    + ); + }) : ''} )} @@ -1109,7 +1137,7 @@ const PaymentPdfBooking = ({ >
    )} - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments)?.map((paymentType) => ( @@ -1122,6 +1150,48 @@ const PaymentPdfBooking = ({ ))} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {table2Data?.CustSuppName && (

    { + singleData2?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce((acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { // For null or empty CounterName, print each item individually @@ -1607,7 +1677,7 @@ const PaymentPdfBooking = ({

    Token

    -

    BillNo: {orderId}

    +

    Bill No: {orderId}

    {Date1}

    @@ -1625,9 +1695,9 @@ const PaymentPdfBooking = ({ - + - + ))} From 139789f085cfc12b18b8b289ded748ff864019ff Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 Feb 2026 18:40:27 +0530 Subject: [PATCH 2/5] conflict-updated --- .../BookingScreen/BookingData/BookingData.js | 12 +- .../BSBillingTable4/BSBilling4Payment.jsx | 70 +- .../OtherConponents/Reprint/BSReprint.jsx | 7 +- .../PrintTemplates/A4/A4Standard.jsx | 3830 +++++++++++------ 4 files changed, 2678 insertions(+), 1241 deletions(-) diff --git a/src/Features/BookingScreen/BookingData/BookingData.js b/src/Features/BookingScreen/BookingData/BookingData.js index 97bb72b..9598fbc 100644 --- a/src/Features/BookingScreen/BookingData/BookingData.js +++ b/src/Features/BookingScreen/BookingData/BookingData.js @@ -18,6 +18,15 @@ export const getNotification = createAsyncThunk( ); } ); +export const getStockDetailsByVariantName = createAsyncThunk( + 'BookingData/getStockDetailsByVariantName', + async (data) => { + return await axiosRetailInstanceData.post( + `/productVariantListByname`, + data + ); + } +); export const getLayoutCategories = createAsyncThunk( 'BookingData/getLayoutCategories', @@ -1449,8 +1458,7 @@ export const CustomerOrderList = createAsyncThunk( return await axiosRetailInstanceData.get( `/LastBuyProductList?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&mobileNo=${MobileNo}&fromDate=${FromDate}&toDate=${ToDate}` ); - } - else if ( + } else if ( AppId != null && AppId != undefined && CompId != null && diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx index e74dd18..6b6a3a1 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx @@ -3789,40 +3789,7 @@ const BSBilling4Payment = () => { )} - {/* Customer Orders */} - {GetCustId && ( - - {' '} -
    { - if ( - CheckBookingStatus !== 'Close' && - !addnewAccess && - !(OrderCardDetail?.length > 0) - ) { - setCustomerPreviesOrders(true); - } - }} - style={{ - cursor: OrderCardDetail?.length > 0 && 'not-allowed', - color: - OrderCardDetail?.length > 0 || - (OrderCardDetail?.length > 0 && - GetCustId?.CustMobile === undefined) - ? 'gray' - : 'rgb(18, 146, 238)', - fontSize: '25px', - display: 'flex', - alignItems: 'center', - height: '2.46rem', - width: '1.5rem', - }} - > - -
    -
    - )} + {OtherServicesglobal && OrderCardDetail.length >= 1 && ( {' '} @@ -3859,6 +3826,41 @@ const BSBilling4Payment = () => { {/* */} )} + + {/* Customer Orders */} + {GetCustId && ( + + {' '} +
    { + if ( + CheckBookingStatus !== 'Close' && + !addnewAccess && + !(OrderCardDetail?.length > 0) + ) { + setCustomerPreviesOrders(true); + } + }} + style={{ + cursor: OrderCardDetail?.length > 0 && 'not-allowed', + color: + OrderCardDetail?.length > 0 || + (OrderCardDetail?.length > 0 && + GetCustId?.CustMobile === undefined) + ? 'gray' + : 'rgb(18, 146, 238)', + fontSize: '25px', + display: 'flex', + alignItems: 'center', + height: '2.46rem', + width: '1.5rem', + }} + > + +
    +
    + )} {tabledata?.length > 0 && (
    {tableOptions diff --git a/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx b/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx index 61056a2..db26e13 100644 --- a/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx +++ b/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx @@ -815,6 +815,7 @@ function BSReprint({ setOpenModel = () => { } }) { {(page - 1) * 10 + index + 1} ), }, + { title: 'Bill No', dataIndex: 'BillNo', @@ -1420,7 +1421,7 @@ function BSReprint({ setOpenModel = () => { } }) { CreatedDate={orderDetail?.CreatedDate} PaymentStatus={reprintData?.[0]?.OrderPaymentDtl} Preference={SettingDataSelector} - + printDatas={printDatas} />
    ))} @@ -1553,7 +1554,7 @@ function BSReprint({ setOpenModel = () => { } }) { label: option.ConfigName, }))} label={ - + } className="field-DropDown-Emp" onChangeFunction={(e) => reprintReasonDropDownChange(e)} @@ -1748,6 +1749,7 @@ function BSReprint({ setOpenModel = () => { } }) { CreatedDate={orderDetail?.CreatedDate} PaymentStatus={reprintData?.[0]?.OrderPaymentDtl} Preference={SettingDataSelector} + printDatas={printDatas} /> ))} @@ -1809,6 +1811,7 @@ function BSReprint({ setOpenModel = () => { } }) { CreatedDate={orderDetail?.CreatedDate} PaymentStatus={reprintData?.[0]?.OrderPaymentDtl} Preference={SettingDataSelector} + printDatas={printDatas} /> ))} diff --git a/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx b/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx index 993b6a0..140924d 100644 --- a/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx @@ -1,10 +1,10 @@ -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"; -import Logo from '../../../../Images/Logo.jpg' +} from '../../../../Services/Others'; +import Logo from '../../../../Images/Logo.jpg'; import { GlobalprintSlNo, GlobalprintItem, @@ -27,14 +27,19 @@ import { GlobalprintCashierName, GlobalprintLogo, GlobalprintTax, -} from "../../../../Features/ThemeChange/ThemeChange"; -import "../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.scss"; -import QRCode from "react-qr-code"; -import { GlobalUpiIDprint, PreferenceData } from "../../../../Features/BookingScreen/BookingData/BookingData"; -import signature from "../../../../Images/signatureimage.jpg" + GlobalSelectedPrintHeaderColor, +} from '../../../../Features/ThemeChange/ThemeChange'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle1.scss'; +import QRCode from 'react-qr-code'; +import { + GlobalUpiIDprint, + PreferenceData, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; +import signature from '../../../../Images/signatureimage.jpg'; import { isMobile } from 'react-device-detect'; -const InvoiceTemplate = ({ index, +const InvoiceTemplate = ({ + index, totalQuantityFilter, Date1, CashierName, @@ -48,23 +53,27 @@ const InvoiceTemplate = ({ index, PrintLogo, PrintGreeting, base64Image, - printDatas, isPdf, sportsAppPreference, MembershipApplied = null }) => { + printDatas, + isPdf, + sportsAppPreference, + MembershipApplied = null, +}) => { const dispatch = useDispatch(); const GlobalUpiID = useSelector(GlobalUpiIDprint); const FieldDetails = useSelector(GloabalFieldDetails); - 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 Tax = FieldDetails?.["Tax"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const LogoField = FieldDetails?.["Logo"]; + 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 Tax = FieldDetails?.['Tax']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const LogoField = FieldDetails?.['Logo']; const WeightasKg = FieldDetails?.['Weight']; const GlobalSlNo = useSelector(GlobalprintSlNo); const GlobalItem = useSelector(GlobalprintItem); @@ -81,44 +90,50 @@ const InvoiceTemplate = ({ index, 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 GlobalLogo = useSelector(GlobalprintLogo); const SettingData = useSelector(PreferenceData); - const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' + const estimatePrintHeader = + SettingData?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader', + )?.SettingValue === 'Y'; const keysLength = Object.keys(table2Data ?? {}).length; - console.log(GlobalDiscount, Discount, "Discount"); + console.log(GlobalDiscount, Discount, 'Discount'); - let BankDetails = table2Data?.BankDetails - let TermsAndConditions = printDatas?.TermsandConditions - let SignatureImg = printDatas?.Signature - let Notestext = printDatas?.Notes - let BillName = printDatas?.PrintHdrName - let FormatTheme = printDatas?.PrintType == "S" ? true : false - let PageSize = printDatas?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - console.log(BankDetails, "GlobalthemeFormatr"); - console.log(table2Data, "FormatThemekjhjk", PaymentStatus) + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); + + let BankDetails = table2Data?.BankDetails; + let TermsAndConditions = printDatas?.TermsandConditions; + let SignatureImg = printDatas?.Signature; + let Notestext = printDatas?.Notes; + let BillName = printDatas?.PrintHdrName; + let FormatTheme = printDatas?.PrintType == 'S' ? true : false; + let PageSize = printDatas?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + console.log(BankDetails, 'GlobalthemeFormatr'); + 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); @@ -126,15 +141,15 @@ const InvoiceTemplate = ({ index, 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 isEditedBill = PaymentStatus?.some(payment => { + const isEditedBill = PaymentStatus?.some((payment) => { const type = payment?.AdjustmentType?.toLowerCase(); return ( (type === 'extra' || type === 'refund') && @@ -143,16 +158,16 @@ const InvoiceTemplate = ({ index, ); }); const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ) + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y', + ); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0 + 0, ); - const PackageDetails = table2Data?.PackageDtl + const PackageDetails = table2Data?.PackageDtl; const DineInTotal = DineInData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0 + 0, ); const aggregatedPayments = PaymentStatusSuccess?.reduce( (acc, paymentdata) => { @@ -167,69 +182,77 @@ const InvoiceTemplate = ({ index, return acc; }, - {} + {}, ); const productsData = table2Data?.productDetails || []; 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, @@ -239,15 +262,15 @@ const InvoiceTemplate = ({ index, 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, @@ -257,15 +280,15 @@ const InvoiceTemplate = ({ index, 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, @@ -275,11 +298,10 @@ const InvoiceTemplate = ({ index, cgstAmount: 0, sgstRate: 0, sgstAmount: 0, - igstRate: 18.00, + igstRate: 18.0, igstAmount: 4500, - totalAmount: 29500 + totalAmount: 29500, }, - ], totals: { beforeTax: 83660, @@ -288,21 +310,22 @@ const InvoiceTemplate = ({ index, 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 = isMobile ? 11 : PageSize == "A5" ? 8 : 9; + const chunkSize = isMobile ? 11 : PageSize == 'A5' ? 8 : 9; let dataSource = []; if (GlobaldummyData || TakeawayData?.length > 0) { - dataSource = GlobaldummyData ? "" : TakeawayData; + dataSource = GlobaldummyData ? '' : TakeawayData; } else if (DineInData?.length > 0) { dataSource = DineInData; } @@ -311,50 +334,100 @@ const InvoiceTemplate = ({ index, 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 > (isMobile ? 11 : PageSize == "A5" ? 4 : 6); + const lastChunkRows = + paginatedChunks.length > 0 + ? paginatedChunks[paginatedChunks.length - 1].length + : 0; + const shouldFooterBeOnNewPage = + lastChunkRows > (isMobile ? 11 : 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; // Billing Address (replace static values) - const billToName = table2Data?.CustomerName || "Ooty Boat House"; - const billToAddress = table2Data?.CustomerAddress || "No:2, North Lake Road,"; - const billToState = table2Data?.CustomerState || "Tamil Nadu"; - const billToStateCode = table2Data?.CustomerStateCode || "33"; - const billToGSTIN = table2Data?.CustomerGSTIN || ""; + const billToName = table2Data?.CustomerName || 'Ooty Boat House'; + const billToAddress = table2Data?.CustomerAddress || 'No:2, North Lake Road,'; + const billToState = table2Data?.CustomerState || 'Tamil Nadu'; + const billToStateCode = table2Data?.CustomerStateCode || '33'; + const billToGSTIN = table2Data?.CustomerGSTIN || ''; 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)}

    @@ -363,54 +436,52 @@ const InvoiceTemplate = ({ index, 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', }, - ]; - return ( <> <> - {FormatTheme ? - -
    + {FormatTheme ? ( +
    {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    0 ? ' print-page-break' : ''}`} +
    0 ? ' print-page-break' : ''}` + } style={{ - display: "flex", flexDirection: "column", - justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", - height: FormatTheme ? isMobile ? "293mm" : PageSize == "A5" ? '170mm' : "275mm" : "", marginBottom: "0" - }} key={chunkIndex}> - + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: FormatTheme + ? isMobile + ? '293mm' + : PageSize == 'A5' + ? '170mm' + : '275mm' + : '', + marginBottom: '0', + }} + key={chunkIndex} + > {/*
    */} {/* Header */} {/*
    */} -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    -
    -
    - {(GlobalLogo && GlobaldummyData) &&
    Brand Logo
    } - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? Brand Logo : null} -

    {GlobaldummyData ? "Company Name" : companyName}

    -
    -

    {companyAddress}

    - {(companyPhone || GlobaldummyData) &&
    Phone: {GlobaldummyData ? "999999XXXX" : companyPhone}
    } -
    Email: {companyEmail}
    - {companyGSTIN || GlobaldummyData &&
    GSTIN: {GlobaldummyData ? "XXTTHJJF7679" : companyGSTIN}
    } -
    -
    - {" "} - BillNo: - {GlobaldummyData - ? "121" - : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    +
    + {GlobalLogo && GlobaldummyData && ( +
    + {' '} + Brand Logo +
    + )} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + Brand Logo + ) : null} +

    + {GlobaldummyData ? 'Company Name' : companyName} +

    +
    +

    {companyAddress}

    + {(companyPhone || GlobaldummyData) && ( +
    + Phone:{' '} + {GlobaldummyData ? '999999XXXX' : companyPhone} +
    )} +
    Email: {companyEmail}
    + {companyGSTIN || + (GlobaldummyData && ( +
    + GSTIN:{' '} + {GlobaldummyData + ? 'XXTTHJJF7679' + : companyGSTIN} +
    + ))} +
    +
    + {' '} + BillNo: + {GlobaldummyData + ? '121' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus, + )} +
    - -
    )} + )} {/* Invoice Title */}
    - {table2Data?.OrderType === "E" && ( + {table2Data?.OrderType === 'E' && (
    - Estimate{" "} + Estimate{' '}
    )} - {table2Data?.OrderType === "E" ? ( - "" + {table2Data?.OrderType === 'E' ? ( + '' ) : (
    - {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} - + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + + ' Bill' + : ''}
    )}
    - - {GlobaldummyData ? + {GlobaldummyData ? (
    -

    Details of Receiver | Billed to

    +

    + Details of Receiver | Billed to +

    -
    Name : +
    + Name : {GlobaldummyData ? ( - - {"XXXYYY"} - - ) : table2Data?.CustomerDetails?.[0]?.CustSuppName} -
    - - -
    Address: - XYZ City -
    - -
    State: XYZ State
    - -
    -
    - -
    - : - table2Data?.CustomerDetails?.length > 0 && -
    -
    -

    Details of Receiver | Billed to

    -
    -
    Name : - {GlobaldummyData ? ( - - {"XXXYYY"} - - ) : table2Data?.CustomerDetails?.[0]?.CustSuppName} -
    - - -
    Address: {table2Data?.CustomerDetails?.length > 0 && - !GlobaldummyData && ( - - {table2Data?.CustomerDetails?.[0]?.Address1} {table2Data?.CustomerDetails?.[0]?.Address2} + + {'XXXYYY'} + ) : ( + table2Data?.CustomerDetails?.[0]?.CustSuppName )}
    -
    State: {table2Data?.CustomerDetails?.[0]?.State}
    - {table2Data?.CustomerDetails?.[0]?.CustGSTNo &&
    GST: {table2Data?.CustomerDetails?.[0]?.CustGSTNo}
    } +
    + Address: + XYZ City +
    + +
    + State: XYZ State +
    -
    - } + ) : ( + table2Data?.CustomerDetails?.length > 0 && ( +
    +
    +

    + Details of Receiver | Billed to +

    +
    +
    + Name : + {GlobaldummyData ? ( + + {'XXXYYY'} + + ) : ( + table2Data?.CustomerDetails?.[0]?.CustSuppName + )} +
    +
    + Address:{' '} + {table2Data?.CustomerDetails?.length > 0 && + !GlobaldummyData && ( + + { + table2Data?.CustomerDetails?.[0] + ?.Address1 + }{' '} + { + table2Data?.CustomerDetails?.[0] + ?.Address2 + } + + )} +
    +
    + State:{' '} + {table2Data?.CustomerDetails?.[0]?.State} +
    + {table2Data?.CustomerDetails?.[0]?.CustGSTNo && ( +
    + GST:{' '} + {table2Data?.CustomerDetails?.[0]?.CustGSTNo} +
    + )} +
    +
    +
    + ) + )}
    - {/* Items Table */} -
    +
    -
    {idx + 1} {item.ProdName}{item.SalesQty}{item?.EditTokenAvailable === 'Y' ? item?.EditTokenQty : item.SalesQty} {item.Rate}{item.TotalAmt}{((item?.EditTokenAvailable === 'Y' ? item?.EditTokenQty : item.SalesQty) * item.Rate) - ((item?.EditTokenAvailable === 'Y' ? (item?.OfferAmt / item?.EditTokenQty) : item?.OfferAmt))}
    +
    {GlobaldummyData - ? GlobalSlNo && : - SLNO == true && } + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} {GlobaldummyData - ? GlobalItem && : - Item == true && } - + ? GlobalItem && ( + + ) + : Item == true && ( + + )} {GlobaldummyData - ? GlobalHsnCode && : - HsnCode == true && } + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} {GlobaldummyData - ? GlobalQuantity && - : Quantity == true && } + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} {/* */} {GlobaldummyData - ? GlobalMRP && - : MRP == true && } + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} {GlobaldummyData - ? GlobalRate && - : Rate == true && } + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} {GlobaldummyData - ? GlobalDiscount && - : Discount == true && } + ? GlobalDiscount && ( + + ) + : Discount == true && ( + + )} {GlobaldummyData - ? GlobalTax && - : (Tax && table2Data?.OrderType !== 'E') && } + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} {GlobaldummyData - ? GlobalAmount && - : Amount == true && } - + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} - - {((GlobaldummyData ? products : dataChunk) || []).map((item, idx) => ( - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && ( - + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item == true && ( + - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode == true && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity == true && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP == true && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate == true && ( - - )} - {GlobaldummyData - ? GlobalDiscount && - : Discount == true && ( - - )} - {GlobaldummyData - ? GlobalTax && - : (Tax && table2Data?.OrderType !== 'E') && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount == true && ( - - )} - - ))} - - - + + )} +  {' '} + {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(',')} +
    + ); + }) + : ''} + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + ), + )}
    S.NoS.NoS.No + S.No + ItemItemItem + Item + HSN HSN HSN + HSN{' '} + Qty {WeightasKg ? 'Qty/Kg' : 'Qty'}Qty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + UOM UOMMRPMRPMRP + MRP + RateRateRate + Rate + DisDisDis + Dis + Tax %Tax %Tax % + Tax % + AmountAmountAmount + Amount +
    - {chunkIndex * chunkSize + idx + 1} - - {chunkIndex * chunkSize + idx + 1} - {item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) - - ))} -
    - - :
    - ({item?.Size ? item?.Size : "1"}{" "} - {item?.SinglePc == "Y" - ? "PCS" - : item?.Type != "C" - ? item?.UomName - : "COMBO"} - ) -
    )} -  {" "} - {item?.BrandName !== null - ? item?.BrandName - : ""} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == "" || - items.SerialNumber == null + {((GlobaldummyData ? products : dataChunk) || []).map( + (item, idx) => ( +
    + {chunkIndex * chunkSize + idx + 1} + + {chunkIndex * chunkSize + idx + 1} + + {item?.ProdName} + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId, + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId, + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} ) - )?.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} - - {item?.HSN} - - {item?.SalesQty} - - {item?.SalesQty} - - {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?.ProdTaxPercentage} - {item?.ProdTaxPercentage || 0} - - {item?.TotalAmt} - - {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0} -
    + {item?.HSN} + + {item?.HSN} + + {item?.SalesQty} + + {item?.SalesQty} + + {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    @@ -1143,483 +1533,1113 @@ const InvoiceTemplate = ({ index,
    )} - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - <> - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} -
    - -
    -
    - Items : -
    -
    {GlobaldummyData ? "7" : totalQuantityFilter?.length}
    -
    - -
    -
    - Qty : -
    -
    {GlobaldummyData ? "9" : totalQuantity}
    -
    - -
    -
    - Off : -
    -
    {(Number(TotalOfferAmount || 0) + Number(table2Data?.OverallDisc || 0)).toFixed(2)}
    -
    -
    -
    - Amount :₹ -
    -
    {GlobaldummyData - ? "1066" - : (table2Data?.NetAmount)}
    -
    - - - - - - -
    - {/* Summary */} -
    - {GlobaldummyData ?
    - -
    :
    - -
    } - {table2Data?.OrderType !== 'E' &&
    - - -
    -
    - Total Taxable Amount : +
    +
    +
    + Items : +
    +
    + {GlobaldummyData + ? '7' + : totalQuantityFilter?.length}
    -
    {GlobaldummyData ? 736 : table2Data?.BillAmount}
    -
    - {OrderDetailGST?.map((item, index) => ( -
    -
    -
    - Taxable Amount : -
    -
    {Number(item.WithOutTaxAmount).toFixed(2)}
    -
    +
    +
    + Qty : +
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    -
    -
    - CGST ({item.TaxPercentage / 2}%) : -
    -
    {Number(item.CGST).toFixed(2)}
    +
    +
    + Off : +
    +
    + {( + Number(TotalOfferAmount || 0) + + Number(table2Data?.OverallDisc || 0) + ).toFixed(2)} +
    +
    +
    +
    + Amount :₹ +
    +
    + {GlobaldummyData + ? '1066' + : table2Data?.NetAmount} +
    +
    +
    + {/* Summary */} +
    + {GlobaldummyData ? ( +
    + +
    + ) : ( +
    + +
    + )} + {table2Data?.OrderType !== 'E' && ( +
    +
    +
    + Total Taxable Amount :
    - -
    -
    - SGST ({item.TaxPercentage / 2}%) : -
    -
    {Number(item.SGST).toFixed(2)}
    -
    - -
    -
    - Total (incl GST) : -
    -
    {Number(item.TotalAmt).toFixed(2)}
    +
    + {GlobaldummyData + ? 736 + : table2Data?.BillAmount}
    - ))} -
    - {/*
    +
    + {OrderDetailGST?.map((item, index) => ( +
    +
    +
    + Taxable Amount : +
    +
    + {Number( + item.WithOutTaxAmount, + ).toFixed(2)} +
    +
    + +
    +
    + CGST ({item.TaxPercentage / 2}%) : +
    +
    + {Number(item.CGST).toFixed(2)} +
    +
    + +
    +
    + SGST ({item.TaxPercentage / 2}%) : +
    +
    + {Number(item.SGST).toFixed(2)} +
    +
    + +
    +
    + Total (incl GST) : +
    +
    + {Number(item.TotalAmt).toFixed(2)} +
    +
    +
    + ))} +
    + + {/*
    GST Payable on Reverse Charge
    */} -
    +
    -
    -
    - Total Amount Payable : -
    -
    {Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)}
    -
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    +
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - + Total Amount Payable :
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    + {Number( + GlobaldummyData + ? 736 + : table2Data?.NetAmount, + )?.toFixed(2)}
    -
    - )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {( + lastTransaction?.BeforeAdjustment || + 0 + ).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === + 'REFUND' + ? '-' + : '+'} + {( + lastTransaction?.Amount || 0 + ).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {( + lastTransaction?.AfterAdjustment || + 0 + ).toFixed(2)} + +
    +
    +
    + )} - {/*
    + {/*
    Total Amount Payable {Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)}
    */} - {/*
    + {/*
    {Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)}
    */} -
    } -
    - - {/* Footer */} -
    -
    - {(BankDetails?.length > 0) && (<> -

    Bank Details:

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

    - Terms & Conditions + {/* Footer */} +

    +
    + {BankDetails?.length > 0 && ( + <> +

    + Bank Details: +

    +
    +
    + Bank Name:{' '} + {!estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : BankDetails?.[0]?.BankName} +
    +
    + Account No.:{' '} + {!estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : BankDetails?.[0]?.AccountNo} +
    +
    + IFSC Code:{' '} + {!estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : BankDetails?.[0]?.IFSCCode} +
    +
    + Branch Name:{' '} + {!estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : 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

    + ) : !estimatePrintHeader && + table2Data?.OrderType === 'E' ? ( + '' + ) : ( +

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

    -
      -
    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. */} -
    -
    ) - } + )} +

    + Authorised Signatory +

    + + {GlobaldummyData + ? GlobalSignature && ( +
    + +
    + ) + : Signature == true && ( +
    + {!estimatePrintHeader && + table2Data?.OrderType === 'E' ? ( + '' + ) : ( + + )} +
    + )} +

    (Common Seal)

    +
    -
    -
    -

    Certified that the particulars given above are true and correct.

    -
    -
    - {GlobaldummyData ?

    Company Name

    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :

    "For" {companyName}

    } -

    Authorised Signatory

    + {/*
    */} - {GlobaldummyData ? GlobalSignature && (
    - -
    ) : Signature == true && ( -
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : } + {/* Copy Labels */} +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

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

    + {Notestext} +

    + + {/*
    */}
    )} -

    (Common Seal)

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

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - - {/*
    */} -
    ) - } -
    -
    - - } + + )}
    //
    ))}
    {/*
    */} - {shouldFooterBeOnNewPage && FormatTheme && + {shouldFooterBeOnNewPage && FormatTheme && (
    -
    <> - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )}
    -
    -
    - Items : +
    +
    + Items : +
    +
    + {GlobaldummyData ? '7' : totalQuantityFilter?.length}
    -
    {GlobaldummyData ? "7" : totalQuantityFilter?.length}
    -
    -
    - Qty : +
    +
    + Qty : +
    +
    + {GlobaldummyData ? '9' : totalQuantity}
    -
    {GlobaldummyData ? "9" : totalQuantity}
    -
    -
    - Off : +
    +
    + Off : +
    +
    + {( + Number(TotalOfferAmount || 0) + + Number(table2Data?.OverallDisc || 0) + ).toFixed(2)}
    -
    {(Number(TotalOfferAmount || 0) + Number(table2Data?.OverallDisc || 0)).toFixed(2)}
    -
    -
    - Amount :₹ +
    +
    + Amount :₹ +
    +
    + {GlobaldummyData ? '1066' : table2Data?.NetAmount}
    -
    {GlobaldummyData - ? "1066" - : (table2Data?.NetAmount)}
    {/*
    */} {/* Summary */}
    - {GlobaldummyData ?
    - -
    :
    - -
    } - {table2Data?.OrderType !== 'E' &&
    - - -
    -
    - Total Taxable Amount : -
    -
    {GlobaldummyData ? 736 : table2Data?.BillAmount}
    + {GlobaldummyData ? ( +
    +
    - -
    - {OrderDetailGST?.map((item, index) => ( -
    -
    -
    - Taxable Amount : -
    -
    {Number(item.WithOutTaxAmount).toFixed(2)}
    -
    - -
    -
    - CGST ({item.TaxPercentage / 2}%) : -
    -
    {Number(item.CGST).toFixed(2)}
    -
    - -
    -
    - SGST ({item.TaxPercentage / 2}%) : -
    -
    {Number(item.SGST).toFixed(2)}
    -
    - -
    -
    - Total Amount Tax : -
    -
    {Number(item.TotalAmt).toFixed(2)}
    -
    + ) : ( +
    + +
    + )} + {table2Data?.OrderType !== 'E' && ( +
    +
    +
    + Total Taxable Amount :
    - ))} -
    - {/*
    +
    + {GlobaldummyData ? 736 : table2Data?.BillAmount} +
    +
    + +
    + {OrderDetailGST?.map((item, index) => ( +
    +
    +
    + Taxable Amount : +
    +
    + {Number(item.WithOutTaxAmount).toFixed(2)} +
    +
    + +
    +
    + CGST ({item.TaxPercentage / 2}%) : +
    +
    {Number(item.CGST).toFixed(2)}
    +
    + +
    +
    + SGST ({item.TaxPercentage / 2}%) : +
    +
    {Number(item.SGST).toFixed(2)}
    +
    + +
    +
    + Total Amount Tax : +
    +
    {Number(item.TotalAmt).toFixed(2)}
    +
    +
    + ))} +
    + {/*
    GST Payable on Reverse Charge
    */} -
    -
    - Total Amount Payable - {Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)} -
    -
    - {Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)} -
    - {isEditedBill && lastTransaction && ( -
    +
    +
    + Total Amount Payable + + {Number( + GlobaldummyData ? 736 : table2Data?.NetAmount, + )?.toFixed(2)} + +
    +
    + {Number( + GlobaldummyData ? 736 : table2Data?.NetAmount, + )?.toFixed(2)} +
    + {isEditedBill && lastTransaction && (
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    + + Bill Gross Amount + + + {( + lastTransaction?.BeforeAdjustment || 0 + ).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === + 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {( + lastTransaction?.AfterAdjustment || 0 + ).toFixed(2)} + +
    -
    - )} -
    } + )} +
    + )}
    {/* Footer */}
    - {BankDetails?.length > 0 && (<> -

    Bank Details:

    -
    -
    Bank Name: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.BankName}
    -
    Account No.: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.AccountNo}
    -
    IFSC Code: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.IFSCCode}
    -
    Branch Name: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.BankBranch}
    -
    -
    - )} + {BankDetails?.length > 0 && ( + <> +

    + Bank Details: +

    +
    +
    + Bank Name:{' '} + {!estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : BankDetails?.[0]?.BankName} +
    +
    + Account No.:{' '} + {!estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : BankDetails?.[0]?.AccountNo} +
    +
    + IFSC Code:{' '} + {!estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : BankDetails?.[0]?.IFSCCode} +
    +
    + Branch Name:{' '} + {!estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : 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)

    @@ -1628,177 +2648,296 @@ const InvoiceTemplate = ({ index, {/* Copy Labels */}
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    -
    -
    ) : - Notestext && (
    -

    {Notestext}

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

    + {Notestext} +

    - {/*
    */} -
    ) - } + {/*
    */} +
    + )}
    - } - + )}
    - : + ) : (
    {/* Header */} - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - -
    -
    - {(GlobalLogo && GlobaldummyData) &&
    Brand Logo
    } - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? Brand Logo : null} -

    {GlobaldummyData ? "Company Name" : companyName}

    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    +
    + {GlobalLogo && GlobaldummyData && ( +
    + {' '} + Brand Logo +
    + )} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + Brand Logo + ) : null} +

    + {GlobaldummyData ? 'Company Name' : companyName} +

    +
    +

    {companyAddress}

    + {(companyPhone || GlobaldummyData) && ( +
    + Phone: {GlobaldummyData ? '999999XXXX' : companyPhone} +
    + )} +
    Email: {companyEmail}
    + {companyGSTIN || + (GlobaldummyData && ( +
    + GSTIN:{' '} + {GlobaldummyData ? 'XXTTHJJF7679' : companyGSTIN} +
    + ))}
    -

    {companyAddress}

    - {(companyPhone || GlobaldummyData) &&
    Phone: {GlobaldummyData ? "999999XXXX" : companyPhone}
    } -
    Email: {companyEmail}
    - {companyGSTIN || GlobaldummyData &&
    GSTIN: {GlobaldummyData ? "XXTTHJJF7679" : companyGSTIN}
    }
    - - -
    } + )} {/* Invoice Title */}
    - {table2Data?.OrderType === "E" && ( + {table2Data?.OrderType === 'E' && (
    - Estimate{" "} + Estimate{' '}
    )} - {table2Data?.OrderType === "E" ? ( - "" + {table2Data?.OrderType === 'E' ? ( + '' ) : (
    - {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} - + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' + : ''}
    )}
    - - {GlobaldummyData ? + {GlobaldummyData ? (
    -

    Details of Receiver | Billed to

    +

    + Details of Receiver | Billed to +

    -
    Name : +
    + Name : {GlobaldummyData ? ( - - {"XXXYYY"} - - ) : table2Data?.CustomerDetails?.[0]?.CustSuppName} -
    - - -
    Address: - XYZ City -
    - -
    State: XYZ State
    - -
    -
    - -
    - : - table2Data?.CustomerDetails?.length > 0 &&
    -
    -

    Details of Receiver | Billed to

    -
    -
    Name : - {GlobaldummyData ? ( - - {"XXXYYY"} - - ) : table2Data?.CustomerDetails?.[0]?.CustSuppName} -
    - - -
    Address: {table2Data?.CustomerDetails?.length > 0 && - !GlobaldummyData && ( - - {table2Data?.CustomerDetails?.[0]?.Address1} {table2Data?.CustomerDetails?.[0]?.Address2} - + {'XXXYYY'} + ) : ( + table2Data?.CustomerDetails?.[0]?.CustSuppName )}
    -
    State: {table2Data?.CustomerDetails?.[0]?.State}
    +
    + Address: + XYZ City +
    +
    + State: XYZ State +
    -
    - } + ) : ( + table2Data?.CustomerDetails?.length > 0 && ( +
    +
    +

    + Details of Receiver | Billed to +

    +
    +
    + Name : + {GlobaldummyData ? ( + {'XXXYYY'} + ) : ( + table2Data?.CustomerDetails?.[0]?.CustSuppName + )} +
    +
    + Address:{' '} + {table2Data?.CustomerDetails?.length > 0 && + !GlobaldummyData && ( + + {table2Data?.CustomerDetails?.[0]?.Address1}{' '} + {table2Data?.CustomerDetails?.[0]?.Address2} + + )} +
    + +
    + State:{' '} + {table2Data?.CustomerDetails?.[0]?.State} +
    +
    +
    +
    + ) + )} {/* Items Table */}
    - +
    {GlobaldummyData - ? GlobalSlNo && : - SLNO == true && } + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} {GlobaldummyData - ? GlobalItem && : - Item == true && } - + ? GlobalItem && ( + + ) + : Item == true && ( + + )} {GlobaldummyData - ? GlobalHsnCode && : - HsnCode == true && } + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} {GlobaldummyData - ? GlobalQuantity && - : Quantity == true && } + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} {/* */} {GlobaldummyData - ? GlobalMRP && - : MRP == true && } + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} {GlobaldummyData - ? GlobalRate && - : Rate == true && } + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} {GlobaldummyData - ? GlobalDiscount && - : Discount == true && } + ? GlobalDiscount && ( + + ) + : Discount == true && ( + + )} {GlobaldummyData - ? GlobalTax && - : (Tax && table2Data?.OrderType !== 'E') && } + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} {GlobaldummyData - ? GlobalAmount && - : Amount == true && } + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} {/* @@ -1820,368 +2959,647 @@ const InvoiceTemplate = ({ index, */} - {((GlobaldummyData ? products : productsData) || []).map((item, idx) => ( - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && ( - - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode == true && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity == true && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP == true && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate == true && ( - - )} - {GlobaldummyData - ? GlobalDiscount && - : Discount == true && ( - - )} - {(GlobaldummyData - ? GlobalTax && - : (Tax && table2Data?.OrderType !== 'E') && - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount == true && ( - - )} - - ))} - - - + {((GlobaldummyData ? products : productsData) || []).map( + (item, idx) => ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item == true && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + ), + )}
    S.NoS.NoS.NoS.NoItemItemItemItemHSN HSN HSN HSN Qty {WeightasKg ? 'Qty/Kg' : 'Qty'}Qty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + UOM UOMMRPMRPMRPMRPRateRateRateRateDisDisDisDisTax %Tax %Tax % + Tax % + AmountAmountAmountAmountTaxable IGST
    - {idx + 1} - - {idx + 1} - {item?.ProdName} -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : "1"}{" "} - {item?.SinglePc == "Y" - ? "PCS" - : item?.Type != "C" - ? item?.UomName - : "COMBO"} - ) -
    -  {" "} - {item?.BrandName !== null - ? item?.BrandName - : ""} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == "" || - items.SerialNumber == null - ) - )?.map((a) => { - return
    {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} - - {item?.HSN} - - {item?.SalesQty} - - {item?.SalesQty} - - {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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0} - {item?.TotalAmt} - - {item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0} -
    + {idx + 1} + + {idx + 1} + + {item?.ProdName} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    +  {' '} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ), + )?.map((a) => { + return
    {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} + + {item?.HSN} + + {item?.SalesQty} + + {item?.SalesQty} + + {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    - {" "} - Items:{GlobaldummyData ? "7" : totalQuantityFilter?.length} + {' '} + Items:{GlobaldummyData ? '7' : totalQuantityFilter?.length}
    - {" "} - Qty:{GlobaldummyData ? "9" : totalQuantity} + {' '} + Qty:{GlobaldummyData ? '9' : totalQuantity}
    {/* {ExtraChargeTotal > 0 &&

    Extra Charges:{ExtraChargeTotal}

    } */} - {(TotalOfferAmount > 0 || table2Data?.OverallDisc > 0) && ( -

    - Off :{(Number(TotalOfferAmount || 0) + Number(table2Data?.OverallDisc || 0)).toFixed(2)} +

    + Off : + {( + Number(TotalOfferAmount || 0) + + Number(table2Data?.OverallDisc || 0) + ).toFixed(2)}

    )}
    Amount :₹ {GlobaldummyData - ? "1066" + ? '1066' : Number(table2Data?.NetAmount).toFixed(2)}
    {/* Summary */}
    - {GlobaldummyData ?
    - -
    :
    - -
    } - {table2Data?.OrderType !== 'E' &&
    - - -
    -
    - Total Taxable Amount : -
    -
    {GlobaldummyData ? 736 : table2Data?.BillAmount}
    + {GlobaldummyData ? ( +
    +
    - -
    - {OrderDetailGST?.map((item, index) => ( -
    -
    -
    - Taxable Amount : -
    -
    {Number(item.WithOutTaxAmount).toFixed(2)}
    -
    - -
    -
    - CGST ({item.TaxPercentage / 2}%) : -
    -
    {Number(item.CGST).toFixed(2)}
    -
    - -
    -
    - SGST ({item.TaxPercentage / 2}%) : -
    -
    {Number(item.SGST).toFixed(2)}
    -
    - -
    -
    - Total (incl GST) : -
    -
    {Number(item.TotalAmt).toFixed(2)}
    -
    + ) : ( +
    + +
    + )} + {table2Data?.OrderType !== 'E' && ( +
    +
    +
    + Total Taxable Amount :
    - ))} -
    - {/*
    +
    + {GlobaldummyData ? 736 : table2Data?.BillAmount} +
    +
    + +
    + {OrderDetailGST?.map((item, index) => ( +
    +
    +
    + Taxable Amount : +
    +
    + {Number(item.WithOutTaxAmount).toFixed(2)} +
    +
    + +
    +
    + CGST ({item.TaxPercentage / 2}%) : +
    +
    {Number(item.CGST).toFixed(2)}
    +
    + +
    +
    + SGST ({item.TaxPercentage / 2}%) : +
    +
    {Number(item.SGST).toFixed(2)}
    +
    + +
    +
    + Total (incl GST) : +
    +
    {Number(item.TotalAmt).toFixed(2)}
    +
    +
    + ))} +
    + {/*
    GST Payable on Reverse Charge
    */} -
    -
    - Total Amount Payable - {Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)} -
    -
    - {Number(GlobaldummyData ? 736 : table2Data?.NetAmount)?.toFixed(2)} -
    - {isEditedBill && lastTransaction && ( -
    +
    +
    + Total Amount Payable + + {Number( + GlobaldummyData ? 736 : table2Data?.NetAmount, + )?.toFixed(2)} + +
    +
    + {Number( + GlobaldummyData ? 736 : table2Data?.NetAmount, + )?.toFixed(2)} +
    + {isEditedBill && lastTransaction && (
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2, + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2, + )} + +
    -
    - )} -
    } + )} +
    + )}
    {/* Footer */}
    - {(BankDetails?.length > 0 || GlobaldummyData) && (<> -

    Bank Details:

    -
    -
    Bank Name: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.BankName}
    -
    Account No.: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.AccountNo}
    -
    IFSC Code: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.IFSCCode}
    -
    Branch Name: {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : BankDetails?.[0]?.BankBranch}
    -
    -
    - )} + {(BankDetails?.length > 0 || GlobaldummyData) && ( + <> +

    Bank Details:

    +
    +
    + Bank Name:{' '} + {!estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : BankDetails?.[0]?.BankName} +
    +
    + Account No.:{' '} + {!estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : BankDetails?.[0]?.AccountNo} +
    +
    + IFSC Code:{' '} + {!estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : BankDetails?.[0]?.IFSCCode} +
    +
    + Branch Name:{' '} + {!estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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)

    @@ -2190,25 +3608,31 @@ const InvoiceTemplate = ({ index, {/* Copy Labels */}
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    -
    -
    ) : - Notestext && (
    -

    {Notestext}

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

    + {Notestext} +

    - {/*
    */} -
    ) - } + {/*
    */} +
    + )}
    - - } + )} ); }; -export default InvoiceTemplate; \ No newline at end of file +export default InvoiceTemplate; From 2f4f8d3e5ed2140073554ccf36559894e6b0ac98 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 Feb 2026 19:16:18 +0530 Subject: [PATCH 3/5] resolved conflicting files --- src/Components/Menu/SideMenuPozo.jsx | 11 +- .../BookingScreen/BookingData/BookingData.js | 35 +- .../BSBillingTable1/BST1Payment.jsx | 507 +- .../BSBillingTable1/BalanceAndReceived.jsx | 29 +- .../BSBillingTable2/BSBillingTable2.jsx | 178 +- .../BSBillingTable3/BSBillingTable3pay.jsx | 175 +- .../BSBillingTable4/BSBilling4Payment.jsx | 70 +- .../BSBillingTable5/BSBillingTable5.jsx | 183 +- .../BSBillingTable6/BST6Payment.jsx | 178 +- .../BSBillingTable7/BSBilling7Payment.jsx | 182 +- .../StandardTable/StandardTable.jsx | 401 +- .../StandardTable/StandardTable.scss | 58 +- .../StandardTable/StandardTablePayment.jsx | 216 +- .../Components/BSCombo/BSC1Payment.jsx | 374 +- .../Components/BSItemCards/BSItemCard.jsx | 11 +- .../FeaturesFunctionalities.jsx | 456 +- .../BookingFunctionality/SplitPayment.jsx | 251 +- .../OtherConponents/Reprint/BSReprint.jsx | 222 +- .../PrintMainPage/PrintPreviewpage.jsx | 204 +- .../UtillComponents/BSCreditCustomer.jsx | 1 + .../BSNavbarSearchStandard.jsx | 4 +- .../UtillComponents/BSPrinterSetting.jsx | 6 +- .../PrintTemplates/A4/PrintA4Style11.jsx | 178 +- .../PrintTemplates/A4/PrintStyleA5.jsx | 259 +- .../ThermalPrinter/PrintStyle1.jsx | 3197 ++++----- .../ThermalPrinter/PrintStyle10.jsx | 231 +- .../ThermalPrinter/PrintStyle11.jsx | 5447 ++++----------- .../ThermalPrinter/PrintStyle12.jsx | 5475 ++++----------- .../ThermalPrinter/PrintStyle2.jsx | 3544 +++++----- .../ThermalPrinter/PrintStyle3.jsx | 155 +- .../ThermalPrinter/PrintStyle4.jsx | 3462 +++++----- .../ThermalPrinter/PrintStyle5.jsx | 2657 ++++--- .../ThermalPrinter/PrintStyle6.jsx | 2939 ++++---- .../ThermalPrinter/PrintStyle7.jsx | 5597 ++++----------- .../ThermalPrinter/PrintStyle8.jsx | 6136 ++++------------- .../ThermalPrinter/PrintStyle9.jsx | 3215 ++++----- src/Pages/DashBoard/RetailDashboard.jsx | 1 + src/Pages/Kiosk/CardPage/SelfCardPage1.jsx | 209 +- src/Pages/Preference/PreferenceList.jsx | 3 - src/Pages/Tablebooking/TableBooking.jsx | 1 + .../paymentpdfPage/PaymentPdfBooking.jsx | 158 +- 41 files changed, 15567 insertions(+), 31049 deletions(-) diff --git a/src/Components/Menu/SideMenuPozo.jsx b/src/Components/Menu/SideMenuPozo.jsx index bbd38dd..c60cd0c 100644 --- a/src/Components/Menu/SideMenuPozo.jsx +++ b/src/Components/Menu/SideMenuPozo.jsx @@ -56,9 +56,6 @@ import { changeBtoBQuickProductTransfer, changeTipAmount, GlobalDineinDefault, - changePreviousOrderOfferDetail, - changePreviousOrderPayment, - changeBillEditingMode, } from '../../Features/BookingScreen/BookingData/BookingData'; import { changeWholeSaleAuctionSelectedData, @@ -265,9 +262,6 @@ const SideMenuPozo = ({ items = [] }) => { dispatch(ChangeTotalAmount([])); dispatch(ChangeFullFreeProductList([])); dispatch(changeFullOfferAppliedProducts([])); - dispatch(changeBillEditingMode(false)); - await dispatch(changePreviousOrderPayment([])); - await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeLoyaltyConsumedQuantities({})); } if (e == `${subDirectory}sales`) { @@ -291,9 +285,6 @@ const SideMenuPozo = ({ items = [] }) => { dispatch(Offer.changeCoupenCodeAmount(0)); dispatch(ChangeFullFreeProductList([])); dispatch(changeFullOfferAppliedProducts([])); - dispatch(changeBillEditingMode(false)); - await dispatch(changePreviousOrderPayment([])); - await dispatch(changePreviousOrderOfferDetail([])); dispatch(ChangeTotalAmount([])); dispatch(changeLoyaltyConsumedQuantities({})); } @@ -391,7 +382,7 @@ const SideMenuPozo = ({ items = [] }) => { e.stopPropagation(); handleMenuClick(item, parentKeys, e, level); }} - // style={{ paddingLeft: `${level * 10 + 1}px` }} + // style={{ paddingLeft: `${level * 10 + 1}px` }} > {item.icon && level === 0 && ( { - return await axiosRetailInstanceData.put(`/SalesBillEdit`, putData); - } -); - export const getEstimateDatewiseReport = createAsyncThunk( 'BookingData/getEstimateDatewiseReport', async (data) => { @@ -1440,7 +1432,7 @@ export const getMissedOrderids = createAsyncThunk( export const CustomerOrderList = createAsyncThunk( 'CustomerOrderList/LastBuyProductList', async (data) => { - const { AppId, CompId, BranchId, MobileNo, FromDate, ToDate } = data; + const { AppId, CompId, BranchId, MobileNo,FromDate,ToDate } = data; if ( AppId != null && AppId != undefined && @@ -1612,9 +1604,6 @@ const initialState = { AddBookingDetailsTrigger: false, CurrentOrderId: null, productCardTrigger: 0, - salesBillEdit: false, - previousOrderPayment: [], - previousOrderOfferDetails: [], }; const BookingData = createSlice({ @@ -1940,15 +1929,6 @@ const BookingData = createSlice({ triggerProductCard: (state) => { state.productCardTrigger += 1; }, - changeBillEditingMode: (state, action) => { - state.salesBillEdit = action?.payload; - }, - changePreviousOrderPayment: (state, action) => { - state.previousOrderPayment = action?.payload; - }, - changePreviousOrderOfferDetail: (state, action) => { - state.previousOrderOfferDetails = action?.payload; - }, }, extraReducers: (builder) => { @@ -1996,8 +1976,8 @@ const BookingData = createSlice({ } }), - builder.addCase(getProductsearch.fulfilled, (state, action) => { - console.log(action?.payload, "mohanaacacacca") + builder.addCase(getProductsearch.fulfilled, (state, action) => { + console.log(action?.payload,"mohanaacacacca") if (action?.payload?.statusCode === 1) { state.SelectedDatas = action?.payload?.data; } else { @@ -2217,9 +2197,6 @@ export const { changeAddBookingDetailsTrigger, changeCurrentOrderId, triggerProductCard, - changeBillEditingMode, - changePreviousOrderPayment, - changePreviousOrderOfferDetail } = BookingData.actions; export const GlobalComboRedirectionToDefaultLayoutForParking = (state) => @@ -2388,11 +2365,5 @@ export const GlobalAddBookingDetailsTrigger = (state) => state?.BookingData?.AddBookingDetailsTrigger; export const GlobalCurrentOrderId = (state) => state?.BookingData?.CurrentOrderId; -export const GlobalSalesBillEdit = (state) => - state?.BookingData?.salesBillEdit; -export const GlobalPreviousOrderPayment = (state) => - state?.BookingData?.previousOrderPayment; -export const GlobalPreviousOrderOfferDetails = (state) => - state?.BookingData?.previousOrderOfferDetails; export default BookingData.reducer; diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx index 05f774e..bd078f5 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx @@ -117,15 +117,6 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, - GlobalSalesBillEdit, - GlobalPreviousOrderPayment, - GlobalPreviousOrderOfferDetails, - GlobalpaymentOptionData, - getPaymentOptions, - putSalesBillEdit, - changeBillEditingMode, - changePreviousOrderPayment, - changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; import { @@ -244,10 +235,6 @@ export default function BST1Payment() { ); const dispatch = useDispatch(); const navigate = useNavigate(); - const salesBillEdit = useSelector(GlobalSalesBillEdit); - const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); - const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); - const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const Discount = useSelector(GlobalOverAllOfferAmt); const defaultBookingType = useSelector(GlobalDefaultBookingType); const globalTipAmount = useSelector(GlobaltipAmount); @@ -336,12 +323,6 @@ export default function BST1Payment() { const [defaultEnabled, setDefaultEnabled] = useState(false); const [SelectedUpiOption, setSelectedUpiOption] = useState(); const [hold, setHold] = useState(false); - const [refundPayBtns, setRefundPayBtns] = useState([]); - const [refundPaySelected, setRefundPaySelected] = useState(); - const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); - const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); - const [previousNetAmount, setPreviousNetAmount] = useState(0); - console.log(currentOrderNetAmount, 'currentOrderNetAmount', previousNetAmount, salesBillEdit); const [addcustomer, setAddCustomer] = useState(false); const [PrintOrderDetails, setPrintOrderDetails] = useState([]); //Total calculation @@ -559,27 +540,6 @@ export default function BST1Payment() { ); } - const filteredPayments = - previousOrderPayment?.filter( - p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment - ) || []; - - const paymentsToUse = - filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; - - const totalPreviouspayment = paymentsToUse?.reduce( - (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), - 0 - ); - - const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( - (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), - 0 - ); - - const previousNetAmount = - (totalPreviouspayment) || 0; - // let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0)); let withdiscTotal = Total - @@ -587,17 +547,19 @@ export default function BST1Payment() { (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - const currentOrderNetAmount = formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - - setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); - setCurrentOrderNetAmount(currentOrderNetAmount); - setPreviousNetAmount(previousNetAmount); - dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); + setTotalAmount( + formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) + ); + dispatch( + changeSummeryTotalAmount( + formatAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) + ) + ); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -659,31 +621,6 @@ export default function BST1Payment() { fetchApi(); } }, [UserType]); - - useEffect(() => { - if (salesBillEdit) { - dispatch(getPaymentOptions()).unwrap(); - } - }, [salesBillEdit]); - - useEffect(() => { - - if (salesBillEdit) { - if (SelCustId) { - setRefundPayBtns(AllPaymentOptions); - setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); - setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); - } else { - const withoutCustomer = AllPaymentOptions?.filter?.( - (item) => item?.ConfigName?.toLowerCase() !== 'credit' - ); - setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); - setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); - setRefundPayBtns(withoutCustomer); - } - } - - }, [AllPaymentOptions, SelCustId, salesBillEdit]) useEffect(() => { let hasAccess = false; @@ -891,7 +828,7 @@ export default function BST1Payment() { const selectedStyle = stylesMap[ - printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle + printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle ]; if (selectedStyle) { @@ -1245,7 +1182,7 @@ export default function BST1Payment() { await Promise.all( PrintOrderDetails?.[0]?.OrderDetails?.map( async (orderDetail, index) => { - const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( + const groupedTokens = orderDetail?.productDetails?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -1326,10 +1263,6 @@ export default function BST1Payment() { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); - } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { - setMessageType('warning'); - setMessageData('Please Select Refund Payment Method'); - return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1602,12 +1535,6 @@ export default function BST1Payment() { setCardoptionnotSelected(false); } }; - - const handleRefundPaymentMode = (id, name) => { - setRefundPaySelected(id); - setRefundPaySelectedName(name); - } - const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1809,9 +1736,6 @@ export default function BST1Payment() { ParkingClaimed: false, }) ); - dispatch(changeBillEditingMode(false)); - await dispatch(changePreviousOrderPayment([])); - await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeLoyaltyConsumedQuantities({})); dispatch(changeFullOfferAppliedProducts([])); @@ -1828,8 +1752,6 @@ export default function BST1Payment() { setPaybtnselected(PaymentOptionsModeId); setQrCode(false); setUpinotSelected(false); - setCurrentOrderNetAmount(0); - setPreviousNetAmount(0); getHolddata(); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -2006,15 +1928,15 @@ export default function BST1Payment() { OrderStatus: 'O', OrderType: BookingType === 'Dine In' || - BookingTypeBoth || - Estimation?.SettingValue == 'N' + BookingTypeBoth || + Estimation?.SettingValue == 'N' ? 'S' : GlobEstBooking === 'OvrAllEst' ? 'E' : GlobEstBooking === 'ParEst' ? GlobProdwisedata?.includes( - a.InwardDtlId + ' ' + a?.BookingTypeName - ) + a.InwardDtlId + ' ' + a?.BookingTypeName + ) ? 'E' : 'S' : 'S', @@ -2104,7 +2026,7 @@ export default function BST1Payment() { : Paybtnnameselected?.toLowerCase() === 'credit' ? 'S' : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', OrderDtlDetails: @@ -2121,15 +2043,15 @@ export default function BST1Payment() { ? globalTipAmount === 0 ? SelectedTableDetails : SelectedTableDetails?.map((item) => ({ - ...item, - TipsAmount: globalTipAmount, - })) + ...item, + TipsAmount: globalTipAmount, + })) : null, SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : + PaymentType: Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2137,20 +2059,20 @@ export default function BST1Payment() { ? PaymentgatewayUPI?.[0]?.ModeId : SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find( - (busupi) => busupi?.ModeId === UpiId - )?.ModeId + (busupi) => busupi?.ModeId === UpiId + )?.ModeId : paybtnselected : paybtnselected ? paybtnselected : null, - Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), - MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + Amount: Math.round(TotalAmount), + MerchantId: Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'business' + SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) - ?.MerchantId + ?.MerchantId : null, - PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : + PaymentOptionType: Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2164,42 +2086,42 @@ export default function BST1Payment() { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + ModeOfPayment: SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) - ?.UPIDetailId + ?.UPIDetailId : SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) - ?.MerchantUPIId + ?.MerchantUPIId : null, - AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : + AccountDtl: Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( - (upipay) => upipay?.UPIId === UpiId - ) + (upipay) => upipay?.UPIId === UpiId + ) : (Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'pd') || - (Paybtnnameselected?.toLowerCase() === 'card' && - SelectedCardOption?.toLowerCase() === 'pd') + SelectedUPIPayOption?.toLowerCase() === 'pd') || + (Paybtnnameselected?.toLowerCase() === 'card' && + SelectedCardOption?.toLowerCase() === 'pd') ? useOptions?.[0]?.PaymentDetails?.PaymentDevice : (Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'pg') || - (Paybtnnameselected?.toLowerCase() === 'card' && - SelectedCardOption?.toLowerCase() === 'pg') + SelectedUPIPayOption?.toLowerCase() === 'pg') || + (Paybtnnameselected?.toLowerCase() === 'card' && + SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : + PaymentStatus: Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' ? 'S' : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, - Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : + Debit: 0, + Credit: Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2268,14 +2190,14 @@ export default function BST1Payment() { setMessageType('success'); setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); response?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([response?.data]); @@ -2404,12 +2326,7 @@ export default function BST1Payment() { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = null; - if (salesBillEdit) { - response = await dispatch(putSalesBillEdit(putdata)).unwrap(); - } else { - response = await dispatch(PutBookingData(putdata)).unwrap(); - } + let response = await dispatch(PutBookingData(putdata)).unwrap(); if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -2432,14 +2349,14 @@ export default function BST1Payment() { setMessageType('success'); setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); response?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([response?.data]); @@ -2540,14 +2457,14 @@ export default function BST1Payment() { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -2722,14 +2639,14 @@ export default function BST1Payment() { setMessageType('success'); setMessageData( bookingpaymentupdate?.data?.response + - ' ' + - (bookingpaymentupdate?.data?.OrderDetails?.length > 0 - ? bookingpaymentupdate?.data?.OrderId && - extractLastNumberOrderId( - bookingpaymentupdate?.data?.OrderId, - bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus - ) - : '') + ' ' + + (bookingpaymentupdate?.data?.OrderDetails?.length > 0 + ? bookingpaymentupdate?.data?.OrderId && + extractLastNumberOrderId( + bookingpaymentupdate?.data?.OrderId, + bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus + ) + : '') ); bookingpaymentupdate?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([bookingpaymentupdate?.data]); @@ -2747,7 +2664,7 @@ export default function BST1Payment() { if ( Date.now() - startTime > useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes * - 60000 + 60000 ) { // 60,000 ms = 1 minute @@ -3181,7 +3098,7 @@ export default function BST1Payment() { }; const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0 && TotalAmount > 0) { + if (OrderCardDetail?.length > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3191,11 +3108,6 @@ export default function BST1Payment() { setFailedOrderData(updatedData); setSplitpayment(true); } else { - if (TotalAmount <= 0) { - setMessageType('warning'); - setMessageData('Cannot split when total amount is zero or less'); - return; - } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3525,30 +3437,30 @@ export default function BST1Payment() { (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 'none' : 'auto', opacity: (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 0.5 : 1, }} > - {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( + {paybtns?.length > 0 ? ( paybtns?.map((payment) => (
    )) - ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( - refundPayBtns.map((payment) => ( -
    - -
    - )) ) : (
    0 && 'not-allowed', color: OrderCardDetail?.length > 0 || - (selOption?.value === undefined && - GlobalAddCustomerDetails1?.length === 0 && - GetCustId?.CustMobile === undefined) + (selOption?.value === undefined && + GlobalAddCustomerDetails1?.length === 0 && + GetCustId?.CustMobile === undefined) ? 'gray' : 'rgb(18, 146, 238)', fontSize: '28px', @@ -3750,16 +3626,16 @@ export default function BST1Payment() { (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 'none' : 'auto', opacity: (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 0.5 : 1, }} @@ -3778,14 +3654,14 @@ export default function BST1Payment() { width: '1.5rem', cursor: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'not-allowed' : 'pointer', color: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'gray' : 'rgb(18, 146, 238)', display: 'flex', @@ -3851,14 +3727,14 @@ export default function BST1Payment() { width: '1.5rem', cursor: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'not-allowed' : 'pointer', color: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'gray' : 'rgb(18, 146, 238)', display: 'flex', @@ -3940,58 +3816,58 @@ export default function BST1Payment() {
    {unpaidFlow == false ? holdCheckedSalesSetup && - BookingType !== 'Dine In' && - !BookingTypeBoth && - OrderCardDetail?.length != 0 && - CheckOrderType?.length === 0 && - OrderType != 'Failed' && - CheckBookingStatus != 'Close' && - paybtns?.length > 0 && - !addnewAccess && ( - - {' '} - AddBookingDetails('Hold')} - style={{ - fontSize: '30px', - cursor: 'pointer', - color: '' ? '#52c41a' : '#1292EE', - }} - /> - - ) + BookingType !== 'Dine In' && + !BookingTypeBoth && + OrderCardDetail?.length != 0 && + CheckOrderType?.length === 0 && + OrderType != 'Failed' && + CheckBookingStatus != 'Close' && + paybtns?.length > 0 && + !addnewAccess && ( + + {' '} + AddBookingDetails('Hold')} + style={{ + fontSize: '30px', + cursor: 'pointer', + color: '' ? '#52c41a' : '#1292EE', + }} + /> + + ) : ''} {unpaidFlow == false ? holdCheckedSalesSetup && - paybtns?.length > 0 && - BookingType !== 'Dine In' && - !BookingTypeBoth && - Holddata?.length > 0 && - OrderCardDetail?.length == 0 && - CheckBookingStatus != 'Close' && - !addnewAccess && ( - - {' '} - - HandleholdModelOpen()} - style={{ - fontSize: '28px', - cursor: 'pointer', - color: Holddata ? '#52c41a' : 'default', - pointerEvents: - OrderType === 'Failed' ? 'none' : 'auto', - }} - /> - - - ) + paybtns?.length > 0 && + BookingType !== 'Dine In' && + !BookingTypeBoth && + Holddata?.length > 0 && + OrderCardDetail?.length == 0 && + CheckBookingStatus != 'Close' && + !addnewAccess && ( + + {' '} + + HandleholdModelOpen()} + style={{ + fontSize: '28px', + cursor: 'pointer', + color: Holddata ? '#52c41a' : 'default', + pointerEvents: + OrderType === 'Failed' ? 'none' : 'auto', + }} + /> + + + ) : ''}
    )} @@ -4020,11 +3896,6 @@ export default function BST1Payment() { } BillingTableName="BillingTable1" CheckBookingStatus={CheckBookingStatus} - salesBillEdit={salesBillEdit} - currentOrderNetAmount={currentOrderNetAmount} - previousNetAmount={previousNetAmount} - credit={credit} - overAllBal={overAllBal} /> ) : ( @@ -4034,12 +3905,11 @@ export default function BST1Payment() { addnewAccess ? 'price-button-disabled' : FirstPaymentclick === false && - OrderCardDetail?.length > 0 && - paybtnselected && - CheckBookingStatus != 'Close' - ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? - 'price-button' - : 'price-button' + OrderCardDetail?.length > 0 && + paybtnselected && + CheckBookingStatus != 'Close' + ? !OrderStatus + ? 'price-button' : 'price-button Order' : 'price-button-disabled' } @@ -4054,7 +3924,7 @@ export default function BST1Payment() { > {' '} {isMobile ? ( - !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : ( + !OrderStatus ? ( `₹ ${Math.round( OrderType === 'Failed' ? FailedTotalAmt @@ -4065,7 +3935,7 @@ export default function BST1Payment() { ) : ( 'ORDER' ) - ) : !OrderStatus ? (salesBillEdit && (currentOrderNetAmount < previousNetAmount)) ? (
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    ) : ( + ) : !OrderStatus ? (
    ₹{' '} data?.TotalAmt + acc, 0) - - ((OverAllSales > 0 ? OverAllSales : 0) + - (OverAllEstimate > 0 ? OverAllEstimate : 0) + - (Discount > 0 ? Discount : 0))) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) } failedOrderData={failedOrderData} /> @@ -4399,9 +4266,9 @@ export default function BST1Payment() { const qty = isGroup ? OrderCardDetail.filter((o) => o.id === groupKey).reduce( - (sum, o) => sum + (o.OrderQty || 1), - 0 - ) + (sum, o) => sum + (o.OrderQty || 1), + 0 + ) : item.OrderQty || 1; return ( @@ -4516,24 +4383,24 @@ export default function BST1Payment() { Do you want to cancel the payment? )} - - {customerPreviesOrders && ( - setCustomerPreviesOrders(false)} - footer={false} - width={700} - className={'ModalPaymentGatewayEmbedded'} - children={ - <> - setCustomerPreviesOrders(false)} + + {customerPreviesOrders && ( + setCustomerPreviesOrders(false)} + footer={false} + width={700} + className={'ModalPaymentGatewayEmbedded'} + children={ + <> + setCustomerPreviesOrders(false)} + /> + + } /> - - } - /> - )} + )} ); } diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BalanceAndReceived.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BalanceAndReceived.jsx index 5911b82..5d037c2 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BalanceAndReceived.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BalanceAndReceived.jsx @@ -32,11 +32,6 @@ const PaymentInput = ({ handleButtonClick, BillingTableName, CheckBookingStatus, - salesBillEdit = false, - currentOrderNetAmount = 0, - previousNetAmount = 0, - credit = false, - overAllBal = 0, }) => { const { SadminuserAccess } = useAuth(); let SAAccessCommonMaster = SadminuserAccess?.find( @@ -138,9 +133,9 @@ const PaymentInput = ({ addnewAccess ? 'price-button-disabled' : FirstPaymentclick === false && - OrderCardDetail?.length > 0 && - paybtnselected && - CheckBookingStatus != 'Close' + OrderCardDetail?.length > 0 && + paybtnselected && + CheckBookingStatus != 'Close' ? !OrderStatus ? 'price-button' : 'price-button Order' @@ -157,15 +152,13 @@ const PaymentInput = ({ style={{ fontFamily: FontFamily['head'] }} > {isMobile && - (!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : - `₹ ${Math.round( - OrderType === 'Failed' ? failedTotalAmt : credit && overAllBal >= 0 - ? Math.max(0, totalAmount - overAllBal) - : totalAmount - )}` + (!OrderStatus + ? `₹ ${Math.round( + OrderType === 'Failed' ? failedTotalAmt : totalAmount + )}` : 'ORDER')} - {!isMobile && !OrderStatus && ((salesBillEdit && (currentOrderNetAmount < previousNetAmount)) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : ( + {!isMobile && !OrderStatus && ( <> ₹{' '} {/* */} {OrderType === 'Failed' ? failedTotalAmt - : safeRound((credit && overAllBal >= 0) - ? Math.max(0, totalAmount - overAllBal) - : totalAmount)} + : safeRound(totalAmount)} - ))} + )} {!isMobile && OrderStatus && 'ORDER'} diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx index caa8639..3c8e9c0 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx @@ -124,15 +124,6 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, - GlobalSalesBillEdit, - GlobalPreviousOrderPayment, - GlobalPreviousOrderOfferDetails, - GlobalpaymentOptionData, - getPaymentOptions, - putSalesBillEdit, - changeBillEditingMode, - changePreviousOrderPayment, - changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import { gettinghold, @@ -251,10 +242,6 @@ const BSBillingTable2 = () => { const SessionMobileNo = SessionData?.SessionMobileNo; const dispatch = useDispatch(); const navigate = useNavigate(); - const salesBillEdit = useSelector(GlobalSalesBillEdit); - const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); - const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); - const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const defaultBookingType = useSelector(GlobalDefaultBookingType); const globalTipAmount = useSelector(GlobaltipAmount); const OtherServiceTicketClaim = useSelector(GlobalOtherServiceTicketClaim); @@ -332,11 +319,6 @@ const BSBillingTable2 = () => { const [overAllBal, setOverAllBal] = useState(0); const [creditCustomerOpen, setcreditCustomerOpen] = useState(false); const [hold, setHold] = useState(false); - const [refundPayBtns, setRefundPayBtns] = useState([]); - const [refundPaySelected, setRefundPaySelected] = useState(); - const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); - const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); - const [previousNetAmount, setPreviousNetAmount] = useState(0); const [addcustomer, setAddCustomer] = useState(false); const [paybtns, setpaybtns] = useState([]); const tableOptions = templateData?.BookingBilling?.[1]; @@ -470,7 +452,6 @@ const BSBillingTable2 = () => { item.SettingIdName.toLowerCase() === 'shortcutkeys' && item.SettingValue === 'Y' ); - useEffect(() => { const fetchCreditCustomer = async () => { const selectedMode = paybtns?.find( @@ -510,31 +491,6 @@ const BSBillingTable2 = () => { fetchCreditCustomer(); }, [paybtnselected, selOption, paybtns]); - useEffect(() => { - if (salesBillEdit) { - dispatch(getPaymentOptions()).unwrap(); - } - }, [salesBillEdit]); - - useEffect(() => { - - if (salesBillEdit) { - if (SelCustId) { - setRefundPayBtns(AllPaymentOptions); - setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); - setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); - } else { - const withoutCustomer = AllPaymentOptions?.filter?.( - (item) => item?.ConfigName?.toLowerCase() !== 'credit' - ); - setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); - setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); - setRefundPayBtns(withoutCustomer); - } - } - - }, [AllPaymentOptions, SelCustId, salesBillEdit]) - useEffect(() => { if (!preOrder) { const totalSum = OrderCardDetail?.reduce( @@ -590,43 +546,23 @@ const BSBillingTable2 = () => { ); } - const filteredPayments = - previousOrderPayment?.filter( - p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment - ) || []; - - const paymentsToUse = - filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; - - const totalPreviouspayment = paymentsToUse?.reduce( - (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), - 0 - ); - - const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( - (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), - 0 - ); - - const previousNetAmount = - (totalPreviouspayment) || 0; - let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - const currentOrderNetAmount = formatAmount( + setTotalAmount( withdiscTotal >= 0 ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) + ); - setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); - setCurrentOrderNetAmount(currentOrderNetAmount); - setPreviousNetAmount(previousNetAmount); - dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); + dispatch( + changeSummeryTotalAmount( + withdiscTotal > 0 ? withdiscTotal : Number(Total) + ) + ); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -831,10 +767,6 @@ const BSBillingTable2 = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); - } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { - setMessageType('warning'); - setMessageData('Please Select Refund Payment Method'); - return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1308,11 +1240,6 @@ const BSBillingTable2 = () => { } }; - const handleRefundPaymentMode = (id, name) => { - setRefundPaySelected(id); - setRefundPaySelectedName(name); - } - const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1849,9 +1776,6 @@ const BSBillingTable2 = () => { } else { dispatch(changeOrderCardDetails([])); } - dispatch(changeBillEditingMode(false)); - await dispatch(changePreviousOrderPayment([])); - await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeFullOfferAppliedProducts([])); dispatch(ChangeFullFreeProductList([])); @@ -1868,8 +1792,6 @@ const BSBillingTable2 = () => { setPaybtnnameselected(PaymentOptionsModeName); setQrCode(false); setUpinotSelected(false); - setCurrentOrderNetAmount(0); - setPreviousNetAmount(0); getHolddata(); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -2171,7 +2093,7 @@ const BSBillingTable2 = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : + PaymentType: Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2185,14 +2107,15 @@ const BSBillingTable2 = () => { : paybtnselected ? paybtnselected : null, - Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), - MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + // SelectedUPIPayOption?.toLowerCase() === "pg" ? + Amount: Math.round(TotalAmount), + MerchantId: Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : + PaymentOptionType: Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2206,7 +2129,7 @@ const BSBillingTable2 = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + ModeOfPayment: SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2214,7 +2137,7 @@ const BSBillingTable2 = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : + AccountDtl: Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2231,7 +2154,7 @@ const BSBillingTable2 = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : + PaymentStatus: Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2240,8 +2163,8 @@ const BSBillingTable2 = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, - Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : + Debit: 0, + Credit: Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2449,12 +2372,7 @@ const BSBillingTable2 = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = null; - if (salesBillEdit) { - response = await dispatch(putSalesBillEdit(putdata)).unwrap(); - } else { - response = await dispatch(PutBookingData(putdata)).unwrap(); - } + let response = await dispatch(PutBookingData(putdata)).unwrap(); if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -3283,7 +3201,7 @@ const BSBillingTable2 = () => { // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0 && TotalAmount > 0) { + if (OrderCardDetail?.length > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3293,11 +3211,6 @@ const BSBillingTable2 = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { - if (TotalAmount <= 0) { - setMessageType('warning'); - setMessageData('Cannot split when total amount is zero or less'); - return; - } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3907,7 +3820,7 @@ const BSBillingTable2 = () => { : 1, }} > - {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( + {paybtns?.length > 0 ? ( paybtns?.map((payment) => (
    )) - ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( - refundPayBtns.map((payment) => ( -
    - -
    - )) ) : (
    { OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? - 'billing-btn' - : 'billing-btn' + ? 'billing-btn' : 'billing-btn-deactive' } // onClick={() => { @@ -4267,9 +4142,7 @@ const BSBillingTable2 = () => { handleButtonClick } > - {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : ( + {!OrderStatus ? ( <>

    Total

    @@ -4490,10 +4363,7 @@ const BSBillingTable2 = () => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - - ((OverAllSales > 0 ? OverAllSales : 0) + - (OverAllEstimate > 0 ? OverAllEstimate : 0) + - (Discount > 0 ? Discount : 0))) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) } failedOrderData={failedOrderData} /> @@ -4708,7 +4578,7 @@ const BSBillingTable2 = () => {
    } /> - + setShowCancelConfirm(true)} diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx index 217a778..1de2de5 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx @@ -131,15 +131,6 @@ import { GlobalCombocarddata, getCreditCustomer, GlobalSummeryTotalItems, - GlobalSalesBillEdit, - GlobalPreviousOrderPayment, - GlobalPreviousOrderOfferDetails, - GlobalpaymentOptionData, - getPaymentOptions, - putSalesBillEdit, - changeBillEditingMode, - changePreviousOrderPayment, - changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; @@ -234,10 +225,6 @@ const BSBillingTable3Pay = () => { ); const dispatch = useDispatch(); const navigate = useNavigate(); - const salesBillEdit = useSelector(GlobalSalesBillEdit); - const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); - const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); - const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const FreeProdList = useSelector(GlobalFreeProdList); const offerAppliedProducts = useSelector( GlobalOfferAppliedProducts, @@ -345,16 +332,11 @@ const BSBillingTable3Pay = () => { const [SelectedUPIPayOption, setSelectedUPIPayOption] = useState('Default'); const [SelectedUpiOption, setSelectedUpiOption] = useState(''); const [hold, setHold] = useState(false); - const [refundPayBtns, setRefundPayBtns] = useState([]); - const [refundPaySelected, setRefundPaySelected] = useState(); - const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); - const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); - const [previousNetAmount, setPreviousNetAmount] = useState(0); const [addcustomer, setAddCustomer] = useState(false); const [PrintOrderDetails, setPrintOrderDetails] = useState([]); const OrderCardDetail = useSelector(GlobalOrderCardDetails); const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false); - + console.log(OrderCardDetail, 'OrderCardDetail'); //Total calculation const TotalItems = OrderCardDetail?.length; @@ -586,43 +568,23 @@ const BSBillingTable3Pay = () => { ); } - const filteredPayments = - previousOrderPayment?.filter( - p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment - ) || []; - - const paymentsToUse = - filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; - - const totalPreviouspayment = paymentsToUse?.reduce( - (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), - 0 - ); - - const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( - (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), - 0 - ); - - const previousNetAmount = - (totalPreviouspayment) || 0; - let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - const currentOrderNetAmount = formatAmount( + setTotalAmount( withdiscTotal >= 0 ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) + ); - setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); - setCurrentOrderNetAmount(currentOrderNetAmount); - setPreviousNetAmount(previousNetAmount); - dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); + dispatch( + changeSummeryTotalAmount( + formatAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) + ) + ); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -731,31 +693,6 @@ const BSBillingTable3Pay = () => { // } }, []); - useEffect(() => { - if (salesBillEdit) { - dispatch(getPaymentOptions()).unwrap(); - } - }, [salesBillEdit]); - - useEffect(() => { - - if (salesBillEdit) { - if (SelCustId) { - setRefundPayBtns(AllPaymentOptions); - setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); - setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); - } else { - const withoutCustomer = AllPaymentOptions?.filter?.( - (item) => item?.ConfigName?.toLowerCase() !== 'credit' - ); - setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); - setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); - setRefundPayBtns(withoutCustomer); - } - } - - }, [AllPaymentOptions, SelCustId, salesBillEdit]) - useEffect(() => { if (UserType === 'Employee') { fetchApi(); @@ -1487,10 +1424,6 @@ const BSBillingTable3Pay = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); - } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { - setMessageType('warning'); - setMessageData('Please Select Refund Payment Method'); - return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1772,11 +1705,6 @@ const BSBillingTable3Pay = () => { } }; - const handleRefundPaymentMode = (id, name) => { - setRefundPaySelected(id); - setRefundPaySelectedName(name); - } - const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1984,9 +1912,6 @@ const BSBillingTable3Pay = () => { // } else { dispatch(changeOrderCardDetails([])); // } - dispatch(changeBillEditingMode(false)); - await dispatch(changePreviousOrderPayment([])); - await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeLoyaltyConsumedQuantities({})); dispatch(changeFullOfferAppliedProducts([])); dispatch(ChangeFullFreeProductList([])); @@ -2002,8 +1927,6 @@ const BSBillingTable3Pay = () => { setPaybtnnameselected(PaymentOptionsModeName); setPaybtnselected(PaymentOptionsModeId); setQrCode(false); - setCurrentOrderNetAmount(0); - setPreviousNetAmount(0); setUpinotSelected(false); getHolddata(); if (defaultBookingType === 'Both') { @@ -2316,7 +2239,7 @@ const BSBillingTable3Pay = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : + PaymentType: Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2330,14 +2253,14 @@ const BSBillingTable3Pay = () => { : paybtnselected ? paybtnselected : null, - Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), - MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + Amount: Math.round(TotalAmount), + MerchantId: Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : + PaymentOptionType: Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2351,7 +2274,7 @@ const BSBillingTable3Pay = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + ModeOfPayment: SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2359,7 +2282,7 @@ const BSBillingTable3Pay = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : + AccountDtl: Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2376,7 +2299,7 @@ const BSBillingTable3Pay = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : + PaymentStatus: Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2385,8 +2308,8 @@ const BSBillingTable3Pay = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, - Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : + Debit: 0, + Credit: Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2596,12 +2519,7 @@ const BSBillingTable3Pay = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = null; - if (salesBillEdit) { - response = await dispatch(putSalesBillEdit(putdata)).unwrap(); - } else { - response = await dispatch(PutBookingData(putdata)).unwrap(); - } + let response = await dispatch(PutBookingData(putdata)).unwrap(); if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -3300,7 +3218,7 @@ const BSBillingTable3Pay = () => { }; // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0 && TotalAmount > 0) { + if (OrderCardDetail?.length > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3310,11 +3228,6 @@ const BSBillingTable3Pay = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { - if (TotalAmount <= 0) { - setMessageType('warning'); - setMessageData('Cannot split when total amount is zero or less'); - return; - } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -4041,7 +3954,7 @@ const BSBillingTable3Pay = () => { : 1, }} > - {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( + {paybtns?.length > 0 ? ( paybtns?.map((payment) => (
    )) - ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( - refundPayBtns.map((payment) => ( -
    - -
    - )) ) : (
    { OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? - 'BSBillingTable3-paybtn' - : 'BSBillingTable3-paybtn' + ? !OrderStatus + ? 'BSBillingTable3-paybtn' : 'BSBillingTable3-paybtn Order' : 'BSBillingTable3-paybtn-deactive' } @@ -4416,7 +4292,7 @@ const BSBillingTable3Pay = () => { } //dhana > - {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?

    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}

    : ( + {!OrderStatus ? ( <>

    {' '} @@ -4628,10 +4504,7 @@ const BSBillingTable3Pay = () => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - - ((OverAllSales > 0 ? OverAllSales : 0) + - (OverAllEstimate > 0 ? OverAllEstimate : 0) + - (Discount > 0 ? Discount : 0))) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) } failedOrderData={failedOrderData} /> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx index 6b6a3a1..e74dd18 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBilling4Payment.jsx @@ -3789,7 +3789,40 @@ const BSBilling4Payment = () => {

    )} - + {/* Customer Orders */} + {GetCustId && ( + + {' '} +
    { + if ( + CheckBookingStatus !== 'Close' && + !addnewAccess && + !(OrderCardDetail?.length > 0) + ) { + setCustomerPreviesOrders(true); + } + }} + style={{ + cursor: OrderCardDetail?.length > 0 && 'not-allowed', + color: + OrderCardDetail?.length > 0 || + (OrderCardDetail?.length > 0 && + GetCustId?.CustMobile === undefined) + ? 'gray' + : 'rgb(18, 146, 238)', + fontSize: '25px', + display: 'flex', + alignItems: 'center', + height: '2.46rem', + width: '1.5rem', + }} + > + +
    +
    + )} {OtherServicesglobal && OrderCardDetail.length >= 1 && ( {' '} @@ -3826,41 +3859,6 @@ const BSBilling4Payment = () => { {/* */}
    )} - - {/* Customer Orders */} - {GetCustId && ( - - {' '} -
    { - if ( - CheckBookingStatus !== 'Close' && - !addnewAccess && - !(OrderCardDetail?.length > 0) - ) { - setCustomerPreviesOrders(true); - } - }} - style={{ - cursor: OrderCardDetail?.length > 0 && 'not-allowed', - color: - OrderCardDetail?.length > 0 || - (OrderCardDetail?.length > 0 && - GetCustId?.CustMobile === undefined) - ? 'gray' - : 'rgb(18, 146, 238)', - fontSize: '25px', - display: 'flex', - alignItems: 'center', - height: '2.46rem', - width: '1.5rem', - }} - > - -
    -
    - )} {tabledata?.length > 0 && (
    {tableOptions diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx index e95245f..afa9d03 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx @@ -121,15 +121,6 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, - GlobalSalesBillEdit, - GlobalPreviousOrderPayment, - GlobalPreviousOrderOfferDetails, - GlobalpaymentOptionData, - getPaymentOptions, - putSalesBillEdit, - changeBillEditingMode, - changePreviousOrderPayment, - changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayth Date:27/12/2023 import { @@ -245,10 +236,6 @@ const BSBillingTable5 = () => { const UserType = SessionData?.UserType; const AuthToken = SessionData?.AuthToken; const SessionMobileNo = SessionData?.SessionMobileNo; - const salesBillEdit = useSelector(GlobalSalesBillEdit); - const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); - const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); - const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const Discount = useSelector(GlobalOverAllOfferAmt); const FreeProdList = useSelector(GlobalFreeProdList); const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts); @@ -329,11 +316,6 @@ const BSBillingTable5 = () => { const printDatas = useSelector(GlobalprintDatas); const PrinterDetails = useSelector(GlobalPrinterMappingDtls); - const [refundPayBtns, setRefundPayBtns] = useState([]); - const [refundPaySelected, setRefundPaySelected] = useState(); - const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); - const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); - const [previousNetAmount, setPreviousNetAmount] = useState(0); const [paybtnselected, setPaybtnselected] = useState(); const [Paybtnnameselected, setPaybtnnameselected] = useState(); const [SelectedBookingType, setSelectedBookingType] = useState(null); @@ -484,31 +466,6 @@ const BSBillingTable5 = () => { // for customised invoice number const { invoiceDate, clearInvoiceDate } = useDateStore(); const CurrentOrderId = useSelector(GlobalCurrentOrderId); - useEffect(() => { - if (salesBillEdit) { - dispatch(getPaymentOptions()).unwrap(); - } - }, [salesBillEdit]); - - useEffect(() => { - - if (salesBillEdit) { - if (SelCustId) { - setRefundPayBtns(AllPaymentOptions); - setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); - setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); - } else { - const withoutCustomer = AllPaymentOptions?.filter?.( - (item) => item?.ConfigName?.toLowerCase() !== 'credit' - ); - setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); - setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); - setRefundPayBtns(withoutCustomer); - } - } - - }, [AllPaymentOptions, SelCustId, salesBillEdit]) - useEffect(() => { if ( OrderCardDetail?.length === 1 && @@ -632,44 +589,25 @@ const BSBillingTable5 = () => { ); } - - const filteredPayments = - previousOrderPayment?.filter( - p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment - ) || []; - - const paymentsToUse = - filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; - - const totalPreviouspayment = paymentsToUse?.reduce( - (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), - 0 - ); - - const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( - (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), - 0 - ); - - const previousNetAmount = - (totalPreviouspayment) || 0; - let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - const currentOrderNetAmount = formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) + setTotalAmount( + formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) + ); - setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); - setCurrentOrderNetAmount(currentOrderNetAmount); - setPreviousNetAmount(previousNetAmount); - dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); + dispatch( + changeSummeryTotalAmount( + formatAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) + ) + ); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -906,10 +844,6 @@ const BSBillingTable5 = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); - } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { - setMessageType('warning'); - setMessageData('Please Select Refund Payment Method'); - return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1745,12 +1679,6 @@ const BSBillingTable5 = () => { setCardoptionnotSelected(false); } }; - - const handleRefundPaymentMode = (id, name) => { - setRefundPaySelected(id); - setRefundPaySelectedName(name); - } - const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1892,9 +1820,6 @@ const BSBillingTable5 = () => { } else { dispatch(changeOrderCardDetails([])); } - dispatch(changeBillEditingMode(false)); - await dispatch(changePreviousOrderPayment([])); - await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeLoyaltyConsumedQuantities({})); await dispatch(ChangeTotalAmount([])); @@ -1911,8 +1836,6 @@ const BSBillingTable5 = () => { setPaybtnselected(PaymentOptionsModeId); setQrCode(false); setUpinotSelected(false); - setCurrentOrderNetAmount(0); - setPreviousNetAmount(0); getHolddata(); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -2211,7 +2134,7 @@ const BSBillingTable5 = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : + PaymentType: Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2225,14 +2148,14 @@ const BSBillingTable5 = () => { : paybtnselected ? paybtnselected : null, - Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), - MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + Amount: Math.round(TotalAmount), + MerchantId: Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : + PaymentOptionType: Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2246,7 +2169,7 @@ const BSBillingTable5 = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + ModeOfPayment: SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2254,7 +2177,7 @@ const BSBillingTable5 = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : + AccountDtl: Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2271,7 +2194,7 @@ const BSBillingTable5 = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : + PaymentStatus: Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2280,8 +2203,8 @@ const BSBillingTable5 = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, - Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : + Debit: 0, + Credit: Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2487,12 +2410,7 @@ const BSBillingTable5 = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = null; - if (salesBillEdit) { - response = await dispatch(putSalesBillEdit(putdata)).unwrap(); - } else { - response = await dispatch(PutBookingData(putdata)).unwrap(); - } + let response = await dispatch(PutBookingData(putdata)).unwrap(); if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -3264,7 +3182,7 @@ const BSBillingTable5 = () => { // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0 && TotalAmount > 0) { + if (OrderCardDetail?.length > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3274,11 +3192,6 @@ const BSBillingTable5 = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { - if (TotalAmount <= 0) { - setMessageType('warning'); - setMessageData('Cannot split when total amount is zero or less'); - return; - } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3692,7 +3605,7 @@ const BSBillingTable5 = () => { : 1, }} > - {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( + {paybtns?.length > 0 ? ( paybtns?.map((payment) => (
    )) - ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( - refundPayBtns.map((payment) => ( -
    - -
    - )) ) : (
    { OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? - 'BSBIllingTable5-paybtn-noitems' - : 'BSBIllingTable5-paybtn-noitems' + ? !OrderStatus + ? 'BSBIllingTable5-paybtn-noitems' : 'BSBIllingTable5-paybtn-noitems Order' : 'BSBIllingTable5-paybtn-noitems-disable' } @@ -4291,7 +4167,7 @@ const BSBillingTable5 = () => { handleButtonClick } > - {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : ( + {!OrderStatus ? ( <> {/* ₹ {Math.round(TotalAmount)} */} {isMobile ? ( @@ -4500,10 +4376,7 @@ const BSBillingTable5 = () => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - - ((OverAllSales > 0 ? OverAllSales : 0) + - (OverAllEstimate > 0 ? OverAllEstimate : 0) + - (Discount > 0 ? Discount : 0))) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) } failedOrderData={failedOrderData} /> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx index c8bfad8..1baef7e 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx @@ -120,15 +120,6 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, - GlobalSalesBillEdit, - GlobalPreviousOrderPayment, - GlobalPreviousOrderOfferDetails, - GlobalpaymentOptionData, - getPaymentOptions, - putSalesBillEdit, - changeBillEditingMode, - changePreviousOrderPayment, - changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; import { @@ -249,10 +240,6 @@ const BST6Payment = () => { type?.PreferredSubCatName?.toLowerCase() === 'dine in' && type?.PreferredStatus === 'Y' ); - const salesBillEdit = useSelector(GlobalSalesBillEdit); - const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); - const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); - const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const screenwidth = useSelector(GlobalScreenSize); const printerTemplateStyle = useSelector(SelectedPrintTemplate); const RetailWSSalesType = useSelector(GlobalRetailWSSalesType); @@ -349,11 +336,6 @@ const BST6Payment = () => { const UserType = SessionData?.UserType; const AuthToken = SessionData?.AuthToken; const SessionMobileNo = SessionData?.SessionMobileNo; - const [refundPayBtns, setRefundPayBtns] = useState([]); - const [refundPaySelected, setRefundPaySelected] = useState(); - const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); - const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); - const [previousNetAmount, setPreviousNetAmount] = useState(0); const [FirstPaymentclick, setFirstPaymentclick] = useState(false); const [open, setOpen] = useState(false); const [unpaidopen, setUnpaidOpen] = useState(false); @@ -477,30 +459,6 @@ const BST6Payment = () => { setPrintOrderDetails([]); } }, [OrderCardDetail]); - useEffect(() => { - if (salesBillEdit) { - dispatch(getPaymentOptions()).unwrap(); - } - }, [salesBillEdit]); - - useEffect(() => { - - if (salesBillEdit) { - if (SelCustId) { - setRefundPayBtns(AllPaymentOptions); - setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); - setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); - } else { - const withoutCustomer = AllPaymentOptions?.filter?.( - (item) => item?.ConfigName?.toLowerCase() !== 'credit' - ); - setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); - setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); - setRefundPayBtns(withoutCustomer); - } - } - - }, [AllPaymentOptions, SelCustId, salesBillEdit]) console.log(PrintOrderDetails, 'PrintOrderDetails'); useEffect(() => { if (selOption) { @@ -605,43 +563,25 @@ const BST6Payment = () => { ); } - const filteredPayments = - previousOrderPayment?.filter( - p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment - ) || []; - - const paymentsToUse = - filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; - - const totalPreviouspayment = paymentsToUse?.reduce( - (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), - 0 - ); - - const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( - (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), - 0 - ); - - const previousNetAmount = - (totalPreviouspayment) || 0; - let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - const currentOrderNetAmount = formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) + setTotalAmount( + formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) + ); - setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); - setCurrentOrderNetAmount(currentOrderNetAmount); - setPreviousNetAmount(previousNetAmount); - dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); + dispatch( + changeSummeryTotalAmount( + formatAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) + ) + ); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -1234,10 +1174,6 @@ const BST6Payment = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); - } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { - setMessageType('warning'); - setMessageData('Please Select Refund Payment Method'); - return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1698,11 +1634,6 @@ const BST6Payment = () => { } }; - const handleRefundPaymentMode = (id, name) => { - setRefundPaySelected(id); - setRefundPaySelectedName(name); - } - const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1787,7 +1718,7 @@ const BST6Payment = () => { setCardOptionOpen(visible); }; const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0 && TotalAmount > 0) { + if (OrderCardDetail?.length > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -1797,11 +1728,6 @@ const BST6Payment = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { - if (TotalAmount <= 0) { - setMessageType('warning'); - setMessageData('Cannot split when total amount is zero or less'); - return; - } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -1935,9 +1861,6 @@ const BST6Payment = () => { } else { dispatch(changeOrderCardDetails([])); } - dispatch(changeBillEditingMode(false)); - await dispatch(changePreviousOrderPayment([])); - await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeLoyaltyConsumedQuantities({})); await dispatch(ChangeTotalAmount([])); @@ -1954,8 +1877,6 @@ const BST6Payment = () => { setPaybtnselected(PaymentOptionsModeId); setQrCode(false); setUpinotSelected(false); - setCurrentOrderNetAmount(0); - setPreviousNetAmount(0); getHolddata(); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -2252,7 +2173,7 @@ const BST6Payment = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : + PaymentType: Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2266,14 +2187,14 @@ const BST6Payment = () => { : paybtnselected ? paybtnselected : null, - Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), - MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + Amount: Math.round(TotalAmount), + MerchantId: Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : + PaymentOptionType: Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2287,7 +2208,7 @@ const BST6Payment = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + ModeOfPayment: SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2295,7 +2216,7 @@ const BST6Payment = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : + AccountDtl: Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2312,7 +2233,7 @@ const BST6Payment = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : + PaymentStatus: Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2321,8 +2242,8 @@ const BST6Payment = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, - Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : + Debit: 0, + Credit: Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2530,12 +2451,7 @@ const BST6Payment = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = null; - if (salesBillEdit) { - response = await dispatch(putSalesBillEdit(putdata)).unwrap(); - } else { - response = await dispatch(PutBookingData(putdata)).unwrap(); - } + let response = await dispatch(PutBookingData(putdata)).unwrap(); let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter( (item) => item?.PaymentOptionType?.toLowerCase() === 'pc' ); @@ -3762,7 +3678,7 @@ const BST6Payment = () => { : 1, }} > - {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( + {paybtns?.length > 0 ? ( paybtns?.map((payment) => (
    )) - ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( - refundPayBtns.map((payment) => ( -
    - -
    - )) ) : (
    { OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? - 'BST6Payment-Button-pay' - : 'BST6Payment-Button-pay' + ? !OrderStatus + ? 'BST6Payment-Button-pay' : 'BST6Payment-Button-pay Order' : 'BST6Payment-Button-pay-disabled' } @@ -3917,7 +3798,7 @@ const BST6Payment = () => { handleButtonClick } > - {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : ( + {!OrderStatus ? ( <>

    {isMobile ? ( @@ -4436,10 +4317,7 @@ const BST6Payment = () => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - - ((OverAllSales > 0 ? OverAllSales : 0) + - (OverAllEstimate > 0 ? OverAllEstimate : 0) + - (Discount > 0 ? Discount : 0))) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) } failedOrderData={failedOrderData} /> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx index 6464813..59df9c9 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx @@ -110,15 +110,6 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, - GlobalSalesBillEdit, - GlobalPreviousOrderPayment, - GlobalPreviousOrderOfferDetails, - GlobalpaymentOptionData, - getPaymentOptions, - putSalesBillEdit, - changeBillEditingMode, - changePreviousOrderPayment, - changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData.js'; import { globalExtraTotalAmount, @@ -234,10 +225,6 @@ const BSBilling7Payment = () => { ); const dispatch = useDispatch(); const navigate = useNavigate(); - const salesBillEdit = useSelector(GlobalSalesBillEdit); - const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); - const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); - const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const Discount = useSelector(GlobalOverAllOfferAmt); const screenwidth = useSelector(GlobalScreenSize); const defaultBookingType = useSelector(GlobalDefaultBookingType); @@ -340,11 +327,6 @@ const BSBilling7Payment = () => { const [SelectedUPIPayOption, setSelectedUPIPayOption] = useState('Default'); const [SelectedUpiOption, setSelectedUpiOption] = useState(); const [hold, setHold] = useState(false); - const [refundPayBtns, setRefundPayBtns] = useState([]); - const [refundPaySelected, setRefundPaySelected] = useState(); - const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); - const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); - const [previousNetAmount, setPreviousNetAmount] = useState(0); const [addcustomer, setAddCustomer] = useState(false); const [PrintOrderDetails, setPrintOrderDetails] = useState([]); const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false); const OverAllSales = useSelector(GlobalOverAllDiscSales); @@ -366,7 +348,7 @@ const BSBilling7Payment = () => { return acc + Math.round(Number(item?.OrderQty || 0)); }, 0); - console.log(salesBillEdit, currentOrderNetAmount, previousNetAmount, "previousNetAmount") + const [UpiOption, setUpiOption] = useState(''); const [BusinessPayOption, setBusinessPayoption] = useState([]); const [paymentSucess, setPaymentSuccess] = useState(false); @@ -500,33 +482,6 @@ const BSBilling7Payment = () => { setMobileNoWhatsApp(selOption); } }, [selOption]); - - useEffect(() => { - if (salesBillEdit) { - dispatch(getPaymentOptions()).unwrap(); - } - }, [salesBillEdit]); - - useEffect(() => { - - if (salesBillEdit) { - if (SelCustId) { - setRefundPayBtns(AllPaymentOptions); - setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); - setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); - } else { - const withoutCustomer = AllPaymentOptions?.filter?.( - (item) => item?.ConfigName?.toLowerCase() !== 'credit' - ); - setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); - setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); - setRefundPayBtns(withoutCustomer); - } - } - - }, [AllPaymentOptions, SelCustId, salesBillEdit]) - - // Usage useEffect(() => { const fetchCreditCustomer = async () => { @@ -624,44 +579,23 @@ const BSBilling7Payment = () => { ); } - const filteredPayments = - previousOrderPayment?.filter( - p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment - ) || []; - - const paymentsToUse = - filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; - - const totalPreviouspayment = paymentsToUse?.reduce( - (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), - 0 - ); - - const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( - (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), - 0 - ); - - const previousNetAmount = - (totalPreviouspayment) || 0; - let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - const currentOrderNetAmount = formatAmount( + setTotalAmount( withdiscTotal >= 0 ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - console.log(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount, "totalPreviouspayment") + ); - setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); - setCurrentOrderNetAmount(currentOrderNetAmount); - setPreviousNetAmount(previousNetAmount); - dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); + dispatch( + changeSummeryTotalAmount( + withdiscTotal > 0 ? withdiscTotal : Number(Total) + ) + ); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -885,7 +819,7 @@ const BSBilling7Payment = () => { async (orderDetail, index) => { await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print if (orderDetail?.BookingTypeName !== 'Dine In') { - const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( + const groupedTokens = orderDetail?.productDetails?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -965,17 +899,12 @@ const BSBilling7Payment = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); - } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { - setMessageType('warning'); - setMessageData('Please Select Refund Payment Method'); - return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) : AddBookingDetails(BookingType, true); } }; - const financialYearError = async () => { setMessageType('error'); setMessageData('Financial Year-Based Sales Not Yet Started'); @@ -1708,12 +1637,6 @@ const BSBilling7Payment = () => { setCardoptionnotSelected(false); } }; - - const handleRefundPaymentMode = (id, name) => { - setRefundPaySelected(id); - setRefundPaySelectedName(name); - } - const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1910,9 +1833,6 @@ const BSBilling7Payment = () => { } else { dispatch(changeOrderCardDetails([])); } - dispatch(changeBillEditingMode(false)); - await dispatch(changePreviousOrderPayment([])); - await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeFullOfferAppliedProducts([])); dispatch(changeLoyaltyConsumedQuantities({})); @@ -1928,8 +1848,6 @@ const BSBilling7Payment = () => { setPaybtnnameselected(PaymentOptionsModeName); setPaybtnselected(PaymentOptionsModeId); setQrCode(false); - setCurrentOrderNetAmount(0); - setPreviousNetAmount(0); setUpinotSelected(false); getHolddata(); if (defaultBookingType === 'Both') { @@ -2221,7 +2139,7 @@ const BSBilling7Payment = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : + PaymentType: Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2235,14 +2153,14 @@ const BSBilling7Payment = () => { : paybtnselected ? paybtnselected : null, - Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), - MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + Amount: Math.round(TotalAmount), + MerchantId: Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : + PaymentOptionType: Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2256,7 +2174,7 @@ const BSBilling7Payment = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + ModeOfPayment: SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2264,7 +2182,7 @@ const BSBilling7Payment = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : + AccountDtl: Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2281,7 +2199,7 @@ const BSBilling7Payment = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : + PaymentStatus: Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2290,8 +2208,8 @@ const BSBilling7Payment = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, - Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : + Debit: 0, + Credit: Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2498,12 +2416,7 @@ const BSBilling7Payment = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = null; - if (salesBillEdit) { - response = await dispatch(putSalesBillEdit(putdata)).unwrap(); - } else { - response = await dispatch(PutBookingData(putdata)).unwrap(); - } + let response = await dispatch(PutBookingData(putdata)).unwrap(); if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -3213,7 +3126,7 @@ const BSBilling7Payment = () => { }; // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0 && TotalAmount > 0) { + if (OrderCardDetail?.length > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3223,11 +3136,6 @@ const BSBilling7Payment = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { - if (TotalAmount <= 0) { - setMessageType('warning'); - setMessageData('Cannot split when total amount is zero or less'); - return; - } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3932,7 +3840,7 @@ const BSBilling7Payment = () => { : 1, }} > - {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( + {paybtns?.length > 0 ? ( paybtns?.map((payment) => (

    )) - ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( - refundPayBtns.map((payment) => ( -
    - -
    - )) ) : (
    { OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? - 'Table4-Btn-final-price' - : 'Table4-Btn-final-price' + ? !OrderStatus + ? 'Table4-Btn-final-price' : 'Table4-Btn-final-price Order' : 'Table4-Btn-final-price-disabled' } @@ -4297,7 +4168,7 @@ const BSBilling7Payment = () => { handleButtonClick } > - {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?

    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}

    : ( + {!OrderStatus ? ( <>
    { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - - ((OverAllSales > 0 ? OverAllSales : 0) + - (OverAllEstimate > 0 ? OverAllEstimate : 0) + - (Discount > 0 ? Discount : 0))) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) } failedOrderData={failedOrderData} /> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx index 706af57..7c71170 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx @@ -63,9 +63,6 @@ import { PostBlockSlots, changeCustomerID, changeSelectedCustId, - changeBillEditingMode, - changePreviousOrderPayment, - changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import './StandardTable.scss'; import { IoClose } from 'react-icons/io5'; @@ -151,8 +148,8 @@ const StandardTable = () => { OrderType === 'Hold' ? OrderCardDetail?.filter((a, b) => a.BookingTypeName === 'TakeAway') : OrderCardDetail?.filter( - (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId - ); + (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId + ); console.log('HoldOrderDtl', OrderCardDetail); const OldtableDataDinein = OrderCardDetail?.filter( (a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId @@ -160,8 +157,8 @@ const StandardTable = () => { const OldtableDataTakeAway = OrderType != 'Hold' ? OrderCardDetail?.filter( - (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId - ) + (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId + ) : []; const [EditQuantity, setEditQuantity] = useState(false); @@ -294,9 +291,9 @@ const StandardTable = () => { AppId: AppId, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; await dispatch(getSelectedFavItems(data)).unwrap(); @@ -308,9 +305,9 @@ const StandardTable = () => { ProdSubCat: ProdSubCat, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; @@ -321,9 +318,9 @@ const StandardTable = () => { prodCat: prodCat, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; @@ -416,9 +413,6 @@ const StandardTable = () => { await dispatch(ChangeTotalAmount([])); await dispatch(changeOrderType(null)); await dispatch(changeReorderHoldDetails({})); - await dispatch(changeBillEditingMode(false)); - await dispatch(changePreviousOrderPayment([])); - await dispatch(changePreviousOrderOfferDetail([])); } else if (OrderType === 'Reorder') { const UpdatedData = OrderCardDetail?.filter( (cartItem) => cartItem?.SalesId @@ -444,9 +438,6 @@ const StandardTable = () => { await dispatch(ChangeTotalAmount([])); await dispatch(changeUnpaidData(false)); await dispatch(changeReorderHoldDetails({})); - await dispatch(changeBillEditingMode(false)); - await dispatch(changePreviousOrderPayment([])); - await dispatch(changePreviousOrderOfferDetail([])); await dispatch(changeReorderProductDetails([])); await dispatch(ChangeSelectedCustDisable(false)); @@ -1133,9 +1124,9 @@ const StandardTable = () => { )?.map((item, idx) => idx === 0 ? { - ...item, - FreeQty, - } + ...item, + FreeQty, + } : item ), }; @@ -2519,10 +2510,11 @@ const StandardTable = () => { {OldtableDataTakeAway?.map((item, index) => ( { ? item?.SalesId && OrderType !== 'Hold' ? 'rgb(243, 248, 213)' : triggerAnimation && - index === 0 && - !item?.SalesId && - tableDataTakeAway?.length >= PreviousdataLength + index === 0 && + !item?.SalesId && + tableDataTakeAway?.length >= PreviousdataLength ? 'wheat' : triggerAnimation && - index === 0 && - tableDataTakeAway?.length >= - PreviousdataLength && - !HoldOrderDtl && - !UnpaidData + index === 0 && + tableDataTakeAway?.length >= + PreviousdataLength && + !HoldOrderDtl && + !UnpaidData ? 'wheat' : 'inherit' : 'none', @@ -2549,9 +2541,9 @@ const StandardTable = () => { item?.SalesId && OrderType !== 'Hold' ? 'rgb(243, 248, 213)' : GlobEstBooking === 'ParEst' && - GlobProdwisedata?.includes( - item?.InwardDtlId + ' ' + item?.BookingTypeName - ) + GlobProdwisedata?.includes( + item?.InwardDtlId + ' ' + item?.BookingTypeName + ) ? '#b2d1f7' : index % 2 === 0 ? 'white' @@ -2614,7 +2606,7 @@ const StandardTable = () => { }} onClick={() => item.FullProductIdentifierDtls?.length > 0 || - item.ProductIdentifierDtls?.length > 0 + item.ProductIdentifierDtls?.length > 0 ? handleImeiDetails(item) : editField && handleEditQuantity(item) } @@ -2683,21 +2675,21 @@ const StandardTable = () => { {productBasedExtraCharges?.find( (find) => find.ProdId === item.ProdId ) !== undefined && ( -
    - Extra Charges :{' '} - { - productBasedExtraCharges?.find( - (find) => find.ProdId === item.ProdId - )?.TotalAmt - } -
    - )} +
    + Extra Charges :{' '} + { + productBasedExtraCharges?.find( + (find) => find.ProdId === item.ProdId + )?.TotalAmt + } +
    + )} )} @@ -2792,7 +2784,7 @@ const StandardTable = () => { } }} > - {safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} + {safeRound(item?.TotalAmt)} )} {tableitem.OptionName == 'Delete' && ( @@ -2836,10 +2828,11 @@ const StandardTable = () => { {OldtableDataDinein?.map((item, index) => ( { ? item?.SalesId ? 'rgb(243, 248, 213)' : BookingType === 'Dine In' && - triggerAnimation && - OldtableDataTakeAway?.length + index === 0 && - !item?.SalesId && - tableDataDinein?.length >= PreviousdataLength - ? 'wheat' - : BookingType !== 'Dine In' && triggerAnimation && OldtableDataTakeAway?.length + index === 0 && - tableDataDinein?.length >= - PreviousdataLength && - !HoldOrderDtl && - !UnpaidData + !item?.SalesId && + tableDataDinein?.length >= PreviousdataLength + ? 'wheat' + : BookingType !== 'Dine In' && + triggerAnimation && + OldtableDataTakeAway?.length + index === 0 && + tableDataDinein?.length >= + PreviousdataLength && + !HoldOrderDtl && + !UnpaidData ? 'wheat' : 'inherit' : 'none', background: item?.SalesId ? 'rgb(243, 248, 213)' : GlobEstBooking === 'ParEst' && - GlobProdwisedata?.includes( - item?.InwardDtlId + ' ' + item?.BookingTypeName - ) + GlobProdwisedata?.includes( + item?.InwardDtlId + ' ' + item?.BookingTypeName + ) ? '#b2d1f7' : (OldtableDataTakeAway?.length + index) % 2 === 0 ? 'white' @@ -2998,21 +2991,21 @@ const StandardTable = () => { {productBasedExtraCharges?.find( (find) => find.ProdId === item.ProdId ) !== undefined && ( -
    - Extra Charges :{' '} - { - productBasedExtraCharges?.find( - (find) => find.ProdId === item.ProdId - )?.TotalAmt - } -
    - )} +
    + Extra Charges :{' '} + { + productBasedExtraCharges?.find( + (find) => find.ProdId === item.ProdId + )?.TotalAmt + } +
    + )} )} @@ -3106,7 +3099,7 @@ const StandardTable = () => { } }} > - {safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} + {safeRound(item?.TotalAmt)} )} @@ -3155,10 +3148,11 @@ const StandardTable = () => { OldtableDataTakeAway?.length + index } - className={`${BookingType === 'Dine In' && item?.SalesId - ? 'booking-billing-table-row-disabled' - : 'booking-billing-table-row' - } + className={`${ + BookingType === 'Dine In' && item?.SalesId + ? 'booking-billing-table-row-disabled' + : 'booking-billing-table-row' + } `} style={{ @@ -3167,43 +3161,43 @@ const StandardTable = () => { ? BookingType === 'Dine In' && item?.SalesId ? 'rgb(243, 248, 213)' : BookingType === 'Dine In' && - triggerAnimation && - OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index === - 0 && - !item?.SalesId && - tableDataTakeAway?.length >= PreviousdataLength - ? 'wheat' - : BookingType !== 'Dine In' && triggerAnimation && OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index === - 0 && - tableDataTakeAway?.length >= - PreviousdataLength && - !HoldOrderDtl && - !UnpaidData + OldtableDataTakeAway?.length + + index === + 0 && + !item?.SalesId && + tableDataTakeAway?.length >= PreviousdataLength + ? 'wheat' + : BookingType !== 'Dine In' && + triggerAnimation && + OldtableDataDinein?.length + + OldtableDataTakeAway?.length + + index === + 0 && + tableDataTakeAway?.length >= + PreviousdataLength && + !HoldOrderDtl && + !UnpaidData ? 'wheat' : (OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index) % - 2 === - 0 + OldtableDataTakeAway?.length + + index) % + 2 === + 0 ? 'white' : SelectedBillColor?.[ - 'OverallBackgroundColor' - ] + 'OverallBackgroundColor' + ] ? SelectedBillColor?.[ - 'OverallBackgroundColor' - ] + 'OverallBackgroundColor' + ] : '#d6d6d6' : (OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index) % - 2 === - 0 + OldtableDataTakeAway?.length + + index) % + 2 === + 0 ? 'white' : SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.['OverallBackgroundColor'] @@ -3212,15 +3206,15 @@ const StandardTable = () => { BookingType === 'Dine In' && item?.SalesId ? 'rgb(243, 248, 213)' : GlobEstBooking === 'ParEst' && - GlobProdwisedata?.includes( - item?.InwardDtlId + ' ' + item?.BookingTypeName - ) + GlobProdwisedata?.includes( + item?.InwardDtlId + ' ' + item?.BookingTypeName + ) ? '#b2d1f7' : (OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index) % - 2 === - 0 + OldtableDataTakeAway?.length + + index) % + 2 === + 0 ? 'white' : SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.['OverallBackgroundColor'] @@ -3229,9 +3223,9 @@ const StandardTable = () => { BillOrderPre === 'Y' && !BookingTypeBoth ? triggerAnimation && OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index === - 0 && + OldtableDataTakeAway?.length + + index === + 0 && !item?.SalesId && tableDataTakeAway?.length >= PreviousdataLength && !HoldOrderDtl && @@ -3284,7 +3278,7 @@ const StandardTable = () => { }} onClick={() => item.FullProductIdentifierDtls?.length > 0 || - item.ProductIdentifierDtls?.length > 0 + item.ProductIdentifierDtls?.length > 0 ? handleImeiDetails(item) : editField && handleEditQuantity(item) } @@ -3308,8 +3302,8 @@ const StandardTable = () => { {!item?.ProdVariantName?.toLowerCase()?.includes( 'variant' ) && ( - {item?.ProdVariantName} - )} + {item?.ProdVariantName} + )} {AvailableDate ? ( <> {' '} @@ -3359,21 +3353,21 @@ const StandardTable = () => { {productBasedExtraCharges?.find( (find) => find.ProdId === item.ProdId ) !== undefined && ( -
    - Extra Charges :{' '} - { - productBasedExtraCharges?.find( - (find) => find.ProdId === item.ProdId - )?.TotalAmt - } -
    - )} +
    + Extra Charges :{' '} + { + productBasedExtraCharges?.find( + (find) => find.ProdId === item.ProdId + )?.TotalAmt + } +
    + )} )} @@ -3468,7 +3462,7 @@ const StandardTable = () => { } }} > - {safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} + {safeRound(item?.TotalAmt)} )} @@ -3517,10 +3511,11 @@ const StandardTable = () => { tableDataTakeAway?.length + index } - className={`${BookingType === 'Dine In' && item?.SalesId - ? 'booking-billing-table-row-disabled' - : 'booking-billing-table-row' - } + className={`${ + BookingType === 'Dine In' && item?.SalesId + ? 'booking-billing-table-row-disabled' + : 'booking-billing-table-row' + } `} style={{ @@ -3531,45 +3526,45 @@ const StandardTable = () => { !BookingTypeBoth ? 'rgb(243, 248, 213)' : BookingType === 'Dine In' && - triggerAnimation && - OldtableDataTakeAway?.length + - OldtableDataDinein?.length + - tableDataTakeAway?.length + - index === - 0 && - !item?.SalesId && - tableDataDinein?.length >= PreviousdataLength - ? 'wheat' - : BookingType !== 'Dine In' && triggerAnimation && OldtableDataTakeAway?.length + - OldtableDataDinein?.length + - tableDataTakeAway?.length + - index === - 0 && - tableDataDinein?.length >= - PreviousdataLength && - !HoldOrderDtl && - !UnpaidData + OldtableDataDinein?.length + + tableDataTakeAway?.length + + index === + 0 && + !item?.SalesId && + tableDataDinein?.length >= PreviousdataLength + ? 'wheat' + : BookingType !== 'Dine In' && + triggerAnimation && + OldtableDataTakeAway?.length + + OldtableDataDinein?.length + + tableDataTakeAway?.length + + index === + 0 && + tableDataDinein?.length >= + PreviousdataLength && + !HoldOrderDtl && + !UnpaidData ? 'wheat' : 'inherit' : 'none', background: BookingType === 'Dine In' && - item?.SalesId && - !BookingTypeBoth + item?.SalesId && + !BookingTypeBoth ? 'rgb(243, 248, 213)' : GlobEstBooking === 'ParEst' && - GlobProdwisedata?.includes( - item?.InwardDtlId + ' ' + item?.BookingTypeName - ) + GlobProdwisedata?.includes( + item?.InwardDtlId + ' ' + item?.BookingTypeName + ) ? '#b2d1f7' : (OldtableDataTakeAway?.length + - OldtableDataDinein?.length + - tableDataTakeAway?.length + - index) % - 2 === - 0 + OldtableDataDinein?.length + + tableDataTakeAway?.length + + index) % + 2 === + 0 ? 'white' : SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.['OverallBackgroundColor'] @@ -3578,10 +3573,10 @@ const StandardTable = () => { BillOrderPre === 'Y' && !BookingTypeBoth ? triggerAnimation && OldtableDataTakeAway?.length + - OldtableDataDinein?.length + - tableDataTakeAway?.length + - index === - 0 && + OldtableDataDinein?.length + + tableDataTakeAway?.length + + index === + 0 && !item?.SalesId && tableDataDinein?.length >= PreviousdataLength && !HoldOrderDtl && @@ -3703,21 +3698,21 @@ const StandardTable = () => { {productBasedExtraCharges?.find( (find) => find.ProdId === item.ProdId ) !== undefined && ( -
    - Extra Charges :{' '} - { - productBasedExtraCharges?.find( - (find) => find.ProdId === item.ProdId - )?.TotalAmt - } -
    - )} +
    + Extra Charges :{' '} + { + productBasedExtraCharges?.find( + (find) => find.ProdId === item.ProdId + )?.TotalAmt + } +
    + )} )} @@ -3811,7 +3806,7 @@ const StandardTable = () => { } }} > - {safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} + {safeRound(item?.TotalAmt)} )} diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.scss b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.scss index fed10fe..d48be0c 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.scss +++ b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.scss @@ -47,7 +47,7 @@ height: 2rem; font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; - >th { + > th { font-size: 10px !important; font-weight: 400 !important; -webkit-text-stroke-width: 0.2px; @@ -1116,20 +1116,19 @@ @media (max-width: 500px) { padding: 5px 10px; } - .ShoppingCartMain-left { display: flex; align-items: center; gap: 1rem; white-space: nowrap; - >div { + > div { font-size: 1rem; font-weight: 500; font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; } - >p { + > p { background-color: #fff3; font-size: 10px; padding: 1px 6px; @@ -1154,9 +1153,11 @@ z-index: 10; @media (max-width: 768px) { - background-color: linear-gradient(to bottom right, - #1e2536, - #2a3447) !important; + background-color: linear-gradient( + to bottom right, + #1e2536, + #2a3447 + ) !important; background: linear-gradient(to bottom right, #1e2536, #2a3447) !important; display: flex !important; } @@ -1171,13 +1172,13 @@ gap: 1rem; white-space: nowrap; - >div { + > div { font-size: 1.125rem; font-weight: 500; font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; } - >p { + > p { background-color: #fff3; font-size: small; padding: 1px 6px; @@ -1193,11 +1194,11 @@ padding: 12px 16px; .ShoppingCartMain-left { - >div { + > div { font-size: 1rem; } - >p { + > p { font-size: 0.75rem; } } @@ -1208,11 +1209,11 @@ align-items: flex-start; .ShoppingCartMain-left { - >div { + > div { font-size: 0.875rem; } - >p { + > p { font-size: 0.7rem; } } @@ -1268,27 +1269,6 @@ } } -.standard-pay-btn-refund { - padding: 0.9rem 0.75rem; - font-size: 1.125rem; - font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; - border: none; - border-radius: 4px; - cursor: pointer; - display: flex; - align-items: center; - justify-content: center; - // justify-content: space-around; - gap: 0.5rem; - opacity: 1; - background-color: #0d9488; - color: #fff; - - @media (max-width: 500px) { - padding: 0.75rem; - } -} - .standard-pay-btn { padding: 0.9rem 0.75rem; font-size: 1.125rem; @@ -1558,7 +1538,7 @@ .paybutton { padding: 10px 12px; - >svg { + > svg { display: none !important; } } @@ -1577,7 +1557,9 @@ display: flex !important; } - .booking-billing-table-container .shoppingCartLeft .payment-buttons-container { + .booking-billing-table-container + .shoppingCartLeft + .payment-buttons-container { display: flex !important; padding: 0 10px; align-items: flex-start; @@ -1614,7 +1596,7 @@ .standard-pay-btns { flex: 1; - >button { + > button { width: 100%; } } @@ -1668,4 +1650,4 @@ @media (max-width: 768px) { display: flex; } -} \ No newline at end of file +} diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx index 40c81a2..86e1761 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx @@ -12,7 +12,6 @@ import Credit from '../../UtillComponents/Pozo retail icons/credit.svg'; import { FaCreditCard } from 'react-icons/fa6'; import { changeAddBookingDetailsTrigger, - changeBillEditingMode, changeBookingType, ChangeComboCarddata, changeCurrentOrderId, @@ -26,8 +25,6 @@ import { ChangeOverAllDiscSales, changePaymentloader, changePaymentTransactionNumber, - changePreviousOrderOfferDetail, - changePreviousOrderPayment, changeReorderHoldDetails, changeReorderProductDetails, changeSelectChair, @@ -53,7 +50,6 @@ import { getCurrentOrderid, getLayoutproductCard, GetPaymentdeviceResponse, - getPaymentOptions, getSalesDetailData, getSelectedFavItems, getUnpaidData, @@ -76,15 +72,11 @@ import { GlobalOverAllDiscEstimate, GlobalOverAllDiscSales, GlobalPayementloader, - GlobalpaymentOptionData, GlobalPaymentTrigger, - GlobalPreviousOrderOfferDetails, - GlobalPreviousOrderPayment, GlobalProductCategorie, GlobalProductSubCategorie, GlobalReorderHoldDetails, GlobalRetailWSSalesType, - GlobalSalesBillEdit, GlobalSelCustId, GlobalSelectedTableDetails, GlobalSelOption, @@ -101,7 +93,6 @@ import { PutBookingData, PutBookingPaymentStatusChange, PutPendingPaymentList, - putSalesBillEdit, putSplitpaymentStatus, SendPaymentLink, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; @@ -276,10 +267,6 @@ const StandardTablePayment = () => { const GlobProdwisedata = useSelector(GlobalSelProdWiseEst); const GlobEstBooking = useSelector(GlobalEstimateBooking); const OtherServicesglobal = useSelector(GlobalOtherSevices); - const salesBillEdit = useSelector(GlobalSalesBillEdit); - const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); - const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); - const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const OrderType = useSelector(GlobalOrderType); const unpaidFlow = useSelector(Globalunpaidflow); const selOption = useSelector(GlobalSelOption); @@ -367,11 +354,6 @@ const StandardTablePayment = () => { const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]); const [ConfigDataList, setConfigDataList] = useState([]); const [TotalAmount, setTotalAmount] = useState(0); - const [refundPayBtns, setRefundPayBtns] = useState([]); - const [refundPaySelected, setRefundPaySelected] = useState(); - const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); - const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); - const [previousNetAmount, setPreviousNetAmount] = useState(0); const [FirstPaymentclick, setFirstPaymentclick] = useState(false); const [UpinotSelected, setUpinotSelected] = useState(false); const [brachName, setbrachName] = useState(''); @@ -504,12 +486,6 @@ const StandardTablePayment = () => { ); }, [GlobalExtraCharge]); - useEffect(() => { - if (salesBillEdit) { - dispatch(getPaymentOptions()).unwrap(); - } - }, [salesBillEdit]); - const customerNameOrMobile = MobileNoWhatsApp?.CustName?.trim() ? `Dear ${MobileNoWhatsApp?.CustName}` : `Dear ${MobileNoWhatsApp?.value}`; @@ -730,6 +706,7 @@ const StandardTablePayment = () => { CheckBookingStatus, addnewAccess, preferenceshortcutkey, + unpaidFlow, ]); @@ -832,13 +809,7 @@ const StandardTablePayment = () => { }, [paybtnselected, selOption, payBtns]); useEffect(() => { - if (orderCardDetail?.length == 0) { - dispatch(changeunpaidflow(false)); - // dispatch(changePreviousOrderPayment([])); - // dispatch(changePreviousOrderOfferDetail([])); - // dispatch(changeBillEditingMode(false)); - } - + orderCardDetail?.length == 0 ? dispatch(changeunpaidflow(false)) : ''; if (!preOrder) { const totalSum = orderCardDetail?.reduce( (acc, card) => acc + parseFloat(card.OrderRate * card.OrderQty || 0), @@ -895,45 +866,29 @@ const StandardTablePayment = () => { ); } - const filteredPayments = - previousOrderPayment?.filter( - p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment - ) || []; - - const paymentsToUse = - filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; - - const totalPreviouspayment = paymentsToUse?.reduce( - (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), - 0 - ); - - const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( - (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), - 0 - ); - - const previousNetAmount = - (totalPreviouspayment) || 0; - - let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - const currentOrderNetAmount = formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - console.log(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount, "totalPreviouspayment") + setTotalAmount( + formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) + ); - setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); - setCurrentOrderNetAmount(currentOrderNetAmount); - setPreviousNetAmount(previousNetAmount); - dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); + dispatch( + changeSummeryTotalAmount( + formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) + ) + ); // dispatch( // changeSummeryTotalAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) // ); @@ -1061,25 +1016,6 @@ const StandardTablePayment = () => { } }, [PaymentUpiOptions, PaymentOptions, SelCustId]); - useEffect(() => { - - if (salesBillEdit) { - if (SelCustId) { - setRefundPayBtns(AllPaymentOptions); - setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); - setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); - } else { - const withoutCustomer = AllPaymentOptions?.filter?.( - (item) => item?.ConfigName?.toLowerCase() !== 'credit' - ); - setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); - setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); - setRefundPayBtns(withoutCustomer); - } - } - - }, [AllPaymentOptions, SelCustId, salesBillEdit]) - useEffect(() => { if ( (BookingType === 'Dine In' || @@ -1176,10 +1112,6 @@ const StandardTablePayment = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); - } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { - setMessageType('warning'); - setMessageData('Please Select Refund Payment Method'); - return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1558,7 +1490,7 @@ const StandardTablePayment = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : + PaymentType: Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -1572,14 +1504,14 @@ const StandardTablePayment = () => { : paybtnselected ? paybtnselected : null, - Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), - MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + Amount: Math.round(TotalAmount), + MerchantId: Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : + PaymentOptionType: Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -1593,7 +1525,7 @@ const StandardTablePayment = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + ModeOfPayment: SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -1601,7 +1533,7 @@ const StandardTablePayment = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : + AccountDtl: Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -1618,7 +1550,7 @@ const StandardTablePayment = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : + PaymentStatus: Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -1627,8 +1559,8 @@ const StandardTablePayment = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, - Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : + Debit: 0, + Credit: Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -1861,12 +1793,7 @@ const StandardTablePayment = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = null; - if (salesBillEdit) { - response = await dispatch(putSalesBillEdit(putdata)).unwrap(); - } else { - response = await dispatch(PutBookingData(putdata)).unwrap(); - } + let response = await dispatch(PutBookingData(putdata)).unwrap(); if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -1918,7 +1845,6 @@ const StandardTablePayment = () => { if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); } - ClearAllGlobalStateDatas(); console.log('more pg data'); } @@ -1932,7 +1858,6 @@ const StandardTablePayment = () => { await dispatch(changeOrderCardDetails([])); await dispatch(changeReorderHoldDetails({})); await dispatch(changeReorderProductDetails([])); - setFirstPaymentclick(false); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -2034,10 +1959,6 @@ const StandardTablePayment = () => { } }; - const handleSalesBillEdit = async (putdatas, value, pay) => { - console.log(putdatas, value, pay, "handleSalesBillEdit") - } - const OtherServicePostBooking = async (PostData, value) => { console.log(PostData, value, 'PostData, value'); @@ -2782,11 +2703,6 @@ const StandardTablePayment = () => { } }; - const handleRefundPaymentMode = (id, name) => { - setRefundPaySelected(id); - setRefundPaySelectedName(name); - } - const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -2817,9 +2733,6 @@ const StandardTablePayment = () => { ParkingClaimed: false, }) ); - dispatch(changeBillEditingMode(false)); - await dispatch(changePreviousOrderPayment([])); - await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeFullOfferAppliedProducts([])); dispatch(ChangeFullFreeProductList([])); @@ -2839,8 +2752,6 @@ const StandardTablePayment = () => { setQrCode(false); setUpinotSelected(false); getHolddata(); - setCurrentOrderNetAmount(0); - setPreviousNetAmount(0); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); } @@ -2982,7 +2893,7 @@ const StandardTablePayment = () => { async (orderDetail, index) => { await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print if (orderDetail?.BookingTypeName !== 'Dine In') { - const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( + const groupedTokens = orderDetail?.productDetails?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -3027,7 +2938,7 @@ const StandardTablePayment = () => { await Promise.all( PrintOrderDetails?.[0]?.OrderDetails?.map( async (orderDetail, index) => { - const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( + const groupedTokens = orderDetail?.productDetails?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -3063,7 +2974,7 @@ const StandardTablePayment = () => { ); } else { await Promise.all( - PrintOrderDetails?.[0]?.OrderDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.map( + PrintOrderDetails?.[0]?.OrderDetails?.map( async (orderDetail, index) => { await TokenPrint(`${index}-${orderDetail?.OrderId}`); } @@ -3277,7 +3188,7 @@ const StandardTablePayment = () => { }; const SplitPaymentOpen = () => { - if (orderCardDetail?.length > 0 && TotalAmount > 0) { + if (orderCardDetail?.length > 0) { // const updatedData = { // userData: OrderCardDetail, // ExtraCharges: GlobalExtraCharge, @@ -3287,11 +3198,6 @@ const StandardTablePayment = () => { // setFailedOrderData(updatedData); setSplitpayment(true); } else { - if (TotalAmount <= 0) { - setMessageType('warning'); - setMessageData('Cannot split when total amount is zero or less'); - return; - } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3704,7 +3610,7 @@ const StandardTablePayment = () => { opacity: isDisabled ? 0.5 : 1, }} > - {payBtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( + {payBtns?.length > 0 ? ( payBtns.map((payment) => { const mode = payment?.ModeName?.toLowerCase(); const isSelected = paybtnselected === payment?.ModeId; @@ -3794,55 +3700,6 @@ const StandardTablePayment = () => {
    ); }) - ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( - refundPayBtns.map((payment) => { - const mode = payment?.ConfigName?.toLowerCase(); - const isSelected = refundPaySelected === payment?.ConfigId; - const buttonClass = isSelected - ? 'paybutton-selected' - : 'paybutton'; - - return ( -
    - -
    - ); - }) ) : (
    { orderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus !== 'Close' - ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? - 'standard-pay-btn-refund' - : 'standard-pay-btn' + ? !OrderStatus + ? 'standard-pay-btn' : 'standard-pay-btn order-complete' : 'standard-pay-btn-disabled' } onClick={handleButtonClick} > - {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?

    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}

    : ( + {!OrderStatus ? ( <>

    { const dispatch = useDispatch(); const navigate = useNavigate(); - const salesBillEdit = useSelector(GlobalSalesBillEdit); - const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); - const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); - const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const SessionData = useSelector(StoredSessionData); const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus); const globalTipAmount = useSelector(GlobaltipAmount); @@ -339,11 +321,6 @@ const BSC1Payment = (props) => { const [UpiOption, setUpiOption] = useState(''); const [UpiId, setUpiId] = useState(); const [hold, setHold] = useState(false); - const [refundPayBtns, setRefundPayBtns] = useState([]); - const [refundPaySelected, setRefundPaySelected] = useState(); - const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); - const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); - const [previousNetAmount, setPreviousNetAmount] = useState(0); const appPreferences = useSelector(ApplicationPreferences); const commonModulePreference = appPreferences?.find( (preference) => preference?.PreferredCatName === 'Common Module' @@ -452,14 +429,6 @@ const BSC1Payment = (props) => { const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]); const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]); const [UpiPayOption, setUpiPayOption] = useState([]); - const [BusinessPayOption, setBusinessPayoption] = useState([]); - const [paymentSucess, setPaymentSuccess] = useState(false); - const [businessUPI, setBusinessUPI] = useState(false); - const [businessUPIOrderId, setBusinessUPIOrderId] = useState(null); - const [businessUPILink, setBusinessUPILink] = useState(null); - const defaultPaymentTrigger = useSelector(GlobalPaymentTrigger); - const [defaultPaymentMode, setDefaultPaymentMode] = useState([]); - const [defaultEnabled, setDefaultEnabled] = useState(false); const [CardPayOption, setCardPayOption] = useState([]); const [PaymentUpiOptions, setPaymentUpiOptions] = useState([]); const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions); @@ -492,7 +461,6 @@ const BSC1Payment = (props) => { const printDatas = useSelector(GlobalprintDatas); const PrinterDetails = useSelector(GlobalPrinterMappingDtls); const [addnewAccess, setaddnewAccess] = useState(true); - const [showCancelConfirm, setShowCancelConfirm] = useState(false); const BookingStatus = useSelector(GlobalBookingStatus); const PaymentOptionsModeName = @@ -561,79 +529,6 @@ const BSC1Payment = (props) => { '11111111111111' ); // Usage - useEffect(() => { - const setDefaultPaymentOption = async () => { - const res = await dispatch( - getDefaultPaymentOptions({ AppId, CompId, BranchId }) - )?.unwrap(); - const defaultDetail = res?.data?.data?.[0]?.DefaultDetails?.[0]; - if (res?.data?.data?.length > 0 && defaultDetail) { - setDefaultEnabled(true); - setDefaultPaymentMode(defaultDetail); - const { option, card } = defaultDetail; - if (option?.value) setSelectedUPIPayOption(option.value); - if (card) { - const isDefault = - String(option?.value ?? '').toLowerCase() === 'default'; - const idToUse = isDefault ? card?.UPIId : card?.ModeId; - - if (idToUse) { - addUpiOption(card?.Mode, card?.ModeName, idToUse); - } - } - } else { - setDefaultEnabled(false); - setDefaultPaymentMode([]); - } - }; - setDefaultPaymentOption(); - }, [defaultPaymentTrigger]); - - useEffect(() => { - const getPrintData = async () => { - try { - const data = { - AppId, - CompId, - BranchId, - OrderId: businessUPIOrderId, - }; - - const res = await dispatch(ReprintDetails(data)).unwrap(); - - if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) { - const orderData = [{ OrderDetails: res.data.data }]; - - // Reset states first - setBusinessUPIOrderId(null); - setBusinessUPI(false); - setPaymentSuccess(false); - - // Then set new data and trigger side effects - setPrintOrderDetails(orderData); - CustomerDisplay(); - ClearAllGlobalStateDatas(); - filteredSettingNames?.includes('whatsapp') && - MobileNoWhatsApp?.value && - handleURL(orderData); - } - } catch (error) { - console.error('Failed to fetch print data:', error); - // Reset states even on error - setBusinessUPI(false); - setPaymentSuccess(false); - } - }; - - if (paymentSucess && businessUPIOrderId) { - const timer = setTimeout(() => { - getPrintData(); - }, 3000); - - return () => clearTimeout(timer); - } - }, [paymentSucess, businessUPIOrderId, AppId, CompId, BranchId, dispatch]); - useEffect(() => { const fetchCreditCustomer = async () => { const selectedMode = paybtns?.find( @@ -672,32 +567,6 @@ const BSC1Payment = (props) => { fetchCreditCustomer(); }, [paybtnselected, selOption, paybtns]); - - useEffect(() => { - if (salesBillEdit) { - dispatch(getPaymentOptions()).unwrap(); - } - }, [salesBillEdit]); - - useEffect(() => { - - if (salesBillEdit) { - if (SelCustId) { - setRefundPayBtns(AllPaymentOptions); - setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); - setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); - } else { - const withoutCustomer = AllPaymentOptions?.filter?.( - (item) => item?.ConfigName?.toLowerCase() !== 'credit' - ); - setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); - setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); - setRefundPayBtns(withoutCustomer); - } - } - - }, [AllPaymentOptions, SelCustId, salesBillEdit]) - useEffect(() => { if (!preOrder) { const totalSum = OrderCardDetail?.reduce( @@ -755,41 +624,22 @@ const BSC1Payment = (props) => { ); } - const filteredPayments = - previousOrderPayment?.filter( - p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment - ) || []; - - const paymentsToUse = - filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; - - const totalPreviouspayment = paymentsToUse?.reduce( - (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), - 0 - ); - - const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( - (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), - 0 - ); - - const previousNetAmount = - (totalPreviouspayment) || 0; - let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - const currentOrderNetAmount = formatAmount( + + setTotalAmount( withdiscTotal >= 0 ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) + ); - setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); - setCurrentOrderNetAmount(currentOrderNetAmount); - setPreviousNetAmount(previousNetAmount); - dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); + dispatch( + changeSummeryTotalAmount( + withdiscTotal > 0 ? withdiscTotal : Number(Total) + ) + ); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -1230,10 +1080,6 @@ const BSC1Payment = (props) => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default') { UpiPayment(); - } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { - setMessageType('warning'); - setMessageData('Please Select Refund Payment Method'); - return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1309,9 +1155,6 @@ const BSC1Payment = (props) => { const filterpaymentdevice = FiltersalesPayment?.[0]?.OptionDetails?.filter( (item) => item?.OptionName?.toLowerCase() === 'payment device' ); - const filterBusinessUpi = FiltersalesPayment?.[0]?.OptionDetails?.filter( - (item) => item?.OptionName?.toLowerCase() === 'business upi' - ); const cardinpaymentgateway = filterpaymentgateway?.[0]?.ModeDetails?.filter((item) => item?.ModeName?.toLowerCase()?.includes('card') @@ -1354,6 +1197,7 @@ const BSC1Payment = (props) => { } setCardPayOption(cardoptions); const options = []; + if (FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter?.length > 0) { options.push({ label: 'Personal UPI', @@ -1361,16 +1205,6 @@ const BSC1Payment = (props) => { imgSrc: defaultupi, }); } - if (filterBusinessUpi?.[0]?.ModeDetails?.length > 0) { - options.push({ - label: 'Business UPI', - value: 'Business', - imgSrc: pozologoimg, - PaymentOptionId: filterBusinessUpi?.[0]?.PaymentOptionId, - PaymentFlowId: filterBusinessUpi?.[0]?.PaymentFlowId, - OptionId: filterBusinessUpi?.[0]?.OptionId, - }); - } if (upiinpaymentgateway?.length > 0) { options.push({ label: 'Payment Gateway', value: 'PG', imgSrc: paygate }); @@ -1380,7 +1214,6 @@ const BSC1Payment = (props) => { options.push({ label: 'Payment Device', value: 'PD', imgSrc: paydevice }); } setUpiPayOption(options); - setBusinessPayoption(filterBusinessUpi?.[0]?.ModeDetails || []); // } }; @@ -1419,17 +1252,12 @@ const BSC1Payment = (props) => { } }; - const handleRefundPaymentMode = (id, name) => { - setRefundPaySelected(id); - setRefundPaySelectedName(name); - } - const AddCardOption = (data) => { setSelectedCardOption(data); setCardOptionOpen(false); setCardoptionnotSelected(false); }; - const AddUPIPaymentOption = async (data, mode = false) => { + const AddUPIPaymentOption = async (data) => { setSelectedUpiOption(''); setUpiOption(''); setUpiId(''); @@ -1439,7 +1267,7 @@ const BSC1Payment = (props) => { setSelectedUPIPayOption(data); setUpinotSelected(false); setCardoptionnotSelected(false); - if (data !== 'Default' && data !== 'Business' && !mode) { + if (data !== 'Default') { setUpiOptionOpen(false); } }; @@ -1819,18 +1647,6 @@ const BSC1Payment = (props) => { } }; - const businessUPIFlow = async ( - businessUPIfilter, - OrderId, - PaymentStatusLink - ) => { - // Implement your business UPI flow here - // You can add similar logic as PaymentDeviceFlow or PaymentGatewayFlow based on your requirements - setBusinessUPILink(PaymentStatusLink); - setBusinessUPI(true); - setBusinessUPIOrderId(OrderId); - }; - function safeRound(amountStr) { if (amountStr == null) return '0.00'; @@ -1978,9 +1794,6 @@ const BSC1Payment = (props) => { } else { dispatch(changeOrderCardDetails([])); } - dispatch(changeBillEditingMode(false)); - await dispatch(changePreviousOrderPayment([])); - await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); await dispatch(ChangeTotalAmount([])); await dispatch(changeReorderHoldDetails({})); @@ -1994,8 +1807,6 @@ const BSC1Payment = (props) => { setPaybtnselected(PaymentOptionsModeId); setQrCode(false); setUpinotSelected(false); - setCurrentOrderNetAmount(0); - setPreviousNetAmount(0); getHolddata(); getUnpaiddatas(); await dispatch(changeBookingType('TakeAway')); @@ -2032,8 +1843,7 @@ const BSC1Payment = (props) => { ); if ( OnUpiSelected?.ModeName?.toLowerCase() === 'upi' && - (SelectedUPIPayOption?.toLowerCase() === 'default' || - SelectedUPIPayOption?.toLowerCase() === 'business') + SelectedUPIPayOption?.toLowerCase() === 'default' ) { SetSuccess(false); setTimeout(function () { @@ -2286,28 +2096,19 @@ const BSC1Payment = (props) => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : + PaymentType: Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId : SelectedUPIPayOption?.toLowerCase() === 'pg' ? PaymentgatewayUPI?.[0]?.ModeId - : SelectedUPIPayOption?.toLowerCase() === 'business' - ? BusinessPayOption?.find( - (busupi) => busupi?.ModeId === UpiId - )?.ModeId - : paybtnselected + : paybtnselected : paybtnselected ? paybtnselected : null, - Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), - MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : - Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'business' - ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) - ?.MerchantId - : null, - PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : + // SelectedUPIPayOption?.toLowerCase() === "pg" ? + Amount: Math.round(TotalAmount), + PaymentOptionType: Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2317,19 +2118,14 @@ const BSC1Payment = (props) => { : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'default' ? 'PC' - : SelectedUPIPayOption?.toLowerCase() === 'business' - ? 'BU' - : SelectedUPIPayOption + : SelectedUPIPayOption : null, - ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + ModeOfPayment: SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId - : SelectedUPIPayOption?.toLowerCase() === 'business' - ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) - ?.MerchantUPIId - : null, - AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : + : null, + AccountDtl: Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2346,7 +2142,7 @@ const BSC1Payment = (props) => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : + PaymentStatus: Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2355,8 +2151,8 @@ const BSC1Payment = (props) => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, - Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : + Debit: 0, + Credit: Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2410,11 +2206,6 @@ const BSC1Payment = (props) => { let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter( (item) => item?.PaymentOptionType?.toLowerCase() === 'pc' ); - let businessUPIfilter = response?.data?.PaymentOrderDtl?.filter( - (item) => - item?.PaymentOptionType?.toLowerCase() === 'bu' && - item?.PaymentStatus === 'P' - ); if ( PayatCounterfilter?.length === 1 || response?.data?.PaymentOrderDtl?.length === 0 @@ -2519,13 +2310,6 @@ const BSC1Payment = (props) => { } else { console.log('more pg data'); } - if (businessUPIfilter?.length === 1) { - businessUPIFlow( - businessUPIfilter, - response?.data?.OrderId, - response?.data?.PaymentPageLink - ); - } dispatch(triggerCustomerRefresh()); } else { setMessageType('error'); @@ -2557,16 +2341,10 @@ const BSC1Payment = (props) => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = null; - if (salesBillEdit) { - response = await dispatch(putSalesBillEdit(putdata)).unwrap(); - } else { - response = await dispatch(PutBookingData(putdata)).unwrap(); - } + let response = await dispatch(PutBookingData(putdata)).unwrap(); let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter( (item) => item?.PaymentOptionType?.toLowerCase() === 'pc' ); - if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -2580,7 +2358,8 @@ const BSC1Payment = (props) => { item?.PaymentStatus === 'P' ); - if (PayatCounterfilter?.length === 1 || + if ( + PayatCounterfilter?.length === 1 || response?.data?.PaymentOrderDtl?.length === 0 ) { setMessageType('success'); @@ -2612,8 +2391,6 @@ const BSC1Payment = (props) => { if (PaymentGatewayfilter?.length === 1) { await PaymentGatewayFlow(PaymentGatewayfilter); } else { - setPrintOrderDetails([response?.data]); - ClearAllGlobalStateDatas(); console.log('more pg data'); } } else { @@ -3307,7 +3084,7 @@ const BSC1Payment = (props) => { }; // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0 && TotalAmount > 0) { + if (OrderCardDetail?.length > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3317,11 +3094,6 @@ const BSC1Payment = (props) => { setFailedOrderData(updatedData); setSplitpayment(true); } else { - if (TotalAmount <= 0) { - setMessageType('warning'); - setMessageData('Cannot split when total amount is zero or less'); - return; - } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3859,7 +3631,7 @@ const BSC1Payment = (props) => { : 1, }} > - {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( + {paybtns?.length > 0 ? ( paybtns?.map((payment) => (

    )) - ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( - refundPayBtns.map((payment) => ( -
    - -
    - )) ) : (
    { OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? - 'BSC1Payment-div4-button' - : 'BSC1Payment-div4-button' + ? !OrderStatus + ? 'BSC1Payment-div4-button' : 'BSC1Payment-div4-button Order' : 'BSC1Payment-div4-button-disable' } @@ -4510,7 +4242,7 @@ const BSC1Payment = (props) => { onClick={handleButtonClick} style={{ borderRadius: '6px 0 0 6px' }} > - {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : ( + {!OrderStatus ? ( <> {isMobile ? ( `₹ ${safeRound( @@ -4759,10 +4491,7 @@ const BSC1Payment = (props) => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - - ((OverAllSales > 0 ? OverAllSales : 0) + - (OverAllEstimate > 0 ? OverAllEstimate : 0) + - (Discount > 0 ? Discount : 0))) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) } failedOrderData={failedOrderData} /> @@ -4840,43 +4569,6 @@ const BSC1Payment = (props) => {
    } /> - setShowCancelConfirm(true)} - footer={false} - width={500} - children={ - <> - - - } - /> - {showCancelConfirm && ( - { - setBusinessUPI(false); - setShowCancelConfirm(false); - ClearAllGlobalStateDatas(); - CustomerDisplay(); - }} - onCancel={() => setShowCancelConfirm(false)} - okText="Yes" - cancelText="No" - > - Do you want to cancel the payment? - - )} ); }; diff --git a/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx b/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx index 541cc13..3172ee0 100644 --- a/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx +++ b/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx @@ -2432,9 +2432,7 @@ const BSItemCard = (props) => { const isItemInCartHold = CartOrderDetails?.find( (cartItem) => itemMatchCondition(cartItem) && - ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' - ? true - : cartItem?.OfferMode !== 'B') && + (cartItem?.OfferMode !== 'B' && cartItem?.OfferMode !== 'P' && cartItem?.OfferMode !== 'C' && cartItem?.OfferMode !== 'O' && cartItem?.OfferMode !== 'L' @@ -2463,9 +2461,7 @@ const BSItemCard = (props) => { (cartItem) => !( itemMatchCondition(cartItem) && - ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' - ? true - : cartItem?.OfferMode !== 'B') && + (cartItem?.OfferMode !== 'B' && cartItem?.OfferMode !== 'P' && cartItem?.OfferMode !== 'C' && cartItem?.OfferMode !== 'O' && cartItem?.OfferMode !== 'L' @@ -2869,6 +2865,7 @@ const BSItemCard = (props) => { OfferId: offer?.OfferId || '', OfferAmount: change?.discount || 0, OfferType: offer?.OfferType || '', // I / Q / B + OfferCode: PromoCodeOffersDatas?.OfferCode, ActualOfferAmount: offer?.OfferAmt || 0, OfferValue: offer?.OfferAmt || 0, TableName: change?.TableName || '', @@ -2876,7 +2873,7 @@ const BSItemCard = (props) => { TableUniqueId: change?.TableUniqueId || '', // OfferType: offer?.ValueType || "", // F / P Detail: offer?.Detail || [], - OfferCode: offer?.OfferCode || PromoCodeOffersDatas?.OfferCode || '', + OfferCode: offer?.OfferCode || '', CustId: offer?.CustId || '', UsedCount: offer?.UsedCount || 0, AppliesTo: offer?.AppliesTo || '', diff --git a/src/Pages/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.jsx b/src/Pages/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.jsx index ce5e6ca..a9c0d18 100644 --- a/src/Pages/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.jsx +++ b/src/Pages/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.jsx @@ -126,7 +126,7 @@ import { MdHome, MdLocationOn } from 'react-icons/md'; import { RadioGrpButton } from '../../../../Components/Forms/RadioGroup.jsx'; const FeaturesFunctionalities = (props) => { - const { closeModal = () => { } } = props; + const { closeModal = () => {} } = props; const applyOffer = useApplyOfferto_CardDetail(); const EditableContext = React.createContext(null); const EditableContext1 = React.createContext(null); @@ -367,30 +367,30 @@ const FeaturesFunctionalities = (props) => { const options = suggestions ? suggestions - ?.filter((item) => - selectedSearchValue === 'CustName' ? item.CustName !== null : item - ) - .map((item) => ({ - value: item?.CustMobile, - label: - selectedSearchValue === 'CustMobile' - ? `${item?.CustMobile} - ${item?.CustName ? item?.CustName : ''} ${item?.CustName ? ' - ' : ''} ${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}` - : selectedSearchValue === 'CustId' - ? `${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}${item?.CustName ? ' - ' : ''} ${item?.CustName ? item?.CustName : ''} - ${item?.CustMobile}` - : selectedSearchValue === 'CustName' && - item?.CustName !== null && - `${item?.CustName ? item?.CustName : ''} ${item?.CustName ? ' - ' : ''} ${item?.CustMobile} - ${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}`, - CustMobile: item?.CustMobile, - CustId: item?.CustId?.match(/-(\d+)$/)?.[1], - CustName: item?.CustName, - })) + ?.filter((item) => + selectedSearchValue === 'CustName' ? item.CustName !== null : item + ) + .map((item) => ({ + value: item?.CustMobile, + label: + selectedSearchValue === 'CustMobile' + ? `${item?.CustMobile} - ${item?.CustName ? item?.CustName : ''} ${item?.CustName ? ' - ' : ''} ${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}` + : selectedSearchValue === 'CustId' + ? `${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}${item?.CustName ? ' - ' : ''} ${item?.CustName ? item?.CustName : ''} - ${item?.CustMobile}` + : selectedSearchValue === 'CustName' && + item?.CustName !== null && + `${item?.CustName ? item?.CustName : ''} ${item?.CustName ? ' - ' : ''} ${item?.CustMobile} - ${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}`, + CustMobile: item?.CustMobile, + CustId: item?.CustId?.match(/-(\d+)$/)?.[1], + CustName: item?.CustName, + })) : GlobalAddCustomerDetails1?.map((item) => ({ - value: item.CustMobile, - label: `${item?.CustName} ${item?.CustMobile}`, - CustMobile: item?.CustMobile, - CustId: item?.CustId, - CustName: item?.CustName, - })); + value: item.CustMobile, + label: `${item?.CustName} ${item?.CustMobile}`, + CustMobile: item?.CustMobile, + CustId: item?.CustId, + CustName: item?.CustName, + })); const handleYesOrNoChange = (value) => { setSelectedValue(value); formRef.current?.setFieldsValue({ OfferActiveStatus: value }); @@ -453,34 +453,34 @@ const FeaturesFunctionalities = (props) => { }, ...(sportsAppPreference ? [ - { - title: 'Subcategory', - key: 'productDetails', - dataIndex: 'productDetails', - align: 'center', - width: '150px', - onCell: (record) => { - const productDetails = record?.productDetails; - const Combodtl = - record?.productDetails?.[0]?.comboDtl?.[0] - ?.ComboInwardDetails?.[0]?.ComboDetails; + { + title: 'Subcategory', + key: 'productDetails', + dataIndex: 'productDetails', + align: 'center', + width: '150px', + onCell: (record) => { + const productDetails = record?.productDetails; + const Combodtl = + record?.productDetails?.[0]?.comboDtl?.[0] + ?.ComboInwardDetails?.[0]?.ComboDetails; - return { - onClick: () => { - HoldPutfun(productDetails, record, Combodtl); - }, - }; + return { + onClick: () => { + HoldPutfun(productDetails, record, Combodtl); + }, + }; + }, + render: (productDetails, record) => ( + HoldPutfun(productDetails, record)} + > + {record?.productDetails?.[0]?.ProdSubCatName} + + ), }, - render: (productDetails, record) => ( - HoldPutfun(productDetails, record)} - > - {record?.productDetails?.[0]?.ProdSubCatName} - - ), - }, - ] + ] : []), { title: 'Orders', @@ -758,7 +758,7 @@ const FeaturesFunctionalities = (props) => { TaxAmt: formatAmount( ((record.Price * record.TaxPercentage) / (100 + record.TaxPercentage)) * - record.QTY + record.QTY ), TaxId: record.TaxId, TaxPercentage: record.TaxPercentage, @@ -785,11 +785,11 @@ const FeaturesFunctionalities = (props) => { const isDuplicate = TableName?.some( (item) => item.InwardDtlId + - ' ' + - item.BookingTypeName + - ' ' + - item.SinglePc === - selectedProduct && item.UniqueId === record.UniqueId + ' ' + + item.BookingTypeName + + ' ' + + item.SinglePc === + selectedProduct && item.UniqueId === record.UniqueId ); if (!isDuplicate) { @@ -807,7 +807,7 @@ const FeaturesFunctionalities = (props) => { TaxAmt: formatAmount( ((record.Price * record.TaxPercentage) / (100 + record.TaxPercentage)) * - record.QTY + record.QTY ), TaxId: record?.TaxId, TaxPercentage: record.TaxPercentage, @@ -1054,7 +1054,7 @@ const FeaturesFunctionalities = (props) => { ...record, ...values, }); - } catch (errInfo) { } + } catch (errInfo) {} }; let childNode = children; @@ -1106,7 +1106,7 @@ const FeaturesFunctionalities = (props) => { return ( record.Price * record.QTY - ((record.Price * record.TaxPercentage) / (100 + record.TaxPercentage)) * - record.QTY + record.QTY ); }; const WithTaxAmountTaxAmount = (record) => { @@ -1179,10 +1179,10 @@ const FeaturesFunctionalities = (props) => { onClick={() => addeddata(record)} disabled={ Object.keys(ReorderHoldDetails).length !== 0 && - BookingType === 'Dine In' && - GlobalExtraCharge.some( - (item) => item.ExtraChargeId === record.UniqueId - ) + BookingType === 'Dine In' && + GlobalExtraCharge.some( + (item) => item.ExtraChargeId === record.UniqueId + ) ? true : false } @@ -1278,7 +1278,7 @@ const FeaturesFunctionalities = (props) => { QTY: parseInt(row.QTY), TaxAmt: formatAmount( ((row.Price * row.TaxPercentage) / (100 + row.TaxPercentage)) * - row.QTY + row.QTY ), TotalAmt: row.Price * row.QTY, // ((row.Price * row.TaxPercentage) / (100 + row.TaxPercentage) *row.QTY ).toFixed(2), @@ -1427,12 +1427,12 @@ const FeaturesFunctionalities = (props) => { {Object.keys(ReorderHoldDetails).length !== 0 && - BookingType === 'Dine In' && - GlobalExtraCharge?.some( - (item) => - item.ExtraChargeId === record.UniqueId && - item.InwardDtlId === record.InwardDtlId - ) ? ( + BookingType === 'Dine In' && + GlobalExtraCharge?.some( + (item) => + item.ExtraChargeId === record.UniqueId && + item.InwardDtlId === record.InwardDtlId + ) ? ( { dispatch( changeCustomerID( response?.data?.CustomerDetails?.[ - response?.data?.CustomerDetails.length - 1 + response?.data?.CustomerDetails.length - 1 ] ) ); @@ -2186,9 +2186,9 @@ const FeaturesFunctionalities = (props) => { AppId: AppId, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; await dispatch(getSelectedFavItems(data)).unwrap(); @@ -2200,9 +2200,9 @@ const FeaturesFunctionalities = (props) => { ProdSubCat: ProdSubCat, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; @@ -2213,9 +2213,9 @@ const FeaturesFunctionalities = (props) => { prodCat: prodCat, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; @@ -2588,7 +2588,7 @@ const FeaturesFunctionalities = (props) => { e?.stopPropagation(); removeAll(); }} - // onClick={() => statusFormatter(record,index)} + // onClick={() => statusFormatter(record,index)} > Clear All @@ -2715,7 +2715,7 @@ const FeaturesFunctionalities = (props) => { : selectedSearchValue == 'CustName' ? 'Please Enter Valid Name' : selectedSearchValue == 'CustId' && - 'Please EnterCustomer Id', + 'Please EnterCustomer Id', }, ]} > @@ -2804,7 +2804,7 @@ const FeaturesFunctionalities = (props) => { : selectedSearchValue == 'CustName' ? 'Enter Name' : selectedSearchValue == 'CustId' && - 'Enter Customer Id' + 'Enter Customer Id' : ' Mobile Number'} } @@ -2986,7 +2986,7 @@ const FeaturesFunctionalities = (props) => { autocomplete="off" isOnChange={ formRef.current?.getFieldsValue()?.CustName || - inputValue + inputValue ? true : false } @@ -3052,9 +3052,9 @@ const FeaturesFunctionalities = (props) => {

    Upload Profile

    - // formType === 'edit' ? editstate?.EmpPhotoLink : e - // } + // getValueFromEvent={(e) => + // formType === 'edit' ? editstate?.EmpPhotoLink : e + // } > {
    -
    -
    +
    + + handleAddressTypeChange( + idx, + 'Delivery Address', + e.target.checked + ) + } > - - handleAddressTypeChange( - idx, - 'Delivery Address', - e.target.checked - ) - } - > - Delivery Address - - - handleAddressTypeChange( - idx, - 'Billing Address', - e.target.checked - ) - } - > - Billing Address - - - handleAddressTypeChange( - idx, - 'Both Address', - e.target.checked - ) - } - > - Both Address - -
    -
    - -
    -
    -
    - {addr?.Address1 || ''} -
    -
    - -
    -
    - {addr?.Address2 || ''} -
    -
    - -
    -
    - {addr?.Zip || ''} -
    -
    - -
    -
    - {addr?.City || ''} -
    -
    - -
    -
    - {addr?.Dist || ''} -
    -
    - -
    -
    - {addr?.State || ''} -
    -
    - - {addr?.Latitude && ( -
    -
    - {' '} - {addr?.Latitude || ''},{' '} - {addr?.Longitude || ''} -
    -
    - )} -
    -
    - - - handleRemoveAddress(idx)} - okText="Yes, Remove" - cancelText="Cancel" - okType="danger" + Billing Address + + + handleAddressTypeChange( + idx, + 'Both Address', + e.target.checked + ) + } > - - + Both Address +
    - )) + +
    +
    +
    + {addr?.Address1 || ''} +
    +
    + +
    +
    + {addr?.Address2 || ''} +
    +
    + +
    +
    + {addr?.Zip || ''} +
    +
    + +
    +
    + {addr?.City || ''} +
    +
    + +
    +
    + {addr?.Dist || ''} +
    +
    + +
    +
    + {addr?.State || ''} +
    +
    + + {addr?.Latitude && ( +
    +
    + {' '} + {addr?.Latitude || ''},{' '} + {addr?.Longitude || ''} +
    +
    + )} +
    +
    + + + handleRemoveAddress(idx)} + okText="Yes, Remove" + cancelText="Cancel" + okType="danger" + > + + +
    +
    + )) ) : (
    @@ -3484,7 +3484,7 @@ const FeaturesFunctionalities = (props) => { { style={ offerType == 'P' ? { - opacity: '1', - boxShadow: - 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', - margin: '3px', - padding: '5px', - backgroundColor: '#fff', - } + opacity: '1', + boxShadow: + 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', + margin: '3px', + padding: '5px', + backgroundColor: '#fff', + } : { opacity: '0.6', boxShadow: 'none' } } onClick={() => { @@ -3549,13 +3549,13 @@ const FeaturesFunctionalities = (props) => { style={ offerType == 'F' ? { - opacity: '1', - boxShadow: - 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', - margin: '3px', - padding: '5px', - backgroundColor: '#fff', - } + opacity: '1', + boxShadow: + 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', + margin: '3px', + padding: '5px', + backgroundColor: '#fff', + } : { opacity: '0.6', boxShadow: 'none' } } onClick={() => { @@ -3652,7 +3652,7 @@ const FeaturesFunctionalities = (props) => { } isOnChange={ formRef.current?.getFieldsValue()?.CustEmail || - inputValue + inputValue ? true : false } @@ -3680,7 +3680,7 @@ const FeaturesFunctionalities = (props) => { autocomplete="off" isOnChange={ formRef.current?.getFieldsValue()?.CreditLimit || - inputValue + inputValue ? true : false } @@ -4027,7 +4027,7 @@ const FeaturesFunctionalities = (props) => { buttonText="SAVE" color="901D77" icon={} - // handleSubmit={() => { globalamount1() }} + // handleSubmit={() => { globalamount1() }} />
    @@ -4041,7 +4041,7 @@ const FeaturesFunctionalities = (props) => { bordered dataSource={TableName} width={'120px'} - //pagination={column2?.length < "11" ? false : true} + //pagination={column2?.length < "11" ? false : true} >
    )} diff --git a/src/Pages/BookingScreen/Components/BookingFunctionality/SplitPayment.jsx b/src/Pages/BookingScreen/Components/BookingFunctionality/SplitPayment.jsx index a99cd9a..b1610d0 100644 --- a/src/Pages/BookingScreen/Components/BookingFunctionality/SplitPayment.jsx +++ b/src/Pages/BookingScreen/Components/BookingFunctionality/SplitPayment.jsx @@ -51,14 +51,7 @@ import { GlobalOverAllDiscSales, GlobalOverAllDiscEstimate, GlobaltipAmount, - GlobalRetailWSSalesType, - GlobalPreviousOrderPayment, - GlobalPreviousOrderOfferDetails, - GlobalSalesBillEdit, - putSalesBillEdit, - changeBillEditingMode, - changePreviousOrderPayment, - changePreviousOrderOfferDetail + GlobalRetailWSSalesType } from '../../../../Features/BookingScreen/BookingData/BookingData'; import { Form, Radio } from 'antd'; import { @@ -105,7 +98,6 @@ import { gettinghold } from '../../../../Features/BookingScreen/HoldOption/HoldO import { Global_OrderOfferDetail } from '../../../../Features/Offer/Offer.js'; import { useApplyOfferto_CardDetail } from '../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js'; -import { ChangeFullFreeProductList, changeFullOfferAppliedProducts, GlobalOfferAppliedProducts } from '../../../../Features/Offer/Offernew/BookingOffernew.js'; const subDirectory = import.meta.env.BASE_URL; const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL; @@ -122,7 +114,7 @@ const SplitPayment = (props) => { const applyOffer = useApplyOfferto_CardDetail(); const globalTipAmount = useSelector(GlobaltipAmount); - const TotalNetAmount = (props.hasOwnProperty('TotalNetAmount') + const TotalAmount = (props.hasOwnProperty('TotalNetAmount') ? props['TotalNetAmount'] : null); const TableOrderId = props.hasOwnProperty('TableBookingOrderId') @@ -136,23 +128,7 @@ const SplitPayment = (props) => { : null; const OrderCardDetail = useSelector(GlobalOrderCardDetails); const SelCustId = useSelector(GlobalSelCustId); - const salesBillEdit = useSelector(GlobalSalesBillEdit); - const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); - const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); - const filteredPayments = - previousOrderPayment?.filter( - p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment - ) || []; - const paymentsToUse = - filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; - const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( - (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), - 0 - ); - const totalPreviouspayment = paymentsToUse?.reduce( - (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), - 0 - ); + const [paybtns, setpaybtns] = useState([]); const [PaymentOptions, setPaymentOptions] = useState([]); const [PaymentUpiOptions, setPaymentUpiOptions] = useState([]); @@ -164,9 +140,6 @@ const SplitPayment = (props) => { const [SplitSelPayMode, setSplitSelPayMode] = useState({}); const [TotalSplitAmount, setTotalSplitAmount] = useState(0); const [SalesOrderId, setSalesOrderId] = useState(); - const [beforeAdjAmount, setBeforeAdjAmount] = useState(null); - const [afterAdjAmount, setAfterAdjAmount] = useState(null); - const [adjustmentType, setAdjustmentType] = useState(null); const [PaymentgatewayCard, setPaymentgatewayCard] = useState([]); const [PaymentDeviceCard, setPaymentDeviceCard] = useState([]); const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]); @@ -181,7 +154,7 @@ const SplitPayment = (props) => { const GlobProdwisedata = useSelector(GlobalSelProdWiseEst); const prodCat = useSelector(GlobalProductCategorie); const ProdSubCat = useSelector(GlobalProductSubCategorie); - const RetailWSSalesType = useSelector(GlobalRetailWSSalesType, shallowEqual); + const RetailWSSalesType= useSelector(GlobalRetailWSSalesType, shallowEqual); const selOption = useSelector(GlobalSelOption); const ReportholdData = useSelector(GlobalReorderHoldDetails); const GlobalExtraCharge = useSelector(globalExtraTotalAmount); @@ -204,7 +177,6 @@ const SplitPayment = (props) => { (i) => i.SettingIdName === 'AllProductindividualToken' )?.[0]; const OrderOfferDetail = useSelector(Global_OrderOfferDetail, shallowEqual); - const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts); const [SelectedBookingType, setSelectedBookingType] = useState(null); const [ConfigDataList, setConfigDataList] = useState([]); const [formattedDate, setFormattedDate] = useState(''); @@ -222,8 +194,6 @@ const SplitPayment = (props) => { const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some( (item) => item?.OptionName == 'Offer' ); - const [TotalAmount, setTotalAmount] = useState(0); - console.log(TotalAmount, "TotalSplitAmount", TotalSplitAmount) const preferenceOffer = SettingDataSelector?.[0]?.['SettingDtlDetails']?.find( (item) => item.SettingIdName === 'Offer' @@ -236,21 +206,6 @@ const SplitPayment = (props) => { getPaymentOptionFeature(); }, []); - useEffect(() => { - - if (salesBillEdit) { - const previousNetAmount = (totalPreviouspayment || 0); - if (TotalNetAmount > previousNetAmount) { - setTotalAmount(TotalNetAmount - previousNetAmount); - } else { - setTotalAmount(0); - } - } else { - setTotalAmount(TotalNetAmount); - } - - }, [totalPreviousOfferAmount, totalPreviouspayment, TotalNetAmount]) - useEffect(() => { if (SelCustId) { setpaybtns(PaymentOptions); @@ -272,11 +227,8 @@ const SplitPayment = (props) => { }, [Splitpayment]); useEffect(() => { const totalPayAmount = Object.keys(SplitSelPayMode) - .filter(key => key.startsWith('PayAmount-')) - .reduce((sum, key) => { - const value = parseInt(SplitSelPayMode[key], 10); - return sum + (isNaN(value) ? 0 : value); - }, 0); + .filter((key) => key.startsWith('PayAmount-')) // Filter keys that start with "PayAmount-" + .reduce((sum, key) => sum + parseInt(SplitSelPayMode[key]), 0); setTotalSplitAmount(totalPayAmount); }, [SplitSelPayMode]); useEffect(() => { @@ -570,7 +522,7 @@ const SplitPayment = (props) => { await Promise.all( PrintOrderDetails?.[0]?.OrderDetails?.map( async (orderDetail, index) => { - const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( + const groupedTokens = orderDetail?.productDetails?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -605,7 +557,7 @@ const SplitPayment = (props) => { ); } else { await Promise.all( - PrintOrderDetails?.[0]?.OrderDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.map( + PrintOrderDetails?.[0]?.OrderDetails?.map( async (orderDetail, index) => { await TokenPrint(`${index}-${orderDetail?.OrderId}`); } @@ -633,10 +585,6 @@ const SplitPayment = (props) => { 'Style 11': 'PrintStyle11', 'Style 12': 'PrintStyle12', 'Style 13': 'RePrint', - A4: 'PrintStyleA4', - A5: 'PrintStyleA5', - A4Standard: 'A4Standard', - TaxInvoice: 'TaxInvoice', }; const selectedStyle = @@ -650,7 +598,7 @@ const SplitPayment = (props) => { async (orderDetail, index) => { await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print if (orderDetail?.BookingTypeName !== 'Dine In') { - const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( + const groupedTokens = orderDetail?.productDetails?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -1033,11 +981,11 @@ const SplitPayment = (props) => { @@ -1292,12 +1240,7 @@ const SplitPayment = (props) => { } else { dispatch(changeOrderCardDetails([])); } - dispatch(changeBillEditingMode(false)); - await dispatch(changePreviousOrderPayment([])); - await dispatch(changePreviousOrderOfferDetail([])); await dispatch(ChangeTotalAmount([])); - dispatch(changeFullOfferAppliedProducts([])); - dispatch(ChangeFullFreeProductList([])); await dispatch(changeReorderHoldDetails({})); await dispatch(changeReorderProductDetails([])); await dispatch(ChangeNavHoldData(false)); @@ -1365,8 +1308,8 @@ const SplitPayment = (props) => { ? 'E' : GlobEstBooking === 'ParEst' ? GlobProdwisedata?.includes( - a.InwardDtlId + ' ' + a?.BookingTypeName - ) + a.InwardDtlId + ' ' + a?.BookingTypeName + ) ? 'E' : 'S' : 'S', @@ -1375,8 +1318,6 @@ const SplitPayment = (props) => { OfferValue: a?.Type === 'C' ? a?.OfferValue : a.Offer, OfferAmt: a?.Type === 'C' ? a?.TotalAmt : a.Offer, OfferType: a?.Type === 'C' ? a?.OfferType : '', - OfferMode: a?.OfferMode, - OfferMessage: a?.OfferMessage, CounterName: a?.TokenAvailable === 'Y' ? a?.CounterName : null, ProductIdentifierDtls: a.ProductIdentifierDtls, ModelNumber: a.ModelNumber, @@ -1385,9 +1326,9 @@ const SplitPayment = (props) => { const NotSlectedTypeFind = temporderdetail?.find( (a) => a?.BookingType != SelectedBookingType ); - let updatedOfferDetails = offerAppliedProducts; + let updatedOfferDetails = OrderOfferDetail; if (GlobEstBooking !== 'Sales') { - updatedOfferDetails = offerAppliedProducts?.filter( + updatedOfferDetails = OrderOfferDetail?.filter( (item) => !( item.TableName === 'LoyaltyPoints' && @@ -1398,7 +1339,7 @@ const SplitPayment = (props) => { } let temppostdata = { CompId: CompId, - SalesMode: RetailWSSalesType || 'R', + SalesMode:RetailWSSalesType || 'R', BranchId: BranchId, AppId: AppId, OrderDate: formattedDate, @@ -1472,37 +1413,37 @@ const SplitPayment = (props) => { : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' ? SplitSelPayMode[`CardSelection-${i}`] : SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'default' + 'default' ? 'PC' : SplitSelPayMode[`UPISelection-${i}`], ModeOfPayment: SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' ? PaymentUpiOptions?.find( - (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] - )?.UPIDetailId + (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] + )?.UPIDetailId : null, AccountDtl: SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( - (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] - ) + (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] + ) : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'pd') || - (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === - 'card' && - SplitSelPayMode[`CardSelection-${i}`]?.toLowerCase() === - 'pd') - ? useOptions?.[0]?.PaymentDetails?.PaymentDevice - : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === - 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'pg') || + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'pd') || (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' && SplitSelPayMode[`CardSelection-${i}`]?.toLowerCase() === - 'pg') + 'pd') + ? useOptions?.[0]?.PaymentDetails?.PaymentDevice + : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === + 'upi' && + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'pg') || + (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === + 'card' && + SplitSelPayMode[`CardSelection-${i}`]?.toLowerCase() === + 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], PaymentStatus: @@ -1511,9 +1452,9 @@ const SplitPayment = (props) => { : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'credit' ? 'S' : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === - 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'default' + 'upi' && + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'default' ? 'S' : 'P', Debit: 0, @@ -1527,7 +1468,7 @@ const SplitPayment = (props) => { }; let PostData = temppostdata; (i === 0 && SplitSelPayMode[`PaymentStatus-${i}`] === 'F') || - (i === 0 && props.hasOwnProperty('TableBookingOrderId')) + (i === 0 && props.hasOwnProperty('TableBookingOrderId')) ? PutSplitPayment(i) : i === 0 ? Object.keys(ReportholdData)?.length > 0 @@ -1576,14 +1517,14 @@ const SplitPayment = (props) => { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -1625,23 +1566,11 @@ const SplitPayment = (props) => { : ReportholdData?.OrderId; putdata['SalesId'] = ReportholdData?.SalesId; putdata['UpdatedBy'] = UserId; - let response = null; - if (salesBillEdit) { - response = await dispatch(putSalesBillEdit(putdata)).unwrap(); - } else { - response = await dispatch(PutBookingData(putdata)).unwrap(); - } + let response = await dispatch(PutBookingData(putdata)).unwrap(); if (response?.data?.statusCode == 1) { setSalesOrderId(response?.data?.OrderId); - const salesEditAmount = response?.data?.PaymentOrderDtl?.find(payment => - payment?.LastOrderTran === 'Y' && payment?.AdjustmentType && - payment?.AdjustmentType != null && payment?.AfterAdjustment && payment?.BeforeAdjustment && payment?.AfterAdjustment != null && payment?.BeforeAdjustment != null - ) - setBeforeAdjAmount(salesEditAmount?.BeforeAdjustment || null); - setAfterAdjAmount(salesEditAmount?.AfterAdjustment || null); - setAdjustmentType(salesEditAmount?.AdjustmentType || null); let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( (item) => item?.PaymentOptionType?.toLowerCase() === 'pd' && @@ -1677,14 +1606,14 @@ const SplitPayment = (props) => { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -1743,32 +1672,32 @@ const SplitPayment = (props) => { : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' ? SplitSelPayMode[`CardSelection-${i}`] : SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'default' + 'default' ? 'PC' : SplitSelPayMode[`UPISelection-${i}`], ModeOfPayment: SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' ? PaymentUpiOptions?.find( - (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] - )?.UPIDetailId + (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] + )?.UPIDetailId : null, AccountDtl: SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( - (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] - ) + (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] + ) : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd') || - (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd') + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd') || + (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' && + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd') ? useOptions?.[0]?.PaymentDetails?.PaymentDevice : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'pg') || - (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === - 'card' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pg') + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'pg') || + (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === + 'card' && + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], PaymentStatus: @@ -1777,8 +1706,8 @@ const SplitPayment = (props) => { : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'credit' ? 'S' : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'default' + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'default' ? 'S' : 'P', Debit: 0, @@ -1786,10 +1715,6 @@ const SplitPayment = (props) => { SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'credit' ? SplitSelPayMode[`PayAmount-${i}`] : 0, - BeforeAdjAmount: beforeAdjAmount || null, - AfterAdjAmount: afterAdjAmount || null, - AdjustmentType: adjustmentType || null, - }; let response = await dispatch( @@ -1836,14 +1761,14 @@ const SplitPayment = (props) => { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -1945,14 +1870,14 @@ const SplitPayment = (props) => { }); setMessageData( bookingpaymentupdate?.data?.response + - ' ' + - (bookingpaymentupdate?.data?.OrderDetails?.length > 0 - ? bookingpaymentupdate?.data?.OrderId && - extractLastNumberOrderId( - bookingpaymentupdate?.data?.OrderId, - bookingpaymentupdate?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (bookingpaymentupdate?.data?.OrderDetails?.length > 0 + ? bookingpaymentupdate?.data?.OrderId && + extractLastNumberOrderId( + bookingpaymentupdate?.data?.OrderId, + bookingpaymentupdate?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (bookingpaymentupdate?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([bookingpaymentupdate?.data]); @@ -1970,7 +1895,7 @@ const SplitPayment = (props) => { if ( Date.now() - startTime > useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes * - 60000 + 60000 ) { // 60,000 ms = 1 minute diff --git a/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx b/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx index db26e13..f1294f6 100644 --- a/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx +++ b/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx @@ -41,26 +41,7 @@ import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx'; import '../../../../../Styles/BookingScreen/Components/OtherConponents/Reprint/BSReprint.scss'; import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking.jsx'; import { - changeBillEditingMode, - changeEstimateBooking, - changeHoldOrderDtl, - changeOrderCardDetails, - changeOrderType, - ChangeOverAllDiscEstimate, - ChangeOverAllDiscSales, - changePreviousOrderOfferDetail, - changePreviousOrderPayment, - changeReorderHoldDetails, - changeReorderProductDetails, - ChangeSelectedCustDisable, - changeSelectedCustId, - changeSelectedOption, - changeSelProdWiseEst, - getAllCustomer, getConfigType, - getCustomerForHold, - GlobalSalesBillEdit, - GlobalSelectedCustDisable, PreferenceData, } from '../../../../../Features/BookingScreen/BookingData/BookingData.js'; import { DatePicker, Form } from 'antd'; @@ -82,15 +63,10 @@ import { import { TbSettingsCog } from 'react-icons/tb'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import { axiosRetailInstanceData } from '../../../../../Features/AuthenicationToken/AuthenticationToken.js'; -import { MdEdit } from "react-icons/md"; -import { v4 as uuidv4 } from 'uuid'; -import { changeOrderOfferDetail } from '../../../../../Features/Offer/Offer.js'; -import { ChangeFullFreeProductList, changeFullOfferAppliedProducts, changeLoyaltyConsumedQuantities } from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; -import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; const RetailApiurl = import.meta.env.ENV_API_URL; -function BSReprint({ setOpenModel = () => { } }) { +function BSReprint() { const dispatch = useDispatch(); const queryClient = useQueryClient(); const appPreferences = useSelector(ApplicationPreferences); @@ -124,31 +100,24 @@ function BSReprint({ setOpenModel = () => { } }) { const [page, setpage] = useState(1); const [itemsPerPage] = useState(10); const [DefReason, setDefReason] = useState({}); + console.log(DefReason, 'DefReason'); const SettingDataSelector = useSelector(PreferenceData); - const salesBillEdit = useSelector(GlobalSalesBillEdit); - const custDisable = useSelector(GlobalSelectedCustDisable); - console.log(SettingDataSelector, 'SettingDataSelector'); const MobileA4Print = SettingDataSelector?.[0]?.SettingDtlDetails?.find( (setting) => setting?.SettingIdName?.toLowerCase() === 'mobilea4' && setting?.SettingValue === 'Y' ); - const editBill = SettingDataSelector?.[0]?.SettingDtlDetails?.find( - (setting) => - setting?.SettingIdName?.toLowerCase() === 'editbill' && - setting?.SettingValue === 'Y' - ); const TokenOnly = SettingDataSelector?.[0]?.SettingDtlDetails?.filter( (i) => i.SettingIdName === 'TokenOnly' )?.[0]; const IndividualToken = SettingDataSelector?.[0]?.SettingDtlDetails?.filter( (i) => i.SettingIdName === 'AllProductindividualToken' )?.[0]; - const Weightasquantity = SettingDataSelector?.[0]?.SettingDtlDetails?.some( - (setting) => - setting?.SettingIdName?.toLowerCase() === 'weightasquantity' && - setting?.SettingValue === 'Y' - ); + const Weightasquantity = SettingDataSelector?.[0]?.SettingDtlDetails?.some( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'weightasquantity' && + setting?.SettingValue === 'Y' + ); const printDatas = useSelector(GlobalprintDatas); console.log(printDatas, 'GlobalprintDatas'); const PrinterDetails = useSelector(GlobalPrinterMappingDtls); @@ -591,7 +560,7 @@ function BSReprint({ setOpenModel = () => { } }) { const selectedStyle = stylesMap[ - printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle + printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle ]; if (selectedStyle) { if (data === 'without') { @@ -926,21 +895,6 @@ function BSReprint({ setOpenModel = () => { } }) { /> ), }, - // ...(editBill ? [ - { - title: 'Edit Bill', - key: 'EditBill', - dataIndex: 'EditBill', - align: 'center', - render: (text, row) => ( - await handleEditBill(e, row)} - /> - ), - } - // ] : []) - , { title: () => (
    { } }) { console.log(table2Data, 'table2Datadfnfjd'); const totalSalesQty = table2Data?.[0]?.productDetails?.reduce((acc, item) => { - const isWeightScale = item?.ScaleType === 'weight'; + const isWeightScale = item?.ScaleType === 'weight'; - if (isWeightScale) { - return acc + ( - Weightasquantity - ? Math.round(Number(item?.SalesQty || item?.OrderQty || 0)) - : 1 - ); - } + if (isWeightScale) { + return acc + ( + Weightasquantity + ? Math.round(Number(item?.SalesQty || item?.OrderQty || 0)) + : 1 + ); + } - return acc + Math.round(Number(item?.SalesQty || item?.OrderQty || 0)); - }, 0) + return acc + Math.round(Number(item?.SalesQty || item?.OrderQty|| 0)); + }, 0) const widthOutTexAmt = table2Data?.[0]?.TaxDetails?.reduce( (sum, item) => sum + (item?.WithOutTaxAmount || 0), 0 ); - const handleEditBill = async (e, orderDtls) => { - setOpenModel(e); - dispatch(changeBillEditingMode(true)); - const { - productDetails, - ExtraChargeDetails, - CustSuppId, - OrderOfferDetails, - RefDetails, - OrderId, - OrderType, - OverallDisc, - OrderPaymentDtl, - } = orderDtls; - const updated = productDetails?.map((item) => ({ - ...item, - Offer: item?.OfferAmt, - localId: uuidv4(), - OfferMode: item?.OfferMode ? item?.OfferMode?.trim() : null, - VariantAvailableFrom: item?.AvailableFrom || null, - VariantAvailableTo: item?.AvailableTo || null, - OrderQty: item?.SalesQty, - OrderRate: item?.Rate, - // TotalAmt: formatAmount((item.TotalAmt - item.OfferValue)), - })); - - if (RefDetails?.[0]?.FreeProdList) { - dispatch(ChangeFullFreeProductList(RefDetails[0]?.FreeProdList)); - } - - if (RefDetails?.[0]?.OfferAppliedProductList) { - dispatch( - changeFullOfferAppliedProducts( - RefDetails[0]?.OfferAppliedProductList - ) - ); - } - - - - if (CustSuppId) { - let res = await dispatch( - getCustomerForHold({ - CompId: CompId, - AppId: AppId, - branchId: BranchId, - OrderId: OrderId, - }) - ).unwrap(); - - if (res?.data?.statusCode !== 1) { - res = await dispatch( - getAllCustomer({ - CompId: CompId, - AppId: AppId, - branchId: BranchId, - }) - ).unwrap(); - } - - if (res?.data?.statusCode === 1) { - - const loyaltyFreeProductOfferApplied = (RefDetails?.[0]?.OfferAppliedProductList || [])?.filter( - (off) => - off?.FreeProductsList?.OfferMode === 'L' && - off?.TableUniqueName === 'FreeProduct' - ); - - const customerDetails = res?.data?.data?.find( - (item) => item.CustId === CustSuppId - ); - - if (customerDetails) { - const { CustId, CustName, CustMobile, LoyaltyPointsDetail, TotalLoyaltyPoints } = customerDetails; - const data = { - CustId: CustId, - CustName: CustName, - label: CustName ? CustName : CustMobile, - value: CustMobile, - LoyaltyPointsDetail: LoyaltyPointsDetail, - TotalLoyaltyPoints: TotalLoyaltyPoints - }; - - dispatch(changeOrderOfferDetail([...OrderOfferDetails])); - dispatch(changeSelectedOption(data)); - await dispatch(ChangeSelectedCustDisable(true)); - - if (loyaltyFreeProductOfferApplied?.length > 0) { - const loyaltyProdQuantities = {}; - - loyaltyFreeProductOfferApplied.forEach((off) => { - const freeProdDtls = off?.FreeProductsList; - const freeProdOfferId = - freeProdDtls?.ProdVariantDetails?.[0]?.StockDetails?.[0] - ?.ProdOfferId; - - const key = [ - freeProdDtls?.OfferId, - freeProdDtls?.FreeProdId, - freeProdDtls?.FreeProdVariantName, - freeProdOfferId, - ].join('|'); - - loyaltyProdQuantities[key] = freeProdDtls?.FreeQty || 0; - }); - - if (Object.keys(loyaltyProdQuantities).length > 0) { - dispatch(changeLoyaltyConsumedQuantities(loyaltyProdQuantities)); - } - - console.log(loyaltyProdQuantities, 'loyaltyProdQuantities'); - } - } - - } - } - await dispatch(changeOrderType('Hold')); - await dispatch(changeHoldOrderDtl(true)); - await dispatch(changeReorderHoldDetails(orderDtls)); - await dispatch(changeReorderProductDetails(updated)); - await dispatch(changeSelectedCustId(CustSuppId)); - await dispatch(ChangeTotalAmount(ExtraChargeDetails)); - await dispatch(changePreviousOrderPayment(OrderPaymentDtl)); - await dispatch(changePreviousOrderOfferDetail(OrderOfferDetails)); - dispatch(changeOrderCardDetails(updated)); - let temp = updated?.filter((item) => item.OrderType === 'E') - .map((item) => item.InwardDtlId + ' ' + item.BookingTypeName); - await dispatch(changeSelProdWiseEst(temp)); - - if (OrderType === 'E') { - await dispatch(changeEstimateBooking('OvrAllEst')); - await dispatch(ChangeOverAllDiscEstimate(parseFloat(OverallDisc))); - } else { - await dispatch(changeEstimateBooking('Sales')); - await dispatch(ChangeOverAllDiscSales(parseFloat(OverallDisc))); - } - } - return ( <>
    @@ -1479,7 +1295,7 @@ function BSReprint({ setOpenModel = () => { } }) { {countOfProduct > 10 && ( { carouselRef.current.goTo(index); } }; - const goToPrintSetup = () => { - navigate(`${subDirectory}saleslayouts/print-selection`); - }; + const goToPrintSetup = () => { + navigate(`${subDirectory}saleslayouts/print-selection`); +}; const getStyleNote = (value) => { if (!GlobaldummyData) return false; const isAnyTableOptionTrue = @@ -385,6 +385,7 @@ const PrintPreviewPage = (props) => { // (item) => item.StyleName === selectedStyleName // ); + // debugger // // Only one "Sales" style should have SetasDefault: "Y" // const updatedTemplates = SizeOptionData.map((item) => { // if ( @@ -400,7 +401,7 @@ const PrintPreviewPage = (props) => { // }); // console.log(updatedTemplates,'ngfjbknbfgjbgfjn'); - + // let TemplateDetails = updatedTemplates.map((item) => ({ // SizeId: null, @@ -450,79 +451,78 @@ const PrintPreviewPage = (props) => { // }; - const onfinish = async (values) => { - if (!SizeOptionData || SizeOptionData.length === 0) { - setMessageType('error'); - setMessageData('Please Setup the Screen'); - return; - } - - const selectedStyle = SizeOptionData.find( - (item) => item.StyleName === selectedStyleName - ); - - if (!selectedStyle) { - setMessageType('error'); - setMessageData('Selected style not found'); - return; - } - // Update all templates, ensuring only the selected style has SetasDefault: "Y" - const updatedTemplates = SizeOptionData.map((item) => { - return { - ...item, - SetasDefault: item.StyleName === selectedStyleName ? "Y" : "N", - }; - }); - - console.log(updatedTemplates, 'ngfjbknbfgjbgfjn'); - - let TemplateDetails = updatedTemplates.map((item) => ({ - SizeId: null, - StyleId: item.StyleId, - SetasDefault: item.SetasDefault, - SetasDefaultInvoice: item.SetasDefaultInvoice, - PrintTypeId: item?.PrintTypeId, - SizeDetails: item.OptionDetails.map((opt) => ({ - OptionId: opt.ConfigId, - })), - ...(item?.TermsandConditions?.length > 0 - ? { - PrintTermsandConditions: (item?.TermsandConditions - ? item?.TermsandConditions - : [] - )?.map((tc) => ({ - TermsandConditions: tc, - })), - } - : {}), - ...(item?.Notes ? { Notes: item.Notes } : {}), - ...(item?.PageSize ? { PageSize: item.PageSize } : {}), - ...(item?.PrintHdrName ? { PrintHdrName: item.PrintHdrName } : {}), - ...(item?.Signature ? { Signature: item?.Signature } : {}), - PrintType: item?.PrintType, - })); - - const Data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - TemplateDetails: TemplateDetails, - CreatedBy: UserId, - }; - - const response = await dispatch( - putPrintSelectionComponentData(Data) - ).unwrap(); - - if (response?.data?.statusCode === 1) { - dispatch(changeSelectedPrintdummyData(false)); - await GetPrintData(); - setMessageType('success'); - setMessageData(response?.data?.response); - if (onClose) onClose(); // Call the onClose callback after success - } - }; +const onfinish = async (values) => { + if (!SizeOptionData || SizeOptionData.length === 0) { + setMessageType('error'); + setMessageData('Please Setup the Screen'); + return; + } + const selectedStyle = SizeOptionData.find( + (item) => item.StyleName === selectedStyleName + ); + + if (!selectedStyle) { + setMessageType('error'); + setMessageData('Selected style not found'); + return; + } + // Update all templates, ensuring only the selected style has SetasDefault: "Y" + const updatedTemplates = SizeOptionData.map((item) => { + return { + ...item, + SetasDefault: item.StyleName === selectedStyleName ? "Y" : "N", + }; + }); + + console.log(updatedTemplates, 'ngfjbknbfgjbgfjn'); + + let TemplateDetails = updatedTemplates.map((item) => ({ + SizeId: null, + StyleId: item.StyleId, + SetasDefault: item.SetasDefault, + SetasDefaultInvoice: item.SetasDefaultInvoice, + PrintTypeId: item?.PrintTypeId, + SizeDetails: item.OptionDetails.map((opt) => ({ + OptionId: opt.ConfigId, + })), + ...(item?.TermsandConditions?.length > 0 + ? { + PrintTermsandConditions: (item?.TermsandConditions + ? item?.TermsandConditions + : [] + )?.map((tc) => ({ + TermsandConditions: tc, + })), + } + : {}), + ...(item?.Notes ? { Notes: item.Notes } : {}), + ...(item?.PageSize ? { PageSize: item.PageSize } : {}), + ...(item?.PrintHdrName ? { PrintHdrName: item.PrintHdrName } : {}), + ...(item?.Signature ? { Signature: item?.Signature } : {}), + PrintType: item?.PrintType, + })); + + const Data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + TemplateDetails: TemplateDetails, + CreatedBy: UserId, + }; + + const response = await dispatch( + putPrintSelectionComponentData(Data) + ).unwrap(); + + if (response?.data?.statusCode === 1) { + dispatch(changeSelectedPrintdummyData(false)); + await GetPrintData(); + setMessageType('success'); + setMessageData(response?.data?.response); + if (onClose) onClose(); // Call the onClose callback after success + } +}; return (
    {
    {style.component}
    - )) : ( -
    - Please set up Print form to view or change here. -
    - - Click here to go there - -
    - )} + )):( +
    + Please set up Print form to view or change here. +
    + + Click here to go there + +
    + )}
    diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSCreditCustomer.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSCreditCustomer.jsx index 29e64ad..695433f 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSCreditCustomer.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSCreditCustomer.jsx @@ -1752,6 +1752,7 @@ const BSCreditCustomer = (props) => { } onChange={(e) => { + // debugger const value = parseFloat(e?.target?.value) || 0; if (value <= SelectedBillData?.OrderPendingAmount) { HandleAmount(e?.target?.value); diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSNavbarSearchStandard.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSNavbarSearchStandard.jsx index 35671ac..531a853 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSNavbarSearchStandard.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSNavbarSearchStandard.jsx @@ -35,7 +35,7 @@ const BSNavbarSearchStandard = ({ inputRef }) => { const ProdName = useSelector(GlobalSearchData); const templateData = useSelector(getTemplateData); const appPreferences = useSelector(ApplicationPreferences); - console.log(ProdName, "ProdName") + const [preFocus, setPreFocus] = useState(false); const [screenWidth, setScreenWidth] = useState(window.innerWidth); const [check, setCheck] = useState(false); @@ -92,7 +92,7 @@ const BSNavbarSearchStandard = ({ inputRef }) => { if (debounceTimeoutRef.current) clearTimeout(debounceTimeoutRef.current); debounceTimeoutRef.current = setTimeout(async () => { - + const hasSearch = (Array?.isArray(ProdName) && ProdName?.length === 0 ? "" : ProdName)?.trim()?.length > 0; if (hasSearch) { diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx index e6ef940..876f7fe 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx @@ -30,7 +30,7 @@ const BSPrinterSetting = ({ IconComponent = PozoReprintIcon, ClassName = 'BSBillingNav-icon', drawerOpen = false, - setDrawerOpen = () => { }, + setDrawerOpen = () => {}, }) => { const CompId = getSession('CompId'); const BranchId = getSession('BranchId'); @@ -57,7 +57,7 @@ const BSPrinterSetting = ({ const [receiptReprintShow, setReceiptReprintShow] = useState(false); const SettingDataSelector = useSelector(PreferenceData); const [KioskPrintersetupShow, setKioskPrintersetupShow] = useState(false); - console.log(OpenModel, "OpenModel") + const dispatch = useDispatch(); const printmodelOpen = () => { setOpenModel(true); @@ -266,7 +266,7 @@ const BSPrinterSetting = ({ className="printer-settings-tabs" > - {reprintShow && } + {reprintShow && } {receiptReprintShow && } diff --git a/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx b/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx index 67c12c8..73fe486 100644 --- a/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx @@ -137,18 +137,6 @@ const PrintA4Style11 = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); - const isEditedBill = PaymentStatus?.some(payment => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ) - const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, 0 @@ -558,7 +546,7 @@ const PrintA4Style11 = ({ textAlign: 'center', }} > - {WeightasKg ? 'Qty/Kg' : 'Qty'} + { WeightasKg ?'Qty/Kg' :'Qty'} )} {GlobaldummyData @@ -944,46 +932,6 @@ const PrintA4Style11 = ({
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {GlobaldummyData ? GlobalCredit && (
    - {WeightasKg ? 'Qty/Kg' : 'Qty'} + { WeightasKg ?'Qty/Kg' :'Qty'} )} {GlobaldummyData @@ -1924,46 +1872,6 @@ const PrintA4Style11 = ({
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {GlobaldummyData ? GlobalCredit && (
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2516,46 +2424,6 @@ const PrintA4Style11 = ({
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {GlobaldummyData ? GlobalCredit && (
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {GlobaldummyData ? GlobalCredit && (
    ps.PaymentStatus === 'S' ); - const isEditedBill = PaymentStatus?.some(payment => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ) const PackageDetails = table2Data?.PackageDtl; const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, @@ -559,7 +548,7 @@ const PrintA5Style11 = ({ textAlign: 'center', }} > - {WeightasKg ? 'Qty/Kg' : 'Qty'} + { WeightasKg ?'Qty/Kg' :'Qty'} )} {GlobaldummyData @@ -947,46 +936,6 @@ const PrintA5Style11 = ({
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {GlobaldummyData ? GlobalCredit && (
    - {WeightasKg ? 'Qty/Kg' : 'Qty'} + { WeightasKg ?'Qty/Kg' :'Qty'} )} {GlobaldummyData @@ -1927,46 +1876,6 @@ const PrintA5Style11 = ({
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {GlobaldummyData ? GlobalCredit && (
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2519,86 +2428,6 @@ const PrintA5Style11 = ({
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {GlobaldummyData ? GlobalCredit && (
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {GlobaldummyData ? GlobalCredit && (
    { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ) if (keysLength > 0) { dispatch(changeReprintDataFound(true)); @@ -389,8 +378,8 @@ const PrintStyle1 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: FormatTheme @@ -456,24 +445,24 @@ const PrintStyle1 = ({ {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 + : '')}
    - {(GlobaldummyData || table2Data?.BrMobile) &&
    +
    {' '} Mobile : +91{' '} {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} -
    } +
    {table2Data?.OrderType === 'E' && (
    @@ -643,80 +632,80 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO == true && ( - S.No - )} + S.No + )} {GlobaldummyData ? GlobalItem && Item : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - MRP - ) + MRP + ) : MRP == true && ( - MRP - )} + MRP + )} {GlobaldummyData ? GlobalRate && ( - Rate - ) + Rate + ) : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && ( - Tax % - ) + Tax % + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -724,175 +713,176 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - )} - {sportsAppPreference && - `${item?.BookingDate?.trim() - ? `(${dateFormatChange(item.BookingDate)})` - : '' - } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} -  {' '} - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} ) - )?.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(',')} -
    - ); - }) - : ''} - - )} +
    + )} + {sportsAppPreference && + `${ + item?.BookingDate?.trim() + ? `(${dateFormatChange(item.BookingDate)})` + : '' + } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} +  {' '} + {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(',')} +
    + ); + }) + : ''} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {' '} - {item?.Rate} - - )} + + {' '} + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage || 0} - - ) + + {item?.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ))} @@ -921,80 +911,80 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO == true && ( - S.No - )} + S.No + )} {GlobaldummyData ? GlobalItem && Item : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - MRP - ) + MRP + ) : MRP == true && ( - MRP - )} + MRP + )} {GlobaldummyData ? GlobalRate && ( - Rate - ) + Rate + ) : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && ( - Tax % - ) + Tax % + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -1002,124 +992,125 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - {sportsAppPreference && - `${item?.BookingDate?.trim() - ? `(${dateFormatChange(item.BookingDate)})` - : '' - } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + {sportsAppPreference && + `${ + item?.BookingDate?.trim() + ? `(${dateFormatChange(item.BookingDate)})` + : '' + } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {' '} - {item?.Rate} - - )} + + {' '} + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage} - - ) + + {item.ProdTaxPercentage} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ))} @@ -1173,21 +1164,21 @@ const PrintStyle1 = ({ {(TotalOfferAmount > 0 || table2Data?.OverallDisc > 0) && ( -

    - Off : - {( - Number(TotalOfferAmount || 0) + - Number(table2Data?.OverallDisc || 0) - ).toFixed(2)} -

    - )} +

    + Off : + {( + Number(TotalOfferAmount || 0) + + Number(table2Data?.OverallDisc || 0) + ).toFixed(2)} +

    + )}
    )} - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -1231,46 +1222,6 @@ const PrintStyle1 = ({ ))} )} - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {table2Data?.OrderType === 'E' ? ( '' ) : ( @@ -1578,103 +1529,103 @@ const PrintStyle1 = ({
    {table2Data?.SalesTableLinkDetails?.[0] ?.WaiterName && ( -
    - Captain:{' '} - { - table2Data?.SalesTableLinkDetails?.[0] - ?.WaiterName - } -
    - )} +
    + Captain:{' '} + { + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName + } +
    + )}
    )} {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} + +

    + )); + })()} +
    + )}
    - {/* QRcode */} - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && (
    + {/* QRcode */} -
    - Scan to Pay{' '} -
    -
    +
    Scan to Pay
    +
    ₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    @@ -1787,30 +1738,30 @@ const PrintStyle1 = ({ > {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    - -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Notestext && (
    -

    - {Notestext} +

    + Notes : 10 days Return policy


    - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. -
    -
    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : TermsnAdCondition == true && - TermsAndConditions?.length > 0 && (

    - {TermsAndConditions?.map((item) => ( -

  • - {item?.TermsandConditions} -
  • - ))} - {/*
  • Please check the product before leaving the counter.
  • */} +
  • + Once goods are sold, they are not + exchangeable or refundable. +
  • +
  • + Please check the product before leaving the + counter. +
  • - )} + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : 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 -

    - -
    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : Signature == true && (
    @@ -1956,12 +1874,45 @@ const PrintStyle1 = ({ Signature

    - )} + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    {PrintGreeting?.SettingValue === 'Y' && (
    )} - {(PaymentStatusSuccess?.length > 1 && !isEditedBill)( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2094,46 +2045,6 @@ const PrintStyle1 = ({ ))} )} - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {table2Data?.OrderType === 'E' ? ( '' ) : ( @@ -2452,81 +2363,81 @@ const PrintStyle1 = ({ )} {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} + +

    + )); + })()} +
    + )}
    - {/* QRcode */} - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && (
    + {/* QRcode */} -
    Scan to Pay
    -
    +
    Scan to Pay
    +
    ₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    @@ -2638,30 +2549,30 @@ const PrintStyle1 = ({ > {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    - -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Notestext && (
    -

    - {Notestext} +

    + Notes : 10 days Return policy


    - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : TermsnAdCondition == true && - TermsAndConditions?.length > 0 && (

    - {TermsAndConditions?.map((item) => ( -

  • - {item?.TermsandConditions} -
  • - ))} - {/*
  • Please check the product before leaving the counter.
  • */} +
  • + Once goods are sold, they are not exchangeable + or refundable. +
  • +
  • + Please check the product before leaving the + counter. +
  • - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 -

    - -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && (
    @@ -2805,12 +2684,44 @@ const PrintStyle1 = ({ Signature

    - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    {PrintGreeting?.SettingValue === 'Y' && (
    )} - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2922,46 +2833,6 @@ const PrintStyle1 = ({ ))} )} - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {table2Data?.OrderType === 'E' ? ( '' ) : ( @@ -3278,79 +3149,79 @@ const PrintStyle1 = ({ {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} + +

    + )); + })()} +
    + )}
    - {/* QRcode */} - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && (
    + {/* QRcode */} -
    Scan to Pay
    -
    +
    Scan to Pay
    +
    ₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    @@ -3461,35 +3332,35 @@ const PrintStyle1 = ({ > {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    - -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Notestext && (

    - {Notestext} + Notes : 10 days Return policy


    - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : TermsnAdCondition == true && - TermsAndConditions?.length > 0 && (

    - {TermsAndConditions?.map((item) => ( -

  • - {item?.TermsandConditions} -
  • - ))} - {/*
  • Please check the product before leaving the counter.
  • */} +
  • + Once goods are sold, they are not exchangeable or + refundable. +
  • +
  • + Please check the product before leaving the + counter. +
  • - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 -

    - -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && (
    @@ -3633,12 +3472,44 @@ const PrintStyle1 = ({ Signature

    - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    {PrintGreeting?.SettingValue === 'Y' && (
    )} -
    +
    ) : (
    - {(GlobaldummyData || table2Data?.BrMobile) &&
    +
    {' '} Mobile : +91{' '} {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} -
    } +
    {table2Data?.OrderType === 'E' && (
    @@ -3867,61 +3738,61 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && S.No : SLNO == true && ( - S.No - )} + S.No + )} {GlobaldummyData ? GlobalItem && ( - Item - ) + Item + ) : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && MRP : MRP == true && MRP} {GlobaldummyData ? GlobalRate && Rate : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && Tax % : Tax == true && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -3930,174 +3801,175 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - )} - {sportsAppPreference && - `${item?.BookingDate?.trim() - ? `(${dateFormatChange(item.BookingDate)})` - : '' - } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} -  {' '} - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} ) - )?.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(',')} -
    - ); - }) - : ''} - - )} +
    + )} + {sportsAppPreference && + `${ + item?.BookingDate?.trim() + ? `(${dateFormatChange(item.BookingDate)})` + : '' + } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} +  {' '} + {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(',')} +
    + ); + }) + : ''} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {' '} - {item?.Rate} - - )} + + {' '} + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ) )} @@ -4128,59 +4000,59 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && S.No : SLNO == true && ( - S.No - )} + S.No + )} {GlobaldummyData ? GlobalItem && Item : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && MRP : MRP == true && MRP} {GlobaldummyData ? GlobalRate && Rate : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && Tax % : Tax == true && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -4189,123 +4061,124 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - {sportsAppPreference && - `${item?.BookingDate?.trim() - ? `(${dateFormatChange(item.BookingDate)})` - : '' - } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + {sportsAppPreference && + `${ + item?.BookingDate?.trim() + ? `(${dateFormatChange(item.BookingDate)})` + : '' + } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {' '} - {item?.Rate} - - )} + + {' '} + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ) )} @@ -4393,7 +4266,7 @@ const PrintStyle1 = ({ )} )} - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4406,46 +4279,6 @@ const PrintStyle1 = ({ ))} )} - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {table2Data?.OrderType === 'E' ? ( '' ) : ( @@ -4753,76 +4586,76 @@ const PrintStyle1 = ({ )} {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} +

    + )); + })()} +
    + )}
    - {/* QRcode */} - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && (
    + {/* QRcode */} -
    Scan to Pay
    -
    +
    Scan to Pay
    +
    ₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    @@ -4925,28 +4758,28 @@ const PrintStyle1 = ({ > {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    - -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Notestext && (
    -

    {Notestext}

    +

    + Notes : 10 days Return policy +


    - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : TermsnAdCondition == true && - TermsAndConditions?.length > 0 && (

    - {TermsAndConditions?.map((item) => ( -

  • - {item?.TermsandConditions} -
  • - ))} - {/*
  • Please check the product before leaving the counter.
  • */} +
  • + Once goods are sold, they are not exchangeable or + refundable. +
  • +
  • + Please check the product before leaving the counter. +
  • - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 -

    - -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && (
    @@ -5089,12 +4890,44 @@ const PrintStyle1 = ({ Signature

    - )} + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx index 424951b..79de332 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx @@ -122,18 +122,6 @@ const PrintStyle10 = ({ (ps) => ps.PaymentTypeName === 'UPI' ); - const isEditedBill = PaymentStatus?.some((payment) => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ); - let TermsAndConditions = printDatas?.TermsandConditions; let SignatureImg = printDatas?.Signature; let Notestext = printDatas?.Notes; @@ -541,7 +529,7 @@ const PrintStyle10 = ({ - {WeightasKg ? 'Qty/Kg' : 'Qty'} + { WeightasKg ?'Qty/Kg' :'Qty'} )} {GlobaldummyData @@ -916,7 +904,7 @@ const PrintStyle10 = ({ - {WeightasKg ? 'Qty/Kg' : 'Qty'} + { WeightasKg ?'Qty/Kg' :'Qty'} )} {GlobaldummyData @@ -1658,7 +1646,7 @@ const PrintStyle10 = ({ table2Data?.FYStatus )}{' '}
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1805,77 +1793,6 @@ const PrintStyle10 = ({ )}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed( - 2 - )} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' - ? '-' - : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed( - 2 - )} - -
    -
    -
    - )} -
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -2754,75 +2671,6 @@ const PrintStyle10 = ({ )}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed( - 2 - )} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' - ? '-' - : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} - -
    -
    -
    - )} -
    - {WeightasKg ? 'Qty/Kg' : 'Qty'} + { WeightasKg ?'Qty/Kg' :'Qty'} )} {GlobaldummyData @@ -3508,7 +3356,7 @@ const PrintStyle10 = ({ ) : Quantity && ( - {WeightasKg ? 'Qty/Kg' : 'Qty'} + { WeightasKg ?'Qty/Kg' :'Qty'} )} {GlobaldummyData @@ -4187,7 +4035,7 @@ const PrintStyle10 = ({ table2Data?.FYStatus )}{' '}
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4305,71 +4153,6 @@ const PrintStyle10 = ({ )}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} - -
    -
    -
    - )} -
    { + +const PrintStyle11 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, totalQuantityFilter, BranchCity, BranchZip, CashierName, totalQuantity, + OrderDetailGST, OrderDetailIGST, OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, printDatas, isPdf, SalesModePref, sportsAppPreference, + MembershipApplied = null }) => { + const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint); + const GlobalUpiID = useSelector(GlobalUpiIDprint) const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.['Sl.No']; - const Item = FieldDetails?.['Item']; - const MRP = FieldDetails?.['MRP']; - const Discount = FieldDetails?.['Discount']; - const Tax = FieldDetails?.['Tax']; - const Quantity = FieldDetails?.['Quantity']; - const Rate = FieldDetails?.['Rate']; - const Amount = FieldDetails?.['Amount']; - const HsnCode = FieldDetails?.['HsnCode']; - const Qrcodet = FieldDetails?.['Qrcode']; - const CashierNameField = FieldDetails?.['CashierName']; - const LogoField = FieldDetails?.['Logo']; - const CreditDetails = FieldDetails?.['Credit details']; + const SLNO = FieldDetails?.["Sl.No"]; + const Item = FieldDetails?.["Item"]; + const MRP = FieldDetails?.["MRP"]; + const Discount = FieldDetails?.["Discount"]; + const Tax = FieldDetails?.["Tax"]; + const Quantity = FieldDetails?.["Quantity"]; + const Rate = FieldDetails?.["Rate"]; + const Amount = FieldDetails?.["Amount"]; + const HsnCode = FieldDetails?.["HsnCode"]; + const Qrcodet = FieldDetails?.["Qrcode"]; + const CashierNameField = FieldDetails?.["CashierName"]; + const LogoField = FieldDetails?.["Logo"]; + const CreditDetails = FieldDetails?.["Credit details"]; const WeightasKg = FieldDetails?.['Weight']; - const GlobalSlNo = useSelector(GlobalprintSlNo); - const GlobalItem = useSelector(GlobalprintItem); - const GlobalMRP = useSelector(GlobalprintMRP); - const GlobalDiscount = useSelector(GlobalprintDiscount); - const GlobalTax = useSelector(GlobalprintTax); - 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 GlobalSlNo = useSelector(GlobalprintSlNo) + const GlobalItem = useSelector(GlobalprintItem) + const GlobalMRP = useSelector(GlobalprintMRP) + const GlobalDiscount = useSelector(GlobalprintDiscount) + const GlobalTax = useSelector(GlobalprintTax) + 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); + const GlobalthemeFormatr = useSelector(GlobalthemeFormat) + const GlobalBilltext = useSelector(GlobalBillName) const appPreferences = useSelector(ApplicationPreferences); const SettingData = useSelector(PreferenceData); const GlobalCashierName = useSelector(GlobalprintCashierName); const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); - const estimatePrintHeader = - SettingData?.[0]?.SettingDtlDetails?.find( - (setting) => - setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' - )?.SettingValue === 'Y'; - const bookingTypePreference = appPreferences?.find( - (preference) => preference?.PreferredCatName === 'Booking Type' - )?.PreferenceCatDetails; - const dinePreference = bookingTypePreference?.find( - (type) => - type?.PreferredSubCatName?.toLowerCase() === 'dine in' && - type?.PreferredStatus === 'Y' - ); - const takeAwayPreference = bookingTypePreference?.find( - (type) => - type?.PreferredSubCatName?.toLowerCase() === 'take away' && - type?.PreferredStatus === 'Y' - ); - const paymentTypeUPI = PaymentStatus?.find( - (ps) => ps.PaymentTypeName === 'UPI' - ); + const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' + const bookingTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Booking Type')?.PreferenceCatDetails + const dinePreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "dine in" && type?.PreferredStatus === 'Y') + const takeAwayPreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "take away" && type?.PreferredStatus === 'Y') + const paymentTypeUPI = PaymentStatus?.find((ps) => ps.PaymentTypeName === "UPI") - const isEditedBill = PaymentStatus?.some((payment) => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ); - - let TermsAndConditions = printDatas?.TermsandConditions; - let SignatureImg = printDatas?.Signature; - let Notestext = printDatas?.Notes; - let BillName = printDatas?.PrintHdrName; - let FormatTheme = printDatas?.PrintType == 'S' ? true : false; - let PageSize = printDatas?.PageSize; - const Signature = FieldDetails?.['signature']; - const TermsnAdCondition = FieldDetails?.['terms&conditions']; + let TermsAndConditions = printDatas?.TermsandConditions + let SignatureImg = printDatas?.Signature + let Notestext = printDatas?.Notes + let BillName = printDatas?.PrintHdrName + let FormatTheme = printDatas?.PrintType == "S" ? true : false + let PageSize = printDatas?.PageSize + const Signature = FieldDetails?.["signature"]; + const TermsnAdCondition = FieldDetails?.["terms&conditions"]; const PackageDetails = table2Data?.PackageDtl; const keysLength = Object.keys(table2Data ?? {}).length; - let PaymentStatusSuccess = PaymentStatus?.filter( - (ps) => ps.PaymentStatus === 'S' - ); + let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } - const TakeawayData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' - ); - const DineInData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === 'dine in' - ); + const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") + const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0 + 0, ); const DineInTotal = DineInData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0 + 0, ); - const aggregatedPayments = PaymentStatusSuccess?.reduce( - (acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); + const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { + const paymentType = paymentdata?.PaymentTypeName; + const amount = Number(paymentdata?.Amount); - if (acc[paymentType]) { - acc[paymentType] += amount; - } else { - acc[paymentType] = amount; - } + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } - return acc; - }, - {} - ); + return acc; + }, {}); const productsData = table2Data?.productDetails || []; const offers = table2Data?.OrderOfferDetails || []; 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.0, - SalesQty: 2, - MRP: 100, - TotalAmt: 176, - discount: 0, - HSN: '01', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 5, - }, - { - ProdName: 'ITEM 2', - Rate: 300.0, - SalesQty: 1, - MRP: 350, - TotalAmt: 300, - discount: 0, - HSN: '02', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 5, - }, - { - ProdName: 'ITEM 3', - Rate: 200.0, - SalesQty: 1, - MRP: 250, - TotalAmt: 200, - discount: 0, - HSN: '03', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 0, - }, - { - ProdName: 'ITEM 4', - Rate: 30.0, - SalesQty: 1, - MRP: 50, - TotalAmt: 30, - discount: 0, - HSN: '04', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 18, - }, - { - ProdName: 'ITEM 5', - Rate: 30.0, - SalesQty: 1, - MRP: 50, - TotalAmt: 30, - discount: 0, - HSN: '05', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 40, - }, - { - ProdName: 'ITEM 6', - Rate: 130.0, - SalesQty: 1, - MRP: 150, - TotalAmt: 130, - discount: 0, - HSN: '06', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 0, - }, - { - ProdName: 'ITEM 7', - Rate: 230.0, - SalesQty: 1, - MRP: 250, - TotalAmt: 230, - discount: 0, - HSN: '08', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 5, - }, + { ProdName: 'ITEM 1', Rate: 88.00, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, + { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, + { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, + { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, + { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, ]; - const chunkSize = PageSize == 'A5' ? 8 : 11; + const chunkSize = PageSize == "A5" ? 8 : 11; let dataSource = []; if (GlobaldummyData || TakeawayData?.length > 0) { @@ -318,4212 +172,1313 @@ const PrintStyle11 = ({ 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); return ( <> - {FormatTheme ? ( -
    {paginatedChunks.map((dataChunk, chunkIndex) => (
    0 ? ' print-page-break' : ''}` - } - style={{ - display: 'flex', - flexDirection: 'column', - justifyContent: - chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme - ? 'space-between' - : '', - height: isMobile - ? '295mm' - : FormatTheme - ? PageSize == 'A5' - ? '170mm' - : '257mm' - : '', - }} - key={chunkIndex} - > + className={isMobile ? `invoice-wrapper container pdf-page` : `invoice-wrapper container print-chunk${chunkIndex > 0 ? ' print-page-break' : ''}`} + style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: isMobile ? "295mm" : FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> + + {/*
    */} -
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    -
    - {GlobalLogo && GlobaldummyData ? ( - image - ) : null} - {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( - image - ) : null} -
    -
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    - {/*
    +
    + {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    +
    + {(GlobalLogo && GlobaldummyData) ? image : null} + {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} +
    +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    + {/*
    Save green | Save nature
    */} -
    -
    -
    -
    -
    - {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 - : '')} -
    -
    - {' '} - MOBILE NO :{table2Data?.BrMobile} -
    -
    -
    -
    - {GlobaldummyData - ? 'CASH' - : BillName - ? BillName - : PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : ''}{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`} -
    -
    - Bill No :{' '} - {GlobaldummyData - ? '553' - : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )}
    - )} - {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( -
    - Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`} +
    +
    +
    + {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 : '')} +
    +
    MOBILE NO :{table2Data?.BrMobile}
    - )} +
    +
    {GlobaldummyData ? 'CASH' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""} {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`}
    +
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    +
    )} + {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`}
    }
    -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && ( + +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && <> - {takeAwayPreference && ( -
    - Take Away -
    - )} + {takeAwayPreference &&
    Take Away
    } - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO && } - {GlobaldummyData - ? GlobalItem && ( - - ) - : Item && } - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalAmount && : Amount && } {dataChunk?.map((item, index) => { return ( - {GlobaldummyData - ? GlobalSlNo && - : SLNO && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalAmount && : Amount && } - ); + ) })}
    S.NS.NItemItem - Qty - - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - HSN - - HSN - - MRP - - MRP - - Dis{' '} - - Dis{' '} - - Tax %{' '} - - Tax %{' '} - - Rate - - Rate - - Amt - - Amt - S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmt
    {index + 1} - {chunkIndex * chunkSize + index + 1} - {item?.ProdName} -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > - 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {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?.SalesQty} - - {item?.SalesQty} - - {item?.HSN} - - {item?.HSN} - - {item?.MRP} - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - {item.discount} - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - {item.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.Rate} - - {item?.Rate} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || - 0} - {index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} +
    {item?.ProdName}
    + {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? +
    + {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( + + {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  + {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) + ?.map(a => { return (
    {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?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    - )} - {DineInData?.length > 0 && dinePreference && ( + } + {(DineInData?.length > 0 && dinePreference) && <> -
    - Dine In -
    +
    Dine In
    - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO && } - {GlobaldummyData - ? GlobalItem && ( - - ) - : Item && } - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalAmount && : Amount && } {dataChunk?.map((item, index) => { return ( - {GlobaldummyData - ? GlobalSlNo && - : SLNO && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalAmount && : Amount && } - ); + ) })}
    S.NS.NItemItem - Qty - - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - HSN - - HSN - - MRP - - MRP - - Dis{' '} - - Dis{' '} - - Tax %{' '} - - Tax %{' '} - - Rate - - Rate - - Amt - - Amt - S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmt
    {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?.SalesQty} - - {item?.SalesQty} - - {item?.HSN} - - {item?.HSN} - - {item?.MRP} - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - {item.discount} - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - {item.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.Rate} - - {item?.Rate} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || - 0} - {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?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    - )} + }
    - {chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme && ( - <> -
    -
    -
    -
    -
    -
    - Qty -
    -
    - Items -
    - {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
    - Off -
    - )} - {/*
    SUB TOTAL
    -
    ROUND OFF
    */} -
    -
    -
    {GlobaldummyData ? '9' : totalQuantity}
    -
    - {GlobaldummyData - ? '8' - : totalQuantityFilter?.length} -
    - {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
    - {GlobaldummyData - ? '8' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} -
    - )} - {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} - {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */} -
    -
    - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - takeAwayPreference && ( -
    - TakeAway :{Number(TakeawayTotal).toFixed(2)}/- -
    - )} - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - dinePreference && ( -
    - DineIn :{Number(DineInTotal).toFixed(2)}/- -
    - )} -
    - Amount : - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} - /- -
    -
    -
    - -
    - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    -
    -
    -
    - {((OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0)) && - table2Data?.NetAmount !== 0 && ( - <> -
    -
    -

    - --------- GST Breakup Details - ----------- -

    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - - - - - - - - - {OrderDetailGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number( - item.TotalAmt - ).toFixed(2)} -
    - )} - - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailIGST?.map((item) => ( - - - - - - - ))} -
    - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number( - item.TaxAmt - ).toFixed(2)} - - {Number( - item.TotalAmt - ).toFixed(2)} -
    - - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - - {OrderDetailVAT?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number( - item.TaxAmt - ).toFixed(2)} - - {Number( - item.TotalAmt - ).toFixed(2)} -
    - - )} -
    -
    - - )} -
    -
    -
    -
    - )} -
    -
    - {PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : 'Split'}{' '} -  Payment :   - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} - /-{' '} -
    -
    - {GlobaldummyData - ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < - 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs( - table2Data.CustomerDetails[0].OldCreditBal - )} -

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > - 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} - -
    -
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map( - (paymentType) => ( -
    - {paymentType}:{' '} - {aggregatedPayments[paymentType].toFixed(2)} -
    - ) - )} - - )} - - {GlobaldummyData && GlobalCashierName && ( -
    - {' '} - Cashier : Cashier Name -
    - )} - {CashierName && - CashierName !== undefined && - CashierName !== null && - !GlobaldummyData && - CashierNameField && ( -
    - Cashier : {CashierName} -
    - )} - - {GlobaldummyData && ( -
    - {' '} - Customer : Customer Name -
    - )} - {table2Data?.CustSuppName && - table2Data?.CustSuppName !== undefined && - table2Data?.CustSuppName !== null && - !GlobaldummyData && ( -
    - Customer : {table2Data?.CustSuppName} -
    - )} - - {table2Data?.BookingTypeName == 'Dine In' && - table2Data?.SalesTableLinkDetails?.[0] - ?.WaiterName && ( -
    - Captain :{' '} - { - table2Data?.SalesTableLinkDetails?.[0] - ?.WaiterName - } -
    - )} - -
    - {Date1} -
    -
    - {GlobaldummyData - ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} -
    -
    - - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed( - 2 - )} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' - ? '-' - : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed( - 2 - )} - -
    -
    -
    - )} -
    - YOUR ORDER NO:{' '} - {table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} -
    -
    - {GlobaldummyData - ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    - -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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. -
    -
    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : 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 -

    - -
    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} -
    -
    - - {PrintGreeting?.SettingValue === 'Y' && ( -
    -
    - Thank You Visit Again -
    -
    - )} - - )} -
    - ))} - - {shouldFooterBeOnNewPage && FormatTheme && ( -
    -
    + {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && <>
    -
    +
    -
    -
    -
    - Qty -
    -
    - Items -
    - {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
    - Off -
    - )} +
    +
    +
    Qty
    +
    Items
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && +
    Off
    + } {/*
    SUB TOTAL
    ROUND OFF
    */}
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    -
    - {GlobaldummyData - ? '8' - : totalQuantityFilter?.length} -
    - {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
    - {GlobaldummyData - ? '8' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} -
    - )} +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && +
    {GlobaldummyData ? '8' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    + } {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */}
    - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - takeAwayPreference && ( -
    - TakeAway :{Number(TakeawayTotal).toFixed(2)}/- -
    - )} - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - dinePreference && ( -
    - DineIn :{Number(DineInTotal).toFixed(2)}/- -
    - )} -
    - Amount : - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} - /- -
    + {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && +
    TakeAway :{Number(TakeawayTotal).toFixed(2)}/-
    + } + {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && +
    DineIn :{Number(DineInTotal).toFixed(2)}/-
    + } +
    Amount :{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}/-

    - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    + {(table2Data?.OrderType === "E") ? '' : +
    -
    -
    - {((OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0)) && - table2Data?.NetAmount !== 0 && ( - <> -
    -
    -

    - --------- GST Breakup Details ----------- -

    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - - - - - - - - {OrderDetailGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number(item.TotalAmt).toFixed( - 2 - )} -
    - )} - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - {OrderDetailIGST?.map((item) => ( - - - - - - - ))} -
    - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed( - 2 - )} - - {Number( - item.TotalAmt - ).toFixed(2)} -
    - - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailVAT?.map((item) => ( - - - - - - - ))} -
    - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed( - 2 - )} - - {Number( - item.TotalAmt - ).toFixed(2)} -
    - - )} -
    -
    - - )} +
    +
    + {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && + <> +
    +
    +

    + --------- GST Breakup Details -----------

    + {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && + + + + + + + + + + {OrderDetailGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + } + + {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + {OrderDetailIGST?.map((item) => + + + + + + + ) + } +
    + + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + + {OrderDetailVAT?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + VAT + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + +
    +
    + + }
    - )} -
    -
    - {PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : 'Split'}{' '} -  Payment :   - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} - /-{' '} -
    + } +
    +
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    - {sportsAppPreference && MembershipApplied && ( -
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    - )} - {GlobaldummyData - ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < - 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs( - table2Data.CustomerDetails[0].OldCreditBal - )} -

    - ) : null} - - )} + {GlobaldummyData ? ( + GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + ) : ( + CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > - 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} -
    -
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    + ) : null} +
    + ) + )} + +
    + +
    + {PaymentStatusSuccess?.length > 1 && <> {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map( - (paymentType) => ( -
    - {paymentType}:{' '} - {aggregatedPayments[paymentType].toFixed(2)} -
    - ) - )} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} - )} - {GlobaldummyData && GlobalCashierName && ( -
    - {' '} - Cashier : Cashier Name + } + {GlobaldummyData && GlobalCashierName && +
    Cashier : Cashier Name
    + + } + {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && +
    Cashier : {CashierName}
    - )} - {CashierName && - CashierName !== undefined && - CashierName !== null && - !GlobaldummyData && - CashierNameField && ( -
    - Cashier : {CashierName} -
    - )} + } - {GlobaldummyData && ( -
    - {' '} - Customer : Customer Name + {GlobaldummyData && +
    Customer : Customer Name
    + + } + {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && +
    Customer : {table2Data?.CustSuppName}
    - )} - {table2Data?.CustSuppName && - table2Data?.CustSuppName !== undefined && - table2Data?.CustSuppName !== null && - !GlobaldummyData && ( -
    - Customer : {table2Data?.CustSuppName} -
    - )} + } - {table2Data?.BookingTypeName == 'Dine In' && - table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( -
    - Captain :{' '} - {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    - )} -
    - {Date1} -
    + {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && +
    + Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    } + +
    {Date1}
    +
    YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - - {GlobaldummyData - ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} + {GlobaldummyData ? GlobalQrcodet &&
    + QRcode +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    +
    + : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + (Qrcodet && paymentTypeUPI) && +
    + +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    }

    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed( - 2 - )} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' - ? '-' - : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} - -
    -
    -
    - )} -
    - YOUR ORDER NO:{' '} - {table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} -
    -
    - {GlobaldummyData - ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy + {GlobaldummyData ? GlobalIsnotes && + (

    +

    Notes : 10 days Return policy

    + +
    +
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + 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. +
    +
    ) + : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    +

    + Terms & Conditions

    +
      + {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    ) + } -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Notestext && ( -
    -

    - {Notestext} -

    + {GlobaldummyData ? GlobalSignature && (
    +

    Signature

    + +
    ) : + (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + 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. -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 -

    - -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )}
    - {PrintGreeting?.SettingValue === 'Y' && ( -
    -
    - Thank You Visit Again + {PrintGreeting?.SettingValue === "Y" && +
    +
    Thank You Visit Again
    +
    + } + + + } + +
    + ))} + + {shouldFooterBeOnNewPage && FormatTheme && +
    +
    + <> +
    +
    +
    +
    +
    +
    Qty
    +
    Items
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && +
    Off
    + } + {/*
    SUB TOTAL
    +
    ROUND OFF
    */} +
    +
    +
    {GlobaldummyData ? '9' : totalQuantity}
    +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && +
    {GlobaldummyData ? '8' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    + } + {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} + {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */} +
    +
    + {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && +
    TakeAway :{Number(TakeawayTotal).toFixed(2)}/-
    + } + {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && +
    DineIn :{Number(DineInTotal).toFixed(2)}/-
    + } +
    Amount :{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}/-
    +
    +
    + +
    + {(table2Data?.OrderType === "E") ? '' : +
    +
    + +
    +
    + {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && + <> +
    +
    +

    + --------- GST Breakup Details -----------

    + {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && + + + + + + + + + {OrderDetailGST?.map((item) => + + + + + + + + ) + } +
    + Taxable Amount + + CGST + + SGST + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + } + + {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + {OrderDetailIGST?.map((item) => + + + + + + + ) + } +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + {OrderDetailVAT?.map((item) => + + + + + + + ) + } +
    + + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + +
    +
    + + } +
    +
    + } +
    +
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    +
    + {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {GlobaldummyData ? ( + GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + ) : ( + CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    + ) : null} +
    + ) )} +
    + +
    + {PaymentStatusSuccess?.length > 1 && + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + } + {GlobaldummyData && GlobalCashierName && +
    Cashier : Cashier Name
    + + } + {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && +
    Cashier : {CashierName} +
    + } + + {GlobaldummyData && +
    Customer : Customer Name
    + + } + {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && +
    Customer : {table2Data?.CustSuppName} +
    + } + + + {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && +
    + Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    } + +
    {Date1}
    +
    YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    +
    + {GlobaldummyData ? GlobalQrcodet &&
    + QRcode +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    +
    + : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + (Qrcodet && paymentTypeUPI) && +
    + +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    } +
    +
    + + +
    + {GlobaldummyData ? GlobalIsnotes && + (
    +

    Notes : 10 days Return policy

    + +
    +
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + 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. +
    +
    ) + : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + (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

    + +
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + Signature == true && (
    +

    Signature

    + +
    )} + +
    +
    + + {PrintGreeting?.SettingValue === "Y" && +
    +
    Thank You Visit Again
    +
    + } +
    - )} -
    - ) : ( -
    + : +
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    -
    - {GlobalLogo && GlobaldummyData ? ( - image - ) : null} - {base64Image && - base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( - image - ) : null} -
    -
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    - {/*
    + + {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + +
    + {(GlobalLogo && GlobaldummyData) ? image : null} + {base64Image && (base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} +
    +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    + {/*
    Save green | Save nature
    */} -
    -
    -
    -
    -
    - {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 - : '')} -
    -
    - {' '} - MOBILE NO :{table2Data?.BrMobile} -
    -
    -
    -
    - {GlobaldummyData - ? GlobalBilltext - ? GlobalBilltext - : 'Cash' + ' Bill' - : BillName - ? BillName - : PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' - : ''}{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`} -
    -
    - Bill No :{' '} - {GlobaldummyData - ? '553' - : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )}
    - )} - {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( -
    - Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`} +
    +
    +
    + {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 : '')} +
    +
    MOBILE NO :{table2Data?.BrMobile}
    - )} +
    +
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`}
    +
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    +
    )} + {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`}
    }
    - {(TakeawayData?.length > 0 || GlobaldummyData) && ( + {(TakeawayData?.length > 0 || GlobaldummyData) && <> - {takeAwayPreference && ( -
    - Take Away -
    - )} + {takeAwayPreference &&
    Take Away
    } - +
    - {GlobaldummyData - ? GlobalSlNo && - : SLNO && } - {GlobaldummyData - ? GlobalItem && - : Item && } - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalAmount && : Amount && } - {(GlobaldummyData ? products : TakeawayData)?.map( - (item, index) => { - return ( - - {GlobaldummyData - ? GlobalSlNo && - : SLNO && } - {GlobaldummyData - ? GlobalItem && - : Item && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} - - ); - } - )} + {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => { + return ( + + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalAmount && : Amount && } + + ) + })}
    S.NS.NItemItem - Qty - - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - HSN - - HSN - - MRP - - MRP - - Dis{' '} - - Dis{' '} - - Tax %{' '} - - Tax %{' '} - - Rate - - Rate - - Amt - - Amt - S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {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?.SalesQty} - - {item?.SalesQty} - - {item?.HSN} - - {item?.HSN} - - {item?.MRP} - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - {item.discount} - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - {item.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.Rate} - - {item?.Rate} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || 0} -
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    + {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? +
    + {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( + + {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  + {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) + ?.map(a => { return (
    {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?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    - )} - {DineInData?.length > 0 && dinePreference && ( + } + {(DineInData?.length > 0 && dinePreference) && <> -
    - Dine In -
    +
    Dine In
    - {GlobaldummyData - ? GlobalSlNo && - : SLNO && } - {GlobaldummyData - ? GlobalItem && - : Item && } - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalAmount && : Amount && } - {(GlobaldummyData ? products : DineInData)?.map( - (item, index) => { - return ( - - {GlobaldummyData - ? GlobalSlNo && - : SLNO && } - {GlobaldummyData - ? GlobalItem && - : Item && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} - - ); - } - )} + {(GlobaldummyData ? products : DineInData)?.map((item, index) => { + return ( + + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalAmount && : Amount && } + + ) + })}
    S.NS.NItemItem - Qty - - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - HSN - - HSN - - MRP - - MRP - - Dis{' '} - - Dis{' '} - - Tax %{' '} - - Tax %{' '} - - Rate - - Rate - - Amt - - Amt - S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    -
    - {item?.SalesQty} - - {item?.SalesQty} - - {item?.HSN} - - {item?.HSN} - - {item?.MRP} - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - {item.discount} - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - {item.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.Rate} - - {item?.Rate} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || 0} -
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    +
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    +
    {item?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    - )} + } + + +
    -
    +
    -
    -
    -
    - Qty -
    -
    - Items -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off -
    - )} +
    +
    +
    Qty
    +
    Items
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && +
    Off
    + } {/*
    SUB TOTAL
    ROUND OFF
    */}
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    -
    - {GlobaldummyData ? '8' : totalQuantityFilter?.length} -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - {GlobaldummyData - ? '8' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} -
    - )} +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && +
    {GlobaldummyData ? '8' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    + } {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */}
    - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - takeAwayPreference && ( -
    - TakeAway :{Number(TakeawayTotal).toFixed(2)}/- -
    - )} - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - dinePreference && ( -
    - DineIn :{Number(DineInTotal).toFixed(2)}/- -
    - )} -
    - Amount : - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} - /- -
    + {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && +
    TakeAway :{Number(TakeawayTotal).toFixed(2)}/-
    + } + {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && +
    DineIn :{Number(DineInTotal).toFixed(2)}/-
    + } +
    Amount :{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}/-

    - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    + {(table2Data?.OrderType === "E") ? '' : +
    -
    -
    - {((OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0)) && - table2Data?.NetAmount !== 0 && ( - <> -
    -
    -

    - --------- GST Breakup Details ----------- -

    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - - - - - - - - - {OrderDetailGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - )} - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailIGST?.map((item) => ( - - - - - - - ))} -
    - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - {OrderDetailVAT?.map((item) => ( - - - - - - - ))} -
    - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - - )} -
    -
    - - )} +
    +
    + {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && + <> +
    +
    +

    + --------- GST Breakup Details -----------

    + {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && + + + + + + + + + + {OrderDetailGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + CGST + + SGST + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + } + + {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + {OrderDetailIGST?.map((item) => + + + + + + + ) + } +
    + + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => + + + + + + + ) + } +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + +
    +
    + + }
    - )} -
    -
    - {PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : 'Split'}{' '} -  Payment :   - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} - /-{' '} -
    + } +
    +
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    - {sportsAppPreference && MembershipApplied && ( -
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    - )} + {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } -
    +
    {/*
    CARD : *********12
    CARD HOLDER : CARD HOLDER NAME
    TOTAL SAVING : 0.00
    */} -
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( +
    + {PaymentStatusSuccess?.length > 1 && <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}:{' '} - {aggregatedPayments[paymentType].toFixed(2)} +
    + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)}
    ))} - )} - {GlobaldummyData && GlobalCashierName && ( -
    - {' '} - Cashier : Cashier Name + } + {GlobaldummyData && GlobalCashierName && +
    Cashier : Cashier Name
    + + } + {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && +
    Cashier : {CashierName}
    - )} - {CashierName && - CashierName !== undefined && - CashierName !== null && - !GlobaldummyData && - CashierNameField && ( -
    - Cashier : {CashierName} -
    - )} + } - {GlobaldummyData && ( -
    - {' '} - Customer : Customer Name + {GlobaldummyData && +
    Customer : Customer Name
    + + } + {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && +
    Customer : {table2Data?.CustSuppName}
    - )} - {table2Data?.CustSuppName && - table2Data?.CustSuppName !== undefined && - table2Data?.CustSuppName !== null && - !GlobaldummyData && ( -
    - Customer : {table2Data?.CustSuppName} -
    - )} + } - {table2Data?.BookingTypeName == 'Dine In' && - table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( -
    - Captain :{' '} - {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    - )} -
    - {Date1} -
    + {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && +
    + Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    } + +
    {Date1}
    +
    YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {GlobaldummyData - ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} + {GlobaldummyData ? GlobalQrcodet &&
    + QRcode +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    +
    + : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + (Qrcodet && paymentTypeUPI) && +
    + +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    }

    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} - -
    -
    -
    - )} -
    - YOUR ORDER NO:{' '} - {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)} -
    -
    - {GlobaldummyData - ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy + {GlobaldummyData ? GlobalIsnotes && + (

    +

    Notes : 10 days Return policy

    + +
    +
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + 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. +
    +
    ) + : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    +

    + Terms & Conditions

    +
      + {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    ) + } -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Notestext && ( -
    -

    {Notestext}

    + {GlobaldummyData ? GlobalSignature && (
    +

    Signature

    + +
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + 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. -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 -

    - -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )}
    - {PrintGreeting?.SettingValue === 'Y' && ( -
    + {PrintGreeting?.SettingValue === "Y" && +
    {/*
    Terms & Condition
    Xxxx Yyyy Xxxx Yyyy Xxxx Yyyy Xxxx Yyyy
    */} -
    - Thank You Visit Again -
    +
    Thank You Visit Again
    - )} + } +
    -
    - )} + + + +
    + } + ); }; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx index e23e409..48226a3 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx @@ -1,12 +1,8 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import QrImage from '../../../../Images/qrcode.jpg'; -import Logo from '../../../../Images/Logo.jpg'; -import { - extractLastNumber, - extractLastNumberOrderId, - printDiv, -} from '../../../../Services/Others'; +import Logo from '../../../../Images/Logo.jpg' +import { extractLastNumber, extractLastNumberOrderId, printDiv } from '../../../../Services/Others'; import { GlobalprintSlNo, GlobalprintItem, @@ -30,285 +26,145 @@ import { GlobalprintLogo, GlobalprintCredit, GlobalprintTax, -} from '../../../../Features/ThemeChange/ThemeChange'; -import { - GlobalUpiIDprint, - PreferenceData, -} from '../../../../Features/BookingScreen/BookingData/BookingData'; -import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.scss'; +} from '../../../../Features/ThemeChange/ThemeChange' +import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.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'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; -const Printstyle12 = ({ - index, - ExtraChargeTotal, - Date1, - base64Image, - PrintLogo, - totalQuantityFilter, - CashierName, - totalQuantity, - OrderDetailGST, - OrderDetailIGST, - OrderDetailVAT, - table2Data, - PaymentStatus, - PrintGreeting, - printDatas, - isPdf, - sportsAppPreference, - SalesModePref, - MembershipApplied = null, -}) => { + + +const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, totalQuantityFilter, CashierName, totalQuantity, OrderDetailGST, OrderDetailIGST, + OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, printDatas, isPdf, sportsAppPreference, SalesModePref, + MembershipApplied = null }) => { + const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint); + const GlobalUpiID = useSelector(GlobalUpiIDprint) const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.['Sl.No']; - const Item = FieldDetails?.['Item']; - const MRP = FieldDetails?.['MRP']; - const Discount = FieldDetails?.['Discount']; - const Tax = FieldDetails?.['Tax']; - const Quantity = FieldDetails?.['Quantity']; - const Rate = FieldDetails?.['Rate']; - const Amount = FieldDetails?.['Amount']; - const HsnCode = FieldDetails?.['HsnCode']; - const Qrcodet = FieldDetails?.['Qrcode']; - const CashierNameField = FieldDetails?.['CashierName']; - const LogoField = FieldDetails?.['Logo']; - const CreditDetails = FieldDetails?.['Credit details']; + const SLNO = FieldDetails?.["Sl.No"]; + const Item = FieldDetails?.["Item"]; + const MRP = FieldDetails?.["MRP"]; + const Discount = FieldDetails?.["Discount"]; + const Tax = FieldDetails?.["Tax"]; + const Quantity = FieldDetails?.["Quantity"]; + const Rate = FieldDetails?.["Rate"]; + const Amount = FieldDetails?.["Amount"]; + const HsnCode = FieldDetails?.["HsnCode"]; + const Qrcodet = FieldDetails?.["Qrcode"]; + const CashierNameField = FieldDetails?.["CashierName"]; + const LogoField = FieldDetails?.["Logo"]; + const CreditDetails = FieldDetails?.["Credit details"]; const WeightasKg = FieldDetails?.['Weight']; - const GlobalSlNo = useSelector(GlobalprintSlNo); - const GlobalItem = useSelector(GlobalprintItem); - const GlobalMRP = useSelector(GlobalprintMRP); - const GlobalDiscount = useSelector(GlobalprintDiscount); - const GlobalTax = useSelector(GlobalprintTax); - 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 GlobalSlNo = useSelector(GlobalprintSlNo) + const GlobalItem = useSelector(GlobalprintItem) + const GlobalMRP = useSelector(GlobalprintMRP) + const GlobalDiscount = useSelector(GlobalprintDiscount) + const GlobalTax = useSelector(GlobalprintTax) + 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); + const GlobalthemeFormatr = useSelector(GlobalthemeFormat) + const GlobalBilltext = useSelector(GlobalBillName) const appPreferences = useSelector(ApplicationPreferences); const GlobalCashierName = useSelector(GlobalprintCashierName); const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); const SettingData = useSelector(PreferenceData); - const estimatePrintHeader = - SettingData?.[0]?.SettingDtlDetails?.find( - (setting) => - setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' - )?.SettingValue === 'Y'; - const bookingTypePreference = appPreferences?.find( - (preference) => preference?.PreferredCatName === 'Booking Type' - )?.PreferenceCatDetails; - const dinePreference = bookingTypePreference?.find( - (type) => - type?.PreferredSubCatName?.toLowerCase() === 'dine in' && - type?.PreferredStatus === 'Y' - ); - const takeAwayPreference = bookingTypePreference?.find( - (type) => - type?.PreferredSubCatName?.toLowerCase() === 'take away' && - type?.PreferredStatus === 'Y' - ); - const paymentTypeUPI = PaymentStatus?.find( - (ps) => ps.PaymentTypeName === 'UPI' - ); + const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' + const bookingTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Booking Type')?.PreferenceCatDetails + const dinePreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "dine in" && type?.PreferredStatus === 'Y') + const takeAwayPreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "take away" && type?.PreferredStatus === 'Y') + const paymentTypeUPI = PaymentStatus?.find((ps) => ps.PaymentTypeName === "UPI") - const isEditedBill = PaymentStatus?.some((payment) => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ); - - let TermsAndConditions = printDatas?.TermsandConditions; - let SignatureImg = printDatas?.Signature; - let Notestext = printDatas?.Notes; - let BillName = printDatas?.PrintHdrName; - let FormatTheme = printDatas?.PrintType == 'S' ? true : false; - let PageSize = printDatas?.PageSize; - const Signature = FieldDetails?.['signature']; - const TermsnAdCondition = FieldDetails?.['terms&conditions']; + let TermsAndConditions = printDatas?.TermsandConditions + let SignatureImg = printDatas?.Signature + let Notestext = printDatas?.Notes + let BillName = printDatas?.PrintHdrName + let FormatTheme = printDatas?.PrintType == "S" ? true : false + let PageSize = printDatas?.PageSize + const Signature = FieldDetails?.["signature"]; + const TermsnAdCondition = FieldDetails?.["terms&conditions"]; const PackageDetails = table2Data?.PackageDtl; const keysLength = Object.keys(table2Data ?? {}).length; - let PaymentStatusSuccess = PaymentStatus?.filter( - (ps) => ps.PaymentStatus === 'S' - ); + let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") const printDocument = () => { window.print(); - }; + } if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } - const TakeawayData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' - ); - const DineInData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === 'dine in' - ); + const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") + const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0 + 0, ); const DineInTotal = DineInData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0 + 0, ); - const aggregatedPayments = PaymentStatusSuccess?.reduce( - (acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); + const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { + const paymentType = paymentdata?.PaymentTypeName; + const amount = Number(paymentdata?.Amount); - if (acc[paymentType]) { - acc[paymentType] += amount; - } else { - acc[paymentType] = amount; - } + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } - return acc; - }, - {} - ); + return acc; + }, {}); const productsData = table2Data?.productDetails || []; const offers = table2Data?.OrderOfferDetails || []; 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.0, - SalesQty: 2, - MRP: 100, - TotalAmt: 176, - discount: 0, - HSN: '01', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 5, - }, - { - ProdName: 'ITEM 2', - Rate: 300.0, - SalesQty: 1, - MRP: 350, - TotalAmt: 300, - discount: 0, - HSN: '02', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 5, - }, - { - ProdName: 'ITEM 3', - Rate: 200.0, - SalesQty: 1, - MRP: 250, - TotalAmt: 200, - discount: 0, - HSN: '03', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 0, - }, - { - ProdName: 'ITEM 4', - Rate: 30.0, - SalesQty: 1, - MRP: 50, - TotalAmt: 30, - discount: 0, - HSN: '04', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 18, - }, - { - ProdName: 'ITEM 5', - Rate: 30.0, - SalesQty: 1, - MRP: 50, - TotalAmt: 30, - discount: 0, - HSN: '05', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 40, - }, - { - ProdName: 'ITEM 6', - Rate: 130.0, - SalesQty: 1, - MRP: 150, - TotalAmt: 130, - discount: 0, - HSN: '06', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 0, - }, - { - ProdName: 'ITEM 7', - Rate: 230.0, - SalesQty: 1, - MRP: 250, - TotalAmt: 230, - discount: 0, - HSN: '08', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 5, - }, + { ProdName: 'ITEM 1', Rate: 88.00, SalesQty: 2, MRP: 100, TotalAmt: 176, discount: 0, HSN: '01', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, + { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, + { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, + { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, + { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, ]; - const chunkSize = PageSize == 'A5' ? 8 : 11; + const chunkSize = PageSize == "A5" ? 8 : 11; let dataSource = []; if (GlobaldummyData || TakeawayData?.length > 0) { @@ -322,11 +178,8 @@ const Printstyle12 = ({ 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 style12 = ``; const PrintA4 = async () => { - await printDiv('PrintStyle12', style12, 'FontApply'); + + await printDiv("PrintStyle12", style12, 'FontApply'); }; + return ( <> - {FormatTheme ? ( -
    + {FormatTheme ? +
    + {paginatedChunks.map((dataChunk, chunkIndex) => (
    0 ? ' print-page-break' : ''}` - } - style={{ - display: 'flex', - flexDirection: 'column', - justifyContent: - chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme - ? 'space-between' - : '', - height: isMobile - ? '295mm' - : FormatTheme - ? PageSize == 'A5' - ? '170mm' - : '257mm' - : '', - }} - key={chunkIndex} - > - {/*
    */} -
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    -
    -
    + className={isMobile ? `invoice-wrapper container pdf-page` : `invoice-wrapper container print-chunk${chunkIndex > 0 ? ' print-page-break' : ''}`} + style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: isMobile ? "295mm" : FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> -
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    -
    - {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 - : '')} -
    -
    - {GlobaldummyData - ? GlobalBilltext - ? GlobalBilltext - : 'Cash' + ' Bill' - : BillName - ? BillName - : PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName + - ' Bill' - : ''} -
    -
    - {' '} - Mobile : +91{' '} - {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} -
    - {GlobaldummyData && GlobalCashierName && ( -

    - {' '} - Cashier : Cashier Name -

    - )} - {CashierName && - CashierName !== undefined && - CashierName !== null && - !GlobaldummyData && - CashierNameField && ( -
    - Cashier : {CashierName} -
    - )} - {GlobaldummyData && ( -
    - {' '} - Customer : Customer Name -
    - )} - {table2Data?.CustSuppName && - table2Data?.CustSuppName !== undefined && - table2Data?.CustSuppName !== null && - !GlobaldummyData && ( -
    - Customer : {table2Data?.CustSuppName} -
    - )} - {table2Data?.BookingTypeName == 'Dine In' && - table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( -
    - Captain :{' '} - {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    - )} - {table2Data?.OrderType === 'E' && ( -
    - Estimate{' '} -
    - )} + + {/*
    */} +
    + {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    +
    +
    + +
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    +
    + {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 : '')}
    - {GlobalLogo && GlobaldummyData && ( -
    - {' '} - image -
    - )} - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( -
    - {' '} - image -
    - ) : null} -
    - )} - {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( -
    - Estimate{' '} -
    - )} -
    -
    - Bill No :{' '} - {GlobaldummyData - ? '553' - : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} -
    -
    - {Date1} +
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""}
    +
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    + {GlobaldummyData && GlobalCashierName &&

    Cashier : Cashier Name

    } + {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && +
    Cashier : {CashierName}
    } + {GlobaldummyData && +
    Customer : Customer Name
    } + {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && +
    Customer : {table2Data?.CustSuppName} +
    } + {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && +
    + Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    } + {table2Data?.OrderType === "E" &&
    Estimate
    }
    + {(GlobalLogo && GlobaldummyData) &&
    image
    } + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : (base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ?
    image
    : null} + +
    )} + {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate
    } +
    +
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    +
    {Date1}
    -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && ( +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && <> - {takeAwayPreference && ( -
    - Take Away -
    - )} + {takeAwayPreference &&
    Take Away
    }
    - {GlobaldummyData - ? GlobalSlNo && - : SLNO && } - {GlobaldummyData - ? GlobalItem && - : Item && } - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount && } {dataChunk?.map((item, index) => { return ( - {GlobaldummyData - ? GlobalSlNo && - : SLNO && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && + } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount && } - ); + ) })}
    S.NoS.NoDescriptionDesQty - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - MRPMRPRateRateHSNHSN(%)(%) - Tax (%) - - Tax (%) - AmtAmtS.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmt
    {index + 1} - {chunkIndex * chunkSize + index + 1} - {item?.ProdName} -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => - pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls - ?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == - '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {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?.SalesQty} - - {item?.SalesQty} - - {item?.MRP} - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - {item?.Rate} - - {item?.Rate} - - {item?.HSN} - - {item?.HSN} - - {item?.discount} - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - {item?.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || - 0} - {index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} +
    {item?.ProdName}
    + {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? +
    + {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( + + {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  + {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) + ?.map(a => { return (
    {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?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    - )} - {DineInData?.length > 0 && dinePreference && ( + } + {(DineInData?.length > 0 && dinePreference) && <> -
    - Dine In -
    +
    Dine In
    + - {GlobaldummyData - ? GlobalSlNo && - : SLNO && } - {GlobaldummyData - ? GlobalItem && - : Item && } - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount && } {dataChunk?.map((item, index) => { return ( - {GlobaldummyData - ? GlobalSlNo && - : SLNO && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && + } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount && } - ); + ) })}
    S.NoS.NoDescriptionDesQty - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - MRPMRPRateRateHSNHSN(%)(%) - Tax (%) - - Tax (%) - AmtAmtS.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmt
    {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?.SalesQty} - - {item?.SalesQty} - - {item?.MRP} - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - {item?.Rate} - - {item?.Rate} - - {item?.HSN} - - {item?.HSN} - - {item?.discount} - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - {item?.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || - 0} - {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?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    - )} + }
    - {chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme && ( - <> -
    -
    -
    -
    -
    Items
    -
    :
    -
    - {GlobaldummyData - ? '8' - : totalQuantityFilter?.length} -
    -
    -
    -
    Qty
    -
    :
    -
    - {GlobaldummyData ? '9' : totalQuantity} -
    -
    - {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
    -
    Off
    -
    :
    -
    - {GlobaldummyData - ? '9' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} -
    -
    - )} - {/*
    -
    - Extra Charges -
    -
    :
    -
    - 0 -
    -
    */} - -
    - - {DineInData?.length > 0 && TakeawayData?.length > 0 && ( - <> - {takeAwayPreference && ( -
    -
    - TakeAway -
    -
    :
    -
    - {Number(TakeawayTotal).toFixed(2)} -
    -
    - )} - {dinePreference && ( -
    -
    - Dine In -
    -
    :
    -
    - {Number(DineInTotal).toFixed(2)} -
    -
    - )} - - )} -
    -
    - Amount -
    -
    :
    -
    - {GlobaldummyData - ? '1,066.00' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    -
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map( - (paymentType) => ( -
    - {paymentType}:{' '} - {aggregatedPayments[paymentType].toFixed(2)} -
    - ) - )} - - )} - - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {((OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( - <> -
    -

    - --------- GST Breakup Details ----------- -

    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - - - - - - - - - {OrderDetailGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - )} - - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailIGST?.map((item) => ( - - - - - - - ))} -
    - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed( - 2 - )} -
    - - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailVAT?.map((item) => ( - - - - - - - ))} -
    - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed( - 2 - )} -
    - - )} -
    - - )} -
    - )} -
    - -
    -
    - {PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : 'Split'}{' '} -   Payment -
    -
    :
    -
    - {GlobaldummyData - ? '1,066.00' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    -
    - - {/*
    -
    - Recived Amt -
    -
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} -
    -
    -
    -
    - Balance Amt -
    -
    :
    -
    - 0.00 -
    -
    */} -
    -
    - - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed( - 2 - )} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' - ? '-' - : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed( - 2 - )} - -
    -
    -
    - )} - - {GlobaldummyData - ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < - 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs( - table2Data.CustomerDetails[0].OldCreditBal - )} -

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > - 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} -
    - -
    -
    -
    - Your Order No:{' '} - {GlobaldummyData - ? '53' - : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} -
    -
    - - {GlobaldummyData - ? GlobalQrcodet && ( -
    - image -
    - {' '} - Scan to Pay:{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} -
    - {sportsAppPreference && MembershipApplied && ( -
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    - )} - -
    - {GlobaldummyData - ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    - -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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. -
    -
    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : 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 -

    - -
    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} -
    -
    - - {PrintGreeting?.SettingValue === 'Y' && ( -
    - Thank You Visit Again -
    - )} - - )} -
    - ))} - - {shouldFooterBeOnNewPage && FormatTheme && ( -
    -
    + {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && <> +
    -
    -
    -
    -
    Items
    +
    +
    +
    +
    + Items +
    :
    -
    +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    Qty
    +
    +
    + Qty +
    :
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
    -
    Off
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && +
    +
    + Off +
    :
    -
    - {GlobaldummyData - ? '9' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} +
    + {GlobaldummyData ? '9' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    - )} + } {/*
    Extra Charges @@ -2314,435 +533,185 @@ const Printstyle12 = ({
    */} -
    +
    - {DineInData?.length > 0 && TakeawayData?.length > 0 && ( + {(DineInData?.length > 0 && TakeawayData?.length > 0) && <> - {takeAwayPreference && ( -
    -
    - TakeAway -
    -
    :
    -
    - {Number(TakeawayTotal).toFixed(2)} -
    + {takeAwayPreference &&
    +
    + TakeAway
    - )} - {dinePreference && ( -
    -
    - Dine In -
    -
    :
    -
    - {Number(DineInTotal).toFixed(2)} -
    +
    :
    +
    + {Number(TakeawayTotal).toFixed(2)}
    - )} +
    } + {dinePreference &&
    +
    + Dine In +
    +
    :
    +
    + {Number(DineInTotal).toFixed(2)} +
    +
    } - )} -
    -
    + } +
    +
    Amount
    :
    -
    - {GlobaldummyData - ? '1,066.00' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} +
    + {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + {PaymentStatusSuccess?.length > 1 && <> {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map( - (paymentType) => ( -
    - {paymentType}:{' '} - {aggregatedPayments[paymentType].toFixed(2)} -
    - ) - )} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} - )} - - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( + } + {(table2Data?.OrderType === "E") ? '' :
    - {((OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( + {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && <>
    -

    - --------- GST Breakup Details ----------- -

    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - +

    + --------- GST Breakup Details -----------

    + {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && +
    + + + + + + + + + {OrderDetailGST?.map((item) => - - + + + + + + ) + } +
    + + Taxable Amount + + CGST + + SGST + + Total Amount +
    + + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + } + + {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && + <> +
    + + + + + - - - - {OrderDetailGST?.map((item) => ( + {OrderDetailIGST?.map((item) => - - - - - + - ))} + ) + }
    + Taxable Amount - CGST + + IGST - SGST - + Total Amount
    + {item?.TaxPercentage || 0}% - {Number( - item.WithOutTaxAmount - ).toFixed(2)} + + {Number(item.WithOutTaxAmount).toFixed(2)} - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
    - )} + + } + {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && + <> +
    + - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( - <> -
    -
    + + + + + + + {OrderDetailVAT?.map((item) => - - - - + - {OrderDetailIGST?.map((item) => ( - - - - - - - ))} -
    + + Taxable Amount + + VAT + + Total Amount +
    - Taxable Amount + + {item?.TaxPercentage || 0}% - IGST + + {Number(item.WithOutTaxAmount).toFixed(2)} - Total Amount + + {Number(item.TaxAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailVAT?.map((item) => ( - - - - - - - ))} -
    - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - - )} + ) + } + + + } +
    - )} + }
    - )} -
    + } +
    -
    -
    - {PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : 'Split'}{' '} -   Payment +
    +
    + {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}   Payment
    :
    -
    - {GlobaldummyData - ? '1,066.00' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} +
    + {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    {/*
    @@ -2763,1140 +732,735 @@ const Printstyle12 = ({ 0.00
    */} +
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed( - 2 - )} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' - ? '-' - : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} - -
    + {GlobaldummyData ? ( + GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    -
    + ) + ) : ( + CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    + ) : null} +
    + ) )} - - {GlobaldummyData - ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < - 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs( - table2Data.CustomerDetails[0].OldCreditBal - )} -

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > - 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )}
    -
    -
    -
    - Your Order No:{' '} - {GlobaldummyData - ? '53' - : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} -
    +
    + +
    +
    Your Order No: {GlobaldummyData ? '53' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    +
    - {GlobaldummyData - ? GlobalQrcodet && ( -
    - image -
    - {' '} - Scan to Pay:{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} + {GlobaldummyData ? GlobalQrcodet && +
    + image +
    Scan to Pay:
    +
    + ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    +
    + : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + (Qrcodet && paymentTypeUPI) && + +
    + +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    } +
    + {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - {sportsAppPreference && MembershipApplied && ( -
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    - )} -
    - {GlobaldummyData - ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy + {GlobaldummyData ? GlobalIsnotes && + (

    +

    Notes : 10 days Return policy

    + +
    +
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + 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. +
    +
    ) + : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    +

    + Terms & Conditions

    +
      + {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    ) + } -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Notestext && ( -
    -

    - {Notestext} -

    + {GlobaldummyData ? GlobalSignature && (
    +

    Signature

    + +
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + 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. -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 -

    - -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )}
    - {PrintGreeting?.SettingValue === 'Y' && ( -
    + {PrintGreeting?.SettingValue === "Y" && +
    Thank You Visit Again
    + } + + } + +
    + ))} + + + {shouldFooterBeOnNewPage && FormatTheme && +
    +
    + <> + +
    +
    +
    +
    +
    + Items +
    +
    :
    +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    +
    +
    + Qty +
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && +
    +
    + Off +
    +
    :
    +
    + {GlobaldummyData ? '9' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)} +
    +
    + } + {/*
    +
    + Extra Charges +
    +
    :
    +
    + 0 +
    +
    */} + +
    + + {(DineInData?.length > 0 && TakeawayData?.length > 0) && + <> + {takeAwayPreference &&
    +
    + TakeAway +
    +
    :
    +
    + {Number(TakeawayTotal).toFixed(2)} +
    +
    } + {dinePreference &&
    +
    + Dine In +
    +
    :
    +
    + {Number(DineInTotal).toFixed(2)} +
    +
    } + + } +
    +
    + Amount +
    +
    :
    +
    + {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    +
    + {PaymentStatusSuccess?.length > 1 && + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + } + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : +
    + {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && + <> +
    +

    + --------- GST Breakup Details -----------

    + {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && + + + + + + + + + + {OrderDetailGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + } + + {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + {OrderDetailIGST?.map((item) => + + + + + + + ) + } +
    + + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + {OrderDetailVAT?.map((item) => + + + + + + + ) + } +
    + + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + +
    + + } +
    + } +
    + +
    +
    + {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}   Payment +
    +
    :
    +
    + {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    +
    + {/*
    +
    + Recived Amt +
    +
    :
    +
    + {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    +
    +
    +
    + Balance Amt +
    +
    :
    +
    + 0.00 +
    +
    */} + +
    +
    + + {GlobaldummyData ? ( + GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + ) : ( + CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    + ) : null} +
    + ) )} +
    + +
    + +
    +
    Your Order No: {GlobaldummyData ? '53' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    + +
    + + {GlobaldummyData ? GlobalQrcodet && +
    + image +
    Scan to Pay:
    +
    + ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    +
    + : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + (Qrcodet && paymentTypeUPI) && + +
    + +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    } + +
    + + {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + +
    + {GlobaldummyData ? GlobalIsnotes && + (
    +

    Notes : 10 days Return policy

    + +
    +
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + 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. +
    +
    ) + : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + (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

    + +
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + Signature == true && (
    +

    Signature

    + +
    )} + +
    +
    + + {PrintGreeting?.SettingValue === "Y" && +
    + Thank You Visit Again +
    + }
    - )} + } +
    - ) : ( -
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {/*

    {table2Data?.BrName}

    */} -
    -
    -
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    -
    - {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 - : '')} -
    -
    - {' '} - Mobile : +91{' '} - {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} -
    - {GlobaldummyData && GlobalCashierName && ( -

    - {' '} - Cashier : Cashier Name -

    - )} - {CashierName && - CashierName !== undefined && - CashierName !== null && - !GlobaldummyData && - CashierNameField && ( -
    - Cashier : {CashierName} -
    - )} - {GlobaldummyData && ( -
    - {' '} - Customer : Customer Name -
    - )} - {table2Data?.CustSuppName && - table2Data?.CustSuppName !== undefined && - table2Data?.CustSuppName !== null && - !GlobaldummyData && ( -
    - Customer : {table2Data?.CustSuppName} -
    - )} + : +
    + {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {table2Data?.BookingTypeName == 'Dine In' && - table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( -
    - Captain :{' '} - {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    - )} - {table2Data?.OrderType === 'E' && ( -
    - Estimate{' '} -
    - )} + {/*

    {table2Data?.BrName}

    */} +
    +
    + +
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    +
    + {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 : '')}
    - {GlobalLogo && GlobaldummyData && ( -
    - {' '} - image +
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    + {GlobaldummyData && GlobalCashierName && +

    Cashier : Cashier Name

    + + } + {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && +
    Cashier : {CashierName}
    - )} - {base64Image && (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( -
    - {' '} - image + } + + {GlobaldummyData && +
    Customer : Customer Name
    + + } + {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && +
    Customer : {table2Data?.CustSuppName}
    - ) : null} + } + + + {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && +
    + Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    } + {table2Data?.OrderType === "E" &&
    Estimate
    }
    - )} - {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( -
    - Estimate{' '} -
    - )} + {(GlobalLogo && GlobaldummyData) &&
    image
    } + {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ?
    image
    : null} +
    )} + {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate
    } {/*

    {table2Data?.PaymentTypeName}  Payment :  {Number(table2Data?.NetAmount).toFixed(2)}/-

    */} -
    -
    - Bill No :{' '} - {GlobaldummyData - ? '553' - : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} -
    -
    - {Date1} -
    +
    +
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    +
    {Date1}
    {/*
    */} - {(TakeawayData?.length > 0 || GlobaldummyData) && ( + {(TakeawayData?.length > 0 || GlobaldummyData) && <> - {takeAwayPreference && ( -
    - Take Away -
    - )} + {takeAwayPreference &&
    Take Away
    }
    + - {GlobaldummyData - ? GlobalSlNo && - : SLNO && } - {GlobaldummyData - ? GlobalItem && - : Item && } - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && } - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && } - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && } + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount && } - {(GlobaldummyData ? products : TakeawayData)?.map( - (item, index) => { - return ( - - {GlobaldummyData - ? GlobalSlNo && - : SLNO && } - {GlobaldummyData - ? GlobalItem && - : Item && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} - - ); - } - )} + {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => { + return ( + + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && + } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount && } + + ) + })}
    S.NoS.NoDescriptionDesQty - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {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?.SalesQty} - - {item?.SalesQty} - - {item?.MRP} - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - {item?.Rate} - - {item?.Rate} - - {item?.HSN} - - {item?.HSN} - - {item?.discount} - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - {item?.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || 0} -
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    + {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? +
    + {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( + + {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  + {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) + ?.map(a => { return (
    {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?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    - )} - {DineInData?.length > 0 && dinePreference && ( + } + {(DineInData?.length > 0 && dinePreference) && <> -
    - Dine In -
    +
    Dine In
    + - {GlobaldummyData - ? GlobalSlNo && - : SLNO && } - {GlobaldummyData - ? GlobalItem && - : Item && } - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && } - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && } - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && } + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount && } - {(GlobaldummyData ? products : DineInData)?.map( - (item, index) => { - return ( - - {GlobaldummyData - ? GlobalSlNo && - : SLNO && } - {GlobaldummyData - ? GlobalItem && - : Item && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} - - ); - } - )} + {(GlobaldummyData ? products : DineInData)?.map((item, index) => { + return ( + + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && + } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount && } + + ) + })}
    S.NoS.NoDescriptionDesQty - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    -
    - {item?.SalesQty} - - {item?.SalesQty} - - {item?.MRP} - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - {item?.Rate} - - {item?.Rate} - - {item?.HSN} - - {item?.HSN} - - {item?.discount} - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - {item?.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || 0} -
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    +
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    +
    {item?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    - - )} + }
    -
    -
    -
    -
    Items
    +
    +
    +
    +
    + Items +
    :
    -
    +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    Qty
    +
    +
    + Qty +
    :
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    -
    Off
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && +
    +
    + Off +
    :
    -
    - {GlobaldummyData - ? '9' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} +
    + {GlobaldummyData ? '9' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    - )} + } {/*
    Extra Charges @@ -3907,412 +1471,187 @@ const Printstyle12 = ({
    */} -
    +
    - {DineInData?.length > 0 && TakeawayData?.length > 0 && ( + {(DineInData?.length > 0 && TakeawayData?.length > 0) && <> - {takeAwayPreference && ( -
    -
    - TakeAway -
    -
    :
    -
    - {Number(TakeawayTotal).toFixed(2)} -
    + {takeAwayPreference &&
    +
    + TakeAway
    - )} - {dinePreference && ( -
    -
    - Dine In -
    -
    :
    -
    - {Number(DineInTotal).toFixed(2)} -
    +
    :
    +
    + {Number(TakeawayTotal).toFixed(2)}
    - )} +
    } + {dinePreference &&
    +
    + Dine In +
    +
    :
    +
    + {Number(DineInTotal).toFixed(2)} +
    +
    } - )} -
    -
    Amount
    + } +
    +
    + Amount +
    :
    -
    - {GlobaldummyData - ? '1,066.00' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} +
    + {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + {PaymentStatusSuccess?.length > 1 && <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}:{' '} - {aggregatedPayments[paymentType].toFixed(2)} +
    + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)}
    ))} - )} - - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( + } + {(table2Data?.OrderType === "E") ? '' :
    - {((OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( + {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && <>
    -

    - --------- GST Breakup Details ----------- -

    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - +

    + --------- GST Breakup Details -----------

    + {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && +
    + + + + + + + + + {OrderDetailGST?.map((item) => - - + + + + + + ) + } +
    + + Taxable Amount + + CGST + + SGST + + + Total Amount +
    + + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + } + + {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && + <> +
    + + + + + - - - - {OrderDetailGST?.map((item) => ( + {OrderDetailIGST?.map((item) => - - - - - + + - ))} + ) + }
    + Taxable Amount - CGST + + IGST - SGST - + Total Amount
    + {item?.TaxPercentage || 0}% + {Number(item.WithOutTaxAmount).toFixed(2)} - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
    - )} + + } + {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && + <> +
    + - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( - <> -
    -
    + + + + + + + {OrderDetailVAT?.map((item) => - - - - + - {OrderDetailIGST?.map((item) => ( - - - - + ) + } +
    + + Taxable Amount + + VAT + + Total Amount +
    - Taxable Amount + + {item?.TaxPercentage || 0}% - IGST + + {Number(item.WithOutTaxAmount).toFixed(2)} - Total Amount + + {Number(item.TaxAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} -
    + + } - - {Number(item.TotalAmt).toFixed(2)} - - - ))} - - - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailVAT?.map((item) => ( - - - - - - - ))} -
    - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - - )}
    - )} + }
    - )} -
    + } +
    -
    -
    - {PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : 'Split'}{' '} -   Payment +
    +
    + {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}   Payment
    :
    -
    - {GlobaldummyData - ? '1,066.00' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} +
    + {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    {/*
    @@ -4333,73 +1672,10 @@ const Printstyle12 = ({ 0.00
    */} +
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} - -
    -
    -
    - )} - {/*
    */} {/*
    @@ -4416,346 +1692,137 @@ const Printstyle12 = ({
    */} - {GlobaldummyData - ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} -

    - ) : null} - - )} + {GlobaldummyData ? ( + GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + ) : ( + CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} -

    - ) : null} -
    - )} + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    + ) : null} +
    + ) + )}
    -
    -
    -
    - Your Order No:{' '} - {GlobaldummyData - ? '53' - : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} -
    +
    + +
    +
    Your Order No: {GlobaldummyData ? '53' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    +
    - {GlobaldummyData - ? GlobalQrcodet && ( -
    - image -
    - {' '} - Scan to Pay:{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} -
    - {sportsAppPreference && MembershipApplied && ( -
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    - )} + {GlobaldummyData ? GlobalQrcodet && +
    + image +
    Scan to Pay:
    +
    + ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    +
    + : + (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + (Qrcodet && paymentTypeUPI) && -
    + +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    } + +
    + {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + + +
    - {GlobaldummyData - ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy + {GlobaldummyData ? GlobalIsnotes && + (

    +

    Notes : 10 days Return policy

    + +
    +
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + 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. +
    +
    ) + : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    +

    + Terms & Conditions

    +
      + {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} + {/*
    3. Please check the product before leaving the counter.
    4. */} +
    +
    ) + } -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Notestext && ( -
    -

    {Notestext}

    + {GlobaldummyData ? GlobalSignature && (
    +

    Signature

    + +
    ) : + (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + 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. -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 -

    - -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )}
    - {PrintGreeting?.SettingValue === 'Y' && ( -
    Thank You Visit Again
    - )} + {PrintGreeting?.SettingValue === "Y" && +
    + Thank You Visit Again +
    + } {/*
    print
    */}
    - )} - - ); -}; + } -export default Printstyle12; + + ) +} + +export default Printstyle12 diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx index 0da37c3..be9e6c8 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx @@ -137,18 +137,6 @@ const Printstyle2 = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); - const isEditedBill = PaymentStatus?.some(payment => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ) - const keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); @@ -351,8 +339,8 @@ const Printstyle2 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: FormatTheme @@ -419,18 +407,18 @@ const Printstyle2 = ({ {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 + : '')}
    @@ -489,10 +477,10 @@ const Printstyle2 = ({ {GlobaldummyData ? 'A22' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    @@ -524,124 +512,124 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ?'Qty/Kg' :'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} @@ -650,214 +638,214 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && ( - - {item?.ProdName} - - ) + + {item?.ProdName} + + ) : Item && ( - -
    {item?.ProdName}
    -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => - pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - )} -  {' '} - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > - 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null + +
    {item?.ProdName}
    +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} ) - )?.map((a) => { - return ( -
    {a.SerialNumber}
    - ); - }) - : ''}{' '} - {item?.ProductIdentifierDtls?.length > +
    + )} +  {' '} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {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?.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(',')} +
    + ); + }) + : ''} +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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 ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage || 0} - - ) + + {item?.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} ); })} @@ -882,124 +870,124 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ?'Qty/Kg' :'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} @@ -1008,155 +996,155 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && ( - - {item?.ProdName} - - ) + + {item?.ProdName} + + ) : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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 ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} ); })} @@ -1278,12 +1266,12 @@ const Printstyle2 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off -
    - )} +
    + Off +
    + )}
    Amount
    @@ -1310,16 +1298,16 @@ const Printstyle2 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - {GlobaldummyData - ? '100' - : Number( +
    + {GlobaldummyData + ? '100' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )}
    @@ -1658,7 +1646,7 @@ const Printstyle2 = ({
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1678,46 +1666,6 @@ const Printstyle2 = ({ )} )} - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {GlobaldummyData && GlobalCashierName && (
    Cashier : Cashier Name
    )} @@ -1764,141 +1712,141 @@ const Printstyle2 = ({ {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' ? ( + table2Data?.OrderType === 'E' ? ( '' ) : (
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} +
    + QRcode +
    + 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 - )} -
    -
    - )} + )}
    )} @@ -1924,7 +1872,7 @@ const Printstyle2 = ({ )} {!estimatePrintHeader && - table2Data?.OrderType === 'E' ? ( + table2Data?.OrderType === 'E' ? ( '' ) : (
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : 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} +

      + 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 +

    + +
    + )}
    )} @@ -2160,10 +2108,10 @@ const Printstyle2 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off -
    - )} +
    + Off +
    + )}
    Amount
    @@ -2184,16 +2132,16 @@ const Printstyle2 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - {GlobaldummyData - ? '100' - : Number( +
    + {GlobaldummyData + ? '100' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )}
    {GlobaldummyData ? '1,066' @@ -2529,7 +2477,7 @@ const Printstyle2 = ({
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -2549,46 +2497,6 @@ const Printstyle2 = ({ )} )} - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {GlobaldummyData && GlobalCashierName && (
    Cashier : Cashier Name
    )} @@ -2635,139 +2543,139 @@ const Printstyle2 = ({ {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( + 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' ? ( '' ) : (
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} +
    + QRcode +
    + 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 - )} -
    -
    - )} + )}
    )} @@ -2806,23 +2714,23 @@ const Printstyle2 = ({ > {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : 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} +

      + 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 +

    + +
    + )}
    )} @@ -3037,18 +2945,18 @@ const Printstyle2 = ({ {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 + : '')}
    @@ -3108,10 +3016,10 @@ const Printstyle2 = ({ {GlobaldummyData ? 'A22' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    @@ -3144,82 +3052,82 @@ const Printstyle2 = ({ : Item && Item} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ?'Qty/Kg' :'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} @@ -3229,208 +3137,208 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && ( - - {item?.ProdName} - - ) + + {item?.ProdName} + + ) : Item && ( - -
    {item?.ProdName}
    -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - )} -  {' '} - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null + +
    {item?.ProdName}
    +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} ) - )?.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?.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(',')} +
    + ); + }) + : ''} +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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 ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} ); } @@ -3462,82 +3370,82 @@ const Printstyle2 = ({ : Item && Item} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ?'Qty/Kg' :'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} @@ -3547,154 +3455,154 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && ( - - {item?.ProdName} - - ) + + {item?.ProdName} + + ) : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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 ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} ); } @@ -3752,8 +3660,8 @@ const Printstyle2 = ({ {GlobaldummyData ? '100' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )}
    @@ -4086,7 +3994,7 @@ const Printstyle2 = ({
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4100,46 +4008,6 @@ const Printstyle2 = ({ ))} )} - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {GlobaldummyData && GlobalCashierName && (
    Cashier : Cashier Name
    )} @@ -4179,123 +4047,123 @@ const Printstyle2 = ({
    {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' ? ( '' ) : (
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} +
    + QRcode +
    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)} +
    -
    - )} + )}
    )} @@ -4333,26 +4201,26 @@ const Printstyle2 = ({ > {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : 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} +

      + 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/PrintTemplates/ThermalPrinter/PrintStyle3.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx index b1a067d..c124a12 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx @@ -105,18 +105,6 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } - const isEditedBill = PaymentStatus?.some(payment => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ) - 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']; @@ -252,7 +240,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ? 'QTY/KG' : 'QTY'}
    } + {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} @@ -314,7 +302,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ? 'QTY/KG' : 'QTY'}
    } + {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} @@ -506,51 +494,11 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    {GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )}
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -559,8 +507,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    ))} - )} - + } {GlobaldummyData && GlobalCashierName &&
    Cashier : Cashier Name
    @@ -904,52 +851,11 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    {GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} -
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -958,7 +864,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    ))} - )} + } {GlobaldummyData && GlobalCashierName &&
    Cashier : Cashier Name
    @@ -1171,7 +1077,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ? 'QTY/KG' : 'QTY'}
    } + {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} @@ -1233,7 +1139,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ? 'QTY/KG' : 'QTY'}
    } + {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} @@ -1421,46 +1327,6 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    {GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {GlobaldummyData ? ( GlobalCredit && ( @@ -1519,7 +1385,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -1528,8 +1394,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    ))} - )} - + } {GlobaldummyData && GlobalCashierName &&
    Cashier : Cashier Name
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx index c164376..43b0472 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx @@ -146,17 +146,6 @@ const Printstyle4 = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); - const isEditedBill = PaymentStatus?.some(payment => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ) const keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { @@ -255,7 +244,7 @@ const Printstyle4 = ({ TotalAmt: 176, discount: 0, HSN: '01', - }, + }, { ProdName: 'ITEM 2', Rate: 300.0, @@ -264,7 +253,7 @@ const Printstyle4 = ({ TotalAmt: 300, discount: 0, HSN: '02', - }, + }, { ProdName: 'ITEM 3', Rate: 200.0, @@ -358,8 +347,8 @@ const Printstyle4 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -409,7 +398,7 @@ const Printstyle4 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    {' '} @@ -481,10 +470,10 @@ const Printstyle4 = ({ {GlobaldummyData ? '51' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    {/*
    {GlobaldummyData ? formattedDate : Date1}
    */}
    @@ -546,138 +535,138 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalSlNo && ( - # - ) + # + ) : SLNO && #} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ?'Qty/Kg' :'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -687,187 +676,187 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => - pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} - {( - (item?.ProductIdentifierDtls - ?.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, index) => { - const imei1 = - item2.IMEI1 || ''; - const imei2 = - item2.IMEI2 || ''; - return ` ${[imei1, imei2].filter(Boolean).join(',')}`; - }) - .join('') - : '') - ).trim()} -
    - ) : ( -
    - {( - (item?.Size || '1') + - (item?.SinglePc === 'Y' - ? ' PCS' - : item?.Type !== 'C' - ? ` ${item?.UomName}` - : ' COMBO') + - (item?.BrandName - ? ` ${item?.BrandName}` - : '') + - (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, index) => { - const imei1 = - item2.IMEI1 || ''; - const imei2 = - item2.IMEI2 || ''; - return ` ${[imei1, imei2].filter(Boolean).join(',')}`; - }) - .join('') - : '') - ).trim()} -
    - )} - - )} + {( + (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, index) => { + const imei1 = + item2.IMEI1 || ''; + const imei2 = + item2.IMEI2 || ''; + return ` ${[imei1, imei2].filter(Boolean).join(',')}`; + }) + .join('') + : '') + ).trim()} +
    + ) : ( +
    + {( + (item?.Size || '1') + + (item?.SinglePc === 'Y' + ? ' PCS' + : item?.Type !== 'C' + ? ` ${item?.UomName}` + : ' COMBO') + + (item?.BrandName + ? ` ${item?.BrandName}` + : '') + + (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, index) => { + const imei1 = + item2.IMEI1 || ''; + const imei2 = + item2.IMEI2 || ''; + return ` ${[imei1, imei2].filter(Boolean).join(',')}`; + }) + .join('') + : '') + ).trim()} +
    + )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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} + + )} ); })} @@ -894,138 +883,138 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalSlNo && ( - # - ) + # + ) : SLNO && #} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - Qty - - )} + + Qty + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -1035,117 +1024,117 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage || 0} - - ) + + {item?.ProdTaxPercentage || 0} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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} + + )} ); })} @@ -1414,17 +1403,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(); @@ -1643,126 +1632,86 @@ const Printstyle4 = ({ /-{' '}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 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' ? ( @@ -1771,59 +1720,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 - )} -
    -
    - )} + )}
    )} @@ -1835,7 +1784,7 @@ const Printstyle4 = ({ extractLastNumber(table2Data?.SalesId)}
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1855,7 +1804,6 @@ const Printstyle4 = ({ )} )} - {GlobaldummyData && GlobalCashierName && (
    {' '} @@ -1929,28 +1877,28 @@ const Printstyle4 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -1970,137 +1918,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 +

    + +
    + )}
    )}
    @@ -2376,16 +2324,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(); @@ -2604,124 +2552,84 @@ const Printstyle4 = ({ /-{' '}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 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' ? ( @@ -2730,55 +2638,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)} -
    -
    - )} + )}
    )}
    @@ -2789,7 +2697,7 @@ const Printstyle4 = ({ extractLastNumber(table2Data?.SalesId)}
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

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

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2923,137 +2831,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 +

    + +
    + )}
    )}
    @@ -3136,18 +3044,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 + : '')}
    {' '} @@ -3179,10 +3087,10 @@ const Printstyle4 = ({ {GlobaldummyData ? '51' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    @@ -3245,48 +3153,48 @@ const Printstyle4 = ({ : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - Qty - - )} + + Qty + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {/* {GlobaldummyData ? GlobalTax && ( - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3344,114 +3252,114 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    - - )} + +
    {item?.ProdName}
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} + + {item?.SalesQty} +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} - {( - (item?.ProductIdentifierDtls - ?.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, index) => { - const imei1 = - item2.IMEI1 || ''; - const imei2 = - item2.IMEI2 || ''; - return ` ${[imei1, imei2].filter(Boolean).join(',')}`; - }) - .join('') - : '') - ).trim()} -
    - ) : ( -
    - {( - (item?.Size || '1') + - (item?.SinglePc === 'Y' - ? ' PCS' - : item?.Type !== 'C' - ? ` ${item?.UomName}` - : ' COMBO') + - (item?.BrandName - ? ` ${item?.BrandName}` - : '') + - (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, index) => { - const imei1 = - item2.IMEI1 || ''; - const imei2 = - item2.IMEI2 || ''; - return ` ${[imei1, imei2].filter(Boolean).join(',')}`; - }) - .join('') - : '') - ).trim()} -
    - )} -
    - - ) + {( + (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, index) => { + const imei1 = + item2.IMEI1 || ''; + const imei2 = + item2.IMEI2 || ''; + return ` ${[imei1, imei2].filter(Boolean).join(',')}`; + }) + .join('') + : '') + ).trim()} +
    + ) : ( +
    + {( + (item?.Size || '1') + + (item?.SinglePc === 'Y' + ? ' PCS' + : item?.Type !== 'C' + ? ` ${item?.UomName}` + : ' COMBO') + + (item?.BrandName + ? ` ${item?.BrandName}` + : '') + + (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, index) => { + const imei1 = + item2.IMEI1 || ''; + const imei2 = + item2.IMEI2 || ''; + return ` ${[imei1, imei2].filter(Boolean).join(',')}`; + }) + .join('') + : '') + ).trim()} +
    + )} +
    + + ) : Quantity && ( - - {item?.SalesQty} - {/*
    + + {item?.SalesQty} + {/*
    {PackageDetails?.filter( (pkg) => pkg.ProdId === item.ProdId ).length > 0 ? ( @@ -3540,119 +3448,119 @@ const Printstyle4 = ({
    )}
    */} - - )} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - {GlobaldummyData - ? GlobalTax && ( - - {/* */} - - GST:{' '} - {' '} - {item?.ProdTaxPercentage || 0} - - ) - : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {/* */} - - GST:{' '} - {' '} - {item?.ProdTaxPercentage || 0} - - )} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + {GlobaldummyData + ? GlobalTax && ( + + {/* */} + + GST:{' '} + {' '} + {item?.ProdTaxPercentage || 0} + + ) + : Tax == true && + table2Data?.OrderType !== 'E' && ( + + {/* */} + + GST:{' '} + {' '} + {item?.ProdTaxPercentage || 0} + + )} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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} + + )} ); } @@ -3686,48 +3594,48 @@ const Printstyle4 = ({ : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - Qty - - )} + + Qty + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {/* {GlobaldummyData ? GlobalTax && ( - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3785,118 +3693,118 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    - - )} + +
    {item?.ProdName}
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {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'} + ) +
    + + ) : Quantity && ( - - {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'} + ) +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage || 0} - - ) + + {item?.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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} + + )} ); } @@ -4133,14 +4041,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(); @@ -4355,121 +4263,81 @@ const Printstyle4 = ({ /-{' '}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 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' ? ( @@ -4478,62 +4346,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 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4547,7 +4414,6 @@ const Printstyle4 = ({ ))} )} - {GlobaldummyData && GlobalCashierName && (
    {' '} @@ -4617,21 +4483,21 @@ const Printstyle4 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -4651,136 +4517,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/PrintTemplates/ThermalPrinter/PrintStyle5.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx index ec2633e..ee2bed5 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx @@ -79,7 +79,7 @@ const PrintStyle5 = ({ const CashierNameField = FieldDetails?.['CashierName']; const LogoField = FieldDetails?.['Logo']; const CreditDetails = FieldDetails?.['Credit details']; - const WeightasKg = FieldDetails?.['Weight']; + const WeightasKg = FieldDetails?.['Weight']; const GlobalSlNo = useSelector(GlobalprintSlNo); const GlobalItem = useSelector(GlobalprintItem); const GlobalMRP = useSelector(GlobalprintMRP); @@ -138,17 +138,6 @@ const PrintStyle5 = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); - const isEditedBill = PaymentStatus?.some(payment => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ) const keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); @@ -334,8 +323,8 @@ const PrintStyle5 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -382,7 +371,7 @@ const PrintStyle5 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    {' '} @@ -477,10 +466,10 @@ const PrintStyle5 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )}{' '} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}{' '}
    {' '}
    @@ -518,15 +507,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - S.No -
    - ) +
    + S.No +
    + ) : SLNO && ( -
    - S.No -
    - )} +
    + S.No +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -547,78 +536,78 @@ const PrintStyle5 = ({ : Item && 'ITEM /DES /'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ? 'QTY/Kg' : 'QTY'}{' '} + : Quantity && WeightasKg ?'QTY/Kg' :'QTY'}{' '}
    )} {GlobaldummyData ? GlobalHsnCode && ( -
    - HSN -
    - ) +
    + HSN +
    + ) : HsnCode && ( -
    - HSN -
    - )} +
    + HSN +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - MRP -
    - ) +
    + MRP +
    + ) : MRP && ( -
    - MRP -
    - )} +
    + MRP +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - RATE -
    - ) +
    + RATE +
    + ) : Rate && ( -
    - RATE -
    - )} +
    + RATE +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - DIS{' '} -
    - ) +
    + DIS{' '} +
    + ) : Discount && ( -
    - DIS{' '} -
    - )} +
    + DIS{' '} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - TAX %{' '} -
    - ) +
    + TAX %{' '} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - TAX %{' '} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + TAX %{' '} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {' '} - Amt{' '} -
    - ) +
    + {' '} + Amt{' '} +
    + ) : Amount && ( -
    - {' '} - AMT{' '} -
    - )} +
    + {' '} + AMT{' '} +
    + )}

    @@ -638,19 +627,19 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - {index + 1} -
    - ) +
    + {index + 1} +
    + ) : SLNO && ( -
    - {chunkIndex * chunkSize + index + 1} -
    - )} +
    + {chunkIndex * chunkSize + index + 1} +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -772,102 +761,102 @@ const PrintStyle5 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( -
    - {item?.HSN} -
    - ) +
    + {item?.HSN} +
    + ) : HsnCode && ( -
    - {item?.HSN} -
    - )} +
    + {item?.HSN} +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - {item?.MRP} -
    - ) +
    + {item?.MRP} +
    + ) : MRP && ( -
    - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} -
    - )} +
    + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - {item?.Rate} -
    - ) +
    + {item?.Rate} +
    + ) : Rate && ( -
    - {item?.Rate} -
    - )} +
    + {item?.Rate} +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - {item?.discount} -
    - ) +
    + {item?.discount} +
    + ) : Discount && ( -
    - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} -
    - )} +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - {item?.ProdTaxPercentage} -
    - ) +
    + {item?.ProdTaxPercentage} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - {item?.ProdTaxPercentage || 0} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {item?.TotalAmt} -
    - ) +
    + {item?.TotalAmt} +
    + ) : Amount && ( -
    - {' '} - {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} +
    + )}
    ))} @@ -897,15 +886,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - S.No -
    - ) +
    + S.No +
    + ) : SLNO && ( -
    - S.No -
    - )} +
    + S.No +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -926,78 +915,78 @@ const PrintStyle5 = ({ : Item && 'ITEM /DES /'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ? 'Qty/Kg' : 'Qty'}{' '} + : Quantity && WeightasKg ?'Qty/Kg' :'Qty'}{' '}
    )} {GlobaldummyData ? GlobalHsnCode && ( -
    - HSN -
    - ) +
    + HSN +
    + ) : HsnCode && ( -
    - HSN -
    - )} +
    + HSN +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - MRP -
    - ) +
    + MRP +
    + ) : MRP && ( -
    - MRP -
    - )} +
    + MRP +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - RATE -
    - ) +
    + RATE +
    + ) : Rate && ( -
    - RATE -
    - )} +
    + RATE +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - DIS{' '} -
    - ) +
    + DIS{' '} +
    + ) : Discount && ( -
    - DIS{' '} -
    - )} +
    + DIS{' '} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - TAX %{' '} -
    - ) +
    + TAX %{' '} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - TAX %{' '} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + TAX %{' '} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {' '} - Amt{' '} -
    - ) +
    + {' '} + Amt{' '} +
    + ) : Amount && ( -
    - {' '} - AMT{' '} -
    - )} +
    + {' '} + AMT{' '} +
    + )}

    @@ -1017,19 +1006,19 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - {index + 1} -
    - ) +
    + {index + 1} +
    + ) : SLNO && ( -
    - {chunkIndex * chunkSize + index + 1} -
    - )} +
    + {chunkIndex * chunkSize + index + 1} +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -1085,102 +1074,102 @@ const PrintStyle5 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( -
    - {item?.HSN} -
    - ) +
    + {item?.HSN} +
    + ) : HsnCode && ( -
    - {item?.HSN} -
    - )} +
    + {item?.HSN} +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - {item?.MRP} -
    - ) +
    + {item?.MRP} +
    + ) : MRP && ( -
    - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} -
    - )} +
    + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - {item?.Rate} -
    - ) +
    + {item?.Rate} +
    + ) : Rate && ( -
    - {item?.Rate} -
    - )} +
    + {item?.Rate} +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - {item?.discount} -
    - ) +
    + {item?.discount} +
    + ) : Discount && ( -
    - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} -
    - )} +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - {item?.ProdTaxPercentage} -
    - ) +
    + {item?.ProdTaxPercentage} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - {item?.ProdTaxPercentage || 0} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {item?.TotalAmt} -
    - ) +
    + {item?.TotalAmt} +
    + ) : Amount && ( -
    - {' '} - {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} +
    + )}
    ))} @@ -1376,18 +1365,18 @@ const PrintStyle5 = ({ {/* {ExtraChargeTotal>0 &&
    Extra Charges :
    {ExtraChargeTotal}
    } */} {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - {' '} -
    Off :
    {' '} -
    - {GlobaldummyData - ? '100' - : Number( +
    + {' '} +
    Off :
    {' '} +
    + {GlobaldummyData + ? '100' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    {' '} -
    - )} +
    {' '} +
    + )}
    @@ -1464,76 +1453,36 @@ const PrintStyle5 = ({ /-{' '}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0] .OldCreditBal > 0 ? ( @@ -1545,7 +1494,7 @@ const PrintStyle5 = ({ }

    ) : table2Data.CustomerDetails[0] - .OldCreditBal < 0 ? ( + .OldCreditBal < 0 ? (

    {' '} Opening Balance:{' '} @@ -1558,30 +1507,30 @@ const PrintStyle5 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0] - .CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - { - table2Data.CustomerDetails[0] - .CurrentCreditBal - } -

    - ) : table2Data.CustomerDetails[0] - .CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0] - .CurrentCreditBal - )} -

    - ) : null} -
    - )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0] + .CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + { + table2Data.CustomerDetails[0] + .CurrentCreditBal + } +

    + ) : table2Data.CustomerDetails[0] + .CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0] + .CurrentCreditBal + )} +

    + ) : null} +
    + )}
    {/*
    TOTAL SAVING : 10.00
    */}
    @@ -1592,54 +1541,54 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - {' '} - {' '} +
    + {' '} + {' '} +
    +
    Scan to Pay
    +
    + {' '} + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed( + 2 + )} +
    -
    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 + )} +
    -
    - )} + )}
    )}
    @@ -1649,7 +1598,7 @@ const PrintStyle5 = ({ extractLastNumber(table2Data?.SalesId)}
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1733,23 +1682,23 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -1769,138 +1718,138 @@ const PrintStyle5 = ({ > {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 +

    + +
    + )}
    )}
    @@ -2129,8 +2078,8 @@ const PrintStyle5 = ({ {GlobaldummyData ? '100' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    {' '}
    )} @@ -2204,79 +2153,39 @@ const PrintStyle5 = ({ /-{' '}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: { @@ -2285,7 +2194,7 @@ const PrintStyle5 = ({ }

    ) : table2Data.CustomerDetails[0] - .OldCreditBal < 0 ? ( + .OldCreditBal < 0 ? (

    {' '} Opening Balance:{' '} @@ -2298,30 +2207,30 @@ const PrintStyle5 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - { - table2Data.CustomerDetails[0] - .CurrentCreditBal - } -

    - ) : table2Data.CustomerDetails[0] - .CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0] - .CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + { + table2Data.CustomerDetails[0] + .CurrentCreditBal + } +

    + ) : table2Data.CustomerDetails[0] + .CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0] + .CurrentCreditBal + )} +

    + ) : null} +
    + )}
    {/*
    TOTAL SAVING : 10.00
    */}
    @@ -2332,47 +2241,47 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - {' '} - {' '} +
    + {' '} + {' '} +
    +
    Scan to Pay
    +
    + {' '} + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    -
    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)} +
    -
    - )} + )}
    )}
    @@ -2382,7 +2291,7 @@ const PrintStyle5 = ({ extractLastNumber(table2Data?.SalesId)}
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2460,23 +2369,23 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2496,138 +2405,138 @@ const PrintStyle5 = ({ > {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 +

    + +
    + )}
    )}
    @@ -2674,7 +2583,7 @@ const PrintStyle5 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    {' '} @@ -2767,10 +2676,10 @@ const PrintStyle5 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )}{' '} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}{' '}
    {' '}
    @@ -2802,15 +2711,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - S.No -
    - ) +
    + S.No +
    + ) : SLNO && ( -
    - S.No -
    - )} +
    + S.No +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -2829,78 +2738,78 @@ const PrintStyle5 = ({ : Item && 'ITEM /DES /'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ? 'Qty/Kg' : 'Qty'}{' '} + : Quantity && WeightasKg ?'Qty/Kg' :'Qty'}{' '}
    )} {GlobaldummyData ? GlobalHsnCode && ( -
    - HSN -
    - ) +
    + HSN +
    + ) : HsnCode && ( -
    - HSN -
    - )} +
    + HSN +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - MRP -
    - ) +
    + MRP +
    + ) : MRP && ( -
    - MRP -
    - )} +
    + MRP +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - RATE -
    - ) +
    + RATE +
    + ) : Rate && ( -
    - RATE -
    - )} +
    + RATE +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - DIS{' '} -
    - ) +
    + DIS{' '} +
    + ) : Discount && ( -
    - DIS{' '} -
    - )} +
    + DIS{' '} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - TAX %{' '} -
    - ) +
    + TAX %{' '} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - TAX %{' '} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + TAX %{' '} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {' '} - Amt{' '} -
    - ) +
    + {' '} + Amt{' '} +
    + ) : Amount && ( -
    - {' '} - AMT{' '} -
    - )} +
    + {' '} + AMT{' '} +
    + )}

    @@ -2921,15 +2830,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - {index + 1} -
    - ) +
    + {index + 1} +
    + ) : SLNO && ( -
    - {index + 1} -
    - )} +
    + {index + 1} +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -3054,76 +2963,76 @@ const PrintStyle5 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( -
    - {item?.HSN} -
    - ) +
    + {item?.HSN} +
    + ) : HsnCode && ( -
    - {item?.HSN} -
    - )} +
    + {item?.HSN} +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - {item?.MRP} -
    - ) +
    + {item?.MRP} +
    + ) : MRP && ( -
    - {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} -
    - )} +
    + {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - {item?.Rate} -
    - ) +
    + {item?.Rate} +
    + ) : Rate && ( -
    - {item?.Rate} -
    - )} +
    + {item?.Rate} +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - {item?.discount} -
    - ) +
    + {item?.discount} +
    + ) : Discount && ( -
    - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} -
    - )} +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - {item?.ProdTaxPercentage} -
    - ) +
    + {item?.ProdTaxPercentage} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - {item?.ProdTaxPercentage || 0} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {item?.TotalAmt} -
    - ) +
    + {item?.TotalAmt} +
    + ) : Amount && ( -
    - {' '} - {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} +
    + )}
    ) )} @@ -3154,15 +3063,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - S.No -
    - ) +
    + S.No +
    + ) : SLNO && ( -
    - S.No -
    - )} +
    + S.No +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -3181,78 +3090,78 @@ const PrintStyle5 = ({ : Item && 'ITEM /DES /'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ? 'Qty/Kg' : 'Qty'}{' '} + : Quantity && WeightasKg ?'Qty/Kg' :'Qty'}{' '}
    )} {GlobaldummyData ? GlobalHsnCode && ( -
    - HSN -
    - ) +
    + HSN +
    + ) : HsnCode && ( -
    - HSN -
    - )} +
    + HSN +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - MRP -
    - ) +
    + MRP +
    + ) : MRP && ( -
    - MRP -
    - )} +
    + MRP +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - RATE -
    - ) +
    + RATE +
    + ) : Rate && ( -
    - RATE -
    - )} +
    + RATE +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - DIS{' '} -
    - ) +
    + DIS{' '} +
    + ) : Discount && ( -
    - DIS{' '} -
    - )} +
    + DIS{' '} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - TAX %{' '} -
    - ) +
    + TAX %{' '} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - TAX %{' '} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + TAX %{' '} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {' '} - Amt{' '} -
    - ) +
    + {' '} + Amt{' '} +
    + ) : Amount && ( -
    - {' '} - AMT{' '} -
    - )} +
    + {' '} + AMT{' '} +
    + )}

    @@ -3273,15 +3182,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - {index + 1} -
    - ) +
    + {index + 1} +
    + ) : SLNO && ( -
    - {index + 1} -
    - )} +
    + {index + 1} +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -3337,76 +3246,76 @@ const PrintStyle5 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( -
    - {item?.HSN} -
    - ) +
    + {item?.HSN} +
    + ) : HsnCode && ( -
    - {item?.HSN} -
    - )} +
    + {item?.HSN} +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - {item?.MRP} -
    - ) +
    + {item?.MRP} +
    + ) : MRP && ( -
    - {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} -
    - )} +
    + {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - {item?.Rate} -
    - ) +
    + {item?.Rate} +
    + ) : Rate && ( -
    - {item?.Rate} -
    - )} +
    + {item?.Rate} +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - {item?.discount} -
    - ) +
    + {item?.discount} +
    + ) : Discount && ( -
    - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} -
    - )} +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - {item?.ProdTaxPercentage} -
    - ) +
    + {item?.ProdTaxPercentage} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - {item?.ProdTaxPercentage || 0} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {item?.TotalAmt} -
    - ) +
    + {item?.TotalAmt} +
    + ) : Amount && ( -
    - {' '} - {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} +
    + )}
    ) )} @@ -3580,8 +3489,8 @@ const PrintStyle5 = ({ {GlobaldummyData ? '100' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    {' '}
    )} @@ -3658,76 +3567,36 @@ const PrintStyle5 = ({ /-{' '}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > 0 ? (

    @@ -3747,25 +3616,25 @@ const PrintStyle5 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    {/*
    TOTAL SAVING : 10.00
    */}
    @@ -3776,47 +3645,47 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - {' '} - {' '} +
    + {' '} + {' '} +
    +
    Scan to Pay
    +
    + {' '} + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    -
    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)} +
    -
    - )} + )}
    )}
    @@ -3825,7 +3694,7 @@ const PrintStyle5 = ({ {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

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

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -3940,137 +3809,137 @@ const PrintStyle5 = ({ > {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. - ))} -
      -
    - )} +
  • + Please check the product before leaving the + counter. +
  • + +
    + ) + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && ( +
    +

    + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} +
    +
    + )} {GlobaldummyData ? GlobalSignature && ( -
    -

    - Signature -

    - -
    - ) +

    + Signature +

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

    - Signature -

    - -
    - )} +

    + Signature +

    + +
    + )}
    )}
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx index fde7306..2f03b14 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx @@ -102,7 +102,6 @@ const Printstyle6 = ({ const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); const SettingData = useSelector(PreferenceData); - console.log(CashierNameField, "GlobaldummyData") const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find( (setting) => @@ -124,17 +123,6 @@ const Printstyle6 = ({ const paymentTypeUPI = PaymentStatus?.find( (ps) => ps.PaymentTypeName === 'UPI' ); - const isEditedBill = PaymentStatus?.some(payment => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ) console.log(GlobalDiscount, Discount, 'Discount'); @@ -347,8 +335,8 @@ const Printstyle6 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -403,7 +391,7 @@ const Printstyle6 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( - {table2Data?.BrMobile &&
    +
    Mobile : {table2Data?.BrMobile} -
    } +
    {table2Data?.OrderType === 'E' && (
    {Date1}
    @@ -535,8 +523,8 @@ const Printstyle6 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( @@ -556,136 +544,136 @@ const Printstyle6 = ({ : Item && 'ITEM /DES/'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ? 'QTY/KG' : 'QTY'} + : Quantity && WeightasKg ?'QTY/KG' :'QTY'} )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - AMt - - ) + + AMt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -695,10 +683,10 @@ const Printstyle6 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( {item?.ProdName}
    {item?.Size + - item?.UomName + - '-' + - GlobaldummyData + item?.UomName + + '-' + + GlobaldummyData ? GlobalQuantity && item?.SalesQty : item?.SalesQty}
    @@ -790,90 +778,90 @@ const Printstyle6 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); })} @@ -901,8 +889,8 @@ const Printstyle6 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( @@ -922,136 +910,136 @@ const Printstyle6 = ({ : Item && 'ITEM /DES/'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ? 'QTY/KG' : 'QTY'} + : Quantity && WeightasKg ?'QTY/KG' :'QTY'} )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - AMt - - ) + + AMt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -1061,10 +1049,10 @@ const Printstyle6 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( {item?.ProdName}
    {item?.Size + - item?.UomName + - '-' + - GlobaldummyData + item?.UomName + + '-' + + GlobaldummyData ? GlobalQuantity && item?.SalesQty : item?.SalesQty}
    @@ -1106,139 +1094,139 @@ const Printstyle6 = ({ > {(GlobaldummyData ? GlobalItem && - item?.ProdName + - `(${item?.Size + item?.UomName})` + item?.ProdName + + `(${item?.Size + item?.UomName})` : Item && - item?.ProdName + - `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})`) + + item?.ProdName + + `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})`) + item?.BrandName !== - null + null ? item?.BrandName : '' + - item?.ProductIdentifierDtls - ?.length > - 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return
    {a.SerialNumber}
    ; - }) - : '' + - item?.ProductIdentifierDtls - ?.length > + 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?.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(',')} +
    + ); + }) : '' + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : Quantity && item?.SalesQty)} + '-' + + (GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : Quantity && item?.SalesQty)} )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); })} @@ -1279,17 +1267,17 @@ const Printstyle6 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    -
    - Off :{' '} - {GlobaldummyData - ? '10' - : Number( + Off :{' '} + {GlobaldummyData + ? '10' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )}
    {table2Data?.OrderType === 'E' ? ( @@ -1661,80 +1649,41 @@ const Printstyle6 = ({ : Number(table2Data?.NetAmount).toFixed(2)}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -1752,28 +1701,28 @@ const Printstyle6 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} - {(PaymentStatus?.length > 1 && !isEditedBill) && ( + {PaymentStatus?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -1797,48 +1746,48 @@ const Printstyle6 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} +
    + QRcode +
    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 + )} +
    -
    - )} + )}
    )}
    @@ -1861,7 +1810,7 @@ const Printstyle6 = ({
    {/*
    Card No
    */} - {GlobaldummyData && GlobalCashierName && ( + {GlobaldummyData && (
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2080,137 +2028,137 @@ const Printstyle6 = ({ > {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 +

    + +
    + )}
    )}
    @@ -2284,8 +2232,8 @@ const Printstyle6 = ({ {GlobaldummyData ? '10' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -2662,81 +2610,40 @@ const Printstyle6 = ({
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -2754,27 +2661,27 @@ const Printstyle6 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} - {(PaymentStatus?.length > 1 && !isEditedBill) && ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} + {PaymentStatus?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2798,44 +2705,44 @@ const Printstyle6 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} +
    + QRcode +
    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)} +
    -
    - )} + )}
    )}
    @@ -2858,7 +2765,7 @@ const Printstyle6 = ({
    {/*
    Card No
    */} - {GlobaldummyData && GlobalCashierName && ( + {GlobaldummyData && (
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -3074,137 +2980,137 @@ const Printstyle6 = ({ > {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 +

    + +
    + )}
    )}
    @@ -3255,7 +3161,7 @@ const Printstyle6 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( - {table2Data?.BrMobile &&
    +
    Mobile : {table2Data?.BrMobile} -
    } +
    {table2Data?.OrderType === 'E' && (
    {Date1}
    @@ -3401,76 +3307,76 @@ const Printstyle6 = ({ : Item && 'ITEM /DES/'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ? 'QTY/KG' : 'QTY'} + : Quantity && WeightasKg ?'QTY/KG' :'QTY'} )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - AMt - - ) + + AMt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3503,9 +3409,9 @@ const Printstyle6 = ({
    {item?.ProdName}
    {item?.Size + - item?.UomName + - '-' + - GlobaldummyData + item?.UomName + + '-' + + GlobaldummyData ? GlobalQuantity && item?.SalesQty : item?.SalesQty}
    @@ -3566,89 +3472,89 @@ const Printstyle6 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3694,76 +3600,76 @@ const Printstyle6 = ({ : Item && 'ITEM /DES/'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ? 'QTY/KG' : 'QTY'} + : Quantity && WeightasKg ?'QTY/KG' :'QTY'} )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - AMt - - ) + + AMt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3796,9 +3702,9 @@ const Printstyle6 = ({
    {item?.ProdName}
    {item?.Size + - item?.UomName + - '-' + - GlobaldummyData + item?.UomName + + '-' + + GlobaldummyData ? GlobalQuantity && item?.SalesQty : item?.SalesQty}
    @@ -3813,133 +3719,133 @@ const Printstyle6 = ({ > {(GlobaldummyData ? GlobalItem && - item?.ProdName + - `(${item?.Size + item?.UomName})` + item?.ProdName + + `(${item?.Size + item?.UomName})` : Item && - item?.ProdName + - `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})`) + + item?.ProdName + + `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})`) + item?.BrandName !== - null + 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(',')} -
    - ); + (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(',')} +
    + ); + }) : '' + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : Quantity && item?.SalesQty)} + '-' + + (GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : Quantity && item?.SalesQty)} )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3978,8 +3884,8 @@ const Printstyle6 = ({ {GlobaldummyData ? '10' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -4336,110 +4242,70 @@ const Printstyle6 = ({ : Number(table2Data?.NetAmount).toFixed(2)}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} -

    - ) : null} - - )} + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} +

    + ) : null} + + )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} -

    - ) : null} -
    - )} - {(PaymentStatus?.length > 1 && !isEditedBill) && ( + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} +

    + ) : null} +
    + )} + {PaymentStatus?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4462,44 +4328,44 @@ const Printstyle6 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} +
    + QRcode +
    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)} +
    -
    - )} + )}
    )}
    @@ -4522,7 +4388,7 @@ const Printstyle6 = ({
    {/*
    Card No
    */} - {GlobaldummyData && GlobalCashierName && ( + {GlobaldummyData && (
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -4730,136 +4595,136 @@ const Printstyle6 = ({ > {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/PrintTemplates/ThermalPrinter/PrintStyle7.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx index 85ed1dd..6ef6187 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx @@ -1,4300 +1,1433 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import QRcode from '../../../../Images/QRcode.png'; +import QRcode from '../../../../Images/QRcode.png' import { extractLastNumberOrderId } from '../../../../Services/Others'; import { - GlobalprintSlNo, - GlobalprintItem, - GlobalprintMRP, - GlobalprintDiscount, - GlobalprintQuantity, - GlobalprintRate, - GlobalprintAmount, - GlobalprintHsnCode, - GlobalprintQrcodet, - GlobalPritdummyData, - GloabalFieldDetails, - changeReprintDataFound, - GlobalprintSignature, - GlobalprinttermsAndConditions, - GlobalSignatureImage, - Globalnotes, - GlobalthemeFormat, - GlobalBillName, - GlobalprintCashierName, - GlobalprintLogo, - GlobalprintCredit, - GlobalprintTax, + GlobalprintSlNo, + GlobalprintItem, + GlobalprintMRP, + GlobalprintDiscount, + GlobalprintQuantity, + GlobalprintRate, + GlobalprintAmount, + GlobalprintHsnCode, + GlobalprintQrcodet, + GlobalPritdummyData, + GloabalFieldDetails, + changeReprintDataFound, + GlobalprintSignature, + GlobalprinttermsAndConditions, + GlobalSignatureImage, + Globalnotes, + GlobalthemeFormat, + GlobalBillName, + GlobalprintCashierName, + GlobalprintLogo, + GlobalprintCredit, + GlobalprintTax, } from '../../../../Features/ThemeChange/ThemeChange'; -import Logo from '../../../../Images/Logo.jpg'; -import { - GlobalUpiIDprint, - PreferenceData, -} from '../../../../Features/BookingScreen/BookingData/BookingData'; -import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.scss'; +import Logo from '../../../../Images/Logo.jpg' +import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import "../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.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'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; -const PrintStyle7 = ({ - index, - ExtraChargeTotal, - Date1, - totalQuantityFilter, - CashierName, - totalQuantity, - OrderDetailGST, - OrderDetailIGST, - OrderDetailVAT, - table2Data, - PaymentStatus, - PrintGreeting, - base64Image, - PrintLogo, - printDatas, - isPdf, - sportsAppPreference, - SalesModePref, - MembershipApplied = null, +const PrintStyle7 = ({ index, ExtraChargeTotal, Date1, totalQuantityFilter, CashierName, totalQuantity, OrderDetailGST, + OrderDetailIGST, OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, base64Image, PrintLogo, printDatas, isPdf, sportsAppPreference, SalesModePref, + MembershipApplied = null }) => { - const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint); - const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.['Sl.No']; - const Item = FieldDetails?.['Item']; - const MRP = FieldDetails?.['MRP']; - const Discount = FieldDetails?.['Discount']; - const Tax = FieldDetails?.['Tax']; - const Quantity = FieldDetails?.['Quantity']; - const Rate = FieldDetails?.['Rate']; - const Amount = FieldDetails?.['Amount']; - const HsnCode = FieldDetails?.['HsnCode']; - const Qrcodet = FieldDetails?.['Qrcode']; - const CashierNameField = FieldDetails?.['CashierName']; - const LogoField = FieldDetails?.['Logo']; - const CreditDetails = FieldDetails?.['Credit details']; - const WeightasKg = FieldDetails?.['Weight']; - const GlobalSlNo = useSelector(GlobalprintSlNo); - const GlobalItem = useSelector(GlobalprintItem); - const GlobalMRP = useSelector(GlobalprintMRP); - const GlobalDiscount = useSelector(GlobalprintDiscount); - const GlobalTax = useSelector(GlobalprintTax); - 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); - const appPreferences = useSelector(ApplicationPreferences); - const GlobalCashierName = useSelector(GlobalprintCashierName); - const GlobalLogo = useSelector(GlobalprintLogo); - const GlobalCredit = useSelector(GlobalprintCredit); - const SettingData = useSelector(PreferenceData); - const estimatePrintHeader = - SettingData?.[0]?.SettingDtlDetails?.find( - (setting) => - setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' - )?.SettingValue === 'Y'; - const bookingTypePreference = appPreferences?.find( - (preference) => preference?.PreferredCatName === 'Booking Type' - )?.PreferenceCatDetails; - const dinePreference = bookingTypePreference?.find( - (type) => - type?.PreferredSubCatName?.toLowerCase() === 'dine in' && - type?.PreferredStatus === 'Y' - ); - const takeAwayPreference = bookingTypePreference?.find( - (type) => - type?.PreferredSubCatName?.toLowerCase() === 'take away' && - type?.PreferredStatus === 'Y' - ); - const paymentTypeUPI = PaymentStatus?.find( - (ps) => ps.PaymentTypeName === 'UPI' - ); - console.log(GlobalDiscount, Discount, 'Discount'); - console.log(printDatas, 'printDatasjk'); - const isEditedBill = PaymentStatus?.some((payment) => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ); + const dispatch = useDispatch(); + const GlobalUpiID = useSelector(GlobalUpiIDprint) + const FieldDetails = useSelector(GloabalFieldDetails); + const SLNO = FieldDetails?.["Sl.No"]; + const Item = FieldDetails?.["Item"]; + const MRP = FieldDetails?.["MRP"]; + const Discount = FieldDetails?.["Discount"]; + const Tax = FieldDetails?.["Tax"]; + const Quantity = FieldDetails?.["Quantity"]; + const Rate = FieldDetails?.["Rate"]; + const Amount = FieldDetails?.["Amount"]; + const HsnCode = FieldDetails?.["HsnCode"]; + const Qrcodet = FieldDetails?.["Qrcode"]; + const CashierNameField = FieldDetails?.["CashierName"]; + const LogoField = FieldDetails?.["Logo"]; + const CreditDetails = FieldDetails?.["Credit details"]; + const WeightasKg = FieldDetails?.['Weight']; + const GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalMRP = useSelector(GlobalprintMRP); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalTax = useSelector(GlobalprintTax); + 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) + const appPreferences = useSelector(ApplicationPreferences); + const GlobalCashierName = useSelector(GlobalprintCashierName); + const GlobalLogo = useSelector(GlobalprintLogo); + const GlobalCredit = useSelector(GlobalprintCredit); + const SettingData = useSelector(PreferenceData); + const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' + const bookingTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Booking Type')?.PreferenceCatDetails + const dinePreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "dine in" && type?.PreferredStatus === 'Y') + const takeAwayPreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "take away" && type?.PreferredStatus === 'Y') + const paymentTypeUPI = PaymentStatus?.find((ps) => ps.PaymentTypeName === "UPI") + console.log(GlobalDiscount, Discount, "Discount"); + console.log(printDatas, "printDatasjk") + let TermsAndConditions = printDatas?.TermsandConditions + let SignatureImg = printDatas?.Signature + let Notestext = printDatas?.Notes + let BillName = printDatas?.PrintHdrName + let FormatTheme = printDatas?.PrintType == "S" ? true : false + let PageSize = printDatas?.PageSize + const Signature = FieldDetails?.["signature"]; + const TermsnAdCondition = FieldDetails?.["terms&conditions"]; + const PackageDetails = table2Data?.PackageDtl; - let TermsAndConditions = printDatas?.TermsandConditions; - let SignatureImg = printDatas?.Signature; - let Notestext = printDatas?.Notes; - let BillName = printDatas?.PrintHdrName; - let FormatTheme = printDatas?.PrintType == 'S' ? true : false; - let PageSize = printDatas?.PageSize; - const Signature = FieldDetails?.['signature']; - const TermsnAdCondition = FieldDetails?.['terms&conditions']; - const PackageDetails = table2Data?.PackageDtl; - - 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 formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; - const TakeawayData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' - ); - const DineInData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === 'dine in' - ); - - const TakeawayTotal = TakeawayData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0 - ); - const DineInTotal = DineInData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0 - ); - const aggregatedPayments = PaymentStatusSuccess?.reduce( - (acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); - - if (acc[paymentType]) { - acc[paymentType] += amount; - } else { - acc[paymentType] = amount; - } - - return acc; - }, - {} - ); - 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; + let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") + const keysLength = Object.keys(table2Data ?? {}).length; + if (keysLength > 0) { + dispatch(changeReprintDataFound(true)); } - }); - const hasMappedOffer = offers.some((offer) => - ['ItemWiseOffers', 'BundleOffers', 'QuantityWiseOffers'].includes( - offer.TableName - ) - ); + 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); - if (hasMappedOffer) { - const productTotal = productsData?.reduce( - (acc, item) => - acc + (item?.Type != 'C' ? item.OfferAmt : item.OfferValue || 0), - 0 + const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; + const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") + const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") + + const TakeawayTotal = TakeawayData?.reduce( + (accumulator, currentValue) => accumulator + currentValue.TotalAmt, + 0, ); - TotalOfferAmount += productTotal; - } else { - const Combothere = productsData?.filter((item) => item?.Type == 'C'); - const CombothereTotal = Combothere?.reduce( - (acc, item) => acc + (item.OfferValue || 0), - 0 + const DineInTotal = DineInData?.reduce( + (accumulator, currentValue) => accumulator + currentValue.TotalAmt, + 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', - ProdTaxPercentage: 5, - }, - { - ProdName: 'ITEM 2', - Rate: 300.0, - SalesQty: 1, - MRP: 350, - TotalAmt: 300, - discount: 0, - HSN: '02', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 5, - }, - { - ProdName: 'ITEM 3', - Rate: 200.0, - SalesQty: 1, - MRP: 250, - TotalAmt: 200, - discount: 0, - HSN: '03', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 0, - }, - { - ProdName: 'ITEM 4', - Rate: 30.0, - SalesQty: 1, - MRP: 50, - TotalAmt: 30, - discount: 0, - HSN: '04', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 18, - }, - { - ProdName: 'ITEM 5', - Rate: 30.0, - SalesQty: 1, - MRP: 50, - TotalAmt: 30, - discount: 0, - HSN: '05', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 40, - }, - { - ProdName: 'ITEM 6', - Rate: 130.0, - SalesQty: 1, - MRP: 150, - TotalAmt: 130, - discount: 0, - HSN: '06', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 0, - }, - { - ProdName: 'ITEM 7', - Rate: 230.0, - SalesQty: 1, - MRP: 250, - TotalAmt: 230, - discount: 0, - HSN: '08', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 5, - }, - ]; + const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { + const paymentType = paymentdata?.PaymentTypeName; + const amount = Number(paymentdata?.Amount); - const chunkSize = PageSize == 'A5' ? 8 : 11; - let dataSource = []; + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } - if (GlobaldummyData || TakeawayData?.length > 0) { - dataSource = GlobaldummyData ? products : TakeawayData; - } else if (DineInData?.length > 0) { - dataSource = DineInData; - } + return acc; + }, {}); + const productsData = table2Data?.productDetails || []; + const offers = table2Data?.OrderOfferDetails || []; - // 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); + let TotalOfferAmount = 0; - return ( - <> - {FormatTheme ? ( -
    - {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    0 ? ' print-page-break' : ''}` - } - style={{ - display: 'flex', - flexDirection: 'column', - justifyContent: - chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme - ? 'space-between' - : '', - height: isMobile - ? '295mm' - : FormatTheme - ? PageSize == 'A5' - ? '170mm' - : '257mm' - : '', - }} - key={chunkIndex} - > - {/*
    */} -
    -
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {/*
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    */} -
    - {GlobaldummyData && GlobalLogo ? ( - image - ) : null} - {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( - image - ) : null} -
    - {' '} - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    -
    -
    - {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?.OrderType === 'E' && ( -
    - {' '} - Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} -
    - )} - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? 'Cash' - : BillName - ? BillName - : PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : ''}{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} -
    - )} -
    - )} - {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( -
    - {' '} - Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} -
    - )} -
    + // 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) + ); -
    -
    -
    - Bill No : - {GlobaldummyData - ? '553' - : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} -
    -
    -
    -
    - {GlobaldummyData ? formattedDate : Date1} -
    -
    -
    + 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', ProdTaxPercentage: 5 }, + { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, + { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, + { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, + { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, + { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + ]; -
    -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && ( - <> - {takeAwayPreference && ( + const chunkSize = PageSize == "A5" ? 8 : 11; + let dataSource = []; + + if (GlobaldummyData || TakeawayData?.length > 0) { + dataSource = GlobaldummyData ? products : TakeawayData; + } else if (DineInData?.length > 0) { + dataSource = DineInData; + } + + // 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); + + return ( + <> + {FormatTheme ? +
    + {paginatedChunks.map((dataChunk, chunkIndex) => (
    - TakeAway -
    - )} -
    - - - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && } - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode == true && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity == true && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP == true && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate == true && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount == true && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount == true && ( - - )} - - - - {dataChunk?.map((item, index) => ( - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode == true && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity == true && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP == true && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate == true && ( - - )} - {GlobaldummyData - ? GlobalDiscount && - : Discount == true && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount == true && ( - - )} - - ))} - -
    SSItemItemHSNHSNQty - {WeightasKg ? 'Qty/Kg' : 'Qty'} - MRPMRPRateRateDis Dis Tax % Tax % - Amt - - Amt -
    - {index + 1} - - {chunkIndex * chunkSize + index + 1} - {item?.ProdName} -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => - pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - )} -
    - {item?.HSN} - - {item?.HSN} - - {item?.SalesQty} - - {item?.SalesQty} - - {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?.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || - 0} -
    -
    - - )} - {DineInData?.length > 0 && dinePreference && ( - <> -
    - Dine In -
    + className={isMobile ? `invoice-wrapper container pdf-page` : `invoice-wrapper container print-chunk${chunkIndex > 0 ? ' print-page-break' : ''}`} + style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: isMobile ? "295mm" : FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> -
    - - - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && } - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode == true && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity == true && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP == true && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate == true && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount == true && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount == true && ( - - )} - - - - {dataChunk?.map((item, index) => ( - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode == true && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity == true && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP == true && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate == true && ( - - )} - {GlobaldummyData - ? GlobalDiscount && - : Discount == true && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount == true && ( - - )} - - ))} - -
    S.NoS.NOItemItemHSNHSNQty - {WeightasKg ? 'Qty/Kg' : 'Qty'} - MRPMRPRateRateDis Dis Tax % Tax % - Amt - - Amt -
    - {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?.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} - - {item?.HSN} - - {item?.SalesQty} - - {item?.SalesQty} - - {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?.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || - 0} -
    -
    - - )} -
    -
    - {chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme && ( - <> -
    -
    -
    - Items :{' '} - {GlobaldummyData ? '8' : totalQuantityFilter?.length} -
    -
    - Qty : {GlobaldummyData ? '9' : totalQuantity} -
    - {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
    - Off :{' '} - {GlobaldummyData - ? '10' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} -
    - )} -
    -
    - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {((OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0)) && - table2Data?.NetAmount !== 0 && ( - <> -
    - -
    -
    - --------- GST Breakup Details ----------- + {/*
    */} +
    +
    + {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {/*
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    */} +
    + {(GlobaldummyData && GlobalLogo) ? image : null} + {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} +
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - - - - - - - - - {OrderDetailGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number(item.TotalAmt).toFixed( - 2 +
    {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?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } + {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? 'Cash' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } + )} + {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } +
    + +
    +
    +
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    +
    +
    +
    {GlobaldummyData ? formattedDate : Date1}
    +
    +
    + +
    + + +
    +
    + + {(TakeawayData?.length > 0 || GlobaldummyData) && + <> + {takeAwayPreference &&
    TakeAway
    } +
    + + + + + + {GlobaldummyData ? GlobalSlNo && : SLNO == true && } + {GlobaldummyData ? GlobalItem && : Item == true && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } + {GlobaldummyData ? GlobalQuantity && : Quantity == true && } + {GlobaldummyData ? GlobalMRP && : MRP == true && } + {GlobaldummyData ? GlobalRate && : Rate == true && } + {GlobaldummyData ? GlobalDiscount && : Discount == true && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount == true && } + + + + {dataChunk?.map((item, index) => ( + + {GlobaldummyData ? GlobalSlNo && : SLNO == true && } + {GlobaldummyData ? GlobalItem && + : Item == true && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } + {GlobaldummyData ? GlobalQuantity && : Quantity == true && } + {GlobaldummyData ? GlobalMRP && : MRP == true && } + {GlobaldummyData ? GlobalRate && : Rate == true && } + {GlobaldummyData ? GlobalDiscount && : Discount == true && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount == true && } + + ))} + +
    SSItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} +
    {item?.ProdName}
    + {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? +
    + {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( + + {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) + + ))} + +
    + :
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    )} +
    {item?.HSN}{item?.HSN}{item?.SalesQty}{item?.SalesQty}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    +
    + } + {(DineInData?.length > 0 && dinePreference) && + <> +
    Dine In
    + +
    + + + + {GlobaldummyData ? GlobalSlNo && : SLNO == true && } + {GlobaldummyData ? GlobalItem && : Item == true && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } + {GlobaldummyData ? GlobalQuantity && : Quantity == true && } + {GlobaldummyData ? GlobalMRP && : MRP == true && } + {GlobaldummyData ? GlobalRate && : Rate == true && } + {GlobaldummyData ? GlobalDiscount && : Discount == true && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount == true && } + + + + {dataChunk?.map((item, index) => ( + + {GlobaldummyData ? GlobalSlNo && : SLNO == true && } + {GlobaldummyData ? GlobalItem && + : Item == true && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } + {GlobaldummyData ? GlobalQuantity && : Quantity == true && } + {GlobaldummyData ? GlobalMRP && : MRP == true && } + {GlobaldummyData ? GlobalRate && : Rate == true && } + {GlobaldummyData ? GlobalDiscount && : Discount == true && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount == true && } + + ))} + +
    S.NoS.NOItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {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?.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}{item?.HSN}{item?.SalesQty}{item?.SalesQty}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    +
    + } +
    +
    + + + {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && + <> +
    +
    +
    Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    +
    Qty : {GlobaldummyData ? '9' : totalQuantity}
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off : {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } +
    +
    + {(table2Data?.OrderType === "E") ? '' :
    + + {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && + <> +
    + +
    +
    + --------- GST Breakup Details -----------
    + {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && + + + + + + + + + + {OrderDetailGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + CGST + + SGST + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + } + + {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + {OrderDetailIGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + {OrderDetailVAT?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + +
    +
    + + + } +
    } +
    + {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && +
    Take Away : ₹{Number(TakeawayTotal).toFixed(2)}
    + } + {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && +
    Dine In: ₹{Number(DineInTotal).toFixed(2)}
    + } +
    Amount : ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    + +
    +
    +
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    +
    + {PaymentStatusSuccess?.length > 1 && + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + } + + {GlobaldummyData ? ( + GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + ) : ( + CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    + ) : null} + )} -
    - )} - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    + ) : null} +
    + ) + )} + {(GlobaldummyData && GlobalCashierName) && +
    +
    Cashier : Cashier Name
    +
    + + } + {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && +
    +
    Cashier : {CashierName}
    +
    + } + {GlobaldummyData && +
    +
    Customer : Customer Name
    +
    + + } + {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && +
    +
    Customer : {table2Data?.CustSuppName}
    +
    + } + + + {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && +
    + Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    } + {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData ? GlobalQrcodet && +
    + QRcode +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    + : (Qrcodet && paymentTypeUPI) && +
    + +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    } +
    } + +
    + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData ? GlobalIsnotes && + (
    +

    Notes : 10 days Return policy

    + +
    +
    ) : + Notestext && (
    +

    {Notestext}

    + +
    +
    ) + } +
    } + + + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {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" && <> -
    - - - - - - - - {OrderDetailIGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed( - 2 - )} - - {Number( - item.TotalAmt - ).toFixed(2)} -
    +
    Thank You Visit Again
    +
    - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailVAT?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed( - 2 - )} - - {Number( - item.TotalAmt - ).toFixed(2)} -
    - - )} -
    -
    + } - )} -
    - )} -
    - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - takeAwayPreference && ( -
    + ))} + + {shouldFooterBeOnNewPage && FormatTheme && +
    - Take Away : ₹{Number(TakeawayTotal).toFixed(2)} -
    - )} - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - dinePreference && ( -
    - Dine In: ₹{Number(DineInTotal).toFixed(2)} -
    - )} -
    - Amount : ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    + > +
    + <> +
    +
    +
    Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    +
    Qty : {GlobaldummyData ? '9' : totalQuantity}
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off : {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } +
    +
    + {(table2Data?.OrderType === "E") ? '' :
    + + {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && + <> +
    + +
    +
    + --------- GST Breakup Details -----------
    + {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && + + + + + + + + + + {OrderDetailGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + CGST + + SGST + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + } + + {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + {OrderDetailIGST?.map((item) => + + + + + + + ) + } +
    + + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + {OrderDetailVAT?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + +
    +
    + + + } +
    } +
    + {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && +
    Take Away : ₹{Number(TakeawayTotal).toFixed(2)}
    + } + {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && +
    Dine In: ₹{Number(DineInTotal).toFixed(2)}
    + } +
    Amount : ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    + +
    +
    +
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    +
    + {PaymentStatusSuccess?.length > 1 && + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + } + + {GlobaldummyData ? ( + GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + ) : ( + CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    + ) : null} +
    + ) + )} + {(GlobaldummyData && GlobalCashierName) && +
    +
    Cashier : Cashier Name
    +
    + + } + {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && +
    +
    Cashier : {CashierName}
    +
    + } + {GlobaldummyData && +
    +
    Customer : Customer Name
    +
    + + } + {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && +
    +
    Customer : {table2Data?.CustSuppName}
    +
    + } + + + {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && +
    + Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    } + {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData ? GlobalQrcodet && +
    + QRcode +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    + : (Qrcodet && paymentTypeUPI) && +
    + +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    } +
    } + +
    + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData ? GlobalIsnotes && + (
    +

    Notes : 10 days Return policy

    + +
    +
    ) : + Notestext && (
    +

    {Notestext}

    + +
    +
    ) + } +
    } + + + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {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
    +
    + + } + +
    +
    + } +
    + + + : +
    +
    + {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    +
    + {(GlobaldummyData && GlobalLogo) ? image : null} + {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} +
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    +
    + +
    {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?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } + {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } +
    )} + {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } +
    + +
    +
    +
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    +
    +
    +
    {GlobaldummyData ? formattedDate : Date1}
    +

    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed( - 2 - )} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' - ? '-' - : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed( - 2 - )} - -
    -
    -
    - )} -
    -
    - {PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : 'Split'}{' '} -  Payment :   - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} - /-{' '} -
    -
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}:{' '} - {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - )} +
    - {GlobaldummyData - ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < - 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs( - table2Data.CustomerDetails[0].OldCreditBal - )} -

    - ) : null} - - )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > - 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} - {GlobaldummyData && GlobalCashierName && ( -
    -
    - Cashier : Cashier Name -
    -
    - )} - {CashierName && - CashierName !== undefined && - CashierName !== null && - !GlobaldummyData && - CashierNameField && ( -
    -
    - Cashier : {CashierName} -
    -
    - )} - {GlobaldummyData && ( -
    -
    - Customer : Customer Name -
    -
    - )} - {table2Data?.CustSuppName && - table2Data?.CustSuppName !== undefined && - table2Data?.CustSuppName !== null && - !GlobaldummyData && ( -
    -
    - Customer : {table2Data?.CustSuppName} -
    -
    - )} - {table2Data?.BookingTypeName == 'Dine In' && - table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( -
    - Captain :{' '} - {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    - )} - {sportsAppPreference && MembershipApplied && ( -
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    - )} - - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - ) - : Qrcodet && - paymentTypeUPI && ( -
    - -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} -
    - )} - -
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

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

    - {Notestext} -

    - -
    -
    - )} -
    - )} - - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {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 -
    -
    - - )} - - )} -
    - ))} - - {shouldFooterBeOnNewPage && FormatTheme && ( -
    -
    - <> -
    -
    -
    - Items :{' '} - {GlobaldummyData ? '8' : totalQuantityFilter?.length} -
    -
    - Qty : {GlobaldummyData ? '9' : totalQuantity} -
    - {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
    - Off :{' '} - {GlobaldummyData - ? '10' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} -
    - )} -
    -
    - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {((OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0)) && - table2Data?.NetAmount !== 0 && ( - <> -
    - -
    -
    - --------- GST Breakup Details ----------- -
    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - - - - - - - - - {OrderDetailGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - )} - - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailIGST?.map((item) => ( - - - - - - - ))} -
    - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed( - 2 - )} -
    - - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailVAT?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed( - 2 - )} -
    - - )} -
    -
    - - )} -
    - )} -
    - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - takeAwayPreference && ( -
    - Take Away : ₹{Number(TakeawayTotal).toFixed(2)} -
    - )} - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - dinePreference && ( -
    - Dine In: ₹{Number(DineInTotal).toFixed(2)} -
    - )} -
    - Amount : ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - -
    - - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed( - 2 - )} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' - ? '-' - : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} - -
    -
    -
    - )} -
    -
    - {PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : 'Split'}{' '} -  Payment :   - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} - /-{' '} -
    -
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}:{' '} - {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - )} - - {GlobaldummyData - ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + {(TakeawayData?.length > 0 || GlobaldummyData) && <> - {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < - 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs( - table2Data.CustomerDetails[0].OldCreditBal - )} -

    - ) : null} - - )} + {takeAwayPreference &&
    TakeAway
    } +
    - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > - 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} - {GlobaldummyData && GlobalCashierName && ( -
    -
    - Cashier : Cashier Name -
    + + + + + {GlobaldummyData ? GlobalSlNo && : SLNO == true && } + {GlobaldummyData ? GlobalItem && : Item == true && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } + {GlobaldummyData ? GlobalQuantity && : Quantity == true && } + {GlobaldummyData ? GlobalMRP && : MRP == true && } + {GlobaldummyData ? GlobalRate && : Rate == true && } + {GlobaldummyData ? GlobalDiscount && : Discount == true && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount == true && } + + + + {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => ( + + {GlobaldummyData ? GlobalSlNo && : SLNO == true && } + {GlobaldummyData ? GlobalItem && + : Item == true && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } + {GlobaldummyData ? GlobalQuantity && : Quantity == true && } + {GlobaldummyData ? GlobalMRP && : MRP == true && } + {GlobaldummyData ? GlobalRate && : Rate == true && } + {GlobaldummyData ? GlobalDiscount && : Discount == true && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount == true && } + + ))} + +
    S.NoS.NoItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    + {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? +
    + {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( + + {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) + + ))} +
    + :
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    )} +
    {item?.HSN}{item?.HSN}{item?.SalesQty}{item?.SalesQty}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    +
    + } + {(DineInData?.length > 0 && dinePreference) && + <> +
    Dine In
    + +
    + + + + {GlobaldummyData ? GlobalSlNo && : SLNO == true && } + {GlobaldummyData ? GlobalItem && : Item == true && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } + {GlobaldummyData ? GlobalQuantity && : Quantity == true && } + {GlobaldummyData ? GlobalMRP && : MRP == true && } + {GlobaldummyData ? GlobalRate && : Rate == true && } + {GlobaldummyData ? GlobalDiscount && : Discount == true && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount == true && } + + + + {(GlobaldummyData ? products : DineInData)?.map((item, index) => ( + + {GlobaldummyData ? GlobalSlNo && : SLNO == true && } + {GlobaldummyData ? GlobalItem && + : Item == true && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } + {GlobaldummyData ? GlobalQuantity && : Quantity == true && } + {GlobaldummyData ? GlobalMRP && : MRP == true && } + {GlobaldummyData ? GlobalRate && : Rate == true && } + {GlobaldummyData ? GlobalDiscount && : Discount == true && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalAmount && : Amount == true && } + + ))} + +
    SSItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    +
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  + {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) + ?.map(a => { return (
    {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}{item?.HSN}{item?.SalesQty}{item?.SalesQty}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    +
    + }
    - )} - {CashierName && - CashierName !== undefined && - CashierName !== null && - !GlobaldummyData && - CashierNameField && ( -
    -
    - Cashier : {CashierName} + +
    +
    +
    Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    +
    Qty : {GlobaldummyData ? '9' : totalQuantity}
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off : {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    }
    -
    - )} - {GlobaldummyData && ( -
    -
    - Customer : Customer Name -
    +
    + {(table2Data?.OrderType === "E") ? '' :
    + + {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && + <> +
    + +
    +
    + --------- GST Breakup Details -----------
    + {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && + + + + + + + + + + {OrderDetailGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + CGST + + SGST + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + } + + {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + {OrderDetailIGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + {OrderDetailVAT?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + +
    +
    + + + } +
    } +
    + {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && +
    Take Away : ₹{Number(TakeawayTotal).toFixed(2)}
    + } + {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && +
    Dine In: ₹{Number(DineInTotal).toFixed(2)}
    + } +
    Amount : ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    - )} - {table2Data?.CustSuppName && - table2Data?.CustSuppName !== undefined && - table2Data?.CustSuppName !== null && - !GlobaldummyData && ( -
    -
    - Customer : {table2Data?.CustSuppName} -
    -
    - )} - {table2Data?.BookingTypeName == 'Dine In' && - table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( -
    - Captain :{' '} - {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    - )} - {sportsAppPreference && MembershipApplied && ( -
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    - )} +
    +
    +
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    +
    + {PaymentStatusSuccess?.length > 1 && + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + } - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    + {GlobaldummyData ? ( + GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    - ) - : Qrcodet && - paymentTypeUPI && ( -
    - -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    + ) + ) : ( + CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    + ) : null}
    - )} -
    - )} - -
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

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

    - {Notestext} -

    - -
    -
    - )} -
    - )} - - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {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 -
    -
    - - )} - -
    -
    - )} -
    - ) : ( -
    -
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    -
    - {GlobaldummyData && GlobalLogo ? ( - image - ) : null} - {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( - image - ) : null} -
    - {' '} - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    -
    - -
    - {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?.OrderType === 'E' && ( -
    - {' '} - Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} -
    - )} - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalBilltext - ? GlobalBilltext - : 'Cash' + ' Bill' - : BillName - ? BillName - : PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' - : ''}{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} -
    - )} -
    - )} - {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( -
    - {' '} - Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} -
    - )} -
    - -
    -
    -
    - Bill No : - {GlobaldummyData - ? '553' - : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} -
    -
    -
    -
    - {GlobaldummyData ? formattedDate : Date1} -
    -
    -
    - -
    - -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && ( - <> - {takeAwayPreference && ( -
    - TakeAway -
    - )} -
    - - - - {GlobaldummyData - ? GlobalSlNo && - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && ( - - ) - : Item == true && } - {GlobaldummyData - ? GlobalHsnCode && - : HsnCode == true && ( - - )} - {GlobaldummyData - ? GlobalQuantity && - : Quantity == true && ( - - )} - {GlobaldummyData - ? GlobalMRP && - : MRP == true && ( - - )} - {GlobaldummyData - ? GlobalRate && - : Rate == true && ( - - )} - {GlobaldummyData - ? GlobalDiscount && - : Discount == true && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount == true && ( - - )} - - - - {(GlobaldummyData ? products : TakeawayData)?.map( - (item, index) => ( - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode == true && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity == true && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP == true && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate == true && ( - - )} - {GlobaldummyData - ? GlobalDiscount && - : Discount == true && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount == true && ( - - )} - ) - )} - -
    S.NoS.No - Item - ItemHSNHSNQty - {WeightasKg ? 'Qty/Kg' : 'Qty'} - MRPMRPRateRateDis Dis Tax % Tax % Amt - Amt -
    - {index + 1} - - {index + 1} - {item?.ProdName} -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - )} -
    - {item?.HSN} - - {item?.HSN} - - {item?.SalesQty} - - {item?.SalesQty} - - {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?.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || 0} -
    -
    - - )} - {DineInData?.length > 0 && dinePreference && ( - <> -
    - Dine In -
    - -
    - - - - {GlobaldummyData - ? GlobalSlNo && - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && } - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode == true && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity == true && ( - - )} - {GlobaldummyData - ? GlobalMRP && - : MRP == true && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate == true && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount == true && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount == true && ( - - )} - - - - {(GlobaldummyData ? products : DineInData)?.map( - (item, index) => ( - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO == true && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item == true && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode == true && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity == true && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP == true && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate == true && ( - - )} - {GlobaldummyData - ? GlobalDiscount && - : Discount == true && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount == true && ( - - )} - - ) - )} - -
    SSItemItemHSNHSNQty - {WeightasKg ? 'Qty/Kg' : 'Qty'} - MRPMRPRateRateDis Dis Tax % Tax % - Amt - - Amt -
    - {index + 1} - - {index + 1} - {item?.ProdName} -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return
    {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} - - {item?.HSN} - - {item?.SalesQty} - - {item?.SalesQty} - - {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?.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || 0} -
    -
    - - )} -
    - -
    -
    -
    - Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length} -
    -
    - Qty : {GlobaldummyData ? '9' : totalQuantity} -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off :{' '} - {GlobaldummyData - ? '10' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} -
    - )} -
    -
    - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {((OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0)) && - table2Data?.NetAmount !== 0 && ( - <> -
    - + )} + {(GlobaldummyData && GlobalCashierName) &&
    -
    - --------- GST Breakup Details ----------- -
    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - - - - - - - - - {OrderDetailGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - )} - - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailIGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed( - 2 - )} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailVAT?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed( - 2 - )} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - - )} +
    Cashier : Cashier Name
    -
    - - )} -
    - )} -
    - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - takeAwayPreference && ( -
    - Take Away : ₹{Number(TakeawayTotal).toFixed(2)} -
    - )} - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - dinePreference && ( -
    - Dine In: ₹{Number(DineInTotal).toFixed(2)} -
    - )} -
    - Amount : ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    -
    + } + {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && +
    +
    Cashier : {CashierName}
    +
    + } + {GlobaldummyData && +
    +
    Customer : Customer Name
    +
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} - -
    -
    -
    - )} -
    -
    - {PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : 'Split'}{' '} -  Payment :   - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} - /-{' '} -
    -
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - )} + } + {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && +
    +
    Customer : {table2Data?.CustSuppName}
    +
    + } - {GlobaldummyData - ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} -

    - ) : null} - - )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} -

    - ) : null} -
    - )} - {GlobaldummyData && GlobalCashierName && ( -
    -
    - Cashier : Cashier Name -
    -
    - )} - {CashierName && - CashierName !== undefined && - CashierName !== null && - !GlobaldummyData && - CashierNameField && ( -
    -
    - Cashier : {CashierName} -
    -
    - )} - {GlobaldummyData && ( -
    -
    - Customer : Customer Name -
    -
    - )} - {table2Data?.CustSuppName && - table2Data?.CustSuppName !== undefined && - table2Data?.CustSuppName !== null && - !GlobaldummyData && ( -
    -
    - Customer : {table2Data?.CustSuppName} -
    -
    - )} + {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && +
    + Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    } + {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - {table2Data?.BookingTypeName == 'Dine In' && - table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    - )} - {sportsAppPreference && MembershipApplied && ( -
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    - )} + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData ? GlobalQrcodet && +
    + QRcode +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    + : (Qrcodet && paymentTypeUPI) && +
    + +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    } +
    } - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - ) - : Qrcodet && - paymentTypeUPI && ( -
    - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData ? GlobalIsnotes && + (
    +

    Notes : 10 days Return policy

    + +
    +
    ) : + Notestext && (
    +

    {Notestext}

    + +
    +
    ) + } +
    } + + + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {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

    + +
    )} + +
    }
    - )} -
    - )} -
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

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

    {Notestext}

    -
    -
    - )} -
    - )} - - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {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 -
    -
    - - )} -
    - )} - - ); + {PrintGreeting?.SettingValue === "Y" && + <> +
    Thank You Visit Again
    +
    + + } +
    + } + + ); }; export default PrintStyle7; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx index 4a347d7..1838949 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx @@ -1,4771 +1,1517 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import QrImage from '../../../../Images/QRcode.png'; +import { extractLastNumber, extractLastNumberOrderId } from '../../../../Services/Others'; 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, - GlobalprintCashierName, - GlobalprintLogo, - GlobalprintCredit, - GlobalprintTax, + GlobalprintSlNo, + GlobalprintItem, + GlobalprintMRP, + GlobalprintDiscount, + GlobalprintQuantity, + GlobalprintRate, + GlobalprintAmount, + GlobalprintHsnCode, + GlobalprintQrcodet, + GlobalPritdummyData, + changeReprintDataFound, + GloabalFieldDetails, + GlobalprintSignature, + GlobalprinttermsAndConditions, + GlobalSignatureImage, + Globalnotes, + GlobalthemeFormat, + GlobalBillName, + GlobalprintCashierName, + GlobalprintLogo, + GlobalprintCredit, + GlobalprintTax, } from '../../../../Features/ThemeChange/ThemeChange'; -import Logo from '../../../../Images/Logo.jpg'; -import { - GlobalUpiIDprint, - PreferenceData, -} from '../../../../Features/BookingScreen/BookingData/BookingData'; +import Logo from '../../../../Images/Logo.jpg' +import { GlobalUpiIDprint, PreferenceData } 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'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; -const Printstyle8 = ({ - index, - ExtraChargeTotal, - Date1, - totalQuantityFilter, - BranchAddress, - BranchCity, - BranchZip, - CashierName, - totalQuantity, - OrderDetailGST, - OrderDetailIGST, - OrderDetailVAT, - table2Data, - PaymentStatus, - PrintGreeting, - base64Image, - PrintLogo, - printDatas, - isPdf, - sportsAppPreference, - SalesModePref, - MembershipApplied = null, -}) => { - const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint); - const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.['Sl.No']; - const Item = FieldDetails?.['Item']; - const MRP = FieldDetails?.['MRP']; - const Discount = FieldDetails?.['Discount']; - const Tax = FieldDetails?.['Tax']; - const Quantity = FieldDetails?.['Quantity']; - const Rate = FieldDetails?.['Rate']; - const Amount = FieldDetails?.['Amount']; - const HsnCode = FieldDetails?.['HsnCode']; - const Qrcodet = FieldDetails?.['Qrcode']; - const CashierNameField = FieldDetails?.['CashierName']; - const LogoField = FieldDetails?.['Logo']; - const CreditDetails = FieldDetails?.['Credit details']; - const WeightasKg = FieldDetails?.['Weight']; - const GlobalSlNo = useSelector(GlobalprintSlNo); - const GlobalItem = useSelector(GlobalprintItem); - const GlobalMRP = useSelector(GlobalprintMRP); - const GlobalDiscount = useSelector(GlobalprintDiscount); - const GlobalTax = useSelector(GlobalprintTax); - 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); - const appPreferences = useSelector(ApplicationPreferences); - const GlobalCashierName = useSelector(GlobalprintCashierName); - const GlobalLogo = useSelector(GlobalprintLogo); - const GlobalCredit = useSelector(GlobalprintCredit); - const SettingData = useSelector(PreferenceData); - const estimatePrintHeader = - SettingData?.[0]?.SettingDtlDetails?.find( - (setting) => - setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' - )?.SettingValue === 'Y'; - const bookingTypePreference = appPreferences?.find( - (preference) => preference?.PreferredCatName === 'Booking Type' - )?.PreferenceCatDetails; - const dinePreference = bookingTypePreference?.find( - (type) => - type?.PreferredSubCatName?.toLowerCase() === 'dine in' && - type?.PreferredStatus === 'Y' - ); - const takeAwayPreference = bookingTypePreference?.find( - (type) => - type?.PreferredSubCatName?.toLowerCase() === 'take away' && - type?.PreferredStatus === 'Y' - ); - const paymentTypeUPI = PaymentStatus?.find( - (ps) => ps.PaymentTypeName === 'UPI' - ); +const Printstyle8 = ({ index, ExtraChargeTotal, Date1, totalQuantityFilter, BranchAddress, BranchCity, BranchZip, CashierName, totalQuantity, OrderDetailGST, OrderDetailIGST, + OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, base64Image, PrintLogo, printDatas, isPdf, sportsAppPreference, SalesModePref, MembershipApplied = null }) => { - console.log(GlobalDiscount, Discount, 'Discount'); + const dispatch = useDispatch(); + const GlobalUpiID = useSelector(GlobalUpiIDprint) + const FieldDetails = useSelector(GloabalFieldDetails); + const SLNO = FieldDetails?.["Sl.No"]; + const Item = FieldDetails?.["Item"]; + const MRP = FieldDetails?.["MRP"]; + const Discount = FieldDetails?.["Discount"]; + const Tax = FieldDetails?.["Tax"]; + const Quantity = FieldDetails?.["Quantity"]; + const Rate = FieldDetails?.["Rate"]; + const Amount = FieldDetails?.["Amount"]; + const HsnCode = FieldDetails?.["HsnCode"]; + const Qrcodet = FieldDetails?.["Qrcode"]; + const CashierNameField = FieldDetails?.["CashierName"]; + const LogoField = FieldDetails?.["Logo"]; + const CreditDetails = FieldDetails?.["Credit details"]; + const WeightasKg = FieldDetails?.['Weight']; + const GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalMRP = useSelector(GlobalprintMRP); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalTax = useSelector(GlobalprintTax); + 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) + const appPreferences = useSelector(ApplicationPreferences); + const GlobalCashierName = useSelector(GlobalprintCashierName); + const GlobalLogo = useSelector(GlobalprintLogo); + const GlobalCredit = useSelector(GlobalprintCredit); + const SettingData = useSelector(PreferenceData); + const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' + const bookingTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Booking Type')?.PreferenceCatDetails + const dinePreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "dine in" && type?.PreferredStatus === 'Y') + const takeAwayPreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "take away" && type?.PreferredStatus === 'Y') + const paymentTypeUPI = PaymentStatus?.find((ps) => ps.PaymentTypeName === "UPI") - const isEditedBill = PaymentStatus?.some((payment) => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ); + console.log(GlobalDiscount, Discount, "Discount"); - let TermsAndConditions = printDatas?.TermsandConditions; - let SignatureImg = printDatas?.Signature; - let Notestext = printDatas?.Notes; - let BillName = printDatas?.PrintHdrName; - let FormatTheme = printDatas?.PrintType == 'S' ? true : false; - let PageSize = printDatas?.PageSize; - const Signature = FieldDetails?.['signature']; - const TermsnAdCondition = FieldDetails?.['terms&conditions']; + let TermsAndConditions = printDatas?.TermsandConditions + let SignatureImg = printDatas?.Signature + let Notestext = printDatas?.Notes + let BillName = printDatas?.PrintHdrName + let FormatTheme = printDatas?.PrintType == "S" ? true : false + let PageSize = printDatas?.PageSize; + const Signature = FieldDetails?.["signature"]; + const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - let PaymentStatusSuccess = PaymentStatus?.filter( - (ps) => ps.PaymentStatus === 'S' - ); - const keysLength = Object.keys(table2Data ?? {}).length; - if (keysLength > 0) { - dispatch(changeReprintDataFound(true)); - } - const PackageDetails = table2Data?.PackageDtl; - 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 formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; - - const TakeawayData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' - ); - const DineInData = table2Data?.productDetails?.filter( - (item) => item.BookingTypeName?.toLowerCase() === 'dine in' - ); - - const TakeawayTotal = TakeawayData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0 - ); - const DineInTotal = DineInData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0 - ); - - const aggregatedPayments = PaymentStatusSuccess?.reduce( - (acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); - - if (acc[paymentType]) { - acc[paymentType] += amount; - } else { - acc[paymentType] = amount; - } - - return acc; - }, - {} - ); - 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; + let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") + const keysLength = Object.keys(table2Data ?? {}).length; + if (keysLength > 0) { + dispatch(changeReprintDataFound(true)); } - }); - const hasMappedOffer = offers.some((offer) => - ['ItemWiseOffers', 'BundleOffers', 'QuantityWiseOffers'].includes( - offer.TableName - ) - ); + const PackageDetails = table2Data?.PackageDtl; + 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); - if (hasMappedOffer) { - const productTotal = productsData?.reduce( - (acc, item) => - acc + (item?.Type != 'C' ? item.OfferAmt : item.OfferValue || 0), - 0 + const formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; + + const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") + const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") + + const TakeawayTotal = TakeawayData?.reduce( + (accumulator, currentValue) => accumulator + currentValue.TotalAmt, + 0, ); - TotalOfferAmount += productTotal; - } else { - const Combothere = productsData?.filter((item) => item?.Type == 'C'); - const CombothereTotal = Combothere?.reduce( - (acc, item) => acc + (item.OfferValue || 0), - 0 + const DineInTotal = DineInData?.reduce( + (accumulator, currentValue) => accumulator + currentValue.TotalAmt, + 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', - ProdTaxPercentage: 5, - }, - { - ProdName: 'ITEM 2', - Rate: 300.0, - SalesQty: 1, - MRP: 350, - TotalAmt: 300, - discount: 0, - HSN: '02', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 5, - }, - { - ProdName: 'ITEM 3', - Rate: 200.0, - SalesQty: 1, - MRP: 250, - TotalAmt: 200, - discount: 0, - HSN: '03', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 0, - }, - { - ProdName: 'ITEM 4', - Rate: 30.0, - SalesQty: 1, - MRP: 50, - TotalAmt: 30, - discount: 0, - HSN: '04', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 18, - }, - { - ProdName: 'ITEM 5', - Rate: 30.0, - SalesQty: 1, - MRP: 50, - TotalAmt: 30, - discount: 0, - HSN: '05', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 40, - }, - { - ProdName: 'ITEM 6', - Rate: 130.0, - SalesQty: 1, - MRP: 150, - TotalAmt: 130, - discount: 0, - HSN: '06', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 0, - }, - { - ProdName: 'ITEM 7', - Rate: 230.0, - SalesQty: 1, - MRP: 250, - TotalAmt: 230, - discount: 0, - HSN: '08', - Size: 250, - UomName: 'g', - ProdTaxPercentage: 5, - }, - ]; - console.log(printDatas, 'printDatasjk'); - const chunkSize = PageSize == 'A5' ? 10 : 16; - let dataSource = []; + const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { + const paymentType = paymentdata?.PaymentTypeName; + const amount = Number(paymentdata?.Amount); - if (GlobaldummyData || TakeawayData?.length > 0) { - dataSource = GlobaldummyData ? products : TakeawayData; - } else if (DineInData?.length > 0) { - dataSource = DineInData; - } + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } - // 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); + return acc; + }, {}); + const productsData = table2Data?.productDetails || []; + const offers = table2Data?.OrderOfferDetails || []; - return ( - <> - {FormatTheme ? ( -
    - {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    0 ? ' print-page-break' : ''}` - } - style={{ - display: 'flex', - flexDirection: 'column', - justifyContent: - chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme - ? 'space-between' - : '', - height: isMobile - ? '295mm' - : FormatTheme - ? PageSize == 'A5' - ? '170mm' - : '257mm' - : '', - }} - key={chunkIndex} - > - {/*
    */} -
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {/*

    {table2Data?.BrName}

    */} + let TotalOfferAmount = 0; -
    - {GlobalLogo && GlobaldummyData ? ( - image - ) : null} - {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( - image - ) : null} -
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    -
    + // 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) + ); -
    - {GlobaldummyData - ? 'BranchAddress, Town- 635XXX City - State' - : (BranchAddress || '') + - (BranchCity - ? (BranchAddress && BranchCity ? '-' : '') + - BranchCity - : '') + - (BranchZip - ? (BranchCity && BranchZip ? '-' : '') + BranchZip - : '')} -
    -
    - {' '} - Mobile : +91{' '} - {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} -
    -
    - )} - {table2Data?.OrderType === 'E' && ( -
    - Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} -
    - )} + if (hasMappedOffer) { - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? 'Cash' - : BillName - ? BillName - : PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : ''}{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} -
    - )} + 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', ProdTaxPercentage: 5 }, + { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, + { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, + { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, + { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, + { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + ]; -
    -
    - Bill No : - {GlobaldummyData - ? '553' - : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} -
    -
    - {GlobaldummyData ? formattedDate : Date1} -
    -
    + console.log(printDatas, "printDatasjk") + const chunkSize = PageSize == "A5" ? 10 : 16; + let dataSource = []; -
    -
    -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && ( - <> - {takeAwayPreference && ( -
    - TakeAway -
    - )} + if (GlobaldummyData || TakeawayData?.length > 0) { + dataSource = GlobaldummyData ? products : TakeawayData; + } else if (DineInData?.length > 0) { + dataSource = DineInData; + } -
    - - - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item && } - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} - - - - {dataChunk?.map((item, index) => { - return ( - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && - : HsnCode && } - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} - - ); - })} - -
    - S.No - - S.No - DisDes - HSN - - HSN - - MRP - - MRP - - Rate - - Rt - - (%) - - (%) - - Tax % - - Tax % - - Qty - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - Amt - - Amt -
    - {chunkIndex * chunkSize + index + 1} - - {chunkIndex * chunkSize + index + 1} - {item?.ProdName} -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => - pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount}PCS - {item.ParcelQty}PACK( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - )} -
    {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?.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.SalesQty} - - {item?.SalesQty} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || - 0} -
    -
    - - )} - {DineInData?.length > 0 && dinePreference && ( - <> -
    - Dine In -
    + // 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); -
    - - - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item && } - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} - - - - {dataChunk?.map((item, index) => { - return ( - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && - : HsnCode && } - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} - - ); - })} - -
    - S.No - - S.No - DisDes - HSN - - HSN - - MRP - - MRP - - Rate - - Rt - - (%) - - (%) - - Tax % - - Tax % - - Qty - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - Amt - - Amt -
    - {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?.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(',')} -
    - ); - }) - : ''} + return ( + <> + {FormatTheme ? +
    + {paginatedChunks.map((dataChunk, chunkIndex) => ( +
    0 ? ' print-page-break' : ''}`} + style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: isMobile ? "295mm" : FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> + + + {/*
    */} +
    + {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {/*

    {table2Data?.BrName}

    */} + +
    + {(GlobalLogo && GlobaldummyData) ? image : null} + {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} +
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    +
    + + +
    + {GlobaldummyData ? + 'BranchAddress, Town- 635XXX City - State' : + (BranchAddress || '') + (BranchCity ? (BranchAddress && BranchCity ? '-' : '') + BranchCity : '') + (BranchZip ? (BranchCity && BranchZip ? '-' : '') + BranchZip : '')} +
    +
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    +
    )} + {table2Data?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } + + {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? 'Cash' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } + +
    +
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    +
    {GlobaldummyData ? formattedDate : Date1}
    +
    + +
    +
    +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && + <> + {takeAwayPreference &&
    TakeAway
    } + +
    + + + + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalAmount && : Amount && } + + + + {dataChunk?.map((item, index) => { + return ( + + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalAmount && : Amount && } + + ) + })} + +
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {chunkIndex * chunkSize + index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} +
    {item?.ProdName}
    + {( + PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? +
    + {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( + + {item.ParcelCount}PCS{item.ParcelQty}PACK({item.ParcelType}) + + ))} +
    + :
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    )} +
    {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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    {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?.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.SalesQty} - - {item?.SalesQty} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || - 0} -
    -
    - - )} -
    + + } + {(DineInData?.length > 0 && dinePreference) && + <> +
    Dine In
    - {chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme && ( - <> -
    -
    -
    -
    Items
    -
    :
    -
    - {GlobaldummyData ? '8' : totalQuantityFilter?.length} -
    -
    -
    -
    Qty
    -
    :
    -
    - {GlobaldummyData ? '9' : totalQuantity} -
    -
    - {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
    -
    Off
    -
    :
    -
    - {GlobaldummyData - ? '10' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} -
    -
    - )} - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - takeAwayPreference && ( -
    -
    Take Away
    -
    :
    -
    - {GlobaldummyData - ? '1,066' - : Number(TakeawayTotal).toFixed(2)} +
    + + + + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalAmount && : Amount && } + + + + {dataChunk?.map((item, index) => { + return ( + + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalAmount && : Amount && } + + ) + })} + +
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {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?.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}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    +
    + + }
    -
    - )} - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - dinePreference && ( -
    -
    Dine In
    -
    :
    -
    - {GlobaldummyData - ? '1,066' - : Number(DineInTotal).toFixed(2)} -
    -
    - )} -
    -
    Amount
    -
    :
    -
    - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    -
    -
    - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    -
    - {((OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0)) && - table2Data?.NetAmount !== 0 && ( + {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && + <> -
    +
    +
    +
    +
    Items
    +
    :
    +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    +
    +
    +
    Qty
    +
    :
    +
    {GlobaldummyData ? '9' : totalQuantity}
    +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && +
    +
    Off
    +
    :
    +
    {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    +
    + } + {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && +
    +
    Take Away
    +
    :
    +
    {GlobaldummyData ? '1,066' : Number(TakeawayTotal).toFixed(2)}
    +
    + } + {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && +
    +
    Dine In
    +
    :
    +
    {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)}
    +
    + } +
    +
    Amount
    +
    :
    +
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    +
    -
    -

    - --------- GST Breakup Details ----------- -

    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - - - - - - - - - {OrderDetailGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number(item.TotalAmt).toFixed( - 2 +
    + + {(table2Data?.OrderType === "E") ? '' :
    +
    + {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && + <> +
    + +
    +

    + --------- GST Breakup Details -----------

    + {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && + + + + + + + + + + {OrderDetailGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + CGST + + SGST + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + } + + {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + + {OrderDetailIGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + IGST + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + + {OrderDetailVAT?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + VAT + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + +
    +
    + + + } +
    +
    } + +
    + +
    +
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    +
    +
    + + {GlobaldummyData ? ( + GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + ) : ( + CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    + ) : null} + )} -
    - )} - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    + ) : null} + + ) + )} +
    -
    - - {OrderDetailIGST?.map((item) => ( - - - - +
    + {PaymentStatusSuccess?.length > 1 && + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + } + {GlobaldummyData && GlobalCashierName && +
    Cashier : Cashier Name
    -
    - - ))} -
    - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed( - 2 - )} - - {Number( - item.TotalAmt - ).toFixed(2)} -
    - - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - + } + {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && +
    Cashier : {CashierName} +
    + } + {GlobaldummyData && +
    Customer : Customer Name
    - - - {OrderDetailVAT?.map((item) => ( - - - - + } + {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && +
    Customer : {table2Data?.CustSuppName} +
    + } - - - ))} -
    - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed( - 2 - )} - - {Number( - item.TotalAmt - ).toFixed(2)} -
    - - )} -
    -
    + + {(table2Data?.BookingTypeName === "Dine In" && dinePreference) && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) &&
    Captain: {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } +
    + + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData ? GlobalQrcodet &&
    +
    + 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)}
    +
    } +
    } +
    + +
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    + {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + +
    + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData ? GlobalIsnotes && + (
    +

    Notes : 10 days Return policy

    + +
    +
    ) : + Notestext && (
    +

    {Notestext}

    + +
    +
    ) + } +
    } + + + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {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 +
    + } - )} -
    + }
    - )} + ))} + + {shouldFooterBeOnNewPage && FormatTheme && +
    +
    + <> +
    +
    +
    +
    Items
    +
    :
    +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    +
    +
    +
    Qty
    +
    :
    +
    {GlobaldummyData ? '9' : totalQuantity}
    +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && +
    +
    Off
    +
    :
    +
    {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    +
    + } + {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && +
    +
    Take Away
    +
    :
    +
    {GlobaldummyData ? '1,066' : Number(TakeawayTotal).toFixed(2)}
    +
    + } + {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && +
    +
    Dine In
    +
    :
    +
    {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)}
    +
    + } +
    +
    Amount
    +
    :
    +
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    +
    + +
    + + {(table2Data?.OrderType === "E") ? '' :
    +
    + {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && + <> +
    + +
    +

    + --------- GST Breakup Details -----------

    + {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && + + + + + + + + + + {OrderDetailGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + CGST + + SGST + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + } + + {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + + {OrderDetailIGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + IGST + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + + {OrderDetailVAT?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + VAT + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + +
    +
    + + + } +
    +
    } + +
    + +
    +
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    +
    +
    + + {GlobaldummyData ? ( + GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + ) : ( + CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    + ) : null} +
    + ) + )} +
    + +
    + {PaymentStatusSuccess?.length > 1 && + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + } + {GlobaldummyData && GlobalCashierName && +
    Cashier : Cashier Name
    + + } + {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && +
    Cashier : {CashierName} +
    + } + {GlobaldummyData && +
    Customer : Customer Name
    + + } + {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && +
    Customer : {table2Data?.CustSuppName} +
    + } + {(table2Data?.BookingTypeName === "Dine In" && dinePreference) && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) &&
    Captain: {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } +
    + + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData ? GlobalQrcodet &&
    +
    + 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)}
    +
    } +
    } +
    + +
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    + {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + +
    + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData ? GlobalIsnotes && + (
    +

    Notes : 10 days Return policy

    + +
    +
    ) : + Notestext && (
    +

    {Notestext}

    + +
    +
    ) + } +
    } + + + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {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 +
    + } + +
    +
    + } + +
    + : +
    + {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {/*

    {table2Data?.BrName}

    */} +
    + {(GlobalLogo && GlobaldummyData) ? image : null} + {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} +
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    +
    + +
    + {GlobaldummyData ? + 'BranchAddress, Town- 635XXX City - State' : + (BranchAddress || '') + (BranchCity ? (BranchAddress && BranchCity ? '-' : '') + BranchCity : '') + (BranchZip ? (BranchCity && BranchZip ? '-' : '') + BranchZip : '')} +
    +
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    +
    )} + {table2Data?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } + + {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } + +
    +
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    +
    {GlobaldummyData ? formattedDate : Date1}
    -
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {( - lastTransaction?.BeforeAdjustment || 0 - ).toFixed(2)} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' - ? '-' - : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {( - lastTransaction?.AfterAdjustment || 0 - ).toFixed(2)} - -
    -
    -
    - )} +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && + <> + {takeAwayPreference &&
    TakeAway
    } -
    - {PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : 'Split'}{' '} -  Payment :   - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} - /-{' '} -
    +
    + + + + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalAmount && : Amount && } + + + + {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => { + return ( + + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalAmount && : Amount && } + + ) + })} + +
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    + {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? +
    + {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( + + {item.ParcelCount}PCS{item.ParcelQty}PACK({item.ParcelType}) + + ))} +
    + :
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    )} +
    {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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    +
    + + } + {(DineInData?.length > 0 && dinePreference) && + <> +
    Dine In
    + +
    + + + + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalAmount && : Amount && } + + + + {(GlobaldummyData ? products : DineInData)?.map((item, index) => { + return ( + + {GlobaldummyData ? GlobalSlNo && : SLNO && } + {GlobaldummyData ? GlobalItem && : Item && } + {GlobaldummyData ? GlobalHsnCode && : HsnCode && } + {GlobaldummyData ? GlobalMRP && : MRP && } + {GlobaldummyData ? GlobalRate && : Rate && } + {GlobaldummyData ? GlobalDiscount && : Discount && } + {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } + {GlobaldummyData ? GlobalQuantity && : Quantity && } + {GlobaldummyData ? GlobalAmount && : Amount && } + + ) + })} + +
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    +
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  + {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) + ?.map(a => { return (
    {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}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    +
    + + } +
    +
    +
    +
    Items
    +
    :
    +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    +
    +
    +
    Qty
    +
    :
    +
    {GlobaldummyData ? '9' : totalQuantity}
    +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && +
    +
    Off
    +
    :
    +
    {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    +
    + } + {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && +
    +
    Take Away
    +
    :
    +
    {GlobaldummyData ? '1,066' : Number(TakeawayTotal).toFixed(2)}
    +
    + } + {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && +
    +
    Dine In
    +
    :
    +
    {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)}
    +
    + } +
    +
    Amount
    +
    :
    +
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    +
    + +
    + + {(table2Data?.OrderType === "E") ? '' :
    +
    + {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && + <> +
    + +
    +

    + --------- GST Breakup Details -----------

    + {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && + + + + + + + + + + {OrderDetailGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + CGST + + SGST + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + } + + {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + + {OrderDetailIGST?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + IGST + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && + <> +
    + + + + + + + + + + {OrderDetailVAT?.map((item) => + + + + + + + + ) + } +
    + + Taxable Amount + + VAT + + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + {Number(item.TotalAmt).toFixed(2)}
    + + } + +
    +
    + + + } +
    +
    } + +
    + +
    +
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-

    - - {GlobaldummyData - ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    + {GlobaldummyData ? ( + GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    ) - : CreditDetails && + ) : ( + CreditDetails && table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < - 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs( - table2Data.CustomerDetails[0].OldCreditBal - )} -

    - ) : null} - - )} +
    - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > - 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    + ) : null} + )} -

    - ) : null} -
    - )} -
    -
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map( - (paymentType) => ( -
    - {paymentType}:{' '} - {aggregatedPayments[paymentType].toFixed(2)} -
    - ) - )} - - )} - {GlobaldummyData && GlobalCashierName && ( -
    - {' '} - Cashier : Cashier Name -
    - )} - {CashierName && - CashierName !== undefined && - CashierName !== null && - !GlobaldummyData && - CashierNameField && ( -
    - Cashier : {CashierName} -
    - )} - {GlobaldummyData && ( -
    - {' '} - Customer : Customer Name -
    - )} - {table2Data?.CustSuppName && - table2Data?.CustSuppName !== undefined && - table2Data?.CustSuppName !== null && - !GlobaldummyData && ( -
    - Customer : {table2Data?.CustSuppName} -
    - )} - {table2Data?.BookingTypeName === 'Dine In' && - dinePreference && - table2Data?.SalesTableLinkDetails?.[0] - ?.WaiterName && ( -
    - Captain:{' '} - { - table2Data?.SalesTableLinkDetails?.[0] - ?.WaiterName - } + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    + ) : null}
    - )} -
    - - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalQrcodet && ( -
    -
    - 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 - )} -
    -
    - )} -
    - )} -
    - -
    - Your Order No : - {GlobaldummyData - ? '01' - : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} -
    - {sportsAppPreference && MembershipApplied && ( -
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + ) )} +
    -
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

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

    - {Notestext} -

    - -
    -
    - )} -
    - )} - - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {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. +
      + {PaymentStatusSuccess?.length > 1 && + <> + {/*

      Split Payment:

      */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
      + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
      ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    + + } + {GlobaldummyData && GlobalCashierName && +
    Cashier : Cashier Name
    + + } + {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && +
    Cashier : {CashierName}
    - )} + } + {GlobaldummyData && +
    Customer : Customer Name
    - {GlobaldummyData - ? GlobalSignature && ( -
    -

    - Signature -

    - + } + {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && +
    Customer : {table2Data?.CustSuppName}
    - ) - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} -
    - )} -
    + } - {PrintGreeting?.SettingValue === 'Y' && ( -
    - Thank You Visit Again -
    - )} - - )} -
    - ))} - {shouldFooterBeOnNewPage && FormatTheme && ( -
    -
    - <> -
    -
    -
    -
    Items
    -
    :
    -
    - {GlobaldummyData ? '8' : totalQuantityFilter?.length} -
    -
    -
    -
    Qty
    -
    :
    -
    - {GlobaldummyData ? '9' : totalQuantity} -
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    -
    Off
    -
    :
    -
    - {GlobaldummyData - ? '10' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + {table2Data?.BookingTypeName === "Dine In" && dinePreference && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) &&
    Captain: {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    }
    -
    - )} - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - takeAwayPreference && ( -
    -
    Take Away
    -
    :
    -
    - {GlobaldummyData - ? '1,066' - : Number(TakeawayTotal).toFixed(2)} -
    -
    - )} - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - dinePreference && ( -
    -
    Dine In
    -
    :
    -
    - {GlobaldummyData - ? '1,066' - : Number(DineInTotal).toFixed(2)} -
    -
    - )} -
    -
    Amount
    -
    :
    -
    - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    -
    - -
    - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    -
    - {((OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0)) && - table2Data?.NetAmount !== 0 && ( - <> -
    + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData ? GlobalQrcodet &&
    -

    - --------- GST Breakup Details ----------- -

    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - - - - - - - - - {OrderDetailGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - )} - - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed( - 2 - )} -
    - - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - - {OrderDetailVAT?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed( - 2 - )} -
    - - )} -
    -
    - - )} -
    -
    - )} -
    - -
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed( - 2 - )} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' - ? '-' - : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed( - 2 - )} - -
    -
    -
    - )} -
    - {PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : 'Split'}{' '} -  Payment :   - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} - /-{' '} -
    -
    -
    - - {GlobaldummyData - ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < - 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs( - table2Data.CustomerDetails[0].OldCreditBal - )} -

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > - 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} -
    -
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map( - (paymentType) => ( -
    - {paymentType}:{' '} - {aggregatedPayments[paymentType].toFixed(2)} -
    - ) - )} - - )} - {GlobaldummyData && GlobalCashierName && ( -
    - {' '} - Cashier : Cashier Name -
    - )} - {CashierName && - CashierName !== undefined && - CashierName !== null && - !GlobaldummyData && - CashierNameField && ( -
    - Cashier : {CashierName} -
    - )} - {GlobaldummyData && ( -
    - {' '} - Customer : Customer Name -
    - )} - {table2Data?.CustSuppName && - table2Data?.CustSuppName !== undefined && - table2Data?.CustSuppName !== null && - !GlobaldummyData && ( -
    - Customer : {table2Data?.CustSuppName} -
    - )} - {table2Data?.BookingTypeName === 'Dine In' && - dinePreference && - table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( -
    - Captain:{' '} - {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    - )} -
    - - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalQrcodet && ( -
    -
    - image + 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)} -
    -
    - )} -
    - )} -
    - -
    - Your Order No : - {GlobaldummyData - ? '01' - : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} -
    - {sportsAppPreference && MembershipApplied && ( -
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    - )} - -
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

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

    - {Notestext} -

    - -
    -
    - )} -
    - )} - - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {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 ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    : + (Qrcodet && paymentTypeUPI) && +
    + +
    Scan to Pay
    +
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    +
    } +
    }
    - )} - -
    -
    - )} -
    - ) : ( -
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {/*

    {table2Data?.BrName}

    */} -
    - {GlobalLogo && GlobaldummyData ? ( - image - ) : null} - {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( - image - ) : null} -
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    -
    -
    - {GlobaldummyData - ? 'BranchAddress, Town- 635XXX City - State' - : (BranchAddress || '') + - (BranchCity - ? (BranchAddress && BranchCity ? '-' : '') + BranchCity - : '') + - (BranchZip - ? (BranchCity && BranchZip ? '-' : '') + BranchZip - : '')} -
    -
    - {' '} - Mobile : +91{' '} - {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} -
    -
    - )} - {table2Data?.OrderType === 'E' && ( -
    - Estimate{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} -
    - )} +
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    + {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalBilltext - ? GlobalBilltext - : 'Cash' + ' Bill' - : BillName - ? BillName - : PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' - : ''}{' '} - {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} -
    - )} - -
    -
    - Bill No : - {GlobaldummyData - ? '553' - : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} -
    -
    - {GlobaldummyData ? formattedDate : Date1} -
    -
    - -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && ( - <> - {takeAwayPreference && ( -
    - TakeAway -
    - )} - -
    - - - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO && ( - - )} - {GlobaldummyData - ? GlobalItem && ( - - ) - : Item && } - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} - - - - {(GlobaldummyData ? products : TakeawayData)?.map( - (item, index) => { - return ( - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && - : HsnCode && } - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} - - ); - } - )} - -
    - S.No - - S.No - DisDes - HSN - - HSN - - MRP - - MRP - - Rate - - Rt - - (%) - - (%) - - Tax % - - Tax % - - Qty - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - Amt - - Amt -
    - {index + 1} - - {index + 1} - {item?.ProdName} -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount}PCS - {item.ParcelQty}PACK( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - )} -
    {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?.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.SalesQty} - - {item?.SalesQty} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || 0} -
    -
    - - )} - {DineInData?.length > 0 && dinePreference && ( - <> -
    - Dine In -
    - -
    - - - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item && } - {GlobaldummyData - ? GlobalHsnCode && ( - - ) - : HsnCode && ( - - )} - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} - - - - {(GlobaldummyData ? products : DineInData)?.map( - (item, index) => { - return ( - - {GlobaldummyData - ? GlobalSlNo && ( - - ) - : SLNO && ( - - )} - {GlobaldummyData - ? GlobalItem && - : Item && ( - - )} - {GlobaldummyData - ? GlobalHsnCode && - : HsnCode && } - {GlobaldummyData - ? GlobalMRP && ( - - ) - : MRP && ( - - )} - {GlobaldummyData - ? GlobalRate && ( - - ) - : Rate && ( - - )} - {GlobaldummyData - ? GlobalDiscount && ( - - ) - : Discount && ( - - )} - {GlobaldummyData - ? GlobalTax && ( - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - )} - {GlobaldummyData - ? GlobalQuantity && ( - - ) - : Quantity && ( - - )} - {GlobaldummyData - ? GlobalAmount && ( - - ) - : Amount && ( - - )} - - ); - } - )} - -
    - S.No - - S.No - DisDes - HSN - - HSN - - MRP - - MRP - - Rate - - Rt - - (%) - - (%) - - Tax % - - Tax % - - Qty - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - Amt - - Amt -
    - {index + 1} - - {index + 1} - {item?.ProdName} -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return
    {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}{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?.ProdTaxPercentage} - - {item?.ProdTaxPercentage || 0} - - {item?.SalesQty} - - {item?.SalesQty} - - {item?.TotalAmt} - - {item?.Type != 'C' - ? item?.TotalAmt - item?.OfferAmt || 0 - : item?.TotalAmt - item?.OfferValue || 0} -
    -
    - - )} -
    -
    -
    -
    Items
    -
    :
    -
    - {GlobaldummyData ? '8' : totalQuantityFilter?.length} -
    -
    -
    -
    Qty
    -
    :
    -
    - {GlobaldummyData ? '9' : totalQuantity} -
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    -
    Off
    -
    :
    -
    - {GlobaldummyData - ? '10' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} -
    -
    - )} - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - takeAwayPreference && ( -
    -
    Take Away
    -
    :
    -
    - {GlobaldummyData - ? '1,066' - : Number(TakeawayTotal).toFixed(2)} -
    -
    - )} - {DineInData?.length > 0 && - TakeawayData?.length > 0 && - dinePreference && ( -
    -
    Dine In
    -
    :
    -
    - {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)} -
    -
    - )} -
    -
    Amount
    -
    :
    -
    - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    -
    - -
    - {table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    -
    - {((OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0)) && - table2Data?.NetAmount !== 0 && ( - <> -
    - -
    -

    - --------- GST Breakup Details ----------- -

    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - - - - - - - - - {OrderDetailGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - )} - - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed( - 2 - )} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - - {OrderDetailVAT?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed( - 2 - )} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - - )} -
    -
    - - )} -
    -
    - )} -
    - -
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} - -
    -
    -
    - )} -
    - {PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : 'Split'}{' '} -  Payment :   - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} - /-{' '} -
    -
    -
    - {GlobaldummyData - ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} -

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} -

    - ) : null} -
    - )} -
    -
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}:{' '} - {aggregatedPayments[paymentType].toFixed(2)} + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData ? GlobalIsnotes && + (
    +

    Notes : 10 days Return policy

    + +
    +
    ) : + Notestext && (
    +

    {Notestext}

    + +
    +
    ) + } +
    } + + + {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {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 && GlobalCashierName && ( -
    - {' '} - Cashier : Cashier Name + + + {PrintGreeting?.SettingValue === "Y" && +
    + Thank You Visit Again +
    + } + {/*
    print
    */}
    - )} - {CashierName && - CashierName !== undefined && - CashierName !== null && - !GlobaldummyData && - CashierNameField && ( -
    - Cashier : {CashierName} -
    - )} - {GlobaldummyData && ( -
    - {' '} - Customer : Customer Name -
    - )} - {table2Data?.CustSuppName && - table2Data?.CustSuppName !== undefined && - table2Data?.CustSuppName !== null && - !GlobaldummyData && ( -
    - Customer : {table2Data?.CustSuppName} -
    - )} + } - {table2Data?.BookingTypeName === 'Dine In' && - dinePreference && - table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( -
    - Captain:{' '} - {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    - )} -
    + + ) +} - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalQrcodet && ( -
    -
    - 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)} -
    -
    - )} -
    - )} -
    - -
    - Your Order No : - {GlobaldummyData - ? '01' - : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)} -
    - {sportsAppPreference && MembershipApplied && ( -
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    - )} - -
    - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {GlobaldummyData - ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

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

    {Notestext}

    - -
    -
    - )} -
    - )} - - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {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
    - )} - {/*
    print
    */} -
    - )} - - ); -}; - -export default Printstyle8; +export default Printstyle8 diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx index d7f4463..67d49e8 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx @@ -30,10 +30,7 @@ import { GlobalprintTax, } from '../../../../Features/ThemeChange/ThemeChange'; import Logo from '../../../../Images/Logo.jpg'; -import { - GlobalUpiIDprint, - PreferenceData, -} from '../../../../Features/BookingScreen/BookingData/BookingData'; +import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.scss'; import QRCode from 'react-qr-code'; import signature from '../../../../Images/signatureimage.jpg'; @@ -122,19 +119,6 @@ const PrintStyle9 = ({ const paymentTypeUPI = PaymentStatus?.find( (ps) => ps.PaymentTypeName === 'UPI' ); - - const isEditedBill = PaymentStatus?.some((payment) => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ); - let TermsAndConditions = printDatas?.TermsandConditions; let SignatureImg = printDatas?.Signature; let Notestext = printDatas?.Notes; @@ -246,7 +230,7 @@ const PrintStyle9 = ({ HSN: '01', Size: 250, UomName: 'g', - ProdTaxPercentage: 5, + ProdTaxPercentage: 5 }, { ProdName: 'ITEM 2', @@ -258,7 +242,7 @@ const PrintStyle9 = ({ HSN: '02', Size: 250, UomName: 'g', - ProdTaxPercentage: 5, + ProdTaxPercentage: 5 }, { ProdName: 'ITEM 3', @@ -270,7 +254,7 @@ const PrintStyle9 = ({ HSN: '03', Size: 250, UomName: 'g', - ProdTaxPercentage: 0, + ProdTaxPercentage: 0 }, { ProdName: 'ITEM 4', @@ -282,7 +266,7 @@ const PrintStyle9 = ({ HSN: '04', Size: 250, UomName: 'g', - ProdTaxPercentage: 18, + ProdTaxPercentage: 18 }, { ProdName: 'ITEM 5', @@ -294,7 +278,7 @@ const PrintStyle9 = ({ HSN: '05', Size: 250, UomName: 'g', - ProdTaxPercentage: 40, + ProdTaxPercentage: 40 }, { ProdName: 'ITEM 6', @@ -306,7 +290,7 @@ const PrintStyle9 = ({ HSN: '06', Size: 250, UomName: 'g', - ProdTaxPercentage: 0, + ProdTaxPercentage: 0 }, { ProdName: 'ITEM 7', @@ -318,7 +302,7 @@ const PrintStyle9 = ({ HSN: '08', Size: 250, UomName: 'g', - ProdTaxPercentage: 5, + ProdTaxPercentage: 5 }, ]; @@ -367,8 +351,8 @@ const PrintStyle9 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -415,7 +399,7 @@ const PrintStyle9 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    @@ -511,10 +495,10 @@ const PrintStyle9 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    {' '} @@ -567,120 +551,114 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && ( - Item - ) + Item + ) : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + { WeightasKg ?'Qty/Kg' :'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData - ? GlobalTax && ( - - Tax % - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + + Dis{' '} + + )} + {GlobaldummyData ? + GlobalTax && + + Tax % + : + (Tax && table2Data?.OrderType !== 'E') && + + Tax % + + } {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -690,207 +668,205 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount}PCS - {item.ParcelQty}PACK( - {item.ParcelType}) - - ))} - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount}PCS + {item.ParcelQty}PACK( + {item.ParcelType}) + + ))} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {a.SerialNumber}
    - ); - }) - : ''}{' '} - {item?.ProductIdentifierDtls?.length > + ? 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?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > + ? 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {a.SerialNumber}
    - ); - }) - : ''}{' '} - {item?.ProductIdentifierDtls?.length > + ? 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?.ProductIdentifierDtls.filter( + (item1) => + item1.IMEI1 !== '' || + item1.IMEI2 !== '' + )?.map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) + : ''} +
    + )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + ? GlobalTax && + + {item?.ProdTaxPercentage} + : + (Tax && table2Data?.OrderType !== 'E') && + + {item?.ProdTaxPercentage || 0} + + } {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); })} @@ -917,120 +893,114 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && ( - Item - ) + Item + ) : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + { WeightasKg ?'Qty/Kg' :'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData - ? GlobalTax && ( - - Tax % - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + + Dis{' '} + + )} + {GlobaldummyData ? + GlobalTax && + + Tax % + : + (Tax && table2Data?.OrderType !== 'E') && + + Tax % + + } {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -1040,116 +1010,114 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + ? GlobalTax && + + {item?.ProdTaxPercentage} + : + (Tax && table2Data?.OrderType !== 'E') && + + {item?.ProdTaxPercentage || 0} + + } {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); })} @@ -1194,25 +1162,25 @@ const PrintStyle9 = ({ )} {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off : -
    - {GlobaldummyData - ? '1,066' - : Number( +
    + Off : +
    + {GlobaldummyData + ? '1,066' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} +
    -
    - )} + )}
    - {item?.TaxPercentage || 0}% - + >{item?.TaxPercentage || 0}% - {item?.TaxPercentage || 0}% - + >{item?.TaxPercentage || 0}% - {item?.TaxPercentage || 0}% - + >{item?.TaxPercentage || 0}% {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -1659,28 +1621,28 @@ const PrintStyle9 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1785,142 +1747,64 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} -
    -
    - ₹{' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} -
    +
    + QRcode +
    + 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 + )} +
    +
    + )}
    )}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed( - 2 - )} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' - ? '-' - : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed( - 2 - )} - -
    -
    -
    - )} - -
    +
    Your Order No : {GlobaldummyData ? '01' : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} + extractLastNumber(table2Data?.SalesId)}
    @@ -1949,23 +1833,23 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -1985,137 +1869,137 @@ const PrintStyle9 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -2213,8 +2097,8 @@ const PrintStyle9 = ({ {GlobaldummyData ? '1,066' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -2353,9 +2237,7 @@ const PrintStyle9 = ({ fontSize: '11px', textAlign: 'right', }} - > - {item?.TaxPercentage || 0}% - + >{item?.TaxPercentage || 0}% - {item?.TaxPercentage || 0}% - + >{item?.TaxPercentage || 0}% - {item?.TaxPercentage || 0}% - + >{item?.TaxPercentage || 0}% {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -2652,28 +2530,28 @@ const PrintStyle9 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2772,135 +2650,60 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} -
    -
    - ₹{' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    +
    + QRcode +
    + 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)} +
    +
    + )}
    )}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed( - 2 - )} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' - ? '-' - : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} - -
    -
    -
    - )} -
    +
    Your Order No : {GlobaldummyData ? '01' : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} + extractLastNumber(table2Data?.SalesId)}
    @@ -2929,23 +2732,23 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2965,137 +2768,137 @@ const PrintStyle9 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -3152,7 +2955,7 @@ const PrintStyle9 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    @@ -3257,10 +3060,10 @@ const PrintStyle9 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    {' '} @@ -3309,92 +3112,90 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && ( - - S.No - - ) + + S.No + + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + { WeightasKg ?'Qty/Kg' :'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData - ? GlobalTax && ( - - Tax % - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + + Dis{' '} + + )} + {GlobaldummyData ? + GlobalTax && + + Tax % + : + (Tax && table2Data?.OrderType !== 'E') && + + Tax % + + } {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3408,140 +3209,138 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return
    {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?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return
    {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(',')} +
    + ); + }) + : ''} +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + ? GlobalTax && + + {item?.ProdTaxPercentage} + : + (Tax && table2Data?.OrderType !== 'E') && + + {item?.ProdTaxPercentage || 0} + + } {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3575,82 +3374,80 @@ const PrintStyle9 = ({ : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + { WeightasKg ?'Qty/Kg' :'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData - ? GlobalTax && ( - - Tax % - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + + Dis{' '} + + )} + {GlobaldummyData ? + GlobalTax && + + Tax % + : + (Tax && table2Data?.OrderType !== 'E') && + + Tax % + + } {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3664,108 +3461,106 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) - : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + ? GlobalTax && + + {item?.ProdTaxPercentage} + : + (Tax && table2Data?.OrderType !== 'E') && + + {item?.ProdTaxPercentage || 0} + + } {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3818,8 +3613,8 @@ const PrintStyle9 = ({ {GlobaldummyData ? '1,066' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -3959,9 +3754,7 @@ const PrintStyle9 = ({ fontSize: '11px', textAlign: 'right', }} - > - {item?.TaxPercentage || 0}% - + >{item?.TaxPercentage || 0}% - {item?.TaxPercentage || 0}% - + >{item?.TaxPercentage || 0}% - {item?.TaxPercentage || 0}% - + >{item?.TaxPercentage || 0}% {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > 0 ? (

    @@ -4251,26 +4040,26 @@ const PrintStyle9 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4357,123 +4146,51 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹{' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    +
    + QRcode +
    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)}
    - )} +
    + )}
    )}
    - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} - -
    -
    -
    - )} - -
    +
    Your Order No : {GlobaldummyData ? '01' @@ -4512,26 +4229,26 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -4551,137 +4268,137 @@ const PrintStyle9 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} -
    2. - ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    - )} + 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/DashBoard/RetailDashboard.jsx b/src/Pages/DashBoard/RetailDashboard.jsx index 4a48c3d..750e020 100644 --- a/src/Pages/DashBoard/RetailDashboard.jsx +++ b/src/Pages/DashBoard/RetailDashboard.jsx @@ -264,6 +264,7 @@ const RetailDashboard = () => { useEffect(() => { if (isInitialLoad && CompId && AppId && selection === 'dashboard') { + // debugger if (dates && dates?.[0] && dates?.[1] && !initialDate) { onRangeChange(dates, [ dates?.[0]?.format('DD-MM-YYYY'), diff --git a/src/Pages/Kiosk/CardPage/SelfCardPage1.jsx b/src/Pages/Kiosk/CardPage/SelfCardPage1.jsx index 3fd8b34..1f19cca 100644 --- a/src/Pages/Kiosk/CardPage/SelfCardPage1.jsx +++ b/src/Pages/Kiosk/CardPage/SelfCardPage1.jsx @@ -257,29 +257,29 @@ const CardPage1 = (props) => { if (isItemInCart) { newOrderDetails = newOrderDetails.map((cartItem) => cartItem.ProdId === item.ProdId && - cartItem.InwardDtlId === item.InwardDtlId && - cartItem.OrderRate === item.OrderRate && - cartItem?.BookingTypeName === item?.BookingTypeName && - !cartItem?.disabled + cartItem.InwardDtlId === item.InwardDtlId && + cartItem.OrderRate === item.OrderRate && + cartItem?.BookingTypeName === item?.BookingTypeName && + !cartItem?.disabled ? { - ...cartItem, - OrderQty: cartItem.OrderQty + 1, - TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate, - TaxAmt: ( - ((cartItem.OrderQty + 1) * - cartItem.OrderRate * - cartItem.TaxPercentage) / - (100 + cartItem.TaxPercentage) - ).toFixed(2), - WithoutTaxRate: - (cartItem.OrderQty + 1) * cartItem.OrderRate - - ( + ...cartItem, + OrderQty: cartItem.OrderQty + 1, + TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate, + TaxAmt: ( ((cartItem.OrderQty + 1) * cartItem.OrderRate * cartItem.TaxPercentage) / (100 + cartItem.TaxPercentage) ).toFixed(2), - } + WithoutTaxRate: + (cartItem.OrderQty + 1) * cartItem.OrderRate - + ( + ((cartItem.OrderQty + 1) * + cartItem.OrderRate * + cartItem.TaxPercentage) / + (100 + cartItem.TaxPercentage) + ).toFixed(2), + } : cartItem ); } else { @@ -360,11 +360,11 @@ const CardPage1 = (props) => { (cartItem) => cartItem?.ProdId === item?.ProductDetail?.[0]?.ProdId && cartItem?.InwardDtlId === - item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0] - ?.InwardDtlId && + item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0] + ?.InwardDtlId && cartItem?.OrderRate === - item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0] - ?.SellPrice + item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0] + ?.SellPrice ); if (Isincart && Isincart?.StockAvailable === 'Y') { if (Isincart?.BalanceQty > Isincart?.OrderQty) { @@ -419,13 +419,13 @@ const CardPage1 = (props) => { (cartItem) => cartItem?.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 ); console.log(Isincart, item, KioskOrderDetails, 'IsincartsingleVarient'); if (Isincart && Isincart?.StockAvailable === 'Y') { @@ -543,7 +543,7 @@ const CardPage1 = (props) => { SinglePc: onePcs ? 'Y' : 'N', NoOfPcs: onePcs ? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[stockIndex]?.NoOfPcs + ?.StockDetails?.[stockIndex]?.NoOfPcs : null, ProdVariantName: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] @@ -568,14 +568,14 @@ const CardPage1 = (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, SuppId: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] ?.StockDetails?.[stockIndex]?.SuppId, @@ -603,6 +603,7 @@ const CardPage1 = (props) => { }; // add Product in cart state const AddOrderDetails = async (item) => { + // debugger message.success(`${item?.ProdName} Added in the Cart`); const isItemInCart = KioskOrderDetails?.find( (cartItem) => @@ -618,29 +619,29 @@ const CardPage1 = (props) => { changeKioskOrderDetails( KioskOrderDetails?.map((cartItem) => cartItem.ProdId === item.ProdId && - cartItem.InwardDtlId === item.InwardDtlId && - cartItem.OrderRate === item.OrderRate && - cartItem?.BookingTypeName === item?.BookingTypeName && - !cartItem?.disabled + cartItem.InwardDtlId === item.InwardDtlId && + cartItem.OrderRate === item.OrderRate && + cartItem?.BookingTypeName === item?.BookingTypeName && + !cartItem?.disabled ? { - ...cartItem, - OrderQty: cartItem.OrderQty + 1, - TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate, - TaxAmt: ( - ((cartItem.OrderQty + 1) * - cartItem.OrderRate * - cartItem.TaxPercentage) / - (100 + cartItem.TaxPercentage) - ).toFixed(2), - WithoutTaxRate: - (cartItem.OrderQty + 1) * cartItem.OrderRate - - ( + ...cartItem, + OrderQty: cartItem.OrderQty + 1, + TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate, + TaxAmt: ( ((cartItem.OrderQty + 1) * cartItem.OrderRate * cartItem.TaxPercentage) / (100 + cartItem.TaxPercentage) ).toFixed(2), - } + WithoutTaxRate: + (cartItem.OrderQty + 1) * cartItem.OrderRate - + ( + ((cartItem.OrderQty + 1) * + cartItem.OrderRate * + cartItem.TaxPercentage) / + (100 + cartItem.TaxPercentage) + ).toFixed(2), + } : cartItem ) ) @@ -861,7 +862,7 @@ const CardPage1 = (props) => { return (
    {/* Top area */}
    @@ -874,7 +875,7 @@ const CardPage1 = (props) => { ? props.class : 'KioskCard-card-main' } - // style={{ backgroundColor: getKioskLightColourdata }} + // style={{ backgroundColor: getKioskLightColourdata }} > {/* Mapping through kioskCategoriesCard */} {(selfBookingOption === 'Card Only' || @@ -890,9 +891,9 @@ const CardPage1 = (props) => { card?.OverAllQty, KioskOrderDetails ) > 0) || - card?.ProductDetail?.some( - (item) => item?.StockAvailable !== 'Y' - ) + card?.ProductDetail?.some( + (item) => item?.StockAvailable !== 'Y' + ) ? 'KioskCard-card' : 'KioskCard-card-dis' } @@ -922,9 +923,9 @@ const CardPage1 = (props) => { card?.OverAllQty, KioskOrderDetails ) > 0) || - card?.ProductDetail?.some( - (item) => item?.StockAvailable !== 'Y' - ) ? ( + card?.ProductDetail?.some( + (item) => item?.StockAvailable !== 'Y' + ) ? ( '' ) : (
    { {card?.ProductDetail?.filter( (item) => item.OnePcsAvailable == 'Y' ).length !== 0 && ( -
    { - e.stopPropagation(); // Stop event propagation to the parent div +
    { + e.stopPropagation(); // Stop event propagation to the parent div - if ( - !( - (card?.OverAllQty !== undefined && - returnOnepcCount( - card?.ProductDetail?.[0]?.ProdName, - card?.OverAllPcs, - CartOrderDetails - ) > 0) || - card?.ProductDetail?.some( - (item) => item?.StockAvailable !== 'Y' - ) + if ( + !( + (card?.OverAllQty !== undefined && + returnOnepcCount( + card?.ProductDetail?.[0]?.ProdName, + card?.OverAllPcs, + CartOrderDetails + ) > 0) || + card?.ProductDetail?.some( + (item) => item?.StockAvailable !== 'Y' ) - ) { - return; // Don't proceed if the condition isn't met - } else { - CardOnClick(card, 'OnePeiceProduct'); // This only runs when you click the "One Piece" button - } - }} - style={{ - fontFamily: SelectedCardFont || '', - backgroundColor: - SelectedCardColor?.FontColor || '#f00000ff', - color: - returnOnepcCount( - card?.ProductDetail?.[0]?.ProdName, - card?.OverAllPcs, - CartOrderDetails - ) > 0 || - card?.ProductDetail?.some( - (product) => product?.StockAvailable !== 'Y' - ) - ? true - ? SelectedCardColor?.BackgroundColor || + ) + ) { + return; // Don't proceed if the condition isn't met + } else { + CardOnClick(card, 'OnePeiceProduct'); // This only runs when you click the "One Piece" button + } + }} + style={{ + fontFamily: SelectedCardFont || '', + backgroundColor: + SelectedCardColor?.FontColor || '#f00000ff', + color: + returnOnepcCount( + card?.ProductDetail?.[0]?.ProdName, + card?.OverAllPcs, + CartOrderDetails + ) > 0 || + card?.ProductDetail?.some( + (product) => product?.StockAvailable !== 'Y' + ) + ? true + ? SelectedCardColor?.BackgroundColor || '#000000' - : '#fff' - : '#ff4d4f', - }} - > -
    - {' '} - {AppName?.toLowerCase() === 'sports' - ? 'Single' - : '1PCS'}{' '} -
    + : '#fff' + : '#ff4d4f', + }} + > +
    + {' '} + {AppName?.toLowerCase() === 'sports' + ? 'Single' + : '1PCS'}{' '}
    - )} +
    + )}
    ) )} diff --git a/src/Pages/Preference/PreferenceList.jsx b/src/Pages/Preference/PreferenceList.jsx index 9bb5ac1..a966c06 100644 --- a/src/Pages/Preference/PreferenceList.jsx +++ b/src/Pages/Preference/PreferenceList.jsx @@ -108,7 +108,6 @@ const PreferenceList = () => { weeklysalesreport: allSettingsMap['weeklysalesreport'] === 'Y', notificationblink: allSettingsMap['notificationblink'] === 'Y', onlineindivdualslots: allSettingsMap['onlineindivdualslots'] === 'Y', - editbill: allSettingsMap['editbill'] === 'Y', notification: [ ...(allSettingsMap['onbilltime'] === 'Y' ? ['onbilltime'] : []), ...(allSettingsMap['1daybefore'] === 'Y' ? ['1daybefore'] : []), @@ -309,7 +308,6 @@ const PreferenceList = () => { lowstockreport: values.lowstockreport, weeklysalesreport: values.weeklysalesreport, notificationblink: values.notificationblink, - editbill: values.editbill, }; const arrayValues = { @@ -629,7 +627,6 @@ const PreferenceList = () => { 'Do you Want Customised Bill Number?' )} {renderCheckbox('upiqr', 'Do you want to show the UPI QR code?')} - {/* {renderCheckbox('editbill', 'Do you want to edit the previously created bill?')} */}
    diff --git a/src/Pages/Tablebooking/TableBooking.jsx b/src/Pages/Tablebooking/TableBooking.jsx index 7568463..3c03f1a 100644 --- a/src/Pages/Tablebooking/TableBooking.jsx +++ b/src/Pages/Tablebooking/TableBooking.jsx @@ -1034,6 +1034,7 @@ const TableBooking = ({ PaymentStatus }) => { ); const navigatetoBooking = async (data) => { + const OrderDetails = data?.OrderDetails?.[0]; const { OrderDtlDetails, diff --git a/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx b/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx index a787009..5722742 100644 --- a/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx +++ b/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx @@ -49,18 +49,6 @@ const PaymentPdfBooking = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); - const isEditedBill = PaymentStatus?.some(payment => { - const type = payment?.AdjustmentType?.toLowerCase(); - return ( - (type === 'extra' || type === 'refund') && - payment?.BeforeAdjustment != null && - payment?.AfterAdjustment != null - ); - }); - const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' - ) - console.log(singleData2?.filter(data => data?.EditTokenAvailable !== 'N'), "singleData2") const ExtraChargeTotal = table2Data?.ExtraChargeDetails?.reduce( (accumulator, currentObject) => { return accumulator + currentObject.TotalAmt; @@ -92,7 +80,6 @@ const PaymentPdfBooking = ({ const [BranchZip, setBranchZip] = useState(); const CashierName = getSession('userName'); const printerTemplateStyle = useSelector(SelectedPrintTemplate); - console.log(printerTemplateStyle, "printerTemplateStyle") const appPreferences = useSelector(ApplicationPreferences); const SettingData = useSelector(PreferenceData); const estimatePrintHeader = @@ -310,21 +297,6 @@ const PaymentPdfBooking = ({ return `${h}:${m}${suffix}`; }; - const getAdjustmentLabel = (type) => { - switch (type?.toUpperCase()) { - case 'REFUND': - return 'Returned Item Amount'; - case 'EXTRA': - return 'Additional Amount'; - case 'DISCOUNT': - return 'Discount Applied'; - case 'ROUND_OFF': - return 'Round Off'; - default: - return 'Adjustment Amount'; - } - }; - return ( <>
    @@ -369,8 +341,8 @@ const PaymentPdfBooking = ({ {table2Data?.AddressDetails?.[0]?.City && table2Data?.AddressDetails?.[0]?.Zip && table2Data?.AddressDetails?.[0]?.City + - '- ' + - table2Data?.AddressDetails?.[0]?.Zip} + '- ' + + table2Data?.AddressDetails?.[0]?.Zip}

    )} @@ -386,9 +358,9 @@ const PaymentPdfBooking = ({ GSTIN: {table2Data?.BrGSTIN}

    )} - {table2Data?.BrMobile &&

    +

    Mobile:+91 {table2Data?.BrMobile} -

    } +

    @@ -463,7 +435,7 @@ const PaymentPdfBooking = ({
    - Bill No: + BillNo: {table2Data?.OrderId && extractLastNumberOrderId( table2Data?.OrderId, @@ -540,27 +512,27 @@ const PaymentPdfBooking = ({   {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (items) => - items.SerialNumber && - items.SerialNumber !== '' - ).map((a, i) => ( -
    {a.SerialNumber}
    - )) + (items) => + items.SerialNumber && + items.SerialNumber !== '' + ).map((a, i) => ( +
    {a.SerialNumber}
    + )) : ''} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (id) => id.IMEI1 !== '' || id.IMEI2 !== '' - ).map((id, i) => { - const imei1 = id.IMEI1 || ''; - const imei2 = id.IMEI2 || ''; - return ( -
    - {[imei1, imei2] - .filter(Boolean) - .join(',')} -
    - ); - }) + (id) => id.IMEI1 !== '' || id.IMEI2 !== '' + ).map((id, i) => { + const imei1 = id.IMEI1 || ''; + const imei2 = id.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) : ''}
    @@ -577,25 +549,25 @@ const PaymentPdfBooking = ({   {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (items) => - items.SerialNumber && - items.SerialNumber !== '' - ).map((a, i) => ( -
    {a.SerialNumber}
    - )) + (items) => + items.SerialNumber && + items.SerialNumber !== '' + ).map((a, i) => ( +
    {a.SerialNumber}
    + )) : ''} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (id) => id.IMEI1 !== '' || id.IMEI2 !== '' - ).map((id, i) => { - const imei1 = id.IMEI1 || ''; - const imei2 = id.IMEI2 || ''; - return ( -
    - {[imei1, imei2].filter(Boolean).join(',')} -
    - ); - }) + (id) => id.IMEI1 !== '' || id.IMEI2 !== '' + ).map((id, i) => { + const imei1 = id.IMEI1 || ''; + const imei2 = id.IMEI2 || ''; + return ( +
    + {[imei1, imei2].filter(Boolean).join(',')} +
    + ); + }) : ''} )} @@ -1137,7 +1109,7 @@ const PaymentPdfBooking = ({ >
    )} - {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( + {PaymentStatusSuccess?.length > 1 && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments)?.map((paymentType) => ( @@ -1150,48 +1122,6 @@ const PaymentPdfBooking = ({ ))} )} - {isEditedBill && lastTransaction && ( -
    -
    -
    - Bill Gross Amount - {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - Net Bill Amount - {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} -
    -
    -
    - )} {table2Data?.CustSuppName && (

    data?.EditTokenAvailable !== 'N')?.reduce((acc, item, idx) => { + singleData2?.reduce((acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { // For null or empty CounterName, print each item individually @@ -1677,7 +1607,7 @@ const PaymentPdfBooking = ({

    Token

    -

    Bill No: {orderId}

    +

    BillNo: {orderId}

    {Date1}

    @@ -1695,9 +1625,9 @@ const PaymentPdfBooking = ({ - + - + ))} From 60f8a58c4dda0405b372551013d665aa84c68d17 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 Feb 2026 18:10:12 +0530 Subject: [PATCH 4/5] after-removing-conflicts --- src/Components/Menu/SideMenuPozo.jsx | 11 +- .../BookingScreen/BookingData/BookingData.js | 35 +- .../BSBillingTable1/BST1Payment.jsx | 507 +- .../BSBillingTable1/BalanceAndReceived.jsx | 29 +- .../BSBillingTable2/BSBillingTable2.jsx | 178 +- .../BSBillingTable3/BSBillingTable3pay.jsx | 175 +- .../BSBillingTable5/BSBillingTable5.jsx | 183 +- .../BSBillingTable6/BST6Payment.jsx | 178 +- .../BSBillingTable7/BSBilling7Payment.jsx | 182 +- .../StandardTable/StandardTable.jsx | 401 +- .../StandardTable/StandardTable.scss | 58 +- .../StandardTable/StandardTablePayment.jsx | 216 +- .../Components/BSCombo/BSC1Payment.jsx | 374 +- .../Components/BSItemCards/BSItemCard.jsx | 11 +- .../FeaturesFunctionalities.jsx | 440 +- .../BookingFunctionality/SplitPayment.jsx | 251 +- .../OtherConponents/Reprint/BSReprint.jsx | 223 +- .../PrintMainPage/PrintPreviewpage.jsx | 196 +- .../UtillComponents/BSCreditCustomer.jsx | 1 - .../BSNavbarSearchStandard.jsx | 4 +- .../UtillComponents/BSPrinterSetting.jsx | 6 +- .../PrintTemplates/A4/A4Standard.jsx | 6 +- .../PrintTemplates/A4/PrintA4Style11.jsx | 178 +- .../PrintTemplates/A4/PrintStyleA5.jsx | 259 +- .../ThermalPrinter/PrintStyle1.jsx | 3195 +++++---- .../ThermalPrinter/PrintStyle10.jsx | 231 +- .../ThermalPrinter/PrintStyle11.jsx | 5377 ++++++++++---- .../ThermalPrinter/PrintStyle12.jsx | 5359 ++++++++++---- .../ThermalPrinter/PrintStyle2.jsx | 3526 +++++----- .../ThermalPrinter/PrintStyle3.jsx | 155 +- .../ThermalPrinter/PrintStyle4.jsx | 3444 ++++----- .../ThermalPrinter/PrintStyle5.jsx | 2639 +++---- .../ThermalPrinter/PrintStyle6.jsx | 2917 ++++---- .../ThermalPrinter/PrintStyle7.jsx | 5699 +++++++++++---- .../ThermalPrinter/PrintStyle8.jsx | 6218 +++++++++++++---- .../ThermalPrinter/PrintStyle9.jsx | 3233 +++++---- src/Pages/DashBoard/RetailDashboard.jsx | 1 - src/Pages/Kiosk/CardPage/SelfCardPage1.jsx | 209 +- src/Pages/Preference/PreferenceList.jsx | 3 + src/Pages/Tablebooking/TableBooking.jsx | 1 - .../paymentpdfPage/PaymentPdfBooking.jsx | 158 +- 41 files changed, 30973 insertions(+), 15494 deletions(-) diff --git a/src/Components/Menu/SideMenuPozo.jsx b/src/Components/Menu/SideMenuPozo.jsx index c60cd0c..bbd38dd 100644 --- a/src/Components/Menu/SideMenuPozo.jsx +++ b/src/Components/Menu/SideMenuPozo.jsx @@ -56,6 +56,9 @@ import { changeBtoBQuickProductTransfer, changeTipAmount, GlobalDineinDefault, + changePreviousOrderOfferDetail, + changePreviousOrderPayment, + changeBillEditingMode, } from '../../Features/BookingScreen/BookingData/BookingData'; import { changeWholeSaleAuctionSelectedData, @@ -262,6 +265,9 @@ const SideMenuPozo = ({ items = [] }) => { dispatch(ChangeTotalAmount([])); dispatch(ChangeFullFreeProductList([])); dispatch(changeFullOfferAppliedProducts([])); + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeLoyaltyConsumedQuantities({})); } if (e == `${subDirectory}sales`) { @@ -285,6 +291,9 @@ const SideMenuPozo = ({ items = [] }) => { dispatch(Offer.changeCoupenCodeAmount(0)); dispatch(ChangeFullFreeProductList([])); dispatch(changeFullOfferAppliedProducts([])); + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(ChangeTotalAmount([])); dispatch(changeLoyaltyConsumedQuantities({})); } @@ -382,7 +391,7 @@ const SideMenuPozo = ({ items = [] }) => { e.stopPropagation(); handleMenuClick(item, parentKeys, e, level); }} - // style={{ paddingLeft: `${level * 10 + 1}px` }} + // style={{ paddingLeft: `${level * 10 + 1}px` }} > {item.icon && level === 0 && ( { + return await axiosRetailInstanceData.put(`/SalesBillEdit`, putData); + } +); + export const getEstimateDatewiseReport = createAsyncThunk( 'BookingData/getEstimateDatewiseReport', async (data) => { @@ -1432,7 +1440,7 @@ export const getMissedOrderids = createAsyncThunk( export const CustomerOrderList = createAsyncThunk( 'CustomerOrderList/LastBuyProductList', async (data) => { - const { AppId, CompId, BranchId, MobileNo,FromDate,ToDate } = data; + const { AppId, CompId, BranchId, MobileNo, FromDate, ToDate } = data; if ( AppId != null && AppId != undefined && @@ -1604,6 +1612,9 @@ const initialState = { AddBookingDetailsTrigger: false, CurrentOrderId: null, productCardTrigger: 0, + salesBillEdit: false, + previousOrderPayment: [], + previousOrderOfferDetails: [], }; const BookingData = createSlice({ @@ -1929,6 +1940,15 @@ const BookingData = createSlice({ triggerProductCard: (state) => { state.productCardTrigger += 1; }, + changeBillEditingMode: (state, action) => { + state.salesBillEdit = action?.payload; + }, + changePreviousOrderPayment: (state, action) => { + state.previousOrderPayment = action?.payload; + }, + changePreviousOrderOfferDetail: (state, action) => { + state.previousOrderOfferDetails = action?.payload; + }, }, extraReducers: (builder) => { @@ -1976,8 +1996,8 @@ const BookingData = createSlice({ } }), - builder.addCase(getProductsearch.fulfilled, (state, action) => { - console.log(action?.payload,"mohanaacacacca") + builder.addCase(getProductsearch.fulfilled, (state, action) => { + console.log(action?.payload, "mohanaacacacca") if (action?.payload?.statusCode === 1) { state.SelectedDatas = action?.payload?.data; } else { @@ -2197,6 +2217,9 @@ export const { changeAddBookingDetailsTrigger, changeCurrentOrderId, triggerProductCard, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail } = BookingData.actions; export const GlobalComboRedirectionToDefaultLayoutForParking = (state) => @@ -2365,5 +2388,11 @@ export const GlobalAddBookingDetailsTrigger = (state) => state?.BookingData?.AddBookingDetailsTrigger; export const GlobalCurrentOrderId = (state) => state?.BookingData?.CurrentOrderId; +export const GlobalSalesBillEdit = (state) => + state?.BookingData?.salesBillEdit; +export const GlobalPreviousOrderPayment = (state) => + state?.BookingData?.previousOrderPayment; +export const GlobalPreviousOrderOfferDetails = (state) => + state?.BookingData?.previousOrderOfferDetails; export default BookingData.reducer; diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx index bd078f5..05f774e 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BST1Payment.jsx @@ -117,6 +117,15 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, + GlobalSalesBillEdit, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalpaymentOptionData, + getPaymentOptions, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; import { @@ -235,6 +244,10 @@ export default function BST1Payment() { ); const dispatch = useDispatch(); const navigate = useNavigate(); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const Discount = useSelector(GlobalOverAllOfferAmt); const defaultBookingType = useSelector(GlobalDefaultBookingType); const globalTipAmount = useSelector(GlobaltipAmount); @@ -323,6 +336,12 @@ export default function BST1Payment() { const [defaultEnabled, setDefaultEnabled] = useState(false); const [SelectedUpiOption, setSelectedUpiOption] = useState(); const [hold, setHold] = useState(false); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); + console.log(currentOrderNetAmount, 'currentOrderNetAmount', previousNetAmount, salesBillEdit); const [addcustomer, setAddCustomer] = useState(false); const [PrintOrderDetails, setPrintOrderDetails] = useState([]); //Total calculation @@ -540,6 +559,27 @@ export default function BST1Payment() { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + // let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0)); let withdiscTotal = Total - @@ -547,19 +587,17 @@ export default function BST1Payment() { (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( - formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - ); + const currentOrderNetAmount = formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) + + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); - dispatch( - changeSummeryTotalAmount( - formatAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) - ) - ); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -621,6 +659,31 @@ export default function BST1Payment() { fetchApi(); } }, [UserType]); + + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) useEffect(() => { let hasAccess = false; @@ -828,7 +891,7 @@ export default function BST1Payment() { const selectedStyle = stylesMap[ - printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle + printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle ]; if (selectedStyle) { @@ -1182,7 +1245,7 @@ export default function BST1Payment() { await Promise.all( PrintOrderDetails?.[0]?.OrderDetails?.map( async (orderDetail, index) => { - const groupedTokens = orderDetail?.productDetails?.reduce( + const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -1263,6 +1326,10 @@ export default function BST1Payment() { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1535,6 +1602,12 @@ export default function BST1Payment() { setCardoptionnotSelected(false); } }; + + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1736,6 +1809,9 @@ export default function BST1Payment() { ParkingClaimed: false, }) ); + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeLoyaltyConsumedQuantities({})); dispatch(changeFullOfferAppliedProducts([])); @@ -1752,6 +1828,8 @@ export default function BST1Payment() { setPaybtnselected(PaymentOptionsModeId); setQrCode(false); setUpinotSelected(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); getHolddata(); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -1928,15 +2006,15 @@ export default function BST1Payment() { OrderStatus: 'O', OrderType: BookingType === 'Dine In' || - BookingTypeBoth || - Estimation?.SettingValue == 'N' + BookingTypeBoth || + Estimation?.SettingValue == 'N' ? 'S' : GlobEstBooking === 'OvrAllEst' ? 'E' : GlobEstBooking === 'ParEst' ? GlobProdwisedata?.includes( - a.InwardDtlId + ' ' + a?.BookingTypeName - ) + a.InwardDtlId + ' ' + a?.BookingTypeName + ) ? 'E' : 'S' : 'S', @@ -2026,7 +2104,7 @@ export default function BST1Payment() { : Paybtnnameselected?.toLowerCase() === 'credit' ? 'S' : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', OrderDtlDetails: @@ -2043,15 +2121,15 @@ export default function BST1Payment() { ? globalTipAmount === 0 ? SelectedTableDetails : SelectedTableDetails?.map((item) => ({ - ...item, - TipsAmount: globalTipAmount, - })) + ...item, + TipsAmount: globalTipAmount, + })) : null, SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2059,20 +2137,20 @@ export default function BST1Payment() { ? PaymentgatewayUPI?.[0]?.ModeId : SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find( - (busupi) => busupi?.ModeId === UpiId - )?.ModeId + (busupi) => busupi?.ModeId === UpiId + )?.ModeId : paybtnselected : paybtnselected ? paybtnselected : null, - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'business' + SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) - ?.MerchantId + ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2086,42 +2164,42 @@ export default function BST1Payment() { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) - ?.UPIDetailId + ?.UPIDetailId : SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) - ?.MerchantUPIId + ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( - (upipay) => upipay?.UPIId === UpiId - ) + (upipay) => upipay?.UPIId === UpiId + ) : (Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'pd') || - (Paybtnnameselected?.toLowerCase() === 'card' && - SelectedCardOption?.toLowerCase() === 'pd') + SelectedUPIPayOption?.toLowerCase() === 'pd') || + (Paybtnnameselected?.toLowerCase() === 'card' && + SelectedCardOption?.toLowerCase() === 'pd') ? useOptions?.[0]?.PaymentDetails?.PaymentDevice : (Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'pg') || - (Paybtnnameselected?.toLowerCase() === 'card' && - SelectedCardOption?.toLowerCase() === 'pg') + SelectedUPIPayOption?.toLowerCase() === 'pg') || + (Paybtnnameselected?.toLowerCase() === 'card' && + SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' ? 'S' : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2190,14 +2268,14 @@ export default function BST1Payment() { setMessageType('success'); setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); response?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([response?.data]); @@ -2326,7 +2404,12 @@ export default function BST1Payment() { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -2349,14 +2432,14 @@ export default function BST1Payment() { setMessageType('success'); setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); response?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([response?.data]); @@ -2457,14 +2540,14 @@ export default function BST1Payment() { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -2639,14 +2722,14 @@ export default function BST1Payment() { setMessageType('success'); setMessageData( bookingpaymentupdate?.data?.response + - ' ' + - (bookingpaymentupdate?.data?.OrderDetails?.length > 0 - ? bookingpaymentupdate?.data?.OrderId && - extractLastNumberOrderId( - bookingpaymentupdate?.data?.OrderId, - bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus - ) - : '') + ' ' + + (bookingpaymentupdate?.data?.OrderDetails?.length > 0 + ? bookingpaymentupdate?.data?.OrderId && + extractLastNumberOrderId( + bookingpaymentupdate?.data?.OrderId, + bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus + ) + : '') ); bookingpaymentupdate?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([bookingpaymentupdate?.data]); @@ -2664,7 +2747,7 @@ export default function BST1Payment() { if ( Date.now() - startTime > useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes * - 60000 + 60000 ) { // 60,000 ms = 1 minute @@ -3098,7 +3181,7 @@ export default function BST1Payment() { }; const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3108,6 +3191,11 @@ export default function BST1Payment() { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3437,30 +3525,30 @@ export default function BST1Payment() { (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 'none' : 'auto', opacity: (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 0.5 : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (
    )) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
    + +
    + )) ) : (
    0 && 'not-allowed', color: OrderCardDetail?.length > 0 || - (selOption?.value === undefined && - GlobalAddCustomerDetails1?.length === 0 && - GetCustId?.CustMobile === undefined) + (selOption?.value === undefined && + GlobalAddCustomerDetails1?.length === 0 && + GetCustId?.CustMobile === undefined) ? 'gray' : 'rgb(18, 146, 238)', fontSize: '28px', @@ -3626,16 +3750,16 @@ export default function BST1Payment() { (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 'none' : 'auto', opacity: (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 0.5 : 1, }} @@ -3654,14 +3778,14 @@ export default function BST1Payment() { width: '1.5rem', cursor: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'not-allowed' : 'pointer', color: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'gray' : 'rgb(18, 146, 238)', display: 'flex', @@ -3727,14 +3851,14 @@ export default function BST1Payment() { width: '1.5rem', cursor: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'not-allowed' : 'pointer', color: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'gray' : 'rgb(18, 146, 238)', display: 'flex', @@ -3816,58 +3940,58 @@ export default function BST1Payment() {
    {unpaidFlow == false ? holdCheckedSalesSetup && - BookingType !== 'Dine In' && - !BookingTypeBoth && - OrderCardDetail?.length != 0 && - CheckOrderType?.length === 0 && - OrderType != 'Failed' && - CheckBookingStatus != 'Close' && - paybtns?.length > 0 && - !addnewAccess && ( - - {' '} - AddBookingDetails('Hold')} - style={{ - fontSize: '30px', - cursor: 'pointer', - color: '' ? '#52c41a' : '#1292EE', - }} - /> - - ) + BookingType !== 'Dine In' && + !BookingTypeBoth && + OrderCardDetail?.length != 0 && + CheckOrderType?.length === 0 && + OrderType != 'Failed' && + CheckBookingStatus != 'Close' && + paybtns?.length > 0 && + !addnewAccess && ( + + {' '} + AddBookingDetails('Hold')} + style={{ + fontSize: '30px', + cursor: 'pointer', + color: '' ? '#52c41a' : '#1292EE', + }} + /> + + ) : ''} {unpaidFlow == false ? holdCheckedSalesSetup && - paybtns?.length > 0 && - BookingType !== 'Dine In' && - !BookingTypeBoth && - Holddata?.length > 0 && - OrderCardDetail?.length == 0 && - CheckBookingStatus != 'Close' && - !addnewAccess && ( - - {' '} - - HandleholdModelOpen()} - style={{ - fontSize: '28px', - cursor: 'pointer', - color: Holddata ? '#52c41a' : 'default', - pointerEvents: - OrderType === 'Failed' ? 'none' : 'auto', - }} - /> - - - ) + paybtns?.length > 0 && + BookingType !== 'Dine In' && + !BookingTypeBoth && + Holddata?.length > 0 && + OrderCardDetail?.length == 0 && + CheckBookingStatus != 'Close' && + !addnewAccess && ( + + {' '} + + HandleholdModelOpen()} + style={{ + fontSize: '28px', + cursor: 'pointer', + color: Holddata ? '#52c41a' : 'default', + pointerEvents: + OrderType === 'Failed' ? 'none' : 'auto', + }} + /> + + + ) : ''}
    )} @@ -3896,6 +4020,11 @@ export default function BST1Payment() { } BillingTableName="BillingTable1" CheckBookingStatus={CheckBookingStatus} + salesBillEdit={salesBillEdit} + currentOrderNetAmount={currentOrderNetAmount} + previousNetAmount={previousNetAmount} + credit={credit} + overAllBal={overAllBal} /> ) : ( @@ -3905,11 +4034,12 @@ export default function BST1Payment() { addnewAccess ? 'price-button-disabled' : FirstPaymentclick === false && - OrderCardDetail?.length > 0 && - paybtnselected && - CheckBookingStatus != 'Close' - ? !OrderStatus - ? 'price-button' + OrderCardDetail?.length > 0 && + paybtnselected && + CheckBookingStatus != 'Close' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'price-button' + : 'price-button' : 'price-button Order' : 'price-button-disabled' } @@ -3924,7 +4054,7 @@ export default function BST1Payment() { > {' '} {isMobile ? ( - !OrderStatus ? ( + !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : ( `₹ ${Math.round( OrderType === 'Failed' ? FailedTotalAmt @@ -3935,7 +4065,7 @@ export default function BST1Payment() { ) : ( 'ORDER' ) - ) : !OrderStatus ? ( + ) : !OrderStatus ? (salesBillEdit && (currentOrderNetAmount < previousNetAmount)) ? (
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    ) : (
    ₹{' '} data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> @@ -4266,9 +4399,9 @@ export default function BST1Payment() { const qty = isGroup ? OrderCardDetail.filter((o) => o.id === groupKey).reduce( - (sum, o) => sum + (o.OrderQty || 1), - 0 - ) + (sum, o) => sum + (o.OrderQty || 1), + 0 + ) : item.OrderQty || 1; return ( @@ -4383,24 +4516,24 @@ export default function BST1Payment() { Do you want to cancel the payment? )} - - {customerPreviesOrders && ( - setCustomerPreviesOrders(false)} - footer={false} - width={700} - className={'ModalPaymentGatewayEmbedded'} - children={ - <> - setCustomerPreviesOrders(false)} - /> - - } + + {customerPreviesOrders && ( + setCustomerPreviesOrders(false)} + footer={false} + width={700} + className={'ModalPaymentGatewayEmbedded'} + children={ + <> + setCustomerPreviesOrders(false)} /> - )} + + } + /> + )} ); } diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BalanceAndReceived.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BalanceAndReceived.jsx index 5d037c2..5911b82 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BalanceAndReceived.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BalanceAndReceived.jsx @@ -32,6 +32,11 @@ const PaymentInput = ({ handleButtonClick, BillingTableName, CheckBookingStatus, + salesBillEdit = false, + currentOrderNetAmount = 0, + previousNetAmount = 0, + credit = false, + overAllBal = 0, }) => { const { SadminuserAccess } = useAuth(); let SAAccessCommonMaster = SadminuserAccess?.find( @@ -133,9 +138,9 @@ const PaymentInput = ({ addnewAccess ? 'price-button-disabled' : FirstPaymentclick === false && - OrderCardDetail?.length > 0 && - paybtnselected && - CheckBookingStatus != 'Close' + OrderCardDetail?.length > 0 && + paybtnselected && + CheckBookingStatus != 'Close' ? !OrderStatus ? 'price-button' : 'price-button Order' @@ -152,13 +157,15 @@ const PaymentInput = ({ style={{ fontFamily: FontFamily['head'] }} > {isMobile && - (!OrderStatus - ? `₹ ${Math.round( - OrderType === 'Failed' ? failedTotalAmt : totalAmount - )}` + (!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : + `₹ ${Math.round( + OrderType === 'Failed' ? failedTotalAmt : credit && overAllBal >= 0 + ? Math.max(0, totalAmount - overAllBal) + : totalAmount + )}` : 'ORDER')} - {!isMobile && !OrderStatus && ( + {!isMobile && !OrderStatus && ((salesBillEdit && (currentOrderNetAmount < previousNetAmount)) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : ( <> ₹{' '} {/* */} {OrderType === 'Failed' ? failedTotalAmt - : safeRound(totalAmount)} + : safeRound((credit && overAllBal >= 0) + ? Math.max(0, totalAmount - overAllBal) + : totalAmount)} - )} + ))} {!isMobile && OrderStatus && 'ORDER'} diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx index 3c8e9c0..caa8639 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BSBillingTable2.jsx @@ -124,6 +124,15 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, + GlobalSalesBillEdit, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalpaymentOptionData, + getPaymentOptions, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import { gettinghold, @@ -242,6 +251,10 @@ const BSBillingTable2 = () => { const SessionMobileNo = SessionData?.SessionMobileNo; const dispatch = useDispatch(); const navigate = useNavigate(); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const defaultBookingType = useSelector(GlobalDefaultBookingType); const globalTipAmount = useSelector(GlobaltipAmount); const OtherServiceTicketClaim = useSelector(GlobalOtherServiceTicketClaim); @@ -319,6 +332,11 @@ const BSBillingTable2 = () => { const [overAllBal, setOverAllBal] = useState(0); const [creditCustomerOpen, setcreditCustomerOpen] = useState(false); const [hold, setHold] = useState(false); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const [addcustomer, setAddCustomer] = useState(false); const [paybtns, setpaybtns] = useState([]); const tableOptions = templateData?.BookingBilling?.[1]; @@ -452,6 +470,7 @@ const BSBillingTable2 = () => { item.SettingIdName.toLowerCase() === 'shortcutkeys' && item.SettingValue === 'Y' ); + useEffect(() => { const fetchCreditCustomer = async () => { const selectedMode = paybtns?.find( @@ -491,6 +510,31 @@ const BSBillingTable2 = () => { fetchCreditCustomer(); }, [paybtnselected, selOption, paybtns]); + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) + useEffect(() => { if (!preOrder) { const totalSum = OrderCardDetail?.reduce( @@ -546,23 +590,43 @@ const BSBillingTable2 = () => { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( + const currentOrderNetAmount = formatAmount( withdiscTotal >= 0 ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ); + ) - dispatch( - changeSummeryTotalAmount( - withdiscTotal > 0 ? withdiscTotal : Number(Total) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -767,6 +831,10 @@ const BSBillingTable2 = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1240,6 +1308,11 @@ const BSBillingTable2 = () => { } }; + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1776,6 +1849,9 @@ const BSBillingTable2 = () => { } else { dispatch(changeOrderCardDetails([])); } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeFullOfferAppliedProducts([])); dispatch(ChangeFullFreeProductList([])); @@ -1792,6 +1868,8 @@ const BSBillingTable2 = () => { setPaybtnnameselected(PaymentOptionsModeName); setQrCode(false); setUpinotSelected(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); getHolddata(); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -2093,7 +2171,7 @@ const BSBillingTable2 = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2107,15 +2185,14 @@ const BSBillingTable2 = () => { : paybtnselected ? paybtnselected : null, - // SelectedUPIPayOption?.toLowerCase() === "pg" ? - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2129,7 +2206,7 @@ const BSBillingTable2 = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2137,7 +2214,7 @@ const BSBillingTable2 = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2154,7 +2231,7 @@ const BSBillingTable2 = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2163,8 +2240,8 @@ const BSBillingTable2 = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2372,7 +2449,12 @@ const BSBillingTable2 = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -3201,7 +3283,7 @@ const BSBillingTable2 = () => { // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3211,6 +3293,11 @@ const BSBillingTable2 = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3820,7 +3907,7 @@ const BSBillingTable2 = () => { : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (
    )) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
    + +
    + )) ) : (
    { OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? 'billing-btn' + ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'billing-btn' + : 'billing-btn' : 'billing-btn-deactive' } // onClick={() => { @@ -4142,7 +4267,9 @@ const BSBillingTable2 = () => { handleButtonClick } > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : ( <>

    Total

    @@ -4363,7 +4490,10 @@ const BSBillingTable2 = () => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> @@ -4578,7 +4708,7 @@ const BSBillingTable2 = () => {
    } /> - + setShowCancelConfirm(true)} diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx index 1de2de5..217a778 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx @@ -131,6 +131,15 @@ import { GlobalCombocarddata, getCreditCustomer, GlobalSummeryTotalItems, + GlobalSalesBillEdit, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalpaymentOptionData, + getPaymentOptions, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; @@ -225,6 +234,10 @@ const BSBillingTable3Pay = () => { ); const dispatch = useDispatch(); const navigate = useNavigate(); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const FreeProdList = useSelector(GlobalFreeProdList); const offerAppliedProducts = useSelector( GlobalOfferAppliedProducts, @@ -332,11 +345,16 @@ const BSBillingTable3Pay = () => { const [SelectedUPIPayOption, setSelectedUPIPayOption] = useState('Default'); const [SelectedUpiOption, setSelectedUpiOption] = useState(''); const [hold, setHold] = useState(false); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const [addcustomer, setAddCustomer] = useState(false); const [PrintOrderDetails, setPrintOrderDetails] = useState([]); const OrderCardDetail = useSelector(GlobalOrderCardDetails); const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false); - + console.log(OrderCardDetail, 'OrderCardDetail'); //Total calculation const TotalItems = OrderCardDetail?.length; @@ -568,23 +586,43 @@ const BSBillingTable3Pay = () => { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( + const currentOrderNetAmount = formatAmount( withdiscTotal >= 0 ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ); + ) - dispatch( - changeSummeryTotalAmount( - formatAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -693,6 +731,31 @@ const BSBillingTable3Pay = () => { // } }, []); + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) + useEffect(() => { if (UserType === 'Employee') { fetchApi(); @@ -1424,6 +1487,10 @@ const BSBillingTable3Pay = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1705,6 +1772,11 @@ const BSBillingTable3Pay = () => { } }; + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1912,6 +1984,9 @@ const BSBillingTable3Pay = () => { // } else { dispatch(changeOrderCardDetails([])); // } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeLoyaltyConsumedQuantities({})); dispatch(changeFullOfferAppliedProducts([])); dispatch(ChangeFullFreeProductList([])); @@ -1927,6 +2002,8 @@ const BSBillingTable3Pay = () => { setPaybtnnameselected(PaymentOptionsModeName); setPaybtnselected(PaymentOptionsModeId); setQrCode(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); setUpinotSelected(false); getHolddata(); if (defaultBookingType === 'Both') { @@ -2239,7 +2316,7 @@ const BSBillingTable3Pay = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2253,14 +2330,14 @@ const BSBillingTable3Pay = () => { : paybtnselected ? paybtnselected : null, - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2274,7 +2351,7 @@ const BSBillingTable3Pay = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2282,7 +2359,7 @@ const BSBillingTable3Pay = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2299,7 +2376,7 @@ const BSBillingTable3Pay = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2308,8 +2385,8 @@ const BSBillingTable3Pay = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2519,7 +2596,12 @@ const BSBillingTable3Pay = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -3218,7 +3300,7 @@ const BSBillingTable3Pay = () => { }; // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3228,6 +3310,11 @@ const BSBillingTable3Pay = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3954,7 +4041,7 @@ const BSBillingTable3Pay = () => { : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (
    )) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
    + +
    + )) ) : (
    { OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus - ? 'BSBillingTable3-paybtn' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'BSBillingTable3-paybtn' + : 'BSBillingTable3-paybtn' : 'BSBillingTable3-paybtn Order' : 'BSBillingTable3-paybtn-deactive' } @@ -4292,7 +4416,7 @@ const BSBillingTable3Pay = () => { } //dhana > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?

    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}

    : ( <>

    {' '} @@ -4504,7 +4628,10 @@ const BSBillingTable3Pay = () => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx index afa9d03..e95245f 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BSBillingTable5.jsx @@ -121,6 +121,15 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, + GlobalSalesBillEdit, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalpaymentOptionData, + getPaymentOptions, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; //Shifayth Date:27/12/2023 import { @@ -236,6 +245,10 @@ const BSBillingTable5 = () => { const UserType = SessionData?.UserType; const AuthToken = SessionData?.AuthToken; const SessionMobileNo = SessionData?.SessionMobileNo; + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const Discount = useSelector(GlobalOverAllOfferAmt); const FreeProdList = useSelector(GlobalFreeProdList); const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts); @@ -316,6 +329,11 @@ const BSBillingTable5 = () => { const printDatas = useSelector(GlobalprintDatas); const PrinterDetails = useSelector(GlobalPrinterMappingDtls); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const [paybtnselected, setPaybtnselected] = useState(); const [Paybtnnameselected, setPaybtnnameselected] = useState(); const [SelectedBookingType, setSelectedBookingType] = useState(null); @@ -466,6 +484,31 @@ const BSBillingTable5 = () => { // for customised invoice number const { invoiceDate, clearInvoiceDate } = useDateStore(); const CurrentOrderId = useSelector(GlobalCurrentOrderId); + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) + useEffect(() => { if ( OrderCardDetail?.length === 1 && @@ -589,25 +632,44 @@ const BSBillingTable5 = () => { ); } + + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( - formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - ); + const currentOrderNetAmount = formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) - dispatch( - changeSummeryTotalAmount( - formatAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -844,6 +906,10 @@ const BSBillingTable5 = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1679,6 +1745,12 @@ const BSBillingTable5 = () => { setCardoptionnotSelected(false); } }; + + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1820,6 +1892,9 @@ const BSBillingTable5 = () => { } else { dispatch(changeOrderCardDetails([])); } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeLoyaltyConsumedQuantities({})); await dispatch(ChangeTotalAmount([])); @@ -1836,6 +1911,8 @@ const BSBillingTable5 = () => { setPaybtnselected(PaymentOptionsModeId); setQrCode(false); setUpinotSelected(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); getHolddata(); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -2134,7 +2211,7 @@ const BSBillingTable5 = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2148,14 +2225,14 @@ const BSBillingTable5 = () => { : paybtnselected ? paybtnselected : null, - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2169,7 +2246,7 @@ const BSBillingTable5 = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2177,7 +2254,7 @@ const BSBillingTable5 = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2194,7 +2271,7 @@ const BSBillingTable5 = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2203,8 +2280,8 @@ const BSBillingTable5 = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2410,7 +2487,12 @@ const BSBillingTable5 = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -3182,7 +3264,7 @@ const BSBillingTable5 = () => { // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3192,6 +3274,11 @@ const BSBillingTable5 = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3605,7 +3692,7 @@ const BSBillingTable5 = () => { : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (

    )) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
    + +
    + )) ) : (
    { OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus - ? 'BSBIllingTable5-paybtn-noitems' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'BSBIllingTable5-paybtn-noitems' + : 'BSBIllingTable5-paybtn-noitems' : 'BSBIllingTable5-paybtn-noitems Order' : 'BSBIllingTable5-paybtn-noitems-disable' } @@ -4167,7 +4291,7 @@ const BSBillingTable5 = () => { handleButtonClick } > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : ( <> {/* ₹ {Math.round(TotalAmount)} */} {isMobile ? ( @@ -4376,7 +4500,10 @@ const BSBillingTable5 = () => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx index 1baef7e..c8bfad8 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BST6Payment.jsx @@ -120,6 +120,15 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, + GlobalSalesBillEdit, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalpaymentOptionData, + getPaymentOptions, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities'; import { @@ -240,6 +249,10 @@ const BST6Payment = () => { type?.PreferredSubCatName?.toLowerCase() === 'dine in' && type?.PreferredStatus === 'Y' ); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const screenwidth = useSelector(GlobalScreenSize); const printerTemplateStyle = useSelector(SelectedPrintTemplate); const RetailWSSalesType = useSelector(GlobalRetailWSSalesType); @@ -336,6 +349,11 @@ const BST6Payment = () => { const UserType = SessionData?.UserType; const AuthToken = SessionData?.AuthToken; const SessionMobileNo = SessionData?.SessionMobileNo; + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const [FirstPaymentclick, setFirstPaymentclick] = useState(false); const [open, setOpen] = useState(false); const [unpaidopen, setUnpaidOpen] = useState(false); @@ -459,6 +477,30 @@ const BST6Payment = () => { setPrintOrderDetails([]); } }, [OrderCardDetail]); + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) console.log(PrintOrderDetails, 'PrintOrderDetails'); useEffect(() => { if (selOption) { @@ -563,25 +605,43 @@ const BST6Payment = () => { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( - formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - ); + const currentOrderNetAmount = formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) - dispatch( - changeSummeryTotalAmount( - formatAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -1174,6 +1234,10 @@ const BST6Payment = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1634,6 +1698,11 @@ const BST6Payment = () => { } }; + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1718,7 +1787,7 @@ const BST6Payment = () => { setCardOptionOpen(visible); }; const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -1728,6 +1797,11 @@ const BST6Payment = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -1861,6 +1935,9 @@ const BST6Payment = () => { } else { dispatch(changeOrderCardDetails([])); } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeLoyaltyConsumedQuantities({})); await dispatch(ChangeTotalAmount([])); @@ -1877,6 +1954,8 @@ const BST6Payment = () => { setPaybtnselected(PaymentOptionsModeId); setQrCode(false); setUpinotSelected(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); getHolddata(); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -2173,7 +2252,7 @@ const BST6Payment = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2187,14 +2266,14 @@ const BST6Payment = () => { : paybtnselected ? paybtnselected : null, - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2208,7 +2287,7 @@ const BST6Payment = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2216,7 +2295,7 @@ const BST6Payment = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2233,7 +2312,7 @@ const BST6Payment = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2242,8 +2321,8 @@ const BST6Payment = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2451,7 +2530,12 @@ const BST6Payment = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter( (item) => item?.PaymentOptionType?.toLowerCase() === 'pc' ); @@ -3678,7 +3762,7 @@ const BST6Payment = () => { : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (
    )) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
    + +
    + )) ) : (
    { OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus - ? 'BST6Payment-Button-pay' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'BST6Payment-Button-pay' + : 'BST6Payment-Button-pay' : 'BST6Payment-Button-pay Order' : 'BST6Payment-Button-pay-disabled' } @@ -3798,7 +3917,7 @@ const BST6Payment = () => { handleButtonClick } > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : ( <>

    {isMobile ? ( @@ -4317,7 +4436,10 @@ const BST6Payment = () => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx index 59df9c9..6464813 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBilling7Payment.jsx @@ -110,6 +110,15 @@ import { changeCurrentOrderId, GlobalCombocarddata, getCreditCustomer, + GlobalSalesBillEdit, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalpaymentOptionData, + getPaymentOptions, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData.js'; import { globalExtraTotalAmount, @@ -225,6 +234,10 @@ const BSBilling7Payment = () => { ); const dispatch = useDispatch(); const navigate = useNavigate(); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const Discount = useSelector(GlobalOverAllOfferAmt); const screenwidth = useSelector(GlobalScreenSize); const defaultBookingType = useSelector(GlobalDefaultBookingType); @@ -327,6 +340,11 @@ const BSBilling7Payment = () => { const [SelectedUPIPayOption, setSelectedUPIPayOption] = useState('Default'); const [SelectedUpiOption, setSelectedUpiOption] = useState(); const [hold, setHold] = useState(false); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const [addcustomer, setAddCustomer] = useState(false); const [PrintOrderDetails, setPrintOrderDetails] = useState([]); const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false); const OverAllSales = useSelector(GlobalOverAllDiscSales); @@ -348,7 +366,7 @@ const BSBilling7Payment = () => { return acc + Math.round(Number(item?.OrderQty || 0)); }, 0); - + console.log(salesBillEdit, currentOrderNetAmount, previousNetAmount, "previousNetAmount") const [UpiOption, setUpiOption] = useState(''); const [BusinessPayOption, setBusinessPayoption] = useState([]); const [paymentSucess, setPaymentSuccess] = useState(false); @@ -482,6 +500,33 @@ const BSBilling7Payment = () => { setMobileNoWhatsApp(selOption); } }, [selOption]); + + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) + + // Usage useEffect(() => { const fetchCreditCustomer = async () => { @@ -579,23 +624,44 @@ const BSBilling7Payment = () => { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( + const currentOrderNetAmount = formatAmount( withdiscTotal >= 0 ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ); + ) + console.log(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount, "totalPreviouspayment") - dispatch( - changeSummeryTotalAmount( - withdiscTotal > 0 ? withdiscTotal : Number(Total) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -819,7 +885,7 @@ const BSBilling7Payment = () => { async (orderDetail, index) => { await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print if (orderDetail?.BookingTypeName !== 'Dine In') { - const groupedTokens = orderDetail?.productDetails?.reduce( + const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -899,12 +965,17 @@ const BSBilling7Payment = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) : AddBookingDetails(BookingType, true); } }; + const financialYearError = async () => { setMessageType('error'); setMessageData('Financial Year-Based Sales Not Yet Started'); @@ -1637,6 +1708,12 @@ const BSBilling7Payment = () => { setCardoptionnotSelected(false); } }; + + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -1833,6 +1910,9 @@ const BSBilling7Payment = () => { } else { dispatch(changeOrderCardDetails([])); } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeFullOfferAppliedProducts([])); dispatch(changeLoyaltyConsumedQuantities({})); @@ -1848,6 +1928,8 @@ const BSBilling7Payment = () => { setPaybtnnameselected(PaymentOptionsModeName); setPaybtnselected(PaymentOptionsModeId); setQrCode(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); setUpinotSelected(false); getHolddata(); if (defaultBookingType === 'Both') { @@ -2139,7 +2221,7 @@ const BSBilling7Payment = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -2153,14 +2235,14 @@ const BSBilling7Payment = () => { : paybtnselected ? paybtnselected : null, - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2174,7 +2256,7 @@ const BSBilling7Payment = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -2182,7 +2264,7 @@ const BSBilling7Payment = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2199,7 +2281,7 @@ const BSBilling7Payment = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2208,8 +2290,8 @@ const BSBilling7Payment = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2416,7 +2498,12 @@ const BSBilling7Payment = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -3126,7 +3213,7 @@ const BSBilling7Payment = () => { }; // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3136,6 +3223,11 @@ const BSBilling7Payment = () => { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3840,7 +3932,7 @@ const BSBilling7Payment = () => { : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (

    )) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
    + +
    + )) ) : (
    { OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus - ? 'Table4-Btn-final-price' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'Table4-Btn-final-price' + : 'Table4-Btn-final-price' : 'Table4-Btn-final-price Order' : 'Table4-Btn-final-price-disabled' } @@ -4168,7 +4297,7 @@ const BSBilling7Payment = () => { handleButtonClick } > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?

    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}

    : ( <>
    { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx index 7c71170..706af57 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx @@ -63,6 +63,9 @@ import { PostBlockSlots, changeCustomerID, changeSelectedCustId, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import './StandardTable.scss'; import { IoClose } from 'react-icons/io5'; @@ -148,8 +151,8 @@ const StandardTable = () => { OrderType === 'Hold' ? OrderCardDetail?.filter((a, b) => a.BookingTypeName === 'TakeAway') : OrderCardDetail?.filter( - (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId - ); + (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId + ); console.log('HoldOrderDtl', OrderCardDetail); const OldtableDataDinein = OrderCardDetail?.filter( (a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId @@ -157,8 +160,8 @@ const StandardTable = () => { const OldtableDataTakeAway = OrderType != 'Hold' ? OrderCardDetail?.filter( - (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId - ) + (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId + ) : []; const [EditQuantity, setEditQuantity] = useState(false); @@ -291,9 +294,9 @@ const StandardTable = () => { AppId: AppId, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; await dispatch(getSelectedFavItems(data)).unwrap(); @@ -305,9 +308,9 @@ const StandardTable = () => { ProdSubCat: ProdSubCat, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; @@ -318,9 +321,9 @@ const StandardTable = () => { prodCat: prodCat, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; @@ -413,6 +416,9 @@ const StandardTable = () => { await dispatch(ChangeTotalAmount([])); await dispatch(changeOrderType(null)); await dispatch(changeReorderHoldDetails({})); + await dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); } else if (OrderType === 'Reorder') { const UpdatedData = OrderCardDetail?.filter( (cartItem) => cartItem?.SalesId @@ -438,6 +444,9 @@ const StandardTable = () => { await dispatch(ChangeTotalAmount([])); await dispatch(changeUnpaidData(false)); await dispatch(changeReorderHoldDetails({})); + await dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); await dispatch(changeReorderProductDetails([])); await dispatch(ChangeSelectedCustDisable(false)); @@ -1124,9 +1133,9 @@ const StandardTable = () => { )?.map((item, idx) => idx === 0 ? { - ...item, - FreeQty, - } + ...item, + FreeQty, + } : item ), }; @@ -2510,11 +2519,10 @@ const StandardTable = () => { {OldtableDataTakeAway?.map((item, index) => (
    { ? item?.SalesId && OrderType !== 'Hold' ? 'rgb(243, 248, 213)' : triggerAnimation && - index === 0 && - !item?.SalesId && - tableDataTakeAway?.length >= PreviousdataLength + index === 0 && + !item?.SalesId && + tableDataTakeAway?.length >= PreviousdataLength ? 'wheat' : triggerAnimation && - index === 0 && - tableDataTakeAway?.length >= - PreviousdataLength && - !HoldOrderDtl && - !UnpaidData + index === 0 && + tableDataTakeAway?.length >= + PreviousdataLength && + !HoldOrderDtl && + !UnpaidData ? 'wheat' : 'inherit' : 'none', @@ -2541,9 +2549,9 @@ const StandardTable = () => { item?.SalesId && OrderType !== 'Hold' ? 'rgb(243, 248, 213)' : GlobEstBooking === 'ParEst' && - GlobProdwisedata?.includes( - item?.InwardDtlId + ' ' + item?.BookingTypeName - ) + GlobProdwisedata?.includes( + item?.InwardDtlId + ' ' + item?.BookingTypeName + ) ? '#b2d1f7' : index % 2 === 0 ? 'white' @@ -2606,7 +2614,7 @@ const StandardTable = () => { }} onClick={() => item.FullProductIdentifierDtls?.length > 0 || - item.ProductIdentifierDtls?.length > 0 + item.ProductIdentifierDtls?.length > 0 ? handleImeiDetails(item) : editField && handleEditQuantity(item) } @@ -2675,21 +2683,21 @@ const StandardTable = () => { {productBasedExtraCharges?.find( (find) => find.ProdId === item.ProdId ) !== undefined && ( -
    - Extra Charges :{' '} - { - productBasedExtraCharges?.find( - (find) => find.ProdId === item.ProdId - )?.TotalAmt - } -
    - )} +
    + Extra Charges :{' '} + { + productBasedExtraCharges?.find( + (find) => find.ProdId === item.ProdId + )?.TotalAmt + } +
    + )} )} @@ -2784,7 +2792,7 @@ const StandardTable = () => { } }} > - {safeRound(item?.TotalAmt)} + {safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} )} {tableitem.OptionName == 'Delete' && ( @@ -2828,11 +2836,10 @@ const StandardTable = () => { {OldtableDataDinein?.map((item, index) => ( { ? item?.SalesId ? 'rgb(243, 248, 213)' : BookingType === 'Dine In' && - triggerAnimation && - OldtableDataTakeAway?.length + index === 0 && - !item?.SalesId && - tableDataDinein?.length >= PreviousdataLength + triggerAnimation && + OldtableDataTakeAway?.length + index === 0 && + !item?.SalesId && + tableDataDinein?.length >= PreviousdataLength ? 'wheat' : BookingType !== 'Dine In' && - triggerAnimation && - OldtableDataTakeAway?.length + index === 0 && - tableDataDinein?.length >= - PreviousdataLength && - !HoldOrderDtl && - !UnpaidData + triggerAnimation && + OldtableDataTakeAway?.length + index === 0 && + tableDataDinein?.length >= + PreviousdataLength && + !HoldOrderDtl && + !UnpaidData ? 'wheat' : 'inherit' : 'none', background: item?.SalesId ? 'rgb(243, 248, 213)' : GlobEstBooking === 'ParEst' && - GlobProdwisedata?.includes( - item?.InwardDtlId + ' ' + item?.BookingTypeName - ) + GlobProdwisedata?.includes( + item?.InwardDtlId + ' ' + item?.BookingTypeName + ) ? '#b2d1f7' : (OldtableDataTakeAway?.length + index) % 2 === 0 ? 'white' @@ -2991,21 +2998,21 @@ const StandardTable = () => { {productBasedExtraCharges?.find( (find) => find.ProdId === item.ProdId ) !== undefined && ( -
    - Extra Charges :{' '} - { - productBasedExtraCharges?.find( - (find) => find.ProdId === item.ProdId - )?.TotalAmt - } -
    - )} +
    + Extra Charges :{' '} + { + productBasedExtraCharges?.find( + (find) => find.ProdId === item.ProdId + )?.TotalAmt + } +
    + )} )} @@ -3099,7 +3106,7 @@ const StandardTable = () => { } }} > - {safeRound(item?.TotalAmt)} + {safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} )} @@ -3148,11 +3155,10 @@ const StandardTable = () => { OldtableDataTakeAway?.length + index } - className={`${ - BookingType === 'Dine In' && item?.SalesId - ? 'booking-billing-table-row-disabled' - : 'booking-billing-table-row' - } + className={`${BookingType === 'Dine In' && item?.SalesId + ? 'booking-billing-table-row-disabled' + : 'booking-billing-table-row' + } `} style={{ @@ -3161,43 +3167,43 @@ const StandardTable = () => { ? BookingType === 'Dine In' && item?.SalesId ? 'rgb(243, 248, 213)' : BookingType === 'Dine In' && - triggerAnimation && - OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index === - 0 && - !item?.SalesId && - tableDataTakeAway?.length >= PreviousdataLength + triggerAnimation && + OldtableDataDinein?.length + + OldtableDataTakeAway?.length + + index === + 0 && + !item?.SalesId && + tableDataTakeAway?.length >= PreviousdataLength ? 'wheat' : BookingType !== 'Dine In' && - triggerAnimation && - OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index === - 0 && - tableDataTakeAway?.length >= - PreviousdataLength && - !HoldOrderDtl && - !UnpaidData + triggerAnimation && + OldtableDataDinein?.length + + OldtableDataTakeAway?.length + + index === + 0 && + tableDataTakeAway?.length >= + PreviousdataLength && + !HoldOrderDtl && + !UnpaidData ? 'wheat' : (OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index) % - 2 === - 0 + OldtableDataTakeAway?.length + + index) % + 2 === + 0 ? 'white' : SelectedBillColor?.[ - 'OverallBackgroundColor' - ] + 'OverallBackgroundColor' + ] ? SelectedBillColor?.[ - 'OverallBackgroundColor' - ] + 'OverallBackgroundColor' + ] : '#d6d6d6' : (OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index) % - 2 === - 0 + OldtableDataTakeAway?.length + + index) % + 2 === + 0 ? 'white' : SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.['OverallBackgroundColor'] @@ -3206,15 +3212,15 @@ const StandardTable = () => { BookingType === 'Dine In' && item?.SalesId ? 'rgb(243, 248, 213)' : GlobEstBooking === 'ParEst' && - GlobProdwisedata?.includes( - item?.InwardDtlId + ' ' + item?.BookingTypeName - ) + GlobProdwisedata?.includes( + item?.InwardDtlId + ' ' + item?.BookingTypeName + ) ? '#b2d1f7' : (OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index) % - 2 === - 0 + OldtableDataTakeAway?.length + + index) % + 2 === + 0 ? 'white' : SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.['OverallBackgroundColor'] @@ -3223,9 +3229,9 @@ const StandardTable = () => { BillOrderPre === 'Y' && !BookingTypeBoth ? triggerAnimation && OldtableDataDinein?.length + - OldtableDataTakeAway?.length + - index === - 0 && + OldtableDataTakeAway?.length + + index === + 0 && !item?.SalesId && tableDataTakeAway?.length >= PreviousdataLength && !HoldOrderDtl && @@ -3278,7 +3284,7 @@ const StandardTable = () => { }} onClick={() => item.FullProductIdentifierDtls?.length > 0 || - item.ProductIdentifierDtls?.length > 0 + item.ProductIdentifierDtls?.length > 0 ? handleImeiDetails(item) : editField && handleEditQuantity(item) } @@ -3302,8 +3308,8 @@ const StandardTable = () => { {!item?.ProdVariantName?.toLowerCase()?.includes( 'variant' ) && ( - {item?.ProdVariantName} - )} + {item?.ProdVariantName} + )} {AvailableDate ? ( <> {' '} @@ -3353,21 +3359,21 @@ const StandardTable = () => { {productBasedExtraCharges?.find( (find) => find.ProdId === item.ProdId ) !== undefined && ( -
    - Extra Charges :{' '} - { - productBasedExtraCharges?.find( - (find) => find.ProdId === item.ProdId - )?.TotalAmt - } -
    - )} +
    + Extra Charges :{' '} + { + productBasedExtraCharges?.find( + (find) => find.ProdId === item.ProdId + )?.TotalAmt + } +
    + )} )} @@ -3462,7 +3468,7 @@ const StandardTable = () => { } }} > - {safeRound(item?.TotalAmt)} + {safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} )} @@ -3511,11 +3517,10 @@ const StandardTable = () => { tableDataTakeAway?.length + index } - className={`${ - BookingType === 'Dine In' && item?.SalesId - ? 'booking-billing-table-row-disabled' - : 'booking-billing-table-row' - } + className={`${BookingType === 'Dine In' && item?.SalesId + ? 'booking-billing-table-row-disabled' + : 'booking-billing-table-row' + } `} style={{ @@ -3526,45 +3531,45 @@ const StandardTable = () => { !BookingTypeBoth ? 'rgb(243, 248, 213)' : BookingType === 'Dine In' && - triggerAnimation && - OldtableDataTakeAway?.length + - OldtableDataDinein?.length + - tableDataTakeAway?.length + - index === - 0 && - !item?.SalesId && - tableDataDinein?.length >= PreviousdataLength + triggerAnimation && + OldtableDataTakeAway?.length + + OldtableDataDinein?.length + + tableDataTakeAway?.length + + index === + 0 && + !item?.SalesId && + tableDataDinein?.length >= PreviousdataLength ? 'wheat' : BookingType !== 'Dine In' && - triggerAnimation && - OldtableDataTakeAway?.length + - OldtableDataDinein?.length + - tableDataTakeAway?.length + - index === - 0 && - tableDataDinein?.length >= - PreviousdataLength && - !HoldOrderDtl && - !UnpaidData + triggerAnimation && + OldtableDataTakeAway?.length + + OldtableDataDinein?.length + + tableDataTakeAway?.length + + index === + 0 && + tableDataDinein?.length >= + PreviousdataLength && + !HoldOrderDtl && + !UnpaidData ? 'wheat' : 'inherit' : 'none', background: BookingType === 'Dine In' && - item?.SalesId && - !BookingTypeBoth + item?.SalesId && + !BookingTypeBoth ? 'rgb(243, 248, 213)' : GlobEstBooking === 'ParEst' && - GlobProdwisedata?.includes( - item?.InwardDtlId + ' ' + item?.BookingTypeName - ) + GlobProdwisedata?.includes( + item?.InwardDtlId + ' ' + item?.BookingTypeName + ) ? '#b2d1f7' : (OldtableDataTakeAway?.length + - OldtableDataDinein?.length + - tableDataTakeAway?.length + - index) % - 2 === - 0 + OldtableDataDinein?.length + + tableDataTakeAway?.length + + index) % + 2 === + 0 ? 'white' : SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.['OverallBackgroundColor'] @@ -3573,10 +3578,10 @@ const StandardTable = () => { BillOrderPre === 'Y' && !BookingTypeBoth ? triggerAnimation && OldtableDataTakeAway?.length + - OldtableDataDinein?.length + - tableDataTakeAway?.length + - index === - 0 && + OldtableDataDinein?.length + + tableDataTakeAway?.length + + index === + 0 && !item?.SalesId && tableDataDinein?.length >= PreviousdataLength && !HoldOrderDtl && @@ -3698,21 +3703,21 @@ const StandardTable = () => { {productBasedExtraCharges?.find( (find) => find.ProdId === item.ProdId ) !== undefined && ( -
    - Extra Charges :{' '} - { - productBasedExtraCharges?.find( - (find) => find.ProdId === item.ProdId - )?.TotalAmt - } -
    - )} +
    + Extra Charges :{' '} + { + productBasedExtraCharges?.find( + (find) => find.ProdId === item.ProdId + )?.TotalAmt + } +
    + )} )} @@ -3806,7 +3811,7 @@ const StandardTable = () => { } }} > - {safeRound(item?.TotalAmt)} + {safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)} )} diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.scss b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.scss index d48be0c..fed10fe 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.scss +++ b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.scss @@ -47,7 +47,7 @@ height: 2rem; font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; - > th { + >th { font-size: 10px !important; font-weight: 400 !important; -webkit-text-stroke-width: 0.2px; @@ -1116,19 +1116,20 @@ @media (max-width: 500px) { padding: 5px 10px; } + .ShoppingCartMain-left { display: flex; align-items: center; gap: 1rem; white-space: nowrap; - > div { + >div { font-size: 1rem; font-weight: 500; font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; } - > p { + >p { background-color: #fff3; font-size: 10px; padding: 1px 6px; @@ -1153,11 +1154,9 @@ z-index: 10; @media (max-width: 768px) { - background-color: linear-gradient( - to bottom right, - #1e2536, - #2a3447 - ) !important; + background-color: linear-gradient(to bottom right, + #1e2536, + #2a3447) !important; background: linear-gradient(to bottom right, #1e2536, #2a3447) !important; display: flex !important; } @@ -1172,13 +1171,13 @@ gap: 1rem; white-space: nowrap; - > div { + >div { font-size: 1.125rem; font-weight: 500; font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; } - > p { + >p { background-color: #fff3; font-size: small; padding: 1px 6px; @@ -1194,11 +1193,11 @@ padding: 12px 16px; .ShoppingCartMain-left { - > div { + >div { font-size: 1rem; } - > p { + >p { font-size: 0.75rem; } } @@ -1209,11 +1208,11 @@ align-items: flex-start; .ShoppingCartMain-left { - > div { + >div { font-size: 0.875rem; } - > p { + >p { font-size: 0.7rem; } } @@ -1269,6 +1268,27 @@ } } +.standard-pay-btn-refund { + padding: 0.9rem 0.75rem; + font-size: 1.125rem; + font-family: 'Inter', ui-sans-serif, system-ui, sans-serif !important; + border: none; + border-radius: 4px; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + // justify-content: space-around; + gap: 0.5rem; + opacity: 1; + background-color: #0d9488; + color: #fff; + + @media (max-width: 500px) { + padding: 0.75rem; + } +} + .standard-pay-btn { padding: 0.9rem 0.75rem; font-size: 1.125rem; @@ -1538,7 +1558,7 @@ .paybutton { padding: 10px 12px; - > svg { + >svg { display: none !important; } } @@ -1557,9 +1577,7 @@ display: flex !important; } - .booking-billing-table-container - .shoppingCartLeft - .payment-buttons-container { + .booking-billing-table-container .shoppingCartLeft .payment-buttons-container { display: flex !important; padding: 0 10px; align-items: flex-start; @@ -1596,7 +1614,7 @@ .standard-pay-btns { flex: 1; - > button { + >button { width: 100%; } } @@ -1650,4 +1668,4 @@ @media (max-width: 768px) { display: flex; } -} +} \ No newline at end of file diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx index 86e1761..40c81a2 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTablePayment.jsx @@ -12,6 +12,7 @@ import Credit from '../../UtillComponents/Pozo retail icons/credit.svg'; import { FaCreditCard } from 'react-icons/fa6'; import { changeAddBookingDetailsTrigger, + changeBillEditingMode, changeBookingType, ChangeComboCarddata, changeCurrentOrderId, @@ -25,6 +26,8 @@ import { ChangeOverAllDiscSales, changePaymentloader, changePaymentTransactionNumber, + changePreviousOrderOfferDetail, + changePreviousOrderPayment, changeReorderHoldDetails, changeReorderProductDetails, changeSelectChair, @@ -50,6 +53,7 @@ import { getCurrentOrderid, getLayoutproductCard, GetPaymentdeviceResponse, + getPaymentOptions, getSalesDetailData, getSelectedFavItems, getUnpaidData, @@ -72,11 +76,15 @@ import { GlobalOverAllDiscEstimate, GlobalOverAllDiscSales, GlobalPayementloader, + GlobalpaymentOptionData, GlobalPaymentTrigger, + GlobalPreviousOrderOfferDetails, + GlobalPreviousOrderPayment, GlobalProductCategorie, GlobalProductSubCategorie, GlobalReorderHoldDetails, GlobalRetailWSSalesType, + GlobalSalesBillEdit, GlobalSelCustId, GlobalSelectedTableDetails, GlobalSelOption, @@ -93,6 +101,7 @@ import { PutBookingData, PutBookingPaymentStatusChange, PutPendingPaymentList, + putSalesBillEdit, putSplitpaymentStatus, SendPaymentLink, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; @@ -267,6 +276,10 @@ const StandardTablePayment = () => { const GlobProdwisedata = useSelector(GlobalSelProdWiseEst); const GlobEstBooking = useSelector(GlobalEstimateBooking); const OtherServicesglobal = useSelector(GlobalOtherSevices); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const OrderType = useSelector(GlobalOrderType); const unpaidFlow = useSelector(Globalunpaidflow); const selOption = useSelector(GlobalSelOption); @@ -354,6 +367,11 @@ const StandardTablePayment = () => { const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]); const [ConfigDataList, setConfigDataList] = useState([]); const [TotalAmount, setTotalAmount] = useState(0); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const [FirstPaymentclick, setFirstPaymentclick] = useState(false); const [UpinotSelected, setUpinotSelected] = useState(false); const [brachName, setbrachName] = useState(''); @@ -486,6 +504,12 @@ const StandardTablePayment = () => { ); }, [GlobalExtraCharge]); + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + const customerNameOrMobile = MobileNoWhatsApp?.CustName?.trim() ? `Dear ${MobileNoWhatsApp?.CustName}` : `Dear ${MobileNoWhatsApp?.value}`; @@ -706,7 +730,6 @@ const StandardTablePayment = () => { CheckBookingStatus, addnewAccess, preferenceshortcutkey, - unpaidFlow, ]); @@ -809,7 +832,13 @@ const StandardTablePayment = () => { }, [paybtnselected, selOption, payBtns]); useEffect(() => { - orderCardDetail?.length == 0 ? dispatch(changeunpaidflow(false)) : ''; + if (orderCardDetail?.length == 0) { + dispatch(changeunpaidflow(false)); + // dispatch(changePreviousOrderPayment([])); + // dispatch(changePreviousOrderOfferDetail([])); + // dispatch(changeBillEditingMode(false)); + } + if (!preOrder) { const totalSum = orderCardDetail?.reduce( (acc, card) => acc + parseFloat(card.OrderRate * card.OrderQty || 0), @@ -866,29 +895,45 @@ const StandardTablePayment = () => { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - setTotalAmount( - formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - ); + const currentOrderNetAmount = formatAmount( + withdiscTotal >= 0 + ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) + : (Number(Total) + Number(globalTipAmount)).toFixed(2) + ) + console.log(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount, "totalPreviouspayment") - dispatch( - changeSummeryTotalAmount( - formatAmount( - withdiscTotal >= 0 - ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) - : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); // dispatch( // changeSummeryTotalAmount(withdiscTotal > 0 ? withdiscTotal : Number(Total)) // ); @@ -1016,6 +1061,25 @@ const StandardTablePayment = () => { } }, [PaymentUpiOptions, PaymentOptions, SelCustId]); + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) + useEffect(() => { if ( (BookingType === 'Dine In' || @@ -1112,6 +1176,10 @@ const StandardTablePayment = () => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default' && UpiQRPreference) { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1490,7 +1558,7 @@ const StandardTablePayment = () => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId @@ -1504,14 +1572,14 @@ const StandardTablePayment = () => { : paybtnselected ? paybtnselected : null, - Amount: Math.round(TotalAmount), - MerchantId: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantId : null, - PaymentOptionType: + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -1525,7 +1593,7 @@ const StandardTablePayment = () => { ? 'BU' : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId @@ -1533,7 +1601,7 @@ const StandardTablePayment = () => { ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ?.MerchantUPIId : null, - AccountDtl: + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -1550,7 +1618,7 @@ const StandardTablePayment = () => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -1559,8 +1627,8 @@ const StandardTablePayment = () => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -1793,7 +1861,12 @@ const StandardTablePayment = () => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -1845,6 +1918,7 @@ const StandardTablePayment = () => { if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); } + ClearAllGlobalStateDatas(); console.log('more pg data'); } @@ -1858,6 +1932,7 @@ const StandardTablePayment = () => { await dispatch(changeOrderCardDetails([])); await dispatch(changeReorderHoldDetails({})); await dispatch(changeReorderProductDetails([])); + setFirstPaymentclick(false); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); @@ -1959,6 +2034,10 @@ const StandardTablePayment = () => { } }; + const handleSalesBillEdit = async (putdatas, value, pay) => { + console.log(putdatas, value, pay, "handleSalesBillEdit") + } + const OtherServicePostBooking = async (PostData, value) => { console.log(PostData, value, 'PostData, value'); @@ -2703,6 +2782,11 @@ const StandardTablePayment = () => { } }; + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const addUpiOption = async (id, name, UPIId) => { await dispatch(changeUpiIDprint(UPIId)); await dispatch(changeUpiIDName(name)); @@ -2733,6 +2817,9 @@ const StandardTablePayment = () => { ParkingClaimed: false, }) ); + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); dispatch(changeFullOfferAppliedProducts([])); dispatch(ChangeFullFreeProductList([])); @@ -2752,6 +2839,8 @@ const StandardTablePayment = () => { setQrCode(false); setUpinotSelected(false); getHolddata(); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); if (defaultBookingType === 'Both') { await dispatch(changeBookingType('TakeAway')); } @@ -2893,7 +2982,7 @@ const StandardTablePayment = () => { async (orderDetail, index) => { await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print if (orderDetail?.BookingTypeName !== 'Dine In') { - const groupedTokens = orderDetail?.productDetails?.reduce( + const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -2938,7 +3027,7 @@ const StandardTablePayment = () => { await Promise.all( PrintOrderDetails?.[0]?.OrderDetails?.map( async (orderDetail, index) => { - const groupedTokens = orderDetail?.productDetails?.reduce( + const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -2974,7 +3063,7 @@ const StandardTablePayment = () => { ); } else { await Promise.all( - PrintOrderDetails?.[0]?.OrderDetails?.map( + PrintOrderDetails?.[0]?.OrderDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.map( async (orderDetail, index) => { await TokenPrint(`${index}-${orderDetail?.OrderId}`); } @@ -3188,7 +3277,7 @@ const StandardTablePayment = () => { }; const SplitPaymentOpen = () => { - if (orderCardDetail?.length > 0) { + if (orderCardDetail?.length > 0 && TotalAmount > 0) { // const updatedData = { // userData: OrderCardDetail, // ExtraCharges: GlobalExtraCharge, @@ -3198,6 +3287,11 @@ const StandardTablePayment = () => { // setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3610,7 +3704,7 @@ const StandardTablePayment = () => { opacity: isDisabled ? 0.5 : 1, }} > - {payBtns?.length > 0 ? ( + {payBtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( payBtns.map((payment) => { const mode = payment?.ModeName?.toLowerCase(); const isSelected = paybtnselected === payment?.ModeId; @@ -3700,6 +3794,55 @@ const StandardTablePayment = () => { ); }) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => { + const mode = payment?.ConfigName?.toLowerCase(); + const isSelected = refundPaySelected === payment?.ConfigId; + const buttonClass = isSelected + ? 'paybutton-selected' + : 'paybutton'; + + return ( +
    + +
    + ); + }) ) : (
    { orderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus !== 'Close' - ? !OrderStatus - ? 'standard-pay-btn' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'standard-pay-btn-refund' + : 'standard-pay-btn' : 'standard-pay-btn order-complete' : 'standard-pay-btn-disabled' } onClick={handleButtonClick} > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?

    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}

    : ( <>

    { const dispatch = useDispatch(); const navigate = useNavigate(); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const SessionData = useSelector(StoredSessionData); const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus); const globalTipAmount = useSelector(GlobaltipAmount); @@ -321,6 +339,11 @@ const BSC1Payment = (props) => { const [UpiOption, setUpiOption] = useState(''); const [UpiId, setUpiId] = useState(); const [hold, setHold] = useState(false); + const [refundPayBtns, setRefundPayBtns] = useState([]); + const [refundPaySelected, setRefundPaySelected] = useState(); + const [refundPaySelectedName, setRefundPaySelectedName] = useState(null); + const [currentOrderNetAmount, setCurrentOrderNetAmount] = useState(0); + const [previousNetAmount, setPreviousNetAmount] = useState(0); const appPreferences = useSelector(ApplicationPreferences); const commonModulePreference = appPreferences?.find( (preference) => preference?.PreferredCatName === 'Common Module' @@ -429,6 +452,14 @@ const BSC1Payment = (props) => { const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]); const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]); const [UpiPayOption, setUpiPayOption] = useState([]); + const [BusinessPayOption, setBusinessPayoption] = useState([]); + const [paymentSucess, setPaymentSuccess] = useState(false); + const [businessUPI, setBusinessUPI] = useState(false); + const [businessUPIOrderId, setBusinessUPIOrderId] = useState(null); + const [businessUPILink, setBusinessUPILink] = useState(null); + const defaultPaymentTrigger = useSelector(GlobalPaymentTrigger); + const [defaultPaymentMode, setDefaultPaymentMode] = useState([]); + const [defaultEnabled, setDefaultEnabled] = useState(false); const [CardPayOption, setCardPayOption] = useState([]); const [PaymentUpiOptions, setPaymentUpiOptions] = useState([]); const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions); @@ -461,6 +492,7 @@ const BSC1Payment = (props) => { const printDatas = useSelector(GlobalprintDatas); const PrinterDetails = useSelector(GlobalPrinterMappingDtls); const [addnewAccess, setaddnewAccess] = useState(true); + const [showCancelConfirm, setShowCancelConfirm] = useState(false); const BookingStatus = useSelector(GlobalBookingStatus); const PaymentOptionsModeName = @@ -529,6 +561,79 @@ const BSC1Payment = (props) => { '11111111111111' ); // Usage + useEffect(() => { + const setDefaultPaymentOption = async () => { + const res = await dispatch( + getDefaultPaymentOptions({ AppId, CompId, BranchId }) + )?.unwrap(); + const defaultDetail = res?.data?.data?.[0]?.DefaultDetails?.[0]; + if (res?.data?.data?.length > 0 && defaultDetail) { + setDefaultEnabled(true); + setDefaultPaymentMode(defaultDetail); + const { option, card } = defaultDetail; + if (option?.value) setSelectedUPIPayOption(option.value); + if (card) { + const isDefault = + String(option?.value ?? '').toLowerCase() === 'default'; + const idToUse = isDefault ? card?.UPIId : card?.ModeId; + + if (idToUse) { + addUpiOption(card?.Mode, card?.ModeName, idToUse); + } + } + } else { + setDefaultEnabled(false); + setDefaultPaymentMode([]); + } + }; + setDefaultPaymentOption(); + }, [defaultPaymentTrigger]); + + useEffect(() => { + const getPrintData = async () => { + try { + const data = { + AppId, + CompId, + BranchId, + OrderId: businessUPIOrderId, + }; + + const res = await dispatch(ReprintDetails(data)).unwrap(); + + if (res?.data?.statusCode === 1 && res?.data?.data?.length > 0) { + const orderData = [{ OrderDetails: res.data.data }]; + + // Reset states first + setBusinessUPIOrderId(null); + setBusinessUPI(false); + setPaymentSuccess(false); + + // Then set new data and trigger side effects + setPrintOrderDetails(orderData); + CustomerDisplay(); + ClearAllGlobalStateDatas(); + filteredSettingNames?.includes('whatsapp') && + MobileNoWhatsApp?.value && + handleURL(orderData); + } + } catch (error) { + console.error('Failed to fetch print data:', error); + // Reset states even on error + setBusinessUPI(false); + setPaymentSuccess(false); + } + }; + + if (paymentSucess && businessUPIOrderId) { + const timer = setTimeout(() => { + getPrintData(); + }, 3000); + + return () => clearTimeout(timer); + } + }, [paymentSucess, businessUPIOrderId, AppId, CompId, BranchId, dispatch]); + useEffect(() => { const fetchCreditCustomer = async () => { const selectedMode = paybtns?.find( @@ -567,6 +672,32 @@ const BSC1Payment = (props) => { fetchCreditCustomer(); }, [paybtnselected, selOption, paybtns]); + + useEffect(() => { + if (salesBillEdit) { + dispatch(getPaymentOptions()).unwrap(); + } + }, [salesBillEdit]); + + useEffect(() => { + + if (salesBillEdit) { + if (SelCustId) { + setRefundPayBtns(AllPaymentOptions); + setRefundPaySelected(AllPaymentOptions?.[0]?.ConfigId); + setRefundPaySelectedName(AllPaymentOptions?.[0]?.ConfigName); + } else { + const withoutCustomer = AllPaymentOptions?.filter?.( + (item) => item?.ConfigName?.toLowerCase() !== 'credit' + ); + setRefundPaySelected(withoutCustomer?.[0]?.ConfigId); + setRefundPaySelectedName(withoutCustomer?.[0]?.ConfigName); + setRefundPayBtns(withoutCustomer); + } + } + + }, [AllPaymentOptions, SelCustId, salesBillEdit]) + useEffect(() => { if (!preOrder) { const totalSum = OrderCardDetail?.reduce( @@ -624,22 +755,41 @@ const BSC1Payment = (props) => { ); } + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); + + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + + const previousNetAmount = + (totalPreviouspayment) || 0; + let withdiscTotal = Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + (Discount > 0 ? Discount : 0)); - - setTotalAmount( + const currentOrderNetAmount = formatAmount( withdiscTotal >= 0 ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2) - ); + ) - dispatch( - changeSummeryTotalAmount( - withdiscTotal > 0 ? withdiscTotal : Number(Total) - ) - ); + setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); + setCurrentOrderNetAmount(currentOrderNetAmount); + setPreviousNetAmount(previousNetAmount); + dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(changeSummeryComboOfferAmount(withComboSum)); @@ -1080,6 +1230,10 @@ const BSC1Payment = (props) => { const handleButtonClick = () => { if (qrCode && SelectedUPIPayOption === 'Default') { UpiPayment(); + } else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { + setMessageType('warning'); + setMessageData('Please Select Refund Payment Method'); + return; } else { OrderStatus ? AddBookingDetails('Dine-In', false) @@ -1155,6 +1309,9 @@ const BSC1Payment = (props) => { const filterpaymentdevice = FiltersalesPayment?.[0]?.OptionDetails?.filter( (item) => item?.OptionName?.toLowerCase() === 'payment device' ); + const filterBusinessUpi = FiltersalesPayment?.[0]?.OptionDetails?.filter( + (item) => item?.OptionName?.toLowerCase() === 'business upi' + ); const cardinpaymentgateway = filterpaymentgateway?.[0]?.ModeDetails?.filter((item) => item?.ModeName?.toLowerCase()?.includes('card') @@ -1197,7 +1354,6 @@ const BSC1Payment = (props) => { } setCardPayOption(cardoptions); const options = []; - if (FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter?.length > 0) { options.push({ label: 'Personal UPI', @@ -1205,6 +1361,16 @@ const BSC1Payment = (props) => { imgSrc: defaultupi, }); } + if (filterBusinessUpi?.[0]?.ModeDetails?.length > 0) { + options.push({ + label: 'Business UPI', + value: 'Business', + imgSrc: pozologoimg, + PaymentOptionId: filterBusinessUpi?.[0]?.PaymentOptionId, + PaymentFlowId: filterBusinessUpi?.[0]?.PaymentFlowId, + OptionId: filterBusinessUpi?.[0]?.OptionId, + }); + } if (upiinpaymentgateway?.length > 0) { options.push({ label: 'Payment Gateway', value: 'PG', imgSrc: paygate }); @@ -1214,6 +1380,7 @@ const BSC1Payment = (props) => { options.push({ label: 'Payment Device', value: 'PD', imgSrc: paydevice }); } setUpiPayOption(options); + setBusinessPayoption(filterBusinessUpi?.[0]?.ModeDetails || []); // } }; @@ -1252,12 +1419,17 @@ const BSC1Payment = (props) => { } }; + const handleRefundPaymentMode = (id, name) => { + setRefundPaySelected(id); + setRefundPaySelectedName(name); + } + const AddCardOption = (data) => { setSelectedCardOption(data); setCardOptionOpen(false); setCardoptionnotSelected(false); }; - const AddUPIPaymentOption = async (data) => { + const AddUPIPaymentOption = async (data, mode = false) => { setSelectedUpiOption(''); setUpiOption(''); setUpiId(''); @@ -1267,7 +1439,7 @@ const BSC1Payment = (props) => { setSelectedUPIPayOption(data); setUpinotSelected(false); setCardoptionnotSelected(false); - if (data !== 'Default') { + if (data !== 'Default' && data !== 'Business' && !mode) { setUpiOptionOpen(false); } }; @@ -1647,6 +1819,18 @@ const BSC1Payment = (props) => { } }; + const businessUPIFlow = async ( + businessUPIfilter, + OrderId, + PaymentStatusLink + ) => { + // Implement your business UPI flow here + // You can add similar logic as PaymentDeviceFlow or PaymentGatewayFlow based on your requirements + setBusinessUPILink(PaymentStatusLink); + setBusinessUPI(true); + setBusinessUPIOrderId(OrderId); + }; + function safeRound(amountStr) { if (amountStr == null) return '0.00'; @@ -1794,6 +1978,9 @@ const BSC1Payment = (props) => { } else { dispatch(changeOrderCardDetails([])); } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); dispatch(changeTipAmount(0)); await dispatch(ChangeTotalAmount([])); await dispatch(changeReorderHoldDetails({})); @@ -1807,6 +1994,8 @@ const BSC1Payment = (props) => { setPaybtnselected(PaymentOptionsModeId); setQrCode(false); setUpinotSelected(false); + setCurrentOrderNetAmount(0); + setPreviousNetAmount(0); getHolddata(); getUnpaiddatas(); await dispatch(changeBookingType('TakeAway')); @@ -1843,7 +2032,8 @@ const BSC1Payment = (props) => { ); if ( OnUpiSelected?.ModeName?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + (SelectedUPIPayOption?.toLowerCase() === 'default' || + SelectedUPIPayOption?.toLowerCase() === 'business') ) { SetSuccess(false); setTimeout(function () { @@ -2096,19 +2286,28 @@ const BSC1Payment = (props) => { SalesPaymentType: 'normal', PaymentDetail: [ { - PaymentType: + PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'pd' ? PaymentDeviceUPI?.[0]?.ModeId : SelectedUPIPayOption?.toLowerCase() === 'pg' ? PaymentgatewayUPI?.[0]?.ModeId - : paybtnselected + : SelectedUPIPayOption?.toLowerCase() === 'business' + ? BusinessPayOption?.find( + (busupi) => busupi?.ModeId === UpiId + )?.ModeId + : paybtnselected : paybtnselected ? paybtnselected : null, - // SelectedUPIPayOption?.toLowerCase() === "pg" ? - Amount: Math.round(TotalAmount), - PaymentOptionType: + Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), + MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : + Paybtnnameselected?.toLowerCase() === 'upi' && + SelectedUPIPayOption?.toLowerCase() === 'business' + ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) + ?.MerchantId + : null, + PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2118,14 +2317,19 @@ const BSC1Payment = (props) => { : Paybtnnameselected?.toLowerCase() === 'upi' ? SelectedUPIPayOption?.toLowerCase() === 'default' ? 'PC' - : SelectedUPIPayOption + : SelectedUPIPayOption?.toLowerCase() === 'business' + ? 'BU' + : SelectedUPIPayOption : null, - ModeOfPayment: + ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ?.UPIDetailId - : null, - AccountDtl: + : SelectedUPIPayOption?.toLowerCase() === 'business' + ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) + ?.MerchantUPIId + : null, + AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( @@ -2142,7 +2346,7 @@ const BSC1Payment = (props) => { SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], - PaymentStatus: + PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'S' : Paybtnnameselected?.toLowerCase() === 'credit' @@ -2151,8 +2355,8 @@ const BSC1Payment = (props) => { SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', - Debit: 0, - Credit: + Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, + Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : Paybtnnameselected?.toLowerCase() === 'credit' ? Math.round(TotalAmount) : 0, @@ -2206,6 +2410,11 @@ const BSC1Payment = (props) => { let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter( (item) => item?.PaymentOptionType?.toLowerCase() === 'pc' ); + let businessUPIfilter = response?.data?.PaymentOrderDtl?.filter( + (item) => + item?.PaymentOptionType?.toLowerCase() === 'bu' && + item?.PaymentStatus === 'P' + ); if ( PayatCounterfilter?.length === 1 || response?.data?.PaymentOrderDtl?.length === 0 @@ -2310,6 +2519,13 @@ const BSC1Payment = (props) => { } else { console.log('more pg data'); } + if (businessUPIfilter?.length === 1) { + businessUPIFlow( + businessUPIfilter, + response?.data?.OrderId, + response?.data?.PaymentPageLink + ); + } dispatch(triggerCustomerRefresh()); } else { setMessageType('error'); @@ -2341,10 +2557,16 @@ const BSC1Payment = (props) => { putdata['PaymentType'] = !pay && ''; putdata['PrintType'] = 'Y'; } - let response = await dispatch(PutBookingData(putdata)).unwrap(); + let response = null; + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } let PayatCounterfilter = response?.data?.PaymentOrderDtl?.filter( (item) => item?.PaymentOptionType?.toLowerCase() === 'pc' ); + if (value !== 'Unpaid') { if (response?.data?.statusCode == 1) { let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( @@ -2358,8 +2580,7 @@ const BSC1Payment = (props) => { item?.PaymentStatus === 'P' ); - if ( - PayatCounterfilter?.length === 1 || + if (PayatCounterfilter?.length === 1 || response?.data?.PaymentOrderDtl?.length === 0 ) { setMessageType('success'); @@ -2391,6 +2612,8 @@ const BSC1Payment = (props) => { if (PaymentGatewayfilter?.length === 1) { await PaymentGatewayFlow(PaymentGatewayfilter); } else { + setPrintOrderDetails([response?.data]); + ClearAllGlobalStateDatas(); console.log('more pg data'); } } else { @@ -3084,7 +3307,7 @@ const BSC1Payment = (props) => { }; // split payments const SplitPaymentOpen = () => { - if (OrderCardDetail?.length > 0) { + if (OrderCardDetail?.length > 0 && TotalAmount > 0) { const updatedData = { userData: OrderCardDetail, ExtraCharges: GlobalExtraCharge, @@ -3094,6 +3317,11 @@ const BSC1Payment = (props) => { setFailedOrderData(updatedData); setSplitpayment(true); } else { + if (TotalAmount <= 0) { + setMessageType('warning'); + setMessageData('Cannot split when total amount is zero or less'); + return; + } setMessageType('warning'); setMessageData('Please Select the Product'); } @@ -3631,7 +3859,7 @@ const BSC1Payment = (props) => { : 1, }} > - {paybtns?.length > 0 ? ( + {paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( paybtns?.map((payment) => (

    )) + ) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( + refundPayBtns.map((payment) => ( +
    + +
    + )) ) : (
    { OrderCardDetail?.length > 0 && paybtnselected && CheckBookingStatus != 'Close' - ? !OrderStatus - ? 'BSC1Payment-div4-button' + ? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? + 'BSC1Payment-div4-button' + : 'BSC1Payment-div4-button' : 'BSC1Payment-div4-button Order' : 'BSC1Payment-div4-button-disable' } @@ -4242,7 +4510,7 @@ const BSC1Payment = (props) => { onClick={handleButtonClick} style={{ borderRadius: '6px 0 0 6px' }} > - {!OrderStatus ? ( + {!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ?
    Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
    : ( <> {isMobile ? ( `₹ ${safeRound( @@ -4491,7 +4759,10 @@ const BSC1Payment = (props) => { SplitPaymentModal={Splitpayment} handlesplitpaymentclose={handlesplitpaymentclose} TotalNetAmount={ - OrderType === 'Failed' ? FailedTotalAmt : Math.round(TotalAmount) + OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - + ((OverAllSales > 0 ? OverAllSales : 0) + + (OverAllEstimate > 0 ? OverAllEstimate : 0) + + (Discount > 0 ? Discount : 0))) } failedOrderData={failedOrderData} /> @@ -4569,6 +4840,43 @@ const BSC1Payment = (props) => {
    } /> + setShowCancelConfirm(true)} + footer={false} + width={500} + children={ + <> + + + } + /> + {showCancelConfirm && ( + { + setBusinessUPI(false); + setShowCancelConfirm(false); + ClearAllGlobalStateDatas(); + CustomerDisplay(); + }} + onCancel={() => setShowCancelConfirm(false)} + okText="Yes" + cancelText="No" + > + Do you want to cancel the payment? + + )} ); }; diff --git a/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx b/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx index 3172ee0..541cc13 100644 --- a/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx +++ b/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx @@ -2432,7 +2432,9 @@ const BSItemCard = (props) => { const isItemInCartHold = CartOrderDetails?.find( (cartItem) => itemMatchCondition(cartItem) && - (cartItem?.OfferMode !== 'B' && + ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' + ? true + : cartItem?.OfferMode !== 'B') && cartItem?.OfferMode !== 'P' && cartItem?.OfferMode !== 'C' && cartItem?.OfferMode !== 'O' && cartItem?.OfferMode !== 'L' @@ -2461,7 +2463,9 @@ const BSItemCard = (props) => { (cartItem) => !( itemMatchCondition(cartItem) && - (cartItem?.OfferMode !== 'B' && + ((cartItem?.OfferModeType && cartItem?.OfferMode === 'B' + ? true + : cartItem?.OfferMode !== 'B') && cartItem?.OfferMode !== 'P' && cartItem?.OfferMode !== 'C' && cartItem?.OfferMode !== 'O' && cartItem?.OfferMode !== 'L' @@ -2865,7 +2869,6 @@ const BSItemCard = (props) => { OfferId: offer?.OfferId || '', OfferAmount: change?.discount || 0, OfferType: offer?.OfferType || '', // I / Q / B - OfferCode: PromoCodeOffersDatas?.OfferCode, ActualOfferAmount: offer?.OfferAmt || 0, OfferValue: offer?.OfferAmt || 0, TableName: change?.TableName || '', @@ -2873,7 +2876,7 @@ const BSItemCard = (props) => { TableUniqueId: change?.TableUniqueId || '', // OfferType: offer?.ValueType || "", // F / P Detail: offer?.Detail || [], - OfferCode: offer?.OfferCode || '', + OfferCode: offer?.OfferCode || PromoCodeOffersDatas?.OfferCode || '', CustId: offer?.CustId || '', UsedCount: offer?.UsedCount || 0, AppliesTo: offer?.AppliesTo || '', diff --git a/src/Pages/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.jsx b/src/Pages/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.jsx index a9c0d18..ce5e6ca 100644 --- a/src/Pages/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.jsx +++ b/src/Pages/BookingScreen/Components/BookingFunctionality/FeaturesFunctionalities.jsx @@ -126,7 +126,7 @@ import { MdHome, MdLocationOn } from 'react-icons/md'; import { RadioGrpButton } from '../../../../Components/Forms/RadioGroup.jsx'; const FeaturesFunctionalities = (props) => { - const { closeModal = () => {} } = props; + const { closeModal = () => { } } = props; const applyOffer = useApplyOfferto_CardDetail(); const EditableContext = React.createContext(null); const EditableContext1 = React.createContext(null); @@ -367,30 +367,30 @@ const FeaturesFunctionalities = (props) => { const options = suggestions ? suggestions - ?.filter((item) => - selectedSearchValue === 'CustName' ? item.CustName !== null : item - ) - .map((item) => ({ - value: item?.CustMobile, - label: - selectedSearchValue === 'CustMobile' - ? `${item?.CustMobile} - ${item?.CustName ? item?.CustName : ''} ${item?.CustName ? ' - ' : ''} ${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}` - : selectedSearchValue === 'CustId' - ? `${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}${item?.CustName ? ' - ' : ''} ${item?.CustName ? item?.CustName : ''} - ${item?.CustMobile}` - : selectedSearchValue === 'CustName' && - item?.CustName !== null && - `${item?.CustName ? item?.CustName : ''} ${item?.CustName ? ' - ' : ''} ${item?.CustMobile} - ${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}`, - CustMobile: item?.CustMobile, - CustId: item?.CustId?.match(/-(\d+)$/)?.[1], - CustName: item?.CustName, - })) - : GlobalAddCustomerDetails1?.map((item) => ({ - value: item.CustMobile, - label: `${item?.CustName} ${item?.CustMobile}`, + ?.filter((item) => + selectedSearchValue === 'CustName' ? item.CustName !== null : item + ) + .map((item) => ({ + value: item?.CustMobile, + label: + selectedSearchValue === 'CustMobile' + ? `${item?.CustMobile} - ${item?.CustName ? item?.CustName : ''} ${item?.CustName ? ' - ' : ''} ${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}` + : selectedSearchValue === 'CustId' + ? `${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}${item?.CustName ? ' - ' : ''} ${item?.CustName ? item?.CustName : ''} - ${item?.CustMobile}` + : selectedSearchValue === 'CustName' && + item?.CustName !== null && + `${item?.CustName ? item?.CustName : ''} ${item?.CustName ? ' - ' : ''} ${item?.CustMobile} - ${'Id:' + item?.CustId?.match(/-(\d+)$/)?.[1]}`, CustMobile: item?.CustMobile, - CustId: item?.CustId, + CustId: item?.CustId?.match(/-(\d+)$/)?.[1], CustName: item?.CustName, - })); + })) + : GlobalAddCustomerDetails1?.map((item) => ({ + value: item.CustMobile, + label: `${item?.CustName} ${item?.CustMobile}`, + CustMobile: item?.CustMobile, + CustId: item?.CustId, + CustName: item?.CustName, + })); const handleYesOrNoChange = (value) => { setSelectedValue(value); formRef.current?.setFieldsValue({ OfferActiveStatus: value }); @@ -453,34 +453,34 @@ const FeaturesFunctionalities = (props) => { }, ...(sportsAppPreference ? [ - { - title: 'Subcategory', - key: 'productDetails', - dataIndex: 'productDetails', - align: 'center', - width: '150px', - onCell: (record) => { - const productDetails = record?.productDetails; - const Combodtl = - record?.productDetails?.[0]?.comboDtl?.[0] - ?.ComboInwardDetails?.[0]?.ComboDetails; + { + title: 'Subcategory', + key: 'productDetails', + dataIndex: 'productDetails', + align: 'center', + width: '150px', + onCell: (record) => { + const productDetails = record?.productDetails; + const Combodtl = + record?.productDetails?.[0]?.comboDtl?.[0] + ?.ComboInwardDetails?.[0]?.ComboDetails; - return { - onClick: () => { - HoldPutfun(productDetails, record, Combodtl); - }, - }; - }, - render: (productDetails, record) => ( - HoldPutfun(productDetails, record)} - > - {record?.productDetails?.[0]?.ProdSubCatName} - - ), + return { + onClick: () => { + HoldPutfun(productDetails, record, Combodtl); + }, + }; }, - ] + render: (productDetails, record) => ( + HoldPutfun(productDetails, record)} + > + {record?.productDetails?.[0]?.ProdSubCatName} + + ), + }, + ] : []), { title: 'Orders', @@ -758,7 +758,7 @@ const FeaturesFunctionalities = (props) => { TaxAmt: formatAmount( ((record.Price * record.TaxPercentage) / (100 + record.TaxPercentage)) * - record.QTY + record.QTY ), TaxId: record.TaxId, TaxPercentage: record.TaxPercentage, @@ -785,11 +785,11 @@ const FeaturesFunctionalities = (props) => { const isDuplicate = TableName?.some( (item) => item.InwardDtlId + - ' ' + - item.BookingTypeName + - ' ' + - item.SinglePc === - selectedProduct && item.UniqueId === record.UniqueId + ' ' + + item.BookingTypeName + + ' ' + + item.SinglePc === + selectedProduct && item.UniqueId === record.UniqueId ); if (!isDuplicate) { @@ -807,7 +807,7 @@ const FeaturesFunctionalities = (props) => { TaxAmt: formatAmount( ((record.Price * record.TaxPercentage) / (100 + record.TaxPercentage)) * - record.QTY + record.QTY ), TaxId: record?.TaxId, TaxPercentage: record.TaxPercentage, @@ -1054,7 +1054,7 @@ const FeaturesFunctionalities = (props) => { ...record, ...values, }); - } catch (errInfo) {} + } catch (errInfo) { } }; let childNode = children; @@ -1106,7 +1106,7 @@ const FeaturesFunctionalities = (props) => { return ( record.Price * record.QTY - ((record.Price * record.TaxPercentage) / (100 + record.TaxPercentage)) * - record.QTY + record.QTY ); }; const WithTaxAmountTaxAmount = (record) => { @@ -1179,10 +1179,10 @@ const FeaturesFunctionalities = (props) => { onClick={() => addeddata(record)} disabled={ Object.keys(ReorderHoldDetails).length !== 0 && - BookingType === 'Dine In' && - GlobalExtraCharge.some( - (item) => item.ExtraChargeId === record.UniqueId - ) + BookingType === 'Dine In' && + GlobalExtraCharge.some( + (item) => item.ExtraChargeId === record.UniqueId + ) ? true : false } @@ -1278,7 +1278,7 @@ const FeaturesFunctionalities = (props) => { QTY: parseInt(row.QTY), TaxAmt: formatAmount( ((row.Price * row.TaxPercentage) / (100 + row.TaxPercentage)) * - row.QTY + row.QTY ), TotalAmt: row.Price * row.QTY, // ((row.Price * row.TaxPercentage) / (100 + row.TaxPercentage) *row.QTY ).toFixed(2), @@ -1427,12 +1427,12 @@ const FeaturesFunctionalities = (props) => { {Object.keys(ReorderHoldDetails).length !== 0 && - BookingType === 'Dine In' && - GlobalExtraCharge?.some( - (item) => - item.ExtraChargeId === record.UniqueId && - item.InwardDtlId === record.InwardDtlId - ) ? ( + BookingType === 'Dine In' && + GlobalExtraCharge?.some( + (item) => + item.ExtraChargeId === record.UniqueId && + item.InwardDtlId === record.InwardDtlId + ) ? ( { dispatch( changeCustomerID( response?.data?.CustomerDetails?.[ - response?.data?.CustomerDetails.length - 1 + response?.data?.CustomerDetails.length - 1 ] ) ); @@ -2186,9 +2186,9 @@ const FeaturesFunctionalities = (props) => { AppId: AppId, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; await dispatch(getSelectedFavItems(data)).unwrap(); @@ -2200,9 +2200,9 @@ const FeaturesFunctionalities = (props) => { ProdSubCat: ProdSubCat, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; @@ -2213,9 +2213,9 @@ const FeaturesFunctionalities = (props) => { prodCat: prodCat, ...(AvailableDate && selectedDate ? { - fromDate: selectedDate?.[0], - toDate: selectedDate?.[1], - } + fromDate: selectedDate?.[0], + toDate: selectedDate?.[1], + } : {}), }; @@ -2588,7 +2588,7 @@ const FeaturesFunctionalities = (props) => { e?.stopPropagation(); removeAll(); }} - // onClick={() => statusFormatter(record,index)} + // onClick={() => statusFormatter(record,index)} > Clear All @@ -2715,7 +2715,7 @@ const FeaturesFunctionalities = (props) => { : selectedSearchValue == 'CustName' ? 'Please Enter Valid Name' : selectedSearchValue == 'CustId' && - 'Please EnterCustomer Id', + 'Please EnterCustomer Id', }, ]} > @@ -2804,7 +2804,7 @@ const FeaturesFunctionalities = (props) => { : selectedSearchValue == 'CustName' ? 'Enter Name' : selectedSearchValue == 'CustId' && - 'Enter Customer Id' + 'Enter Customer Id' : ' Mobile Number'} } @@ -2986,7 +2986,7 @@ const FeaturesFunctionalities = (props) => { autocomplete="off" isOnChange={ formRef.current?.getFieldsValue()?.CustName || - inputValue + inputValue ? true : false } @@ -3052,9 +3052,9 @@ const FeaturesFunctionalities = (props) => {

    Upload Profile

    - // formType === 'edit' ? editstate?.EmpPhotoLink : e - // } + // getValueFromEvent={(e) => + // formType === 'edit' ? editstate?.EmpPhotoLink : e + // } > {
    -
    -
    - - handleAddressTypeChange( - idx, - 'Delivery Address', - e.target.checked - ) - } +
    +
    - Delivery Address - - - handleAddressTypeChange( - idx, - 'Billing Address', - e.target.checked - ) - } - > - Billing Address - - - handleAddressTypeChange( - idx, - 'Both Address', - e.target.checked - ) - } - > - Both Address - -
    -
    - -
    -
    -
    - {addr?.Address1 || ''} + + handleAddressTypeChange( + idx, + 'Delivery Address', + e.target.checked + ) + } + > + Delivery Address + + + handleAddressTypeChange( + idx, + 'Billing Address', + e.target.checked + ) + } + > + Billing Address + + + handleAddressTypeChange( + idx, + 'Both Address', + e.target.checked + ) + } + > + Both Address +
    -
    -
    - {addr?.Address2 || ''} -
    -
    - -
    -
    - {addr?.Zip || ''} -
    -
    - -
    -
    - {addr?.City || ''} -
    -
    - -
    -
    - {addr?.Dist || ''} -
    -
    - -
    -
    - {addr?.State || ''} -
    -
    - - {addr?.Latitude && ( -
    -
    - {' '} - {addr?.Latitude || ''},{' '} - {addr?.Longitude || ''} +
    +
    +
    + {addr?.Address1 || ''}
    - )} -
    -
    - - handleRemoveAddress(idx)} - okText="Yes, Remove" - cancelText="Cancel" - okType="danger" - > +
    +
    + {addr?.Address2 || ''} +
    +
    + +
    +
    + {addr?.Zip || ''} +
    +
    + +
    +
    + {addr?.City || ''} +
    +
    + +
    +
    + {addr?.Dist || ''} +
    +
    + +
    +
    + {addr?.State || ''} +
    +
    + + {addr?.Latitude && ( +
    +
    + {' '} + {addr?.Latitude || ''},{' '} + {addr?.Longitude || ''} +
    +
    + )} +
    +
    - + + handleRemoveAddress(idx)} + okText="Yes, Remove" + cancelText="Cancel" + okType="danger" + > + + +
    -
    - )) + )) ) : (
    @@ -3484,7 +3484,7 @@ const FeaturesFunctionalities = (props) => { { style={ offerType == 'P' ? { - opacity: '1', - boxShadow: - 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', - margin: '3px', - padding: '5px', - backgroundColor: '#fff', - } + opacity: '1', + boxShadow: + 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', + margin: '3px', + padding: '5px', + backgroundColor: '#fff', + } : { opacity: '0.6', boxShadow: 'none' } } onClick={() => { @@ -3549,13 +3549,13 @@ const FeaturesFunctionalities = (props) => { style={ offerType == 'F' ? { - opacity: '1', - boxShadow: - 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', - margin: '3px', - padding: '5px', - backgroundColor: '#fff', - } + opacity: '1', + boxShadow: + 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', + margin: '3px', + padding: '5px', + backgroundColor: '#fff', + } : { opacity: '0.6', boxShadow: 'none' } } onClick={() => { @@ -3652,7 +3652,7 @@ const FeaturesFunctionalities = (props) => { } isOnChange={ formRef.current?.getFieldsValue()?.CustEmail || - inputValue + inputValue ? true : false } @@ -3680,7 +3680,7 @@ const FeaturesFunctionalities = (props) => { autocomplete="off" isOnChange={ formRef.current?.getFieldsValue()?.CreditLimit || - inputValue + inputValue ? true : false } @@ -4027,7 +4027,7 @@ const FeaturesFunctionalities = (props) => { buttonText="SAVE" color="901D77" icon={} - // handleSubmit={() => { globalamount1() }} + // handleSubmit={() => { globalamount1() }} />
    @@ -4041,7 +4041,7 @@ const FeaturesFunctionalities = (props) => { bordered dataSource={TableName} width={'120px'} - //pagination={column2?.length < "11" ? false : true} + //pagination={column2?.length < "11" ? false : true} >
    {idx + 1} {item.ProdName}{item?.EditTokenAvailable === 'Y' ? item?.EditTokenQty : item.SalesQty}{item.SalesQty} {item.Rate}{((item?.EditTokenAvailable === 'Y' ? item?.EditTokenQty : item.SalesQty) * item.Rate) - ((item?.EditTokenAvailable === 'Y' ? (item?.OfferAmt / item?.EditTokenQty) : item?.OfferAmt))}{item.TotalAmt}
    )} diff --git a/src/Pages/BookingScreen/Components/BookingFunctionality/SplitPayment.jsx b/src/Pages/BookingScreen/Components/BookingFunctionality/SplitPayment.jsx index b1610d0..a99cd9a 100644 --- a/src/Pages/BookingScreen/Components/BookingFunctionality/SplitPayment.jsx +++ b/src/Pages/BookingScreen/Components/BookingFunctionality/SplitPayment.jsx @@ -51,7 +51,14 @@ import { GlobalOverAllDiscSales, GlobalOverAllDiscEstimate, GlobaltipAmount, - GlobalRetailWSSalesType + GlobalRetailWSSalesType, + GlobalPreviousOrderPayment, + GlobalPreviousOrderOfferDetails, + GlobalSalesBillEdit, + putSalesBillEdit, + changeBillEditingMode, + changePreviousOrderPayment, + changePreviousOrderOfferDetail } from '../../../../Features/BookingScreen/BookingData/BookingData'; import { Form, Radio } from 'antd'; import { @@ -98,6 +105,7 @@ import { gettinghold } from '../../../../Features/BookingScreen/HoldOption/HoldO import { Global_OrderOfferDetail } from '../../../../Features/Offer/Offer.js'; import { useApplyOfferto_CardDetail } from '../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js'; +import { ChangeFullFreeProductList, changeFullOfferAppliedProducts, GlobalOfferAppliedProducts } from '../../../../Features/Offer/Offernew/BookingOffernew.js'; const subDirectory = import.meta.env.BASE_URL; const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL; @@ -114,7 +122,7 @@ const SplitPayment = (props) => { const applyOffer = useApplyOfferto_CardDetail(); const globalTipAmount = useSelector(GlobaltipAmount); - const TotalAmount = (props.hasOwnProperty('TotalNetAmount') + const TotalNetAmount = (props.hasOwnProperty('TotalNetAmount') ? props['TotalNetAmount'] : null); const TableOrderId = props.hasOwnProperty('TableBookingOrderId') @@ -128,7 +136,23 @@ const SplitPayment = (props) => { : null; const OrderCardDetail = useSelector(GlobalOrderCardDetails); const SelCustId = useSelector(GlobalSelCustId); - + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); + const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); + const filteredPayments = + previousOrderPayment?.filter( + p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment + ) || []; + const paymentsToUse = + filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; + const totalPreviousOfferAmount = previousOrderOfferDetails?.reduce( + (acc, offer) => acc + parseFloat(offer.OfferAmount || 0), + 0 + ); + const totalPreviouspayment = paymentsToUse?.reduce( + (acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), + 0 + ); const [paybtns, setpaybtns] = useState([]); const [PaymentOptions, setPaymentOptions] = useState([]); const [PaymentUpiOptions, setPaymentUpiOptions] = useState([]); @@ -140,6 +164,9 @@ const SplitPayment = (props) => { const [SplitSelPayMode, setSplitSelPayMode] = useState({}); const [TotalSplitAmount, setTotalSplitAmount] = useState(0); const [SalesOrderId, setSalesOrderId] = useState(); + const [beforeAdjAmount, setBeforeAdjAmount] = useState(null); + const [afterAdjAmount, setAfterAdjAmount] = useState(null); + const [adjustmentType, setAdjustmentType] = useState(null); const [PaymentgatewayCard, setPaymentgatewayCard] = useState([]); const [PaymentDeviceCard, setPaymentDeviceCard] = useState([]); const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]); @@ -154,7 +181,7 @@ const SplitPayment = (props) => { const GlobProdwisedata = useSelector(GlobalSelProdWiseEst); const prodCat = useSelector(GlobalProductCategorie); const ProdSubCat = useSelector(GlobalProductSubCategorie); - const RetailWSSalesType= useSelector(GlobalRetailWSSalesType, shallowEqual); + const RetailWSSalesType = useSelector(GlobalRetailWSSalesType, shallowEqual); const selOption = useSelector(GlobalSelOption); const ReportholdData = useSelector(GlobalReorderHoldDetails); const GlobalExtraCharge = useSelector(globalExtraTotalAmount); @@ -177,6 +204,7 @@ const SplitPayment = (props) => { (i) => i.SettingIdName === 'AllProductindividualToken' )?.[0]; const OrderOfferDetail = useSelector(Global_OrderOfferDetail, shallowEqual); + const offerAppliedProducts = useSelector(GlobalOfferAppliedProducts); const [SelectedBookingType, setSelectedBookingType] = useState(null); const [ConfigDataList, setConfigDataList] = useState([]); const [formattedDate, setFormattedDate] = useState(''); @@ -194,6 +222,8 @@ const SplitPayment = (props) => { const OfferCheckedInSetup = templateData?.BookingNavbar?.[1].some( (item) => item?.OptionName == 'Offer' ); + const [TotalAmount, setTotalAmount] = useState(0); + console.log(TotalAmount, "TotalSplitAmount", TotalSplitAmount) const preferenceOffer = SettingDataSelector?.[0]?.['SettingDtlDetails']?.find( (item) => item.SettingIdName === 'Offer' @@ -206,6 +236,21 @@ const SplitPayment = (props) => { getPaymentOptionFeature(); }, []); + useEffect(() => { + + if (salesBillEdit) { + const previousNetAmount = (totalPreviouspayment || 0); + if (TotalNetAmount > previousNetAmount) { + setTotalAmount(TotalNetAmount - previousNetAmount); + } else { + setTotalAmount(0); + } + } else { + setTotalAmount(TotalNetAmount); + } + + }, [totalPreviousOfferAmount, totalPreviouspayment, TotalNetAmount]) + useEffect(() => { if (SelCustId) { setpaybtns(PaymentOptions); @@ -227,8 +272,11 @@ const SplitPayment = (props) => { }, [Splitpayment]); useEffect(() => { const totalPayAmount = Object.keys(SplitSelPayMode) - .filter((key) => key.startsWith('PayAmount-')) // Filter keys that start with "PayAmount-" - .reduce((sum, key) => sum + parseInt(SplitSelPayMode[key]), 0); + .filter(key => key.startsWith('PayAmount-')) + .reduce((sum, key) => { + const value = parseInt(SplitSelPayMode[key], 10); + return sum + (isNaN(value) ? 0 : value); + }, 0); setTotalSplitAmount(totalPayAmount); }, [SplitSelPayMode]); useEffect(() => { @@ -522,7 +570,7 @@ const SplitPayment = (props) => { await Promise.all( PrintOrderDetails?.[0]?.OrderDetails?.map( async (orderDetail, index) => { - const groupedTokens = orderDetail?.productDetails?.reduce( + const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -557,7 +605,7 @@ const SplitPayment = (props) => { ); } else { await Promise.all( - PrintOrderDetails?.[0]?.OrderDetails?.map( + PrintOrderDetails?.[0]?.OrderDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.map( async (orderDetail, index) => { await TokenPrint(`${index}-${orderDetail?.OrderId}`); } @@ -585,6 +633,10 @@ const SplitPayment = (props) => { 'Style 11': 'PrintStyle11', 'Style 12': 'PrintStyle12', 'Style 13': 'RePrint', + A4: 'PrintStyleA4', + A5: 'PrintStyleA5', + A4Standard: 'A4Standard', + TaxInvoice: 'TaxInvoice', }; const selectedStyle = @@ -598,7 +650,7 @@ const SplitPayment = (props) => { async (orderDetail, index) => { await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print if (orderDetail?.BookingTypeName !== 'Dine In') { - const groupedTokens = orderDetail?.productDetails?.reduce( + const groupedTokens = orderDetail?.productDetails?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce( (acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { @@ -981,11 +1033,11 @@ const SplitPayment = (props) => { @@ -1240,7 +1292,12 @@ const SplitPayment = (props) => { } else { dispatch(changeOrderCardDetails([])); } + dispatch(changeBillEditingMode(false)); + await dispatch(changePreviousOrderPayment([])); + await dispatch(changePreviousOrderOfferDetail([])); await dispatch(ChangeTotalAmount([])); + dispatch(changeFullOfferAppliedProducts([])); + dispatch(ChangeFullFreeProductList([])); await dispatch(changeReorderHoldDetails({})); await dispatch(changeReorderProductDetails([])); await dispatch(ChangeNavHoldData(false)); @@ -1308,8 +1365,8 @@ const SplitPayment = (props) => { ? 'E' : GlobEstBooking === 'ParEst' ? GlobProdwisedata?.includes( - a.InwardDtlId + ' ' + a?.BookingTypeName - ) + a.InwardDtlId + ' ' + a?.BookingTypeName + ) ? 'E' : 'S' : 'S', @@ -1318,6 +1375,8 @@ const SplitPayment = (props) => { OfferValue: a?.Type === 'C' ? a?.OfferValue : a.Offer, OfferAmt: a?.Type === 'C' ? a?.TotalAmt : a.Offer, OfferType: a?.Type === 'C' ? a?.OfferType : '', + OfferMode: a?.OfferMode, + OfferMessage: a?.OfferMessage, CounterName: a?.TokenAvailable === 'Y' ? a?.CounterName : null, ProductIdentifierDtls: a.ProductIdentifierDtls, ModelNumber: a.ModelNumber, @@ -1326,9 +1385,9 @@ const SplitPayment = (props) => { const NotSlectedTypeFind = temporderdetail?.find( (a) => a?.BookingType != SelectedBookingType ); - let updatedOfferDetails = OrderOfferDetail; + let updatedOfferDetails = offerAppliedProducts; if (GlobEstBooking !== 'Sales') { - updatedOfferDetails = OrderOfferDetail?.filter( + updatedOfferDetails = offerAppliedProducts?.filter( (item) => !( item.TableName === 'LoyaltyPoints' && @@ -1339,7 +1398,7 @@ const SplitPayment = (props) => { } let temppostdata = { CompId: CompId, - SalesMode:RetailWSSalesType || 'R', + SalesMode: RetailWSSalesType || 'R', BranchId: BranchId, AppId: AppId, OrderDate: formattedDate, @@ -1413,37 +1472,37 @@ const SplitPayment = (props) => { : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' ? SplitSelPayMode[`CardSelection-${i}`] : SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'default' + 'default' ? 'PC' : SplitSelPayMode[`UPISelection-${i}`], ModeOfPayment: SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' ? PaymentUpiOptions?.find( - (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] - )?.UPIDetailId + (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] + )?.UPIDetailId : null, AccountDtl: SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( - (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] - ) + (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] + ) : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'pd') || + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'pd') || + (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === + 'card' && + SplitSelPayMode[`CardSelection-${i}`]?.toLowerCase() === + 'pd') + ? useOptions?.[0]?.PaymentDetails?.PaymentDevice + : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === + 'upi' && + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'pg') || (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' && SplitSelPayMode[`CardSelection-${i}`]?.toLowerCase() === - 'pd') - ? useOptions?.[0]?.PaymentDetails?.PaymentDevice - : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === - 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'pg') || - (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === - 'card' && - SplitSelPayMode[`CardSelection-${i}`]?.toLowerCase() === - 'pg') + 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], PaymentStatus: @@ -1452,9 +1511,9 @@ const SplitPayment = (props) => { : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'credit' ? 'S' : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === - 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'default' + 'upi' && + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'default' ? 'S' : 'P', Debit: 0, @@ -1468,7 +1527,7 @@ const SplitPayment = (props) => { }; let PostData = temppostdata; (i === 0 && SplitSelPayMode[`PaymentStatus-${i}`] === 'F') || - (i === 0 && props.hasOwnProperty('TableBookingOrderId')) + (i === 0 && props.hasOwnProperty('TableBookingOrderId')) ? PutSplitPayment(i) : i === 0 ? Object.keys(ReportholdData)?.length > 0 @@ -1517,14 +1576,14 @@ const SplitPayment = (props) => { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -1566,11 +1625,23 @@ const SplitPayment = (props) => { : ReportholdData?.OrderId; putdata['SalesId'] = ReportholdData?.SalesId; putdata['UpdatedBy'] = UserId; + let response = null; - let response = await dispatch(PutBookingData(putdata)).unwrap(); + if (salesBillEdit) { + response = await dispatch(putSalesBillEdit(putdata)).unwrap(); + } else { + response = await dispatch(PutBookingData(putdata)).unwrap(); + } if (response?.data?.statusCode == 1) { setSalesOrderId(response?.data?.OrderId); + const salesEditAmount = response?.data?.PaymentOrderDtl?.find(payment => + payment?.LastOrderTran === 'Y' && payment?.AdjustmentType && + payment?.AdjustmentType != null && payment?.AfterAdjustment && payment?.BeforeAdjustment && payment?.AfterAdjustment != null && payment?.BeforeAdjustment != null + ) + setBeforeAdjAmount(salesEditAmount?.BeforeAdjustment || null); + setAfterAdjAmount(salesEditAmount?.AfterAdjustment || null); + setAdjustmentType(salesEditAmount?.AdjustmentType || null); let Paymentdevicefilter = response?.data?.PaymentOrderDtl?.filter( (item) => item?.PaymentOptionType?.toLowerCase() === 'pd' && @@ -1606,14 +1677,14 @@ const SplitPayment = (props) => { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -1672,32 +1743,32 @@ const SplitPayment = (props) => { : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' ? SplitSelPayMode[`CardSelection-${i}`] : SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'default' + 'default' ? 'PC' : SplitSelPayMode[`UPISelection-${i}`], ModeOfPayment: SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' ? PaymentUpiOptions?.find( - (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] - )?.UPIDetailId + (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] + )?.UPIDetailId : null, AccountDtl: SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( - (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] - ) + (upipay) => upipay?.Mode === SplitSelPayMode[`UPIMode-${i}`] + ) : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd') || - (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd') + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd') || + (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'card' && + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pd') ? useOptions?.[0]?.PaymentDetails?.PaymentDevice : (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'pg') || - (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === - 'card' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pg') + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'pg') || + (SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === + 'card' && + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], PaymentStatus: @@ -1706,8 +1777,8 @@ const SplitPayment = (props) => { : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'credit' ? 'S' : SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'upi' && - SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === - 'default' + SplitSelPayMode[`UPISelection-${i}`]?.toLowerCase() === + 'default' ? 'S' : 'P', Debit: 0, @@ -1715,6 +1786,10 @@ const SplitPayment = (props) => { SplitSelPayMode[`PaymentMode-${i}`]?.toLowerCase() === 'credit' ? SplitSelPayMode[`PayAmount-${i}`] : 0, + BeforeAdjAmount: beforeAdjAmount || null, + AfterAdjAmount: afterAdjAmount || null, + AdjustmentType: adjustmentType || null, + }; let response = await dispatch( @@ -1761,14 +1836,14 @@ const SplitPayment = (props) => { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -1870,14 +1945,14 @@ const SplitPayment = (props) => { }); setMessageData( bookingpaymentupdate?.data?.response + - ' ' + - (bookingpaymentupdate?.data?.OrderDetails?.length > 0 - ? bookingpaymentupdate?.data?.OrderId && - extractLastNumberOrderId( - bookingpaymentupdate?.data?.OrderId, - bookingpaymentupdate?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (bookingpaymentupdate?.data?.OrderDetails?.length > 0 + ? bookingpaymentupdate?.data?.OrderId && + extractLastNumberOrderId( + bookingpaymentupdate?.data?.OrderId, + bookingpaymentupdate?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (bookingpaymentupdate?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([bookingpaymentupdate?.data]); @@ -1895,7 +1970,7 @@ const SplitPayment = (props) => { if ( Date.now() - startTime > useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes * - 60000 + 60000 ) { // 60,000 ms = 1 minute diff --git a/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx b/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx index f1294f6..c89fe41 100644 --- a/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx +++ b/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx @@ -41,7 +41,26 @@ import MobilePrint from '../../BookingFunctionality/MobilePrint.jsx'; import '../../../../../Styles/BookingScreen/Components/OtherConponents/Reprint/BSReprint.scss'; import PaymentPdfBooking from '../../../../paymentpdfPage/PaymentPdfBooking.jsx'; import { + changeBillEditingMode, + changeEstimateBooking, + changeHoldOrderDtl, + changeOrderCardDetails, + changeOrderType, + ChangeOverAllDiscEstimate, + ChangeOverAllDiscSales, + changePreviousOrderOfferDetail, + changePreviousOrderPayment, + changeReorderHoldDetails, + changeReorderProductDetails, + ChangeSelectedCustDisable, + changeSelectedCustId, + changeSelectedOption, + changeSelProdWiseEst, + getAllCustomer, getConfigType, + getCustomerForHold, + GlobalSalesBillEdit, + GlobalSelectedCustDisable, PreferenceData, } from '../../../../../Features/BookingScreen/BookingData/BookingData.js'; import { DatePicker, Form } from 'antd'; @@ -63,10 +82,15 @@ import { import { TbSettingsCog } from 'react-icons/tb'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import { axiosRetailInstanceData } from '../../../../../Features/AuthenicationToken/AuthenticationToken.js'; +import { MdEdit } from "react-icons/md"; +import { v4 as uuidv4 } from 'uuid'; +import { changeOrderOfferDetail } from '../../../../../Features/Offer/Offer.js'; +import { ChangeFullFreeProductList, changeFullOfferAppliedProducts, changeLoyaltyConsumedQuantities } from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; +import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js'; const RetailApiurl = import.meta.env.ENV_API_URL; -function BSReprint() { +function BSReprint({ setOpenModel = () => { } }) { const dispatch = useDispatch(); const queryClient = useQueryClient(); const appPreferences = useSelector(ApplicationPreferences); @@ -100,24 +124,31 @@ function BSReprint() { const [page, setpage] = useState(1); const [itemsPerPage] = useState(10); const [DefReason, setDefReason] = useState({}); - console.log(DefReason, 'DefReason'); const SettingDataSelector = useSelector(PreferenceData); + const salesBillEdit = useSelector(GlobalSalesBillEdit); + const custDisable = useSelector(GlobalSelectedCustDisable); + console.log(SettingDataSelector, 'SettingDataSelector'); const MobileA4Print = SettingDataSelector?.[0]?.SettingDtlDetails?.find( (setting) => setting?.SettingIdName?.toLowerCase() === 'mobilea4' && setting?.SettingValue === 'Y' ); + const editBill = SettingDataSelector?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'editbill' && + setting?.SettingValue === 'Y' + ); const TokenOnly = SettingDataSelector?.[0]?.SettingDtlDetails?.filter( (i) => i.SettingIdName === 'TokenOnly' )?.[0]; const IndividualToken = SettingDataSelector?.[0]?.SettingDtlDetails?.filter( (i) => i.SettingIdName === 'AllProductindividualToken' )?.[0]; - const Weightasquantity = SettingDataSelector?.[0]?.SettingDtlDetails?.some( - (setting) => - setting?.SettingIdName?.toLowerCase() === 'weightasquantity' && - setting?.SettingValue === 'Y' - ); + const Weightasquantity = SettingDataSelector?.[0]?.SettingDtlDetails?.some( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'weightasquantity' && + setting?.SettingValue === 'Y' + ); const printDatas = useSelector(GlobalprintDatas); console.log(printDatas, 'GlobalprintDatas'); const PrinterDetails = useSelector(GlobalPrinterMappingDtls); @@ -560,7 +591,7 @@ function BSReprint() { const selectedStyle = stylesMap[ - printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle + printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle ]; if (selectedStyle) { if (data === 'without') { @@ -784,7 +815,6 @@ function BSReprint() { {(page - 1) * 10 + index + 1} ), }, - { title: 'Bill No', dataIndex: 'BillNo', @@ -895,6 +925,21 @@ function BSReprint() { /> ), }, + // ...(editBill ? [ + { + title: 'Edit Bill', + key: 'EditBill', + dataIndex: 'EditBill', + align: 'center', + render: (text, row) => ( + await handleEditBill(e, row)} + /> + ), + } + // ] : []) + , { title: () => (
    { - const isWeightScale = item?.ScaleType === 'weight'; + const isWeightScale = item?.ScaleType === 'weight'; - if (isWeightScale) { - return acc + ( - Weightasquantity - ? Math.round(Number(item?.SalesQty || item?.OrderQty || 0)) - : 1 - ); - } + if (isWeightScale) { + return acc + ( + Weightasquantity + ? Math.round(Number(item?.SalesQty || item?.OrderQty || 0)) + : 1 + ); + } - return acc + Math.round(Number(item?.SalesQty || item?.OrderQty|| 0)); - }, 0) + return acc + Math.round(Number(item?.SalesQty || item?.OrderQty || 0)); + }, 0) const widthOutTexAmt = table2Data?.[0]?.TaxDetails?.reduce( (sum, item) => sum + (item?.WithOutTaxAmount || 0), 0 ); + const handleEditBill = async (e, orderDtls) => { + setOpenModel(e); + dispatch(changeBillEditingMode(true)); + const { + productDetails, + ExtraChargeDetails, + CustSuppId, + OrderOfferDetails, + RefDetails, + OrderId, + OrderType, + OverallDisc, + OrderPaymentDtl, + } = orderDtls; + const updated = productDetails?.map((item) => ({ + ...item, + Offer: item?.OfferAmt, + localId: uuidv4(), + OfferMode: item?.OfferMode ? item?.OfferMode?.trim() : null, + VariantAvailableFrom: item?.AvailableFrom || null, + VariantAvailableTo: item?.AvailableTo || null, + OrderQty: item?.SalesQty, + OrderRate: item?.Rate, + // TotalAmt: formatAmount((item.TotalAmt - item.OfferValue)), + })); + + if (RefDetails?.[0]?.FreeProdList) { + dispatch(ChangeFullFreeProductList(RefDetails[0]?.FreeProdList)); + } + + if (RefDetails?.[0]?.OfferAppliedProductList) { + dispatch( + changeFullOfferAppliedProducts( + RefDetails[0]?.OfferAppliedProductList + ) + ); + } + + + + if (CustSuppId) { + let res = await dispatch( + getCustomerForHold({ + CompId: CompId, + AppId: AppId, + branchId: BranchId, + OrderId: OrderId, + }) + ).unwrap(); + + if (res?.data?.statusCode !== 1) { + res = await dispatch( + getAllCustomer({ + CompId: CompId, + AppId: AppId, + branchId: BranchId, + }) + ).unwrap(); + } + + if (res?.data?.statusCode === 1) { + + const loyaltyFreeProductOfferApplied = (RefDetails?.[0]?.OfferAppliedProductList || [])?.filter( + (off) => + off?.FreeProductsList?.OfferMode === 'L' && + off?.TableUniqueName === 'FreeProduct' + ); + + const customerDetails = res?.data?.data?.find( + (item) => item.CustId === CustSuppId + ); + + if (customerDetails) { + const { CustId, CustName, CustMobile, LoyaltyPointsDetail, TotalLoyaltyPoints } = customerDetails; + const data = { + CustId: CustId, + CustName: CustName, + label: CustName ? CustName : CustMobile, + value: CustMobile, + LoyaltyPointsDetail: LoyaltyPointsDetail, + TotalLoyaltyPoints: TotalLoyaltyPoints + }; + + dispatch(changeOrderOfferDetail([...OrderOfferDetails])); + dispatch(changeSelectedOption(data)); + await dispatch(ChangeSelectedCustDisable(true)); + + if (loyaltyFreeProductOfferApplied?.length > 0) { + const loyaltyProdQuantities = {}; + + loyaltyFreeProductOfferApplied.forEach((off) => { + const freeProdDtls = off?.FreeProductsList; + const freeProdOfferId = + freeProdDtls?.ProdVariantDetails?.[0]?.StockDetails?.[0] + ?.ProdOfferId; + + const key = [ + freeProdDtls?.OfferId, + freeProdDtls?.FreeProdId, + freeProdDtls?.FreeProdVariantName, + freeProdOfferId, + ].join('|'); + + loyaltyProdQuantities[key] = freeProdDtls?.FreeQty || 0; + }); + + if (Object.keys(loyaltyProdQuantities).length > 0) { + dispatch(changeLoyaltyConsumedQuantities(loyaltyProdQuantities)); + } + + console.log(loyaltyProdQuantities, 'loyaltyProdQuantities'); + } + } + + } + } + await dispatch(changeOrderType('Hold')); + await dispatch(changeHoldOrderDtl(true)); + await dispatch(changeReorderHoldDetails(orderDtls)); + await dispatch(changeReorderProductDetails(updated)); + await dispatch(changeSelectedCustId(CustSuppId)); + await dispatch(ChangeTotalAmount(ExtraChargeDetails)); + await dispatch(changePreviousOrderPayment(OrderPaymentDtl)); + await dispatch(changePreviousOrderOfferDetail(OrderOfferDetails)); + dispatch(changeOrderCardDetails(updated)); + let temp = updated?.filter((item) => item.OrderType === 'E') + .map((item) => item.InwardDtlId + ' ' + item.BookingTypeName); + await dispatch(changeSelProdWiseEst(temp)); + + if (OrderType === 'E') { + await dispatch(changeEstimateBooking('OvrAllEst')); + await dispatch(ChangeOverAllDiscEstimate(parseFloat(OverallDisc))); + } else { + await dispatch(changeEstimateBooking('Sales')); + await dispatch(ChangeOverAllDiscSales(parseFloat(OverallDisc))); + } + } + return ( <>
    @@ -1295,7 +1478,7 @@ function BSReprint() { {countOfProduct > 10 && ( { carouselRef.current.goTo(index); } }; - const goToPrintSetup = () => { - navigate(`${subDirectory}saleslayouts/print-selection`); -}; + const goToPrintSetup = () => { + navigate(`${subDirectory}saleslayouts/print-selection`); + }; const getStyleNote = (value) => { if (!GlobaldummyData) return false; const isAnyTableOptionTrue = @@ -385,7 +385,6 @@ const PrintPreviewPage = (props) => { // (item) => item.StyleName === selectedStyleName // ); - // debugger // // Only one "Sales" style should have SetasDefault: "Y" // const updatedTemplates = SizeOptionData.map((item) => { // if ( @@ -401,7 +400,7 @@ const PrintPreviewPage = (props) => { // }); // console.log(updatedTemplates,'ngfjbknbfgjbgfjn'); - + // let TemplateDetails = updatedTemplates.map((item) => ({ // SizeId: null, @@ -451,78 +450,79 @@ const PrintPreviewPage = (props) => { // }; -const onfinish = async (values) => { - if (!SizeOptionData || SizeOptionData.length === 0) { - setMessageType('error'); - setMessageData('Please Setup the Screen'); - return; - } - - const selectedStyle = SizeOptionData.find( - (item) => item.StyleName === selectedStyleName - ); + const onfinish = async (values) => { + if (!SizeOptionData || SizeOptionData.length === 0) { + setMessageType('error'); + setMessageData('Please Setup the Screen'); + return; + } - if (!selectedStyle) { - setMessageType('error'); - setMessageData('Selected style not found'); - return; - } - // Update all templates, ensuring only the selected style has SetasDefault: "Y" - const updatedTemplates = SizeOptionData.map((item) => { - return { - ...item, - SetasDefault: item.StyleName === selectedStyleName ? "Y" : "N", + const selectedStyle = SizeOptionData.find( + (item) => item.StyleName === selectedStyleName + ); + + if (!selectedStyle) { + setMessageType('error'); + setMessageData('Selected style not found'); + return; + } + // Update all templates, ensuring only the selected style has SetasDefault: "Y" + const updatedTemplates = SizeOptionData.map((item) => { + return { + ...item, + SetasDefault: item.StyleName === selectedStyleName ? "Y" : "N", + }; + }); + + console.log(updatedTemplates, 'ngfjbknbfgjbgfjn'); + + let TemplateDetails = updatedTemplates.map((item) => ({ + SizeId: null, + StyleId: item.StyleId, + SetasDefault: item.SetasDefault, + SetasDefaultInvoice: item.SetasDefaultInvoice, + PrintTypeId: item?.PrintTypeId, + SizeDetails: item.OptionDetails.map((opt) => ({ + OptionId: opt.ConfigId, + })), + ...(item?.TermsandConditions?.length > 0 + ? { + PrintTermsandConditions: (item?.TermsandConditions + ? item?.TermsandConditions + : [] + )?.map((tc) => ({ + TermsandConditions: tc, + })), + } + : {}), + ...(item?.Notes ? { Notes: item.Notes } : {}), + ...(item?.PageSize ? { PageSize: item.PageSize } : {}), + ...(item?.PrintHdrName ? { PrintHdrName: item.PrintHdrName } : {}), + ...(item?.Signature ? { Signature: item?.Signature } : {}), + PrintType: item?.PrintType, + })); + + const Data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + TemplateDetails: TemplateDetails, + CreatedBy: UserId, }; - }); - console.log(updatedTemplates, 'ngfjbknbfgjbgfjn'); + const response = await dispatch( + putPrintSelectionComponentData(Data) + ).unwrap(); - let TemplateDetails = updatedTemplates.map((item) => ({ - SizeId: null, - StyleId: item.StyleId, - SetasDefault: item.SetasDefault, - SetasDefaultInvoice: item.SetasDefaultInvoice, - PrintTypeId: item?.PrintTypeId, - SizeDetails: item.OptionDetails.map((opt) => ({ - OptionId: opt.ConfigId, - })), - ...(item?.TermsandConditions?.length > 0 - ? { - PrintTermsandConditions: (item?.TermsandConditions - ? item?.TermsandConditions - : [] - )?.map((tc) => ({ - TermsandConditions: tc, - })), - } - : {}), - ...(item?.Notes ? { Notes: item.Notes } : {}), - ...(item?.PageSize ? { PageSize: item.PageSize } : {}), - ...(item?.PrintHdrName ? { PrintHdrName: item.PrintHdrName } : {}), - ...(item?.Signature ? { Signature: item?.Signature } : {}), - PrintType: item?.PrintType, - })); - - const Data = { - CompId: CompId, - BranchId: BranchId, - AppId: AppId, - TemplateDetails: TemplateDetails, - CreatedBy: UserId, + if (response?.data?.statusCode === 1) { + dispatch(changeSelectedPrintdummyData(false)); + await GetPrintData(); + setMessageType('success'); + setMessageData(response?.data?.response); + if (onClose) onClose(); // Call the onClose callback after success + } }; - - const response = await dispatch( - putPrintSelectionComponentData(Data) - ).unwrap(); - - if (response?.data?.statusCode === 1) { - dispatch(changeSelectedPrintdummyData(false)); - await GetPrintData(); - setMessageType('success'); - setMessageData(response?.data?.response); - if (onClose) onClose(); // Call the onClose callback after success - } -}; + return (
    {
    {style.component}
    - )):( -
    - Please set up Print form to view or change here. -
    - - Click here to go there - -
    - )} + )) : ( +
    + Please set up Print form to view or change here. +
    + + Click here to go there + +
    + )}
    diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSCreditCustomer.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSCreditCustomer.jsx index 695433f..29e64ad 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSCreditCustomer.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSCreditCustomer.jsx @@ -1752,7 +1752,6 @@ const BSCreditCustomer = (props) => { } onChange={(e) => { - // debugger const value = parseFloat(e?.target?.value) || 0; if (value <= SelectedBillData?.OrderPendingAmount) { HandleAmount(e?.target?.value); diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSNavbarSearchStandard.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSNavbarSearchStandard.jsx index 531a853..35671ac 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSNavbarSearchStandard.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSNavbarSearchStandard.jsx @@ -35,7 +35,7 @@ const BSNavbarSearchStandard = ({ inputRef }) => { const ProdName = useSelector(GlobalSearchData); const templateData = useSelector(getTemplateData); const appPreferences = useSelector(ApplicationPreferences); - + console.log(ProdName, "ProdName") const [preFocus, setPreFocus] = useState(false); const [screenWidth, setScreenWidth] = useState(window.innerWidth); const [check, setCheck] = useState(false); @@ -92,7 +92,7 @@ const BSNavbarSearchStandard = ({ inputRef }) => { if (debounceTimeoutRef.current) clearTimeout(debounceTimeoutRef.current); debounceTimeoutRef.current = setTimeout(async () => { - + const hasSearch = (Array?.isArray(ProdName) && ProdName?.length === 0 ? "" : ProdName)?.trim()?.length > 0; if (hasSearch) { diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx index 876f7fe..e6ef940 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSPrinterSetting.jsx @@ -30,7 +30,7 @@ const BSPrinterSetting = ({ IconComponent = PozoReprintIcon, ClassName = 'BSBillingNav-icon', drawerOpen = false, - setDrawerOpen = () => {}, + setDrawerOpen = () => { }, }) => { const CompId = getSession('CompId'); const BranchId = getSession('BranchId'); @@ -57,7 +57,7 @@ const BSPrinterSetting = ({ const [receiptReprintShow, setReceiptReprintShow] = useState(false); const SettingDataSelector = useSelector(PreferenceData); const [KioskPrintersetupShow, setKioskPrintersetupShow] = useState(false); - + console.log(OpenModel, "OpenModel") const dispatch = useDispatch(); const printmodelOpen = () => { setOpenModel(true); @@ -266,7 +266,7 @@ const BSPrinterSetting = ({ className="printer-settings-tabs" > - {reprintShow && } + {reprintShow && } {receiptReprintShow && } diff --git a/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx b/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx index 140924d..83e48b7 100644 --- a/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/A4/A4Standard.jsx @@ -149,7 +149,7 @@ const InvoiceTemplate = ({ 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') && @@ -158,8 +158,8 @@ const InvoiceTemplate = ({ ); }); const lastTransaction = PaymentStatus?.find( - (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y', - ); + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, 0, diff --git a/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx b/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx index 73fe486..67c12c8 100644 --- a/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/A4/PrintA4Style11.jsx @@ -137,6 +137,18 @@ const PrintA4Style11 = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) + const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, 0 @@ -546,7 +558,7 @@ const PrintA4Style11 = ({ textAlign: 'center', }} > - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -932,6 +944,46 @@ const PrintA4Style11 = ({
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData ? GlobalCredit && (
    - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -1872,6 +1924,46 @@ const PrintA4Style11 = ({
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData ? GlobalCredit && (
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2424,6 +2516,46 @@ const PrintA4Style11 = ({
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData ? GlobalCredit && (
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData ? GlobalCredit && (
    ps.PaymentStatus === 'S' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) const PackageDetails = table2Data?.PackageDtl; const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, @@ -548,7 +559,7 @@ const PrintA5Style11 = ({ textAlign: 'center', }} > - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -936,6 +947,46 @@ const PrintA5Style11 = ({
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData ? GlobalCredit && (
    - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -1876,6 +1927,46 @@ const PrintA5Style11 = ({
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData ? GlobalCredit && (
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2428,6 +2519,86 @@ const PrintA5Style11 = ({
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData ? GlobalCredit && (
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData ? GlobalCredit && (
    { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) if (keysLength > 0) { dispatch(changeReprintDataFound(true)); @@ -378,8 +389,8 @@ const PrintStyle1 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: FormatTheme @@ -445,24 +456,24 @@ const PrintStyle1 = ({ {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 + : '')}
    -
    + {(GlobaldummyData || table2Data?.BrMobile) &&
    {' '} Mobile : +91{' '} {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} -
    +
    } {table2Data?.OrderType === 'E' && (
    @@ -632,80 +643,80 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO == true && ( - S.No - )} + S.No + )} {GlobaldummyData ? GlobalItem && Item : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - MRP - ) + MRP + ) : MRP == true && ( - MRP - )} + MRP + )} {GlobaldummyData ? GlobalRate && ( - Rate - ) + Rate + ) : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && ( - Tax % - ) + Tax % + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -713,176 +724,175 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} + {sportsAppPreference && + `${item?.BookingDate?.trim() + ? `(${dateFormatChange(item.BookingDate)})` + : '' + } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} +  {' '} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null ) -
    - )} - {sportsAppPreference && - `${ - item?.BookingDate?.trim() - ? `(${dateFormatChange(item.BookingDate)})` - : '' - } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} -  {' '} - {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(',')} -
    - ); - }) - : ''} - - )} + )?.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(',')} +
    + ); + }) + : ''} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {' '} - {item?.Rate} - - )} + + {' '} + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage || 0} - - ) + + {item?.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ))} @@ -911,80 +921,80 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO == true && ( - S.No - )} + S.No + )} {GlobaldummyData ? GlobalItem && Item : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - MRP - ) + MRP + ) : MRP == true && ( - MRP - )} + MRP + )} {GlobaldummyData ? GlobalRate && ( - Rate - ) + Rate + ) : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && ( - Tax % - ) + Tax % + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -992,125 +1002,124 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - {sportsAppPreference && - `${ - item?.BookingDate?.trim() - ? `(${dateFormatChange(item.BookingDate)})` - : '' - } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + {sportsAppPreference && + `${item?.BookingDate?.trim() + ? `(${dateFormatChange(item.BookingDate)})` + : '' + } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {' '} - {item?.Rate} - - )} + + {' '} + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage} - - ) + + {item.ProdTaxPercentage} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ))} @@ -1164,21 +1173,21 @@ const PrintStyle1 = ({ {(TotalOfferAmount > 0 || table2Data?.OverallDisc > 0) && ( -

    - Off : - {( - Number(TotalOfferAmount || 0) + - Number(table2Data?.OverallDisc || 0) - ).toFixed(2)} -

    - )} +

    + Off : + {( + Number(TotalOfferAmount || 0) + + Number(table2Data?.OverallDisc || 0) + ).toFixed(2)} +

    + )}
    )} - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -1222,6 +1231,46 @@ const PrintStyle1 = ({ ))} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {table2Data?.OrderType === 'E' ? ( '' ) : ( @@ -1529,103 +1578,103 @@ const PrintStyle1 = ({
    {table2Data?.SalesTableLinkDetails?.[0] ?.WaiterName && ( -
    - Captain:{' '} - { - table2Data?.SalesTableLinkDetails?.[0] - ?.WaiterName - } -
    - )} +
    + Captain:{' '} + { + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName + } +
    + )}
    )} {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed( - 2 - ), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )}
    + {/* QRcode */} + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && (
    - {/* QRcode */} -
    Scan to Pay
    -
    +
    + Scan to Pay{' '} +
    +
    ₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} + )}
    @@ -1738,30 +1787,30 @@ const PrintStyle1 = ({ > {GlobaldummyData ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Notestext && (
    -

    - Notes : 10 days Return policy +

    + {Notestext}


    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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. +
    +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && (

    -

  • - Once goods are sold, they are not - exchangeable or refundable. -
  • -
  • - Please check the product before leaving the - counter. -
  • + {TermsAndConditions?.map((item) => ( +
  • + {item?.TermsandConditions} +
  • + ))} + {/*
  • Please check the product before leaving the counter.
  • */}
    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : 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 +

    + +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : Signature == true && (
    @@ -1874,45 +1956,12 @@ const PrintStyle1 = ({ Signature

    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} + )}
    {PrintGreeting?.SettingValue === 'Y' && (
    )} - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill)( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2045,6 +2094,46 @@ const PrintStyle1 = ({ ))} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {table2Data?.OrderType === 'E' ? ( '' ) : ( @@ -2363,81 +2452,81 @@ const PrintStyle1 = ({ )} {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )}
    + {/* QRcode */} + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && (
    - {/* QRcode */} -
    Scan to Pay
    -
    +
    Scan to Pay
    +
    ₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} + )}
    @@ -2549,30 +2638,30 @@ const PrintStyle1 = ({ > {GlobaldummyData ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Notestext && (
    -

    - Notes : 10 days Return policy +

    + {Notestext}


    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && (

    -

  • - Once goods are sold, they are not exchangeable - or refundable. -
  • -
  • - Please check the product before leaving the - counter. -
  • + {TermsAndConditions?.map((item) => ( +
  • + {item?.TermsandConditions} +
  • + ))} + {/*
  • Please check the product before leaving the counter.
  • */}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && (
    @@ -2684,44 +2805,12 @@ const PrintStyle1 = ({ Signature

    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} + )}
    {PrintGreeting?.SettingValue === 'Y' && (
    )} - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2833,6 +2922,46 @@ const PrintStyle1 = ({ ))} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {table2Data?.OrderType === 'E' ? ( '' ) : ( @@ -3149,79 +3278,79 @@ const PrintStyle1 = ({ {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )}
    + {/* QRcode */} + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && (
    - {/* QRcode */} -
    Scan to Pay
    -
    +
    Scan to Pay
    +
    ₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} + )}
    @@ -3332,35 +3461,35 @@ const PrintStyle1 = ({ > {GlobaldummyData ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Notestext && (

    - Notes : 10 days Return policy + {Notestext}


    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && (

    -

  • - Once goods are sold, they are not exchangeable or - refundable. -
  • -
  • - Please check the product before leaving the - counter. -
  • + {TermsAndConditions?.map((item) => ( +
  • + {item?.TermsandConditions} +
  • + ))} + {/*
  • Please check the product before leaving the counter.
  • */}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && (
    @@ -3472,44 +3633,12 @@ const PrintStyle1 = ({ Signature

    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} + )}
    {PrintGreeting?.SettingValue === 'Y' && (
    )} -
    +
    ) : (
    -
    + {(GlobaldummyData || table2Data?.BrMobile) &&
    {' '} Mobile : +91{' '} {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} -
    +
    } {table2Data?.OrderType === 'E' && (
    @@ -3738,61 +3867,61 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && S.No : SLNO == true && ( - S.No - )} + S.No + )} {GlobaldummyData ? GlobalItem && ( - Item - ) + Item + ) : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && MRP : MRP == true && MRP} {GlobaldummyData ? GlobalRate && Rate : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && Tax % : Tax == true && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -3801,175 +3930,174 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} + {sportsAppPreference && + `${item?.BookingDate?.trim() + ? `(${dateFormatChange(item.BookingDate)})` + : '' + } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} +  {' '} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null ) -
    - )} - {sportsAppPreference && - `${ - item?.BookingDate?.trim() - ? `(${dateFormatChange(item.BookingDate)})` - : '' - } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} -  {' '} - {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(',')} -
    - ); - }) - : ''} - - )} + )?.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(',')} +
    + ); + }) + : ''} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {' '} - {item?.Rate} - - )} + + {' '} + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ) )} @@ -4000,59 +4128,59 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && S.No : SLNO == true && ( - S.No - )} + S.No + )} {GlobaldummyData ? GlobalItem && Item : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && MRP : MRP == true && MRP} {GlobaldummyData ? GlobalRate && Rate : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && Tax % : Tax == true && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -4061,124 +4189,123 @@ const PrintStyle1 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - {sportsAppPreference && - `${ - item?.BookingDate?.trim() - ? `(${dateFormatChange(item.BookingDate)})` - : '' - } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + {sportsAppPreference && + `${item?.BookingDate?.trim() + ? `(${dateFormatChange(item.BookingDate)})` + : '' + } (${to12Hour(item?.AvailableFrom)} - ${to12Hour(item?.AvailableTo)})`} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {' '} - {item?.Rate} - - )} + + {' '} + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ) )} @@ -4266,7 +4393,7 @@ const PrintStyle1 = ({ )} )} - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4279,6 +4406,46 @@ const PrintStyle1 = ({ ))} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {table2Data?.OrderType === 'E' ? ( '' ) : ( @@ -4586,76 +4753,76 @@ const PrintStyle1 = ({ )} {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} +

    + )); + })()} +
    + )}
    + {/* QRcode */} + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && (
    - {/* QRcode */} -
    Scan to Pay
    -
    +
    Scan to Pay
    +
    ₹ {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} + )}
    @@ -4758,28 +4925,28 @@ const PrintStyle1 = ({ > {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : !estimatePrintHeader && table2Data?.OrderType === 'E' ? '' : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && (

    -

  • - Once goods are sold, they are not exchangeable or - refundable. -
  • -
  • - Please check the product before leaving the counter. -
  • + {TermsAndConditions?.map((item) => ( +
  • + {item?.TermsandConditions} +
  • + ))} + {/*
  • Please check the product before leaving the counter.
  • */}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && (
    @@ -4890,44 +5089,12 @@ const PrintStyle1 = ({ Signature

    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} + )}
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx index 79de332..424951b 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle10.jsx @@ -122,6 +122,18 @@ const PrintStyle10 = ({ (ps) => ps.PaymentTypeName === 'UPI' ); + const isEditedBill = PaymentStatus?.some((payment) => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ); + let TermsAndConditions = printDatas?.TermsandConditions; let SignatureImg = printDatas?.Signature; let Notestext = printDatas?.Notes; @@ -529,7 +541,7 @@ const PrintStyle10 = ({ - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -904,7 +916,7 @@ const PrintStyle10 = ({ - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -1646,7 +1658,7 @@ const PrintStyle10 = ({ table2Data?.FYStatus )}{' '}
    - {PaymentStatusSuccess?.length > 1 && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1793,6 +1805,77 @@ const PrintStyle10 = ({ )}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} + +
    +
    +
    + )} +
    - {PaymentStatusSuccess?.length > 1 && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -2671,6 +2754,75 @@ const PrintStyle10 = ({ )}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -3356,7 +3508,7 @@ const PrintStyle10 = ({ ) : Quantity && ( - { WeightasKg ?'Qty/Kg' :'Qty'} + {WeightasKg ? 'Qty/Kg' : 'Qty'} )} {GlobaldummyData @@ -4035,7 +4187,7 @@ const PrintStyle10 = ({ table2Data?.FYStatus )}{' '}
    - {PaymentStatusSuccess?.length > 1 && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4153,6 +4305,71 @@ const PrintStyle10 = ({ )}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    { - +const PrintStyle11 = ({ + index, + ExtraChargeTotal, + Date1, + base64Image, + PrintLogo, + totalQuantityFilter, + BranchCity, + BranchZip, + CashierName, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + OrderDetailVAT, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + isPdf, + SalesModePref, + sportsAppPreference, + MembershipApplied = null, +}) => { const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint) + const GlobalUpiID = useSelector(GlobalUpiIDprint); const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Tax = FieldDetails?.["Tax"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const CashierNameField = FieldDetails?.["CashierName"]; - const LogoField = FieldDetails?.["Logo"]; - const CreditDetails = FieldDetails?.["Credit details"]; + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Tax = FieldDetails?.['Tax']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const CashierNameField = FieldDetails?.['CashierName']; + const LogoField = FieldDetails?.['Logo']; + const CreditDetails = FieldDetails?.['Credit details']; const WeightasKg = FieldDetails?.['Weight']; - const GlobalSlNo = useSelector(GlobalprintSlNo) - const GlobalItem = useSelector(GlobalprintItem) - const GlobalMRP = useSelector(GlobalprintMRP) - const GlobalDiscount = useSelector(GlobalprintDiscount) - const GlobalTax = useSelector(GlobalprintTax) - 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 GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalMRP = useSelector(GlobalprintMRP); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalTax = useSelector(GlobalprintTax); + 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) + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); + const GlobalBilltext = useSelector(GlobalBillName); const appPreferences = useSelector(ApplicationPreferences); const SettingData = useSelector(PreferenceData); const GlobalCashierName = useSelector(GlobalprintCashierName); const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); - const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' - const bookingTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Booking Type')?.PreferenceCatDetails - const dinePreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "dine in" && type?.PreferredStatus === 'Y') - const takeAwayPreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "take away" && type?.PreferredStatus === 'Y') - const paymentTypeUPI = PaymentStatus?.find((ps) => ps.PaymentTypeName === "UPI") + const estimatePrintHeader = + SettingData?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' + )?.SettingValue === 'Y'; + const bookingTypePreference = appPreferences?.find( + (preference) => preference?.PreferredCatName === 'Booking Type' + )?.PreferenceCatDetails; + const dinePreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'dine in' && + type?.PreferredStatus === 'Y' + ); + const takeAwayPreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'take away' && + type?.PreferredStatus === 'Y' + ); + const paymentTypeUPI = PaymentStatus?.find( + (ps) => ps.PaymentTypeName === 'UPI' + ); - let TermsAndConditions = printDatas?.TermsandConditions - let SignatureImg = printDatas?.Signature - let Notestext = printDatas?.Notes - let BillName = printDatas?.PrintHdrName - let FormatTheme = printDatas?.PrintType == "S" ? true : false - let PageSize = printDatas?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; + const isEditedBill = PaymentStatus?.some((payment) => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ); + + let TermsAndConditions = printDatas?.TermsandConditions; + let SignatureImg = printDatas?.Signature; + let Notestext = printDatas?.Notes; + let BillName = printDatas?.PrintHdrName; + let FormatTheme = printDatas?.PrintType == 'S' ? true : false; + let PageSize = printDatas?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; const PackageDetails = table2Data?.PackageDtl; const keysLength = Object.keys(table2Data ?? {}).length; - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } - const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") - const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") + const TakeawayData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' + ); + const DineInData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' + ); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); const DineInTotal = DineInData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); - const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); + const aggregatedPayments = PaymentStatusSuccess?.reduce( + (acc, paymentdata) => { + const paymentType = paymentdata?.PaymentTypeName; + const amount = Number(paymentdata?.Amount); - if (acc[paymentType]) { - acc[paymentType] += amount; - } else { - acc[paymentType] = amount; - } + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } - return acc; - }, {}); + return acc; + }, + {} + ); const productsData = table2Data?.productDetails || []; const offers = table2Data?.OrderOfferDetails || []; 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', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 18, + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 40, + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, ]; - const chunkSize = PageSize == "A5" ? 8 : 11; + const chunkSize = PageSize == 'A5' ? 8 : 11; let dataSource = []; if (GlobaldummyData || TakeawayData?.length > 0) { @@ -172,1313 +318,4212 @@ const PrintStyle11 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 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); return ( <> - {FormatTheme ? -
    {paginatedChunks.map((dataChunk, chunkIndex) => (
    0 ? ' print-page-break' : ''}`} - style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: isMobile ? "295mm" : FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> - - + className={ + isMobile + ? `invoice-wrapper container pdf-page` + : `invoice-wrapper container print-chunk${chunkIndex > 0 ? ' print-page-break' : ''}` + } + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: isMobile + ? '295mm' + : FormatTheme + ? PageSize == 'A5' + ? '170mm' + : '257mm' + : '', + }} + key={chunkIndex} + > {/*
    */} -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    -
    - {(GlobalLogo && GlobaldummyData) ? image : null} - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    -
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    - {/*
    +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {GlobalLogo && GlobaldummyData ? ( + image + ) : null} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    + {/*
    Save green | Save nature
    */} +
    +
    +
    +
    +
    + {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 + : '')} +
    +
    + {' '} + MOBILE NO :{table2Data?.BrMobile} +
    +
    +
    +
    + {GlobaldummyData + ? 'CASH' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`} +
    +
    + Bill No :{' '} + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    -
    -
    -
    - {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 : '')} -
    -
    MOBILE NO :{table2Data?.BrMobile}
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`}
    -
    -
    {GlobaldummyData ? 'CASH' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""} {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`}
    -
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`}
    } + )}
    - -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference &&
    Take Away
    } + {takeAwayPreference && ( +
    + Take Away +
    + )} - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && } + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} {dataChunk?.map((item, index) => { return ( - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - ) + ); })}
    S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmtS.NS.NItemItem + Qty + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + HSN + + HSN + + MRP + + MRP + + Dis{' '} + + Dis{' '} + + Tax %{' '} + + Tax %{' '} + + Rate + + Rate + + Amt + + Amt +
    {index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
    {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?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}{index + 1} + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > + 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return ( +
    {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?.SalesQty} + + {item?.SalesQty} + + {item?.HSN} + + {item?.HSN} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.Rate} + + {item?.Rate} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    - } - {(DineInData?.length > 0 && dinePreference) && + )} + {DineInData?.length > 0 && dinePreference && ( <> -
    Dine In
    +
    + Dine In +
    - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && } + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} {dataChunk?.map((item, index) => { return ( - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - ) + ); })}
    S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmtS.NS.NItemItem + Qty + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + HSN + + HSN + + MRP + + MRP + + Dis{' '} + + Dis{' '} + + Tax %{' '} + + Tax %{' '} + + Rate + + Rate + + Amt + + Amt +
    {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?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}{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?.SalesQty} + + {item?.SalesQty} + + {item?.HSN} + + {item?.HSN} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.Rate} + + {item?.Rate} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    - } + )}
    - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - <> -
    -
    -
    -
    -
    -
    Qty
    -
    Items
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    Off
    - } - {/*
    SUB TOTAL
    + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> +
    +
    +
    +
    +
    +
    + Qty +
    +
    + Items +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + Off +
    + )} + {/*
    SUB TOTAL
    ROUND OFF
    */} +
    +
    +
    {GlobaldummyData ? '9' : totalQuantity}
    +
    + {GlobaldummyData + ? '8' + : totalQuantityFilter?.length} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + {GlobaldummyData + ? '8' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} + {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} + {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */} +
    -
    -
    {GlobaldummyData ? '9' : totalQuantity}
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    {GlobaldummyData ? '8' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    - } - {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} - {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + TakeAway :{Number(TakeawayTotal).toFixed(2)}/- +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + DineIn :{Number(DineInTotal).toFixed(2)}/- +
    + )} +
    + Amount : + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} + /-
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    TakeAway :{Number(TakeawayTotal).toFixed(2)}/-
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    DineIn :{Number(DineInTotal).toFixed(2)}/-
    - } -
    Amount :{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}/-
    -
    -
    - {(table2Data?.OrderType === "E") ? '' : -
    -
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    +
    +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    +
    +

    + --------- GST Breakup Details + ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + )} -
    -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    +
    + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number( + item.TaxAmt + ).toFixed(2)} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    + Taxable Amount + + VAT +
    - - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } + + Total Amount + + + {OrderDetailVAT?.map((item) => ( + + + {item?.TaxPercentage || 0}% + + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + + {Number( + item.TaxAmt + ).toFixed(2)} + - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - } + + {Number( + item.TotalAmt + ).toFixed(2)} + + + ))} + + + )} +
    +
    + + )} +
    -
    - } -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    + )} +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '}
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    +
    + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    ) : null} +
    + )} + +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} - -
    - -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} + {GlobaldummyData && GlobalCashierName && ( +
    + {' '} + Cashier : Cashier Name +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName}
    - ))} - - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    + )} - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName && ( +
    + Captain :{' '} + { + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName + } +
    + )} + +
    + {Date1}
    - } +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    +
    - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} + +
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - -
    {Date1}
    -
    YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    +
    + )} +
    + YOUR ORDER NO:{' '} + {table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)}
    - {GlobaldummyData ? GlobalQrcodet &&
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. +
    +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )} +
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    -
    - - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - 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. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (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

    - -
    ) : - (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - Signature == true && (
    -

    Signature

    - -
    )} - -
    -
    - - {PrintGreeting?.SettingValue === "Y" && -
    -
    Thank You Visit Again
    -
    - } - - - } + {PrintGreeting?.SettingValue === 'Y' && ( +
    +
    + Thank You Visit Again +
    +
    + )} + + )}
    ))} - {shouldFooterBeOnNewPage && FormatTheme && + {shouldFooterBeOnNewPage && FormatTheme && (
    -
    <>
    -
    +
    -
    -
    -
    Qty
    -
    Items
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    Off
    - } +
    +
    +
    + Qty +
    +
    + Items +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + Off +
    + )} {/*
    SUB TOTAL
    ROUND OFF
    */}
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    {GlobaldummyData ? '8' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    - } +
    + {GlobaldummyData + ? '8' + : totalQuantityFilter?.length} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + {GlobaldummyData + ? '8' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */}
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    TakeAway :{Number(TakeawayTotal).toFixed(2)}/-
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    DineIn :{Number(DineInTotal).toFixed(2)}/-
    - } -
    Amount :{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}/-
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + TakeAway :{Number(TakeawayTotal).toFixed(2)}/- +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + DineIn :{Number(DineInTotal).toFixed(2)}/- +
    + )} +
    + Amount : + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} + /- +

    - {(table2Data?.OrderType === "E") ? '' : -
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    - -
    +
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - {OrderDetailIGST?.map((item) => + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    - Taxable Amount - - IGST - - Total Amount -
    - - - + - - ) - } -
    - {item?.TaxPercentage || 0}% + + Taxable Amount - {Number(item.WithOutTaxAmount).toFixed(2)} + + CGST - {Number(item.TaxAmt).toFixed(2)} + + SGST + + Total Amount {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + )} - - - - - Taxable Amount - - - VAT - - - Total Amount - - - {OrderDetailVAT?.map((item) => - - - {item?.TaxPercentage || 0}% - - - {Number(item.WithOutTaxAmount).toFixed(2)} - - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} - - ) - } - - - } - -
    -
    - - } + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed( + 2 + )} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed( + 2 + )} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} +
    +
    + + )}
    - } -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) )} -
    - -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} -
    - } - - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} -
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - -
    {Date1}
    -
    YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    -
    - {GlobaldummyData ? GlobalQrcodet &&
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    -
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    -
    - - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} -
    -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - 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. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal}

    -
      - {TermsAndConditions?.map(item => (
    1. {item?.TermsandConditions}
    2. ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    ) - } + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} + + )} + {GlobaldummyData && GlobalCashierName && ( +
    + {' '} + Cashier : Cashier Name +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} - {GlobaldummyData ? GlobalSignature && (
    -

    Signature

    - -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - Signature == true && (
    -

    Signature

    - -
    )} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + +
    + {Date1} +
    +
    + + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    +
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    + YOUR ORDER NO:{' '} + {table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    + +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && -
    -
    Thank You Visit Again
    + {PrintGreeting?.SettingValue === 'Y' && ( +
    +
    + Thank You Visit Again +
    - } - + )}
    - } -
    - : -
    + ) : ( +
    - - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - -
    - {(GlobalLogo && GlobaldummyData) ? image : null} - {base64Image && (base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    -
    - {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} -
    - {/*
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {GlobalLogo && GlobaldummyData ? ( + image + ) : null} + {base64Image && + base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    + {/*
    Save green | Save nature
    */} +
    +
    +
    +
    +
    + {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 + : '')} +
    +
    + {' '} + MOBILE NO :{table2Data?.BrMobile} +
    +
    +
    +
    + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`} +
    +
    + Bill No :{' '} + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    -
    -
    -
    - {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 : '')} -
    -
    MOBILE NO :{table2Data?.BrMobile}
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode})`}
    -
    -
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`}
    -
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && - `(${table2Data?.SalesMode})`}
    } + )}
    - {(TakeawayData?.length > 0 || GlobaldummyData) && + {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference &&
    Take Away
    } + {takeAwayPreference && ( +
    + Take Away +
    + )} - +
    - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} + {(GlobaldummyData ? products : TakeawayData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )}
    S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmtS.NS.NItemItem + Qty + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + HSN + + HSN + + MRP + + MRP + + Dis{' '} + + Dis{' '} + + Tax %{' '} + + Tax %{' '} + + Rate + + Rate + + Amt + + Amt +
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
    {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?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return ( +
    {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?.SalesQty} + + {item?.SalesQty} + + {item?.HSN} + + {item?.HSN} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.Rate} + + {item?.Rate} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    - } - {(DineInData?.length > 0 && dinePreference) && + )} + {DineInData?.length > 0 && dinePreference && ( <> -
    Dine In
    +
    + Dine In +
    - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - {(GlobaldummyData ? products : DineInData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} + {(GlobaldummyData ? products : DineInData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )}
    S.NS.NItemItemQty { WeightasKg ?'Qty/Kg' :'Qty'}HSNHSNMRPMRPDis Dis Tax % Tax % RateRateAmtAmtS.NS.NItemItem + Qty + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + HSN + + HSN + + MRP + + MRP + + Dis{' '} + + Dis{' '} + + Tax %{' '} + + Tax %{' '} + + Rate + + Rate + + Amt + + Amt +
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    -
    {item?.SalesQty}{item?.SalesQty}{item?.HSN}{item?.HSN}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.Rate}{item?.Rate}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    +
    + {item?.SalesQty} + + {item?.SalesQty} + + {item?.HSN} + + {item?.HSN} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.Rate} + + {item?.Rate} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    - } - - - + )}
    -
    +
    -
    -
    -
    Qty
    -
    Items
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    Off
    - } +
    +
    +
    + Qty +
    +
    + Items +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    + Off +
    + )} {/*
    SUB TOTAL
    ROUND OFF
    */}
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    {GlobaldummyData ? '8' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    - } +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    + {GlobaldummyData + ? '8' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */}
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    TakeAway :{Number(TakeawayTotal).toFixed(2)}/-
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    DineIn :{Number(DineInTotal).toFixed(2)}/-
    - } -
    Amount :{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}/-
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + TakeAway :{Number(TakeawayTotal).toFixed(2)}/- +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + DineIn :{Number(DineInTotal).toFixed(2)}/- +
    + )} +
    + Amount : + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} + /- +

    - {(table2Data?.OrderType === "E") ? '' : -
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    - -
    +
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    - - Taxable Amount - - IGST - - Total Amount -
    - + - - + - - ) - } -
    - {item?.TaxPercentage || 0}% + + Taxable Amount - {Number(item.WithOutTaxAmount).toFixed(2)} + + CGST - {Number(item.TaxAmt).toFixed(2)} + + SGST + + Total Amount {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} - - - Taxable Amount - - - VAT - - - Total Amount - - - {OrderDetailVAT?.map((item) => - - - {item?.TaxPercentage || 0}% - - - {Number(item.WithOutTaxAmount).toFixed(2)} - - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} - - ) - } - - - } - -
    -
    - - } + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )} +
    +
    + + )}
    - } -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    + )} +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} -
    +
    {/*
    CARD : *********12
    CARD HOLDER : CARD HOLDER NAME
    TOTAL SAVING : 0.00
    */} -
    - {PaymentStatusSuccess?.length > 1 && +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)}
    ))} - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} + )} + {GlobaldummyData && GlobalCashierName && ( +
    + {' '} + Cashier : Cashier Name
    - } + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name
    - } + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - -
    {Date1}
    -
    YOUR ORDER NO: {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    +
    + {Date1} +
    - {GlobaldummyData ? GlobalQrcodet &&
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    -
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}

    - -
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - 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. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions + YOUR ORDER NO:{' '} + {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)} +

    +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy

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

    Signature

    - -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - Signature == true && (
    -

    Signature

    - -
    )} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && -
    + {PrintGreeting?.SettingValue === 'Y' && ( +
    {/*
    Terms & Condition
    Xxxx Yyyy Xxxx Yyyy Xxxx Yyyy Xxxx Yyyy
    */} -
    Thank You Visit Again
    +
    + Thank You Visit Again +
    - } - + )}
    - - - -
    - } - +
    + )} ); }; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx index 48226a3..e23e409 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx @@ -1,8 +1,12 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import QrImage from '../../../../Images/qrcode.jpg'; -import Logo from '../../../../Images/Logo.jpg' -import { extractLastNumber, extractLastNumberOrderId, printDiv } from '../../../../Services/Others'; +import Logo from '../../../../Images/Logo.jpg'; +import { + extractLastNumber, + extractLastNumberOrderId, + printDiv, +} from '../../../../Services/Others'; import { GlobalprintSlNo, GlobalprintItem, @@ -26,145 +30,285 @@ import { GlobalprintLogo, GlobalprintCredit, GlobalprintTax, -} from '../../../../Features/ThemeChange/ThemeChange' -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; -import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.scss' +} from '../../../../Features/ThemeChange/ThemeChange'; +import { + GlobalUpiIDprint, + PreferenceData, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.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'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; - - -const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, totalQuantityFilter, CashierName, totalQuantity, OrderDetailGST, OrderDetailIGST, - OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, printDatas, isPdf, sportsAppPreference, SalesModePref, - MembershipApplied = null }) => { - +const Printstyle12 = ({ + index, + ExtraChargeTotal, + Date1, + base64Image, + PrintLogo, + totalQuantityFilter, + CashierName, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + OrderDetailVAT, + table2Data, + PaymentStatus, + PrintGreeting, + printDatas, + isPdf, + sportsAppPreference, + SalesModePref, + MembershipApplied = null, +}) => { const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint) + const GlobalUpiID = useSelector(GlobalUpiIDprint); const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Tax = FieldDetails?.["Tax"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const CashierNameField = FieldDetails?.["CashierName"]; - const LogoField = FieldDetails?.["Logo"]; - const CreditDetails = FieldDetails?.["Credit details"]; + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Tax = FieldDetails?.['Tax']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const CashierNameField = FieldDetails?.['CashierName']; + const LogoField = FieldDetails?.['Logo']; + const CreditDetails = FieldDetails?.['Credit details']; const WeightasKg = FieldDetails?.['Weight']; - const GlobalSlNo = useSelector(GlobalprintSlNo) - const GlobalItem = useSelector(GlobalprintItem) - const GlobalMRP = useSelector(GlobalprintMRP) - const GlobalDiscount = useSelector(GlobalprintDiscount) - const GlobalTax = useSelector(GlobalprintTax) - 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 GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalMRP = useSelector(GlobalprintMRP); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalTax = useSelector(GlobalprintTax); + 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) + const GlobalthemeFormatr = useSelector(GlobalthemeFormat); + const GlobalBilltext = useSelector(GlobalBillName); const appPreferences = useSelector(ApplicationPreferences); const GlobalCashierName = useSelector(GlobalprintCashierName); const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); const SettingData = useSelector(PreferenceData); - const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' - const bookingTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Booking Type')?.PreferenceCatDetails - const dinePreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "dine in" && type?.PreferredStatus === 'Y') - const takeAwayPreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "take away" && type?.PreferredStatus === 'Y') - const paymentTypeUPI = PaymentStatus?.find((ps) => ps.PaymentTypeName === "UPI") + const estimatePrintHeader = + SettingData?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' + )?.SettingValue === 'Y'; + const bookingTypePreference = appPreferences?.find( + (preference) => preference?.PreferredCatName === 'Booking Type' + )?.PreferenceCatDetails; + const dinePreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'dine in' && + type?.PreferredStatus === 'Y' + ); + const takeAwayPreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'take away' && + type?.PreferredStatus === 'Y' + ); + const paymentTypeUPI = PaymentStatus?.find( + (ps) => ps.PaymentTypeName === 'UPI' + ); - let TermsAndConditions = printDatas?.TermsandConditions - let SignatureImg = printDatas?.Signature - let Notestext = printDatas?.Notes - let BillName = printDatas?.PrintHdrName - let FormatTheme = printDatas?.PrintType == "S" ? true : false - let PageSize = printDatas?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; + const isEditedBill = PaymentStatus?.some((payment) => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ); + + let TermsAndConditions = printDatas?.TermsandConditions; + let SignatureImg = printDatas?.Signature; + let Notestext = printDatas?.Notes; + let BillName = printDatas?.PrintHdrName; + let FormatTheme = printDatas?.PrintType == 'S' ? true : false; + let PageSize = printDatas?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; const PackageDetails = table2Data?.PackageDtl; const keysLength = Object.keys(table2Data ?? {}).length; - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); const printDocument = () => { window.print(); - } + }; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } - const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") - const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") + const TakeawayData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' + ); + const DineInData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' + ); const TakeawayTotal = TakeawayData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); const DineInTotal = DineInData?.reduce( (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, + 0 ); - const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); + const aggregatedPayments = PaymentStatusSuccess?.reduce( + (acc, paymentdata) => { + const paymentType = paymentdata?.PaymentTypeName; + const amount = Number(paymentdata?.Amount); - if (acc[paymentType]) { - acc[paymentType] += amount; - } else { - acc[paymentType] = amount; - } + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } - return acc; - }, {}); + return acc; + }, + {} + ); const productsData = table2Data?.productDetails || []; const offers = table2Data?.OrderOfferDetails || []; 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', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, + { + ProdName: 'ITEM 1', + Rate: 88.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 18, + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 40, + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, ]; - const chunkSize = PageSize == "A5" ? 8 : 11; + const chunkSize = PageSize == 'A5' ? 8 : 11; let dataSource = []; if (GlobaldummyData || TakeawayData?.length > 0) { @@ -178,8 +322,11 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 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 style12 = ``; const PrintA4 = async () => { - - await printDiv("PrintStyle12", style12, 'FontApply'); + await printDiv('PrintStyle12', style12, 'FontApply'); }; - return ( <> - {FormatTheme ? -
    - + {FormatTheme ? ( +
    {paginatedChunks.map((dataChunk, chunkIndex) => (
    0 ? ' print-page-break' : ''}`} - style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: isMobile ? "295mm" : FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> - - + className={ + isMobile + ? `invoice-wrapper container pdf-page` + : `invoice-wrapper container print-chunk${chunkIndex > 0 ? ' print-page-break' : ''}` + } + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: isMobile + ? '295mm' + : FormatTheme + ? PageSize == 'A5' + ? '170mm' + : '257mm' + : '', + }} + key={chunkIndex} + > {/*
    */} -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    -
    -
    +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    +
    -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    - {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 : '')} +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    +
    + {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 + : '')} +
    +
    + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + + ' Bill' + : ''} +
    +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} +
    + {GlobaldummyData && GlobalCashierName && ( +

    + {' '} + Cashier : Cashier Name +

    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + {table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} +
    + )}
    -
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""}
    -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    - {GlobaldummyData && GlobalCashierName &&

    Cashier : Cashier Name

    } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName}
    } - {GlobaldummyData && -
    Customer : Customer Name
    } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} -
    } - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - {table2Data?.OrderType === "E" &&
    Estimate
    } + {GlobalLogo && GlobaldummyData && ( +
    + {' '} + image +
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( +
    + {' '} + image +
    + ) : null} +
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} +
    + )} +
    +
    + Bill No :{' '} + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    + {Date1}
    - {(GlobalLogo && GlobaldummyData) &&
    image
    } - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : (base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ?
    image
    : null} - -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate
    } -
    -
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {Date1}
    -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference &&
    Take Away
    } + {takeAwayPreference && ( +
    + Take Away +
    + )}
    - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} {dataChunk?.map((item, index) => { return ( - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - ) + ); })}
    S.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateHSNHSN(%)(%) + Tax (%) + + Tax (%) + AmtAmt
    {index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
    {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?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}{index + 1} + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls + ?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == + '' || + items.SerialNumber == null + ) + )?.map((a) => { + return ( +
    {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?.SalesQty} + + {item?.SalesQty} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item?.Rate} + + {item?.Rate} + + {item?.HSN} + + {item?.HSN} + + {item?.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    - } - {(DineInData?.length > 0 && dinePreference) && + )} + {DineInData?.length > 0 && dinePreference && ( <> -
    Dine In
    +
    + Dine In +
    - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} {dataChunk?.map((item, index) => { return ( - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} - ) + ); })}
    S.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateHSNHSN(%)(%) + Tax (%) + + Tax (%) + AmtAmt
    {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?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}{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?.SalesQty} + + {item?.SalesQty} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item?.Rate} + + {item?.Rate} + + {item?.HSN} + + {item?.HSN} + + {item?.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    - } + )}
    - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - <> - -
    -
    -
    -
    -
    - Items -
    -
    :
    -
    - {GlobaldummyData ? '8' : totalQuantityFilter?.length} -
    -
    -
    -
    - Qty -
    -
    :
    -
    - {GlobaldummyData ? '9' : totalQuantity} -
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    - Off -
    + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> +
    +
    +
    +
    +
    Items
    :
    -
    - {GlobaldummyData ? '9' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)} +
    + {GlobaldummyData + ? '8' + : totalQuantityFilter?.length}
    - } - {/*
    +
    +
    Qty
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '9' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    +
    + )} + {/*
    Extra Charges
    @@ -533,188 +1317,447 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo,
    */} -
    - - {(DineInData?.length > 0 && TakeawayData?.length > 0) && - <> - {takeAwayPreference &&
    -
    - TakeAway -
    -
    :
    -
    - {Number(TakeawayTotal).toFixed(2)} -
    -
    } - {dinePreference &&
    -
    - Dine In -
    -
    :
    -
    - {Number(DineInTotal).toFixed(2)} -
    -
    } - - } -
    -
    - Amount -
    -
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} -
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - {(table2Data?.OrderType === "E") ? '' : -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && - <> -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } +
    + {DineInData?.length > 0 && TakeawayData?.length > 0 && ( + <> + {takeAwayPreference && ( +
    +
    + TakeAway +
    +
    :
    +
    + {Number(TakeawayTotal).toFixed(2)} +
    - - } + )} + {dinePreference && ( +
    +
    + Dine In +
    +
    :
    +
    + {Number(DineInTotal).toFixed(2)} +
    +
    + )} + + )} +
    +
    + Amount +
    +
    :
    +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    - } -
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} + + )} -
    -
    - {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}   Payment + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( + <> +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} +
    + + )} +
    + )} +
    + +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +   Payment +
    +
    :
    +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    -
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} -
    -
    - {/*
    + + {/*
    Recived Amt
    @@ -732,193 +1775,535 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 0.00
    */} - -
    -
    - - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} -
    - -
    - -
    -
    Your Order No: {GlobaldummyData ? '53' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    -
    - {GlobaldummyData ? GlobalQrcodet && -
    - image -
    Scan to Pay:
    -
    - ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} + +
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && + )} -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} -
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} +
    +
    +
    +
    + Your Order No:{' '} + {GlobaldummyData + ? '53' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    +
    -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - 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. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (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

    - -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - Signature == true && (
    -

    Signature

    - -
    )} - + {GlobaldummyData + ? GlobalQrcodet && ( +
    + image +
    + {' '} + Scan to Pay:{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    -
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} - {PrintGreeting?.SettingValue === "Y" && -
    - Thank You Visit Again +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. +
    +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )} +
    - } - - } + {PrintGreeting?.SettingValue === 'Y' && ( +
    + Thank You Visit Again +
    + )} + + )}
    ))} - - {shouldFooterBeOnNewPage && FormatTheme && + {shouldFooterBeOnNewPage && FormatTheme && (
    -
    <> -
    -
    -
    -
    -
    - Items -
    +
    +
    +
    +
    Items
    :
    -
    +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    - Qty -
    +
    +
    Qty
    :
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    - Off -
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    +
    Off
    :
    -
    - {GlobaldummyData ? '9' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)} +
    + {GlobaldummyData + ? '9' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    - } + )} {/*
    Extra Charges @@ -929,185 +2314,435 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo,
    */} -
    +
    - {(DineInData?.length > 0 && TakeawayData?.length > 0) && + {DineInData?.length > 0 && TakeawayData?.length > 0 && ( <> - {takeAwayPreference &&
    -
    - TakeAway + {takeAwayPreference && ( +
    +
    + TakeAway +
    +
    :
    +
    + {Number(TakeawayTotal).toFixed(2)} +
    -
    :
    -
    - {Number(TakeawayTotal).toFixed(2)} + )} + {dinePreference && ( +
    +
    + Dine In +
    +
    :
    +
    + {Number(DineInTotal).toFixed(2)} +
    -
    } - {dinePreference &&
    -
    - Dine In -
    -
    :
    -
    - {Number(DineInTotal).toFixed(2)} -
    -
    } + )} - } -
    -
    + )} +
    +
    Amount
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    - {PaymentStatusSuccess?.length > 1 && + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} - } - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : (
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( <>
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    - - Taxable Amount - - CGST - - SGST - - Total Amount -
    - - - - - - - ) - } -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - + - - + - {OrderDetailIGST?.map((item) => + {OrderDetailGST?.map((item) => ( - - - + + - - ) - } + ))}
    - + Taxable Amount - IGST + + CGST + + SGST + Total Amount
    + {item?.TaxPercentage || 0}% - {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} - {Number(item.TaxAmt).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - + )} - - - - - - - {OrderDetailVAT?.map((item) => + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    +
    - - Taxable Amount - - VAT - - Total Amount -
    - + - - - - ) - } -
    - {item?.TaxPercentage || 0}% + + Taxable Amount - {Number(item.WithOutTaxAmount).toFixed(2)} + + IGST - {Number(item.TaxAmt).toFixed(2)} + + Total Amount {Number(item.TotalAmt).toFixed(2)}
    - - } - + {OrderDetailIGST?.map((item) => ( + + + {item?.TaxPercentage || 0}% + + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + + {Number(item.TaxAmt).toFixed(2)} + + + {Number(item.TotalAmt).toFixed(2)} + + + ))} + + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )}
    - } + )}
    - } -
    + )} +
    -
    -
    - {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}   Payment +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +   Payment
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    {/*
    @@ -1128,339 +2763,1140 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 0.00
    */} -
    - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} -
    - -
    - -
    -
    Your Order No: {GlobaldummyData ? '53' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - -
    - - {GlobaldummyData ? GlobalQrcodet && -
    - image -
    Scan to Pay:
    -
    - ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && +
    + )} -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} +
    + +
    +
    +
    + Your Order No:{' '} + {GlobaldummyData + ? '53' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    +
    + + {GlobaldummyData + ? GlobalQrcodet && ( +
    + image +
    + {' '} + Scan to Pay:{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - 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. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions + {GlobaldummyData + ? GlobalIsnotes && ( +

    +

    + Notes : 10 days Return policy

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

    Signature

    - -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - Signature == true && (
    -

    Signature

    - -
    )} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && -
    + {PrintGreeting?.SettingValue === 'Y' && ( +
    Thank You Visit Again
    - } + )}
    - } - + )}
    + ) : ( +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {/*

    {table2Data?.BrName}

    */} +
    +
    +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    +
    + {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 + : '')} +
    +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} +
    + {GlobaldummyData && GlobalCashierName && ( +

    + {' '} + Cashier : Cashier Name +

    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} - : -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} - {/*

    {table2Data?.BrName}

    */} -
    -
    - -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    - {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?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + {table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} +
    + )}
    -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    - {GlobaldummyData && GlobalCashierName && -

    Cashier : Cashier Name

    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} + {GlobalLogo && GlobaldummyData && ( +
    + {' '} + image
    - } - - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} + )} + {base64Image && (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( +
    + {' '} + image
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - {table2Data?.OrderType === "E" &&
    Estimate
    } + ) : null}
    - {(GlobalLogo && GlobaldummyData) &&
    image
    } - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ?
    image
    : null} -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate
    } + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} +
    + )} {/*

    {table2Data?.PaymentTypeName}  Payment :  {Number(table2Data?.NetAmount).toFixed(2)}/-

    */} -
    -
    Bill No : {GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {Date1}
    +
    +
    + Bill No :{' '} + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    + {Date1} +
    {/*
    */} - {(TakeawayData?.length > 0 || GlobaldummyData) && + {(TakeawayData?.length > 0 || GlobaldummyData) && ( <> - {takeAwayPreference &&
    Take Away
    } + {takeAwayPreference && ( +
    + Take Away +
    + )}
    - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && } + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && } - {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} + {(GlobaldummyData ? products : TakeawayData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )}
    S.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
    {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?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return ( +
    {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?.SalesQty} + + {item?.SalesQty} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item?.Rate} + + {item?.Rate} + + {item?.HSN} + + {item?.HSN} + + {item?.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    - } - {(DineInData?.length > 0 && dinePreference) && + )} + {DineInData?.length > 0 && dinePreference && ( <> -
    Dine In
    +
    + Dine In +
    - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && } + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && } - {(GlobaldummyData ? products : DineInData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && - } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} + {(GlobaldummyData ? products : DineInData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && + : SLNO && } + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )}
    S.NoS.NoDescriptionDesQty { WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmtS.NoS.NoDescriptionDesQty + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateHSNHSN(%)(%)Tax (%)Tax (%)AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    -
    {item?.SalesQty}{item?.SalesQty}{item?.MRP}{item?.SinglePc === 'Y' ? item?.Rate : item?.MRP}{item?.Rate}{item?.Rate}{item?.HSN}{item?.HSN}{item?.discount}{item?.Type != "C" ? item?.OfferAmt || 0 : item?.OfferValue || 0}{item?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    {index + 1}{index + 1}{item?.ProdName} +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    +
    + {item?.SalesQty} + + {item?.SalesQty} + + {item?.MRP} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + {item?.Rate} + + {item?.Rate} + + {item?.HSN} + + {item?.HSN} + + {item?.discount} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + {item?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    - } + + )}
    -
    -
    -
    -
    - Items -
    +
    +
    +
    +
    Items
    :
    -
    +
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    - Qty -
    +
    +
    Qty
    :
    -
    +
    {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    - Off -
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    +
    Off
    :
    -
    - {GlobaldummyData ? '9' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)} +
    + {GlobaldummyData + ? '9' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    - } + )} {/*
    Extra Charges @@ -1471,187 +3907,412 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo,
    */} -
    +
    - {(DineInData?.length > 0 && TakeawayData?.length > 0) && + {DineInData?.length > 0 && TakeawayData?.length > 0 && ( <> - {takeAwayPreference &&
    -
    - TakeAway + {takeAwayPreference && ( +
    +
    + TakeAway +
    +
    :
    +
    + {Number(TakeawayTotal).toFixed(2)} +
    -
    :
    -
    - {Number(TakeawayTotal).toFixed(2)} + )} + {dinePreference && ( +
    +
    + Dine In +
    +
    :
    +
    + {Number(DineInTotal).toFixed(2)} +
    -
    } - {dinePreference &&
    -
    - Dine In -
    -
    :
    -
    - {Number(DineInTotal).toFixed(2)} -
    -
    } + )} - } -
    -
    - Amount -
    + )} +
    +
    Amount
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    - {PaymentStatusSuccess?.length > 1 && + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)}
    ))} - } - {(table2Data?.OrderType === "E") ? '' : + )} + + {table2Data?.OrderType === 'E' ? ( + '' + ) : (
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( <>
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - - - - - - - ) - } -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - + - - + - {OrderDetailIGST?.map((item) => + {OrderDetailGST?.map((item) => ( - - - + + - - - ) - } + ))}
    - + Taxable Amount - IGST + + CGST + + SGST + Total Amount
    + {item?.TaxPercentage || 0}% + {Number(item.WithOutTaxAmount).toFixed(2)} - {Number(item.TaxAmt).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - + )} - - - - - - - {OrderDetailVAT?.map((item) => + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    +
    - - Taxable Amount - - VAT - - Total Amount -
    - + - - - - ) - } -
    - {item?.TaxPercentage || 0}% + + Taxable Amount - {Number(item.WithOutTaxAmount).toFixed(2)} + + IGST - {Number(item.TaxAmt).toFixed(2)} + + Total Amount {Number(item.TotalAmt).toFixed(2)}
    - - } + {OrderDetailIGST?.map((item) => ( + + + {item?.TaxPercentage || 0}% + + + {Number(item.WithOutTaxAmount).toFixed(2)} + + + {Number(item.TaxAmt).toFixed(2)} + + + {Number(item.TotalAmt).toFixed(2)} + + + ))} + + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )}
    - } + )}
    - } -
    + )} +
    -
    -
    - {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}   Payment +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +   Payment
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    {/*
    @@ -1672,10 +4333,73 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo, 0.00
    */} -
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} + {/*
    */} {/*
    @@ -1692,137 +4416,346 @@ const Printstyle12 = ({ index, ExtraChargeTotal, Date1, base64Image, PrintLogo,
    */} - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} +

    + ) : null} + + )} - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} +

    + ) : null} +
    + )}
    -
    - -
    -
    Your Order No: {GlobaldummyData ? '53' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - +
    +
    +
    + Your Order No:{' '} + {GlobaldummyData + ? '53' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    - {GlobaldummyData ? GlobalQrcodet && -
    - image -
    Scan to Pay:
    -
    - ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} -
    -
    - : - (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (Qrcodet && paymentTypeUPI) && - -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } - + {GlobaldummyData + ? GlobalQrcodet && ( +
    + image +
    + {' '} + Scan to Pay:{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )}
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} - -
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - 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. -
    -
    ) - : (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - (TermsnAdCondition == true && TermsAndConditions?.length > 0) && (
    -

    - Terms & Conditions + {GlobaldummyData + ? GlobalIsnotes && ( +

    +

    + Notes : 10 days Return policy

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

    Signature

    - -
    ) : - (!estimatePrintHeader && table2Data?.OrderType === "E") ? '' : - Signature == true && (
    -

    Signature

    - -
    )} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )}
    - {PrintGreeting?.SettingValue === "Y" && -
    - Thank You Visit Again -
    - } + {PrintGreeting?.SettingValue === 'Y' && ( +
    Thank You Visit Again
    + )} {/*
    print
    */}
    - } - + )} - ) -} + ); +}; -export default Printstyle12 +export default Printstyle12; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx index be9e6c8..0da37c3 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle2.jsx @@ -137,6 +137,18 @@ const Printstyle2 = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) + const keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); @@ -339,8 +351,8 @@ const Printstyle2 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: FormatTheme @@ -407,18 +419,18 @@ const Printstyle2 = ({ {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 + : '')}
    @@ -477,10 +489,10 @@ const Printstyle2 = ({ {GlobaldummyData ? 'A22' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    @@ -512,124 +524,124 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} @@ -638,214 +650,214 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && ( - - {item?.ProdName} - - ) + + {item?.ProdName} + + ) : Item && ( - -
    {item?.ProdName}
    -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => - pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} + +
    {item?.ProdName}
    +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +  {' '} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > + 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null ) -
    - )} -  {' '} - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > + )?.map((a) => { + return ( +
    {a.SerialNumber}
    + ); + }) + : ''}{' '} + {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?.ProductIdentifierDtls.filter( + (item1) => + item1.IMEI1 !== '' || + item1.IMEI2 !== '' + )?.map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) + : ''} +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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 ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage || 0} - - ) + + {item?.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} ); })} @@ -870,124 +882,124 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} @@ -996,155 +1008,155 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && ( - - {item?.ProdName} - - ) + + {item?.ProdName} + + ) : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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 ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} ); })} @@ -1266,12 +1278,12 @@ const Printstyle2 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off -
    - )} +
    + Off +
    + )}
    Amount
    @@ -1298,16 +1310,16 @@ const Printstyle2 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - {GlobaldummyData - ? '100' - : Number( +
    + {GlobaldummyData + ? '100' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )}
    @@ -1646,7 +1658,7 @@ const Printstyle2 = ({
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1666,6 +1678,46 @@ const Printstyle2 = ({ )} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData && GlobalCashierName && (
    Cashier : Cashier Name
    )} @@ -1712,141 +1764,141 @@ const Printstyle2 = ({ {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed( - 2 - ), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0] + ?.PaymentTypeName === 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs( - c.CurrentCreditBal - ).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed( + 2 + ), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )} {!estimatePrintHeader && - table2Data?.OrderType === 'E' ? ( + table2Data?.OrderType === 'E' ? ( '' ) : (
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} -
    +
    + QRcode +
    + 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 + )} +
    +
    + )}
    )} @@ -1872,7 +1924,7 @@ const Printstyle2 = ({ )} {!estimatePrintHeader && - table2Data?.OrderType === 'E' ? ( + table2Data?.OrderType === 'E' ? ( '' ) : (
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : 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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )} @@ -2108,10 +2160,10 @@ const Printstyle2 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off -
    - )} +
    + Off +
    + )}
    Amount
    @@ -2132,16 +2184,16 @@ const Printstyle2 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - {GlobaldummyData - ? '100' - : Number( +
    + {GlobaldummyData + ? '100' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )}
    {GlobaldummyData ? '1,066' @@ -2477,7 +2529,7 @@ const Printstyle2 = ({
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -2497,6 +2549,46 @@ const Printstyle2 = ({ )} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData && GlobalCashierName && (
    Cashier : Cashier Name
    )} @@ -2543,139 +2635,139 @@ const Printstyle2 = ({ {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed( - 2 - ), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed( + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed( 2 ), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )} {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} -
    +
    + QRcode +
    + 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 + )} +
    +
    + )}
    )} @@ -2714,23 +2806,23 @@ const Printstyle2 = ({ > {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : 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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )} @@ -2945,18 +3037,18 @@ const Printstyle2 = ({ {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 + : '')}
    @@ -3016,10 +3108,10 @@ const Printstyle2 = ({ {GlobaldummyData ? 'A22' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    @@ -3052,82 +3144,82 @@ const Printstyle2 = ({ : Item && Item} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} @@ -3137,208 +3229,208 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && ( - - {item?.ProdName} - - ) + + {item?.ProdName} + + ) : Item && ( - -
    {item?.ProdName}
    -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} + +
    {item?.ProdName}
    +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +  {' '} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null ) -
    - )} -  {' '} - {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(',')} -
    - ); - }) - : ''} -
    - - )} + )?.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(',')} +
    + ); + }) + : ''} +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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 ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} ); } @@ -3370,82 +3462,82 @@ const Printstyle2 = ({ : Item && Item} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} @@ -3455,154 +3547,154 @@ const Printstyle2 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && ( - - {item?.ProdName} - - ) + + {item?.ProdName} + + ) : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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 ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {' '} - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {' '} + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item.ProdTaxPercentage || 0} - - ) + + {item.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} ); } @@ -3660,8 +3752,8 @@ const Printstyle2 = ({ {GlobaldummyData ? '100' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )}
    @@ -3994,7 +4086,7 @@ const Printstyle2 = ({
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4008,6 +4100,46 @@ const Printstyle2 = ({ ))} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData && GlobalCashierName && (
    Cashier : Cashier Name
    )} @@ -4047,123 +4179,123 @@ const Printstyle2 = ({
    {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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )} {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( '' ) : (
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    +
    + QRcode +
    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)}
    - )} +
    + )}
    )} @@ -4201,26 +4333,26 @@ const Printstyle2 = ({ > {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : 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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} -
    2. - ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    - )} + 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/PrintTemplates/ThermalPrinter/PrintStyle3.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx index c124a12..b1a067d 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle3.jsx @@ -105,6 +105,18 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan if (keysLength > 0) { dispatch(changeReprintDataFound(true)); } + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) + 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']; @@ -240,7 +252,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } + {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ? 'QTY/KG' : 'QTY'}
    } {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} @@ -302,7 +314,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } + {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ? 'QTY/KG' : 'QTY'}
    } {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} @@ -494,11 +506,51 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    {GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )}
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -507,7 +559,8 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    ))} - } + )} + {GlobaldummyData && GlobalCashierName &&
    Cashier : Cashier Name
    @@ -851,11 +904,52 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    {GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} +
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -864,7 +958,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    ))} - } + )} {GlobaldummyData && GlobalCashierName &&
    Cashier : Cashier Name
    @@ -1077,7 +1171,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } + {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ? 'QTY/KG' : 'QTY'}
    } {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} @@ -1139,7 +1233,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan {GlobaldummyData ? GlobalItem &&
    ITEM
    : Item &&
    ITEM
    } {GlobaldummyData ? GlobalHsnCode &&
    HSN
    : HsnCode &&
    HSN
    } {GlobaldummyData ? GlobalMRP &&
    MRP
    : MRP &&
    MRP
    } - {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ?'QTY/KG' :'QTY'}
    } + {GlobaldummyData ? GlobalQuantity &&
    QTY
    : Quantity &&
    {WeightasKg ? 'QTY/KG' : 'QTY'}
    } {GlobaldummyData ? GlobalRate &&
    RATE
    : Rate &&
    RATE
    } {GlobaldummyData ? GlobalDiscount &&
    DIS
    : Discount &&
    DIS
    } {GlobaldummyData ? GlobalTax && (
    TAX %
    ) : (Tax == true && table2Data?.OrderType !== 'E') && (
    TAX %
    )} @@ -1327,6 +1421,46 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    {GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {GlobaldummyData ? ( GlobalCredit && ( @@ -1385,7 +1519,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -1394,7 +1528,8 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
    ))} - } + )} + {GlobaldummyData && GlobalCashierName &&
    Cashier : Cashier Name
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx index 43b0472..c164376 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle4.jsx @@ -146,6 +146,17 @@ const Printstyle4 = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) const keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { @@ -244,7 +255,7 @@ const Printstyle4 = ({ TotalAmt: 176, discount: 0, HSN: '01', - }, + }, { ProdName: 'ITEM 2', Rate: 300.0, @@ -253,7 +264,7 @@ const Printstyle4 = ({ TotalAmt: 300, discount: 0, HSN: '02', - }, + }, { ProdName: 'ITEM 3', Rate: 200.0, @@ -347,8 +358,8 @@ const Printstyle4 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -398,7 +409,7 @@ const Printstyle4 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    {' '} @@ -470,10 +481,10 @@ const Printstyle4 = ({ {GlobaldummyData ? '51' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    {/*
    {GlobaldummyData ? formattedDate : Date1}
    */}
    @@ -535,138 +546,138 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalSlNo && ( - # - ) + # + ) : SLNO && #} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - {WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -676,187 +687,187 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => - pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} - {( - (item?.ProductIdentifierDtls - ?.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, index) => { - const imei1 = - item2.IMEI1 || ''; - const imei2 = - item2.IMEI2 || ''; - return ` ${[imei1, imei2].filter(Boolean).join(',')}`; - }) - .join('') - : '') - ).trim()} -
    - ) : ( -
    - {( - (item?.Size || '1') + - (item?.SinglePc === 'Y' - ? ' PCS' - : item?.Type !== 'C' - ? ` ${item?.UomName}` - : ' COMBO') + - (item?.BrandName - ? ` ${item?.BrandName}` - : '') + - (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, index) => { - const imei1 = - item2.IMEI1 || ''; - const imei2 = - item2.IMEI2 || ''; - return ` ${[imei1, imei2].filter(Boolean).join(',')}`; - }) - .join('') - : '') - ).trim()} -
    - )} - - )} + {( + (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, index) => { + const imei1 = + item2.IMEI1 || ''; + const imei2 = + item2.IMEI2 || ''; + return ` ${[imei1, imei2].filter(Boolean).join(',')}`; + }) + .join('') + : '') + ).trim()} +
    + ) : ( +
    + {( + (item?.Size || '1') + + (item?.SinglePc === 'Y' + ? ' PCS' + : item?.Type !== 'C' + ? ` ${item?.UomName}` + : ' COMBO') + + (item?.BrandName + ? ` ${item?.BrandName}` + : '') + + (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, index) => { + const imei1 = + item2.IMEI1 || ''; + const imei2 = + item2.IMEI2 || ''; + return ` ${[imei1, imei2].filter(Boolean).join(',')}`; + }) + .join('') + : '') + ).trim()} +
    + )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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} + + )} ); })} @@ -883,138 +894,138 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalSlNo && ( - # - ) + # + ) : SLNO && #} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - Qty - - )} + + Qty + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -1024,117 +1035,117 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage || 0} - - ) + + {item?.ProdTaxPercentage || 0} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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} + + )} ); })} @@ -1403,17 +1414,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(); @@ -1632,86 +1643,126 @@ const Printstyle4 = ({ /-{' '}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed( - 2 - ), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )} {/*
    */}
    {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( @@ -1720,59 +1771,59 @@ 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 + )} +
    +
    + )}
    )} @@ -1784,7 +1835,7 @@ const Printstyle4 = ({ extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1804,6 +1855,7 @@ const Printstyle4 = ({ )} )} + {GlobaldummyData && GlobalCashierName && (
    {' '} @@ -1877,28 +1929,28 @@ const Printstyle4 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -1918,137 +1970,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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -2324,16 +2376,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(); @@ -2552,84 +2604,124 @@ const Printstyle4 = ({ /-{' '}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} + +

    + )); + })()} +
    + )}
    {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( @@ -2638,55 +2730,55 @@ 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)} +
    +
    + )}
    )}
    @@ -2697,7 +2789,7 @@ const Printstyle4 = ({ extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

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

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2831,137 +2923,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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -3044,18 +3136,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 + : '')}
    {' '} @@ -3087,10 +3179,10 @@ const Printstyle4 = ({ {GlobaldummyData ? '51' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    @@ -3153,48 +3245,48 @@ const Printstyle4 = ({ : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - Qty - - )} + + Qty + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {/* {GlobaldummyData ? GlobalTax && ( - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3252,114 +3344,114 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    - - )} + +
    {item?.ProdName}
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} + + {item?.SalesQty} +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} - {( - (item?.ProductIdentifierDtls - ?.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, index) => { - const imei1 = - item2.IMEI1 || ''; - const imei2 = - item2.IMEI2 || ''; - return ` ${[imei1, imei2].filter(Boolean).join(',')}`; - }) - .join('') - : '') - ).trim()} -
    - ) : ( -
    - {( - (item?.Size || '1') + - (item?.SinglePc === 'Y' - ? ' PCS' - : item?.Type !== 'C' - ? ` ${item?.UomName}` - : ' COMBO') + - (item?.BrandName - ? ` ${item?.BrandName}` - : '') + - (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, index) => { - const imei1 = - item2.IMEI1 || ''; - const imei2 = - item2.IMEI2 || ''; - return ` ${[imei1, imei2].filter(Boolean).join(',')}`; - }) - .join('') - : '') - ).trim()} -
    - )} -
    - - ) + {( + (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, index) => { + const imei1 = + item2.IMEI1 || ''; + const imei2 = + item2.IMEI2 || ''; + return ` ${[imei1, imei2].filter(Boolean).join(',')}`; + }) + .join('') + : '') + ).trim()} +
    + ) : ( +
    + {( + (item?.Size || '1') + + (item?.SinglePc === 'Y' + ? ' PCS' + : item?.Type !== 'C' + ? ` ${item?.UomName}` + : ' COMBO') + + (item?.BrandName + ? ` ${item?.BrandName}` + : '') + + (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, index) => { + const imei1 = + item2.IMEI1 || ''; + const imei2 = + item2.IMEI2 || ''; + return ` ${[imei1, imei2].filter(Boolean).join(',')}`; + }) + .join('') + : '') + ).trim()} +
    + )} +
    + + ) : Quantity && ( - - {item?.SalesQty} - {/*
    + + {item?.SalesQty} + {/*
    {PackageDetails?.filter( (pkg) => pkg.ProdId === item.ProdId ).length > 0 ? ( @@ -3448,119 +3540,119 @@ const Printstyle4 = ({
    )}
    */} - - )} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - {GlobaldummyData - ? GlobalTax && ( - - {/* */} - - GST:{' '} - {' '} - {item?.ProdTaxPercentage || 0} - - ) - : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {/* */} - - GST:{' '} - {' '} - {item?.ProdTaxPercentage || 0} - - )} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + {GlobaldummyData + ? GlobalTax && ( + + {/* */} + + GST:{' '} + {' '} + {item?.ProdTaxPercentage || 0} + + ) + : Tax == true && + table2Data?.OrderType !== 'E' && ( + + {/* */} + + GST:{' '} + {' '} + {item?.ProdTaxPercentage || 0} + + )} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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} + + )} ); } @@ -3594,48 +3686,48 @@ const Printstyle4 = ({ : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - Qty - - )} + + Qty + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {/* {GlobaldummyData ? GlobalTax && ( - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3693,118 +3785,118 @@ const Printstyle4 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    - - )} + +
    {item?.ProdName}
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {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'} + ) +
    + + ) : Quantity && ( - - {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'} + ) +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage || 0} - - ) + + {item?.ProdTaxPercentage || 0} + + ) : Tax == true && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {' '} - {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} + + )} ); } @@ -4041,14 +4133,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(); @@ -4263,81 +4355,121 @@ const Printstyle4 = ({ /-{' '}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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) { - items.push({ - label: - c.OldCreditBal > 0 - ? 'Advance Amount' - : 'Opening Balance', - value: Math.abs(c.OldCreditBal).toFixed(2), - }); - } - } - - if (c.CurrentCreditBal !== 0) { + if ( + PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' + ) { + if (c.OldCreditBal !== 0) { items.push({ label: - c.CurrentCreditBal > 0 - ? 'Current Advance Amount' - : 'Current Balance Amount', - value: Math.abs(c.CurrentCreditBal).toFixed(2), + c.OldCreditBal > 0 + ? 'Advance Amount' + : 'Opening Balance', + value: Math.abs(c.OldCreditBal).toFixed(2), }); } + } - return items.map((i, idx) => ( -

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

    - )); - })()} -
    - )} + 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} +

    + )); + })()} +
    + )}
    {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( @@ -4346,61 +4478,62 @@ 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 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4414,6 +4547,7 @@ const Printstyle4 = ({ ))} )} + {GlobaldummyData && GlobalCashierName && (
    {' '} @@ -4483,21 +4617,21 @@ const Printstyle4 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -4517,136 +4651,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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} -
    2. - ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    - )} + 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/PrintTemplates/ThermalPrinter/PrintStyle5.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx index ee2bed5..ec2633e 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle5.jsx @@ -79,7 +79,7 @@ const PrintStyle5 = ({ const CashierNameField = FieldDetails?.['CashierName']; const LogoField = FieldDetails?.['Logo']; const CreditDetails = FieldDetails?.['Credit details']; - const WeightasKg = FieldDetails?.['Weight']; + const WeightasKg = FieldDetails?.['Weight']; const GlobalSlNo = useSelector(GlobalprintSlNo); const GlobalItem = useSelector(GlobalprintItem); const GlobalMRP = useSelector(GlobalprintMRP); @@ -138,6 +138,17 @@ const PrintStyle5 = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) const keysLength = Object.keys(table2Data ?? {}).length; if (keysLength > 0) { dispatch(changeReprintDataFound(true)); @@ -323,8 +334,8 @@ const PrintStyle5 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -371,7 +382,7 @@ const PrintStyle5 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    {' '} @@ -466,10 +477,10 @@ const PrintStyle5 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )}{' '} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}{' '}
    {' '}
    @@ -507,15 +518,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - S.No -
    - ) +
    + S.No +
    + ) : SLNO && ( -
    - S.No -
    - )} +
    + S.No +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -536,78 +547,78 @@ const PrintStyle5 = ({ : Item && 'ITEM /DES /'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'QTY/Kg' :'QTY'}{' '} + : Quantity && WeightasKg ? 'QTY/Kg' : 'QTY'}{' '}
    )} {GlobaldummyData ? GlobalHsnCode && ( -
    - HSN -
    - ) +
    + HSN +
    + ) : HsnCode && ( -
    - HSN -
    - )} +
    + HSN +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - MRP -
    - ) +
    + MRP +
    + ) : MRP && ( -
    - MRP -
    - )} +
    + MRP +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - RATE -
    - ) +
    + RATE +
    + ) : Rate && ( -
    - RATE -
    - )} +
    + RATE +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - DIS{' '} -
    - ) +
    + DIS{' '} +
    + ) : Discount && ( -
    - DIS{' '} -
    - )} +
    + DIS{' '} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - TAX %{' '} -
    - ) +
    + TAX %{' '} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - TAX %{' '} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + TAX %{' '} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {' '} - Amt{' '} -
    - ) +
    + {' '} + Amt{' '} +
    + ) : Amount && ( -
    - {' '} - AMT{' '} -
    - )} +
    + {' '} + AMT{' '} +
    + )}

    @@ -627,19 +638,19 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - {index + 1} -
    - ) +
    + {index + 1} +
    + ) : SLNO && ( -
    - {chunkIndex * chunkSize + index + 1} -
    - )} +
    + {chunkIndex * chunkSize + index + 1} +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -761,102 +772,102 @@ const PrintStyle5 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( -
    - {item?.HSN} -
    - ) +
    + {item?.HSN} +
    + ) : HsnCode && ( -
    - {item?.HSN} -
    - )} +
    + {item?.HSN} +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - {item?.MRP} -
    - ) +
    + {item?.MRP} +
    + ) : MRP && ( -
    - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} -
    - )} +
    + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - {item?.Rate} -
    - ) +
    + {item?.Rate} +
    + ) : Rate && ( -
    - {item?.Rate} -
    - )} +
    + {item?.Rate} +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - {item?.discount} -
    - ) +
    + {item?.discount} +
    + ) : Discount && ( -
    - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} -
    - )} +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - {item?.ProdTaxPercentage} -
    - ) +
    + {item?.ProdTaxPercentage} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - {item?.ProdTaxPercentage || 0} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {item?.TotalAmt} -
    - ) +
    + {item?.TotalAmt} +
    + ) : Amount && ( -
    - {' '} - {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} +
    + )}
    ))} @@ -886,15 +897,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - S.No -
    - ) +
    + S.No +
    + ) : SLNO && ( -
    - S.No -
    - )} +
    + S.No +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -915,78 +926,78 @@ const PrintStyle5 = ({ : Item && 'ITEM /DES /'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'Qty/Kg' :'Qty'}{' '} + : Quantity && WeightasKg ? 'Qty/Kg' : 'Qty'}{' '}
    )} {GlobaldummyData ? GlobalHsnCode && ( -
    - HSN -
    - ) +
    + HSN +
    + ) : HsnCode && ( -
    - HSN -
    - )} +
    + HSN +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - MRP -
    - ) +
    + MRP +
    + ) : MRP && ( -
    - MRP -
    - )} +
    + MRP +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - RATE -
    - ) +
    + RATE +
    + ) : Rate && ( -
    - RATE -
    - )} +
    + RATE +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - DIS{' '} -
    - ) +
    + DIS{' '} +
    + ) : Discount && ( -
    - DIS{' '} -
    - )} +
    + DIS{' '} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - TAX %{' '} -
    - ) +
    + TAX %{' '} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - TAX %{' '} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + TAX %{' '} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {' '} - Amt{' '} -
    - ) +
    + {' '} + Amt{' '} +
    + ) : Amount && ( -
    - {' '} - AMT{' '} -
    - )} +
    + {' '} + AMT{' '} +
    + )}

    @@ -1006,19 +1017,19 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - {index + 1} -
    - ) +
    + {index + 1} +
    + ) : SLNO && ( -
    - {chunkIndex * chunkSize + index + 1} -
    - )} +
    + {chunkIndex * chunkSize + index + 1} +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -1074,102 +1085,102 @@ const PrintStyle5 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( -
    - {item?.HSN} -
    - ) +
    + {item?.HSN} +
    + ) : HsnCode && ( -
    - {item?.HSN} -
    - )} +
    + {item?.HSN} +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - {item?.MRP} -
    - ) +
    + {item?.MRP} +
    + ) : MRP && ( -
    - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} -
    - )} +
    + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - {item?.Rate} -
    - ) +
    + {item?.Rate} +
    + ) : Rate && ( -
    - {item?.Rate} -
    - )} +
    + {item?.Rate} +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - {item?.discount} -
    - ) +
    + {item?.discount} +
    + ) : Discount && ( -
    - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} -
    - )} +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - {item?.ProdTaxPercentage} -
    - ) +
    + {item?.ProdTaxPercentage} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - {item?.ProdTaxPercentage || 0} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {item?.TotalAmt} -
    - ) +
    + {item?.TotalAmt} +
    + ) : Amount && ( -
    - {' '} - {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} +
    + )}
    ))} @@ -1365,18 +1376,18 @@ const PrintStyle5 = ({ {/* {ExtraChargeTotal>0 &&
    Extra Charges :
    {ExtraChargeTotal}
    } */} {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - {' '} -
    Off :
    {' '} -
    - {GlobaldummyData - ? '100' - : Number( +
    + {' '} +
    Off :
    {' '} +
    + {GlobaldummyData + ? '100' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    {' '} -
    - )} +
    {' '} +
    + )}
    @@ -1453,36 +1464,76 @@ const PrintStyle5 = ({ /-{' '}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0] .OldCreditBal > 0 ? ( @@ -1494,7 +1545,7 @@ const PrintStyle5 = ({ }

    ) : table2Data.CustomerDetails[0] - .OldCreditBal < 0 ? ( + .OldCreditBal < 0 ? (

    {' '} Opening Balance:{' '} @@ -1507,30 +1558,30 @@ const PrintStyle5 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0] - .CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - { - table2Data.CustomerDetails[0] - .CurrentCreditBal - } -

    - ) : table2Data.CustomerDetails[0] - .CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0] - .CurrentCreditBal - )} -

    - ) : null} -
    - )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0] + .CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + { + table2Data.CustomerDetails[0] + .CurrentCreditBal + } +

    + ) : table2Data.CustomerDetails[0] + .CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0] + .CurrentCreditBal + )} +

    + ) : null} +
    + )}
    {/*
    TOTAL SAVING : 10.00
    */}
    @@ -1541,54 +1592,54 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalQrcodet && ( +
    -
    - {' '} - {' '} -
    -
    Scan to Pay
    -
    - {' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} -
    + {' '} + {' '}
    - ) +
    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 + )}
    - )} +
    + )}
    )}
    @@ -1598,7 +1649,7 @@ const PrintStyle5 = ({ extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1682,23 +1733,23 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -1718,138 +1769,138 @@ const PrintStyle5 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -2078,8 +2129,8 @@ const PrintStyle5 = ({ {GlobaldummyData ? '100' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    {' '}
    )} @@ -2153,39 +2204,79 @@ const PrintStyle5 = ({ /-{' '}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: { @@ -2194,7 +2285,7 @@ const PrintStyle5 = ({ }

    ) : table2Data.CustomerDetails[0] - .OldCreditBal < 0 ? ( + .OldCreditBal < 0 ? (

    {' '} Opening Balance:{' '} @@ -2207,30 +2298,30 @@ const PrintStyle5 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - { - table2Data.CustomerDetails[0] - .CurrentCreditBal - } -

    - ) : table2Data.CustomerDetails[0] - .CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0] - .CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + { + table2Data.CustomerDetails[0] + .CurrentCreditBal + } +

    + ) : table2Data.CustomerDetails[0] + .CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0] + .CurrentCreditBal + )} +

    + ) : null} +
    + )}
    {/*
    TOTAL SAVING : 10.00
    */}
    @@ -2241,47 +2332,47 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalQrcodet && ( +
    -
    - {' '} - {' '} -
    -
    Scan to Pay
    -
    - {' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    + {' '} + {' '}
    - ) +
    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)}
    - )} +
    + )}
    )}
    @@ -2291,7 +2382,7 @@ const PrintStyle5 = ({ extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2369,23 +2460,23 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2405,138 +2496,138 @@ const PrintStyle5 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -2583,7 +2674,7 @@ const PrintStyle5 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    {' '} @@ -2676,10 +2767,10 @@ const PrintStyle5 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )}{' '} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}{' '}
    {' '}
    @@ -2711,15 +2802,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - S.No -
    - ) +
    + S.No +
    + ) : SLNO && ( -
    - S.No -
    - )} +
    + S.No +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -2738,78 +2829,78 @@ const PrintStyle5 = ({ : Item && 'ITEM /DES /'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'Qty/Kg' :'Qty'}{' '} + : Quantity && WeightasKg ? 'Qty/Kg' : 'Qty'}{' '}
    )} {GlobaldummyData ? GlobalHsnCode && ( -
    - HSN -
    - ) +
    + HSN +
    + ) : HsnCode && ( -
    - HSN -
    - )} +
    + HSN +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - MRP -
    - ) +
    + MRP +
    + ) : MRP && ( -
    - MRP -
    - )} +
    + MRP +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - RATE -
    - ) +
    + RATE +
    + ) : Rate && ( -
    - RATE -
    - )} +
    + RATE +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - DIS{' '} -
    - ) +
    + DIS{' '} +
    + ) : Discount && ( -
    - DIS{' '} -
    - )} +
    + DIS{' '} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - TAX %{' '} -
    - ) +
    + TAX %{' '} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - TAX %{' '} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + TAX %{' '} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {' '} - Amt{' '} -
    - ) +
    + {' '} + Amt{' '} +
    + ) : Amount && ( -
    - {' '} - AMT{' '} -
    - )} +
    + {' '} + AMT{' '} +
    + )}

    @@ -2830,15 +2921,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - {index + 1} -
    - ) +
    + {index + 1} +
    + ) : SLNO && ( -
    - {index + 1} -
    - )} +
    + {index + 1} +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -2963,76 +3054,76 @@ const PrintStyle5 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( -
    - {item?.HSN} -
    - ) +
    + {item?.HSN} +
    + ) : HsnCode && ( -
    - {item?.HSN} -
    - )} +
    + {item?.HSN} +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - {item?.MRP} -
    - ) +
    + {item?.MRP} +
    + ) : MRP && ( -
    - {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} -
    - )} +
    + {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - {item?.Rate} -
    - ) +
    + {item?.Rate} +
    + ) : Rate && ( -
    - {item?.Rate} -
    - )} +
    + {item?.Rate} +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - {item?.discount} -
    - ) +
    + {item?.discount} +
    + ) : Discount && ( -
    - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} -
    - )} +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - {item?.ProdTaxPercentage} -
    - ) +
    + {item?.ProdTaxPercentage} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - {item?.ProdTaxPercentage || 0} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {item?.TotalAmt} -
    - ) +
    + {item?.TotalAmt} +
    + ) : Amount && ( -
    - {' '} - {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} +
    + )}
    ) )} @@ -3063,15 +3154,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - S.No -
    - ) +
    + S.No +
    + ) : SLNO && ( -
    - S.No -
    - )} +
    + S.No +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -3090,78 +3181,78 @@ const PrintStyle5 = ({ : Item && 'ITEM /DES /'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'Qty/Kg' :'Qty'}{' '} + : Quantity && WeightasKg ? 'Qty/Kg' : 'Qty'}{' '}
    )} {GlobaldummyData ? GlobalHsnCode && ( -
    - HSN -
    - ) +
    + HSN +
    + ) : HsnCode && ( -
    - HSN -
    - )} +
    + HSN +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - MRP -
    - ) +
    + MRP +
    + ) : MRP && ( -
    - MRP -
    - )} +
    + MRP +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - RATE -
    - ) +
    + RATE +
    + ) : Rate && ( -
    - RATE -
    - )} +
    + RATE +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - DIS{' '} -
    - ) +
    + DIS{' '} +
    + ) : Discount && ( -
    - DIS{' '} -
    - )} +
    + DIS{' '} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - TAX %{' '} -
    - ) +
    + TAX %{' '} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - TAX %{' '} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + TAX %{' '} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {' '} - Amt{' '} -
    - ) +
    + {' '} + Amt{' '} +
    + ) : Amount && ( -
    - {' '} - AMT{' '} -
    - )} +
    + {' '} + AMT{' '} +
    + )}

    @@ -3182,15 +3273,15 @@ const PrintStyle5 = ({ > {GlobaldummyData ? GlobalSlNo && ( -
    - {index + 1} -
    - ) +
    + {index + 1} +
    + ) : SLNO && ( -
    - {index + 1} -
    - )} +
    + {index + 1} +
    + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && (
    @@ -3246,76 +3337,76 @@ const PrintStyle5 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( -
    - {item?.HSN} -
    - ) +
    + {item?.HSN} +
    + ) : HsnCode && ( -
    - {item?.HSN} -
    - )} +
    + {item?.HSN} +
    + )} {GlobaldummyData ? GlobalMRP && ( -
    - {item?.MRP} -
    - ) +
    + {item?.MRP} +
    + ) : MRP && ( -
    - {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} -
    - )} +
    + {item?.SinglePc === 'Y' ? item?.Rate : item?.MRP} +
    + )} {GlobaldummyData ? GlobalRate && ( -
    - {item?.Rate} -
    - ) +
    + {item?.Rate} +
    + ) : Rate && ( -
    - {item?.Rate} -
    - )} +
    + {item?.Rate} +
    + )} {GlobaldummyData ? GlobalDiscount && ( -
    - {item?.discount} -
    - ) +
    + {item?.discount} +
    + ) : Discount && ( -
    - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} -
    - )} +
    + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} +
    + )} {GlobaldummyData ? GlobalTax && ( -
    - {item?.ProdTaxPercentage} -
    - ) +
    + {item?.ProdTaxPercentage} +
    + ) : Tax && - table2Data?.OrderType !== 'E' && ( -
    - {item?.ProdTaxPercentage || 0} -
    - )} + table2Data?.OrderType !== 'E' && ( +
    + {item?.ProdTaxPercentage || 0} +
    + )} {GlobaldummyData ? GlobalAmount && ( -
    - {item?.TotalAmt} -
    - ) +
    + {item?.TotalAmt} +
    + ) : Amount && ( -
    - {' '} - {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} +
    + )}
    ) )} @@ -3489,8 +3580,8 @@ const PrintStyle5 = ({ {GlobaldummyData ? '100' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    {' '}
    )} @@ -3567,36 +3658,76 @@ const PrintStyle5 = ({ /-{' '}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > 0 ? (

    @@ -3616,25 +3747,25 @@ const PrintStyle5 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    {/*
    TOTAL SAVING : 10.00
    */}
    @@ -3645,47 +3776,47 @@ const PrintStyle5 = ({
    {GlobaldummyData ? GlobalQrcodet && ( +
    -
    - {' '} - {' '} -
    -
    Scan to Pay
    -
    - {' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    + {' '} + {' '}
    - ) +
    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)}
    - )} +
    + )}
    )}
    @@ -3694,7 +3825,7 @@ const PrintStyle5 = ({ {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

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

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -3809,137 +3940,137 @@ const PrintStyle5 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} -
    2. - ))} -
    -
    - )} + Terms & Conditions +

    +
      + {TermsAndConditions?.map((item) => ( +
    1. + {item?.TermsandConditions} +
    2. + ))} +
    +
    + )} {GlobaldummyData ? GlobalSignature && ( -
    +

    -

    - Signature -

    - -
    - ) + Signature +

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

    -

    - Signature -

    - -
    - )} + Signature +

    + +
    + )}
    )}
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx index 2f03b14..fde7306 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx @@ -102,6 +102,7 @@ const Printstyle6 = ({ const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); const SettingData = useSelector(PreferenceData); + console.log(CashierNameField, "GlobaldummyData") const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find( (setting) => @@ -123,6 +124,17 @@ const Printstyle6 = ({ const paymentTypeUPI = PaymentStatus?.find( (ps) => ps.PaymentTypeName === 'UPI' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) console.log(GlobalDiscount, Discount, 'Discount'); @@ -335,8 +347,8 @@ const Printstyle6 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -391,7 +403,7 @@ const Printstyle6 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( -
    + {table2Data?.BrMobile &&
    Mobile : {table2Data?.BrMobile} -
    +
    } {table2Data?.OrderType === 'E' && (
    {Date1}
    @@ -523,8 +535,8 @@ const Printstyle6 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( @@ -544,136 +556,136 @@ const Printstyle6 = ({ : Item && 'ITEM /DES/'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'QTY/KG' :'QTY'} + : Quantity && WeightasKg ? 'QTY/KG' : 'QTY'} )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - AMt - - ) + + AMt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -683,10 +695,10 @@ const Printstyle6 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( {item?.ProdName}
    {item?.Size + - item?.UomName + - '-' + - GlobaldummyData + item?.UomName + + '-' + + GlobaldummyData ? GlobalQuantity && item?.SalesQty : item?.SalesQty}
    @@ -778,90 +790,90 @@ const Printstyle6 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); })} @@ -889,8 +901,8 @@ const Printstyle6 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( @@ -910,136 +922,136 @@ const Printstyle6 = ({ : Item && 'ITEM /DES/'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'QTY/KG' :'QTY'} + : Quantity && WeightasKg ? 'QTY/KG' : 'QTY'} )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - AMt - - ) + + AMt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -1049,10 +1061,10 @@ const Printstyle6 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? ( (GlobalItem || GlobalQuantity) && ( {item?.ProdName}
    {item?.Size + - item?.UomName + - '-' + - GlobaldummyData + item?.UomName + + '-' + + GlobaldummyData ? GlobalQuantity && item?.SalesQty : item?.SalesQty}
    @@ -1094,139 +1106,139 @@ const Printstyle6 = ({ > {(GlobaldummyData ? GlobalItem && - item?.ProdName + - `(${item?.Size + item?.UomName})` + item?.ProdName + + `(${item?.Size + item?.UomName})` : Item && - item?.ProdName + - `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})`) + + item?.ProdName + + `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})`) + item?.BrandName !== - null + null ? item?.BrandName : '' + - item?.ProductIdentifierDtls - ?.length > - 0 + item?.ProductIdentifierDtls + ?.length > + 0 ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return
    {a.SerialNumber}
    ; - }) + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return
    {a.SerialNumber}
    ; + }) : '' + - item?.ProductIdentifierDtls - ?.length > - 0 + 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(',')} -
    - ); - }) + (item1) => + item1.IMEI1 !== '' || + item1.IMEI2 !== '' + )?.map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) : '' + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : Quantity && item?.SalesQty)} + '-' + + (GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : Quantity && item?.SalesQty)} )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); })} @@ -1267,17 +1279,17 @@ const Printstyle6 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off :{' '} - {GlobaldummyData - ? '10' - : Number( +
    + Off :{' '} + {GlobaldummyData + ? '10' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} +
    -
    - )} + )}
    {table2Data?.OrderType === 'E' ? ( @@ -1649,41 +1661,80 @@ const Printstyle6 = ({ : Number(table2Data?.NetAmount).toFixed(2)}
    - + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -1701,28 +1752,28 @@ const Printstyle6 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} - {PaymentStatus?.length > 1 && ( + {(PaymentStatus?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -1746,48 +1797,48 @@ const Printstyle6 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed( - 2 - )} -
    +
    + QRcode +
    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 + )}
    - )} +
    + )}
    )}
    @@ -1810,7 +1861,7 @@ const Printstyle6 = ({
    {/*
    Card No
    */} - {GlobaldummyData && ( + {GlobaldummyData && GlobalCashierName && (
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2028,137 +2080,137 @@ const Printstyle6 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -2232,8 +2284,8 @@ const Printstyle6 = ({ {GlobaldummyData ? '10' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -2610,40 +2662,81 @@ const Printstyle6 = ({
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -2661,27 +2754,27 @@ const Printstyle6 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} - {PaymentStatus?.length > 1 && ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} + {(PaymentStatus?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2705,44 +2798,44 @@ const Printstyle6 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    +
    + QRcode +
    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)}
    - )} +
    + )}
    )}
    @@ -2765,7 +2858,7 @@ const Printstyle6 = ({
    {/*
    Card No
    */} - {GlobaldummyData && ( + {GlobaldummyData && GlobalCashierName && (
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2980,137 +3074,137 @@ const Printstyle6 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -3161,7 +3255,7 @@ const Printstyle6 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( -
    + {table2Data?.BrMobile &&
    Mobile : {table2Data?.BrMobile} -
    +
    } {table2Data?.OrderType === 'E' && (
    {Date1}
    @@ -3307,76 +3401,76 @@ const Printstyle6 = ({ : Item && 'ITEM /DES/'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'QTY/KG' :'QTY'} + : Quantity && WeightasKg ? 'QTY/KG' : 'QTY'} )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - AMt - - ) + + AMt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3409,9 +3503,9 @@ const Printstyle6 = ({
    {item?.ProdName}
    {item?.Size + - item?.UomName + - '-' + - GlobaldummyData + item?.UomName + + '-' + + GlobaldummyData ? GlobalQuantity && item?.SalesQty : item?.SalesQty}
    @@ -3472,89 +3566,89 @@ const Printstyle6 = ({ )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3600,76 +3694,76 @@ const Printstyle6 = ({ : Item && 'ITEM /DES/'}{' '} {GlobaldummyData ? GlobalQuantity && 'QTY' - : Quantity && WeightasKg ?'QTY/KG' :'QTY'} + : Quantity && WeightasKg ? 'QTY/KG' : 'QTY'} )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} + + Dis{' '} + + )} {GlobaldummyData ? GlobalTax && ( - - Tax % - - ) + + Tax % + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - Tax % - - )} + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - AMt - - ) + + AMt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3702,9 +3796,9 @@ const Printstyle6 = ({
    {item?.ProdName}
    {item?.Size + - item?.UomName + - '-' + - GlobaldummyData + item?.UomName + + '-' + + GlobaldummyData ? GlobalQuantity && item?.SalesQty : item?.SalesQty}
    @@ -3719,133 +3813,133 @@ const Printstyle6 = ({ > {(GlobaldummyData ? GlobalItem && - item?.ProdName + - `(${item?.Size + item?.UomName})` + item?.ProdName + + `(${item?.Size + item?.UomName})` : Item && - item?.ProdName + - `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})`) + + item?.ProdName + + `(${item?.Size ? item?.Size : '1'}${item?.SinglePc == 'Y' ? 'PCS' : item?.Type != 'C' ? item?.UomName : 'COMBO'})`) + item?.BrandName !== - null + null ? item?.BrandName : '' + item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return
    {a.SerialNumber}
    ; - }) + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return
    {a.SerialNumber}
    ; + }) : '' + item?.ProductIdentifierDtls?.length > - 0 + 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(',')} -
    - ); - }) + (item1) => + item1.IMEI1 !== '' || + item1.IMEI2 !== '' + )?.map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) : '' + - '-' + - (GlobaldummyData - ? GlobalQuantity && item?.SalesQty - : Quantity && item?.SalesQty)} + '-' + + (GlobaldummyData + ? GlobalQuantity && item?.SalesQty + : Quantity && item?.SalesQty)} )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3884,8 +3978,8 @@ const Printstyle6 = ({ {GlobaldummyData ? '10' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -4242,70 +4336,110 @@ const Printstyle6 = ({ : Number(table2Data?.NetAmount).toFixed(2)}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 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 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} -

    - ) : null} - - )} + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} +

    + ) : null} + + )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} -

    - ) : null} -
    - )} - {PaymentStatus?.length > 1 && ( + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} +

    + ) : null} +
    + )} + {(PaymentStatus?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4328,44 +4462,44 @@ const Printstyle6 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    +
    + QRcode +
    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)}
    - )} +
    + )}
    )}
    @@ -4388,7 +4522,7 @@ const Printstyle6 = ({
    {/*
    Card No
    */} - {GlobaldummyData && ( + {GlobaldummyData && GlobalCashierName && (
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -4595,136 +4730,136 @@ const Printstyle6 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

    -
      - {TermsAndConditions?.map((item) => ( -
    1. - {item?.TermsandConditions} -
    2. - ))} - {/*
    3. Please check the product before leaving the counter.
    4. */} -
    -
    - )} + 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/PrintTemplates/ThermalPrinter/PrintStyle7.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx index 6ef6187..85ed1dd 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx @@ -1,1433 +1,4300 @@ import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import QRcode from '../../../../Images/QRcode.png' +import QRcode from '../../../../Images/QRcode.png'; import { extractLastNumberOrderId } from '../../../../Services/Others'; import { - GlobalprintSlNo, - GlobalprintItem, - GlobalprintMRP, - GlobalprintDiscount, - GlobalprintQuantity, - GlobalprintRate, - GlobalprintAmount, - GlobalprintHsnCode, - GlobalprintQrcodet, - GlobalPritdummyData, - GloabalFieldDetails, - changeReprintDataFound, - GlobalprintSignature, - GlobalprinttermsAndConditions, - GlobalSignatureImage, - Globalnotes, - GlobalthemeFormat, - GlobalBillName, - GlobalprintCashierName, - GlobalprintLogo, - GlobalprintCredit, - GlobalprintTax, + GlobalprintSlNo, + GlobalprintItem, + GlobalprintMRP, + GlobalprintDiscount, + GlobalprintQuantity, + GlobalprintRate, + GlobalprintAmount, + GlobalprintHsnCode, + GlobalprintQrcodet, + GlobalPritdummyData, + GloabalFieldDetails, + changeReprintDataFound, + GlobalprintSignature, + GlobalprinttermsAndConditions, + GlobalSignatureImage, + Globalnotes, + GlobalthemeFormat, + GlobalBillName, + GlobalprintCashierName, + GlobalprintLogo, + GlobalprintCredit, + GlobalprintTax, } from '../../../../Features/ThemeChange/ThemeChange'; -import Logo from '../../../../Images/Logo.jpg' -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; -import "../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.scss" +import Logo from '../../../../Images/Logo.jpg'; +import { + GlobalUpiIDprint, + PreferenceData, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; +import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.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'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; -const PrintStyle7 = ({ index, ExtraChargeTotal, Date1, totalQuantityFilter, CashierName, totalQuantity, OrderDetailGST, - OrderDetailIGST, OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, base64Image, PrintLogo, printDatas, isPdf, sportsAppPreference, SalesModePref, - MembershipApplied = null +const PrintStyle7 = ({ + index, + ExtraChargeTotal, + Date1, + totalQuantityFilter, + CashierName, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + OrderDetailVAT, + table2Data, + PaymentStatus, + PrintGreeting, + base64Image, + PrintLogo, + printDatas, + isPdf, + sportsAppPreference, + SalesModePref, + MembershipApplied = null, }) => { + const dispatch = useDispatch(); + const GlobalUpiID = useSelector(GlobalUpiIDprint); + const FieldDetails = useSelector(GloabalFieldDetails); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Tax = FieldDetails?.['Tax']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const CashierNameField = FieldDetails?.['CashierName']; + const LogoField = FieldDetails?.['Logo']; + const CreditDetails = FieldDetails?.['Credit details']; + const WeightasKg = FieldDetails?.['Weight']; + const GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalMRP = useSelector(GlobalprintMRP); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalTax = useSelector(GlobalprintTax); + 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); + const appPreferences = useSelector(ApplicationPreferences); + const GlobalCashierName = useSelector(GlobalprintCashierName); + const GlobalLogo = useSelector(GlobalprintLogo); + const GlobalCredit = useSelector(GlobalprintCredit); + const SettingData = useSelector(PreferenceData); + const estimatePrintHeader = + SettingData?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' + )?.SettingValue === 'Y'; + const bookingTypePreference = appPreferences?.find( + (preference) => preference?.PreferredCatName === 'Booking Type' + )?.PreferenceCatDetails; + const dinePreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'dine in' && + type?.PreferredStatus === 'Y' + ); + const takeAwayPreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'take away' && + type?.PreferredStatus === 'Y' + ); + const paymentTypeUPI = PaymentStatus?.find( + (ps) => ps.PaymentTypeName === 'UPI' + ); + console.log(GlobalDiscount, Discount, 'Discount'); + console.log(printDatas, 'printDatasjk'); - const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint) - const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Tax = FieldDetails?.["Tax"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const CashierNameField = FieldDetails?.["CashierName"]; - const LogoField = FieldDetails?.["Logo"]; - const CreditDetails = FieldDetails?.["Credit details"]; - const WeightasKg = FieldDetails?.['Weight']; - const GlobalSlNo = useSelector(GlobalprintSlNo); - const GlobalItem = useSelector(GlobalprintItem); - const GlobalMRP = useSelector(GlobalprintMRP); - const GlobalDiscount = useSelector(GlobalprintDiscount); - const GlobalTax = useSelector(GlobalprintTax); - 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) - const appPreferences = useSelector(ApplicationPreferences); - const GlobalCashierName = useSelector(GlobalprintCashierName); - const GlobalLogo = useSelector(GlobalprintLogo); - const GlobalCredit = useSelector(GlobalprintCredit); - const SettingData = useSelector(PreferenceData); - const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' - const bookingTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Booking Type')?.PreferenceCatDetails - const dinePreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "dine in" && type?.PreferredStatus === 'Y') - const takeAwayPreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "take away" && type?.PreferredStatus === 'Y') - const paymentTypeUPI = PaymentStatus?.find((ps) => ps.PaymentTypeName === "UPI") - console.log(GlobalDiscount, Discount, "Discount"); - console.log(printDatas, "printDatasjk") - let TermsAndConditions = printDatas?.TermsandConditions - let SignatureImg = printDatas?.Signature - let Notestext = printDatas?.Notes - let BillName = printDatas?.PrintHdrName - let FormatTheme = printDatas?.PrintType == "S" ? true : false - let PageSize = printDatas?.PageSize - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - const PackageDetails = table2Data?.PackageDtl; - - 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 formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; - const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") - const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") - - const TakeawayTotal = TakeawayData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, - ); - const DineInTotal = DineInData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, - ); - const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); - - if (acc[paymentType]) { - acc[paymentType] += amount; - } else { - acc[paymentType] = amount; - } - - return acc; - }, {}); - 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', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - ]; - - const chunkSize = PageSize == "A5" ? 8 : 11; - let dataSource = []; - - if (GlobaldummyData || TakeawayData?.length > 0) { - dataSource = GlobaldummyData ? products : TakeawayData; - } else if (DineInData?.length > 0) { - dataSource = DineInData; - } - - // 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 isEditedBill = PaymentStatus?.some((payment) => { + const type = payment?.AdjustmentType?.toLowerCase(); return ( - <> - {FormatTheme ? -
    - {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    0 ? ' print-page-break' : ''}`} - style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: isMobile ? "295mm" : FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> - - - {/*
    */} -
    -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {/*
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    */} -
    - {(GlobaldummyData && GlobalLogo) ? image : null} - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    -
    {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?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? 'Cash' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    - -
    -
    -
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    -
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    -
    - -
    -
    - -
    -
    - - {(TakeawayData?.length > 0 || GlobaldummyData) && - <> - {takeAwayPreference &&
    TakeAway
    } -
    - - - - - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - - - {dataChunk?.map((item, index) => ( - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && - : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - ))} - -
    SSItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) - - ))} - -
    - :
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    )} -
    {item?.HSN}{item?.HSN}{item?.SalesQty}{item?.SalesQty}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - } - {(DineInData?.length > 0 && dinePreference) && - <> -
    Dine In
    - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - - - {dataChunk?.map((item, index) => ( - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && - : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - ))} - -
    S.NoS.NOItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {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?.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}{item?.HSN}{item?.SalesQty}{item?.SalesQty}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - } -
    -
    - - - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - <> -
    -
    -
    Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    Qty : {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off : {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } -
    -
    - {(table2Data?.OrderType === "E") ? '' :
    - - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -
    - --------- GST Breakup Details -----------
    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - - } -
    } -
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    Take Away : ₹{Number(TakeawayTotal).toFixed(2)}
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    Dine In: ₹{Number(DineInTotal).toFixed(2)}
    - } -
    Amount : ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - -
    -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} - {(GlobaldummyData && GlobalCashierName) && -
    -
    Cashier : Cashier Name
    -
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    -
    Cashier : {CashierName}
    -
    - } - {GlobaldummyData && -
    -
    Customer : Customer Name
    -
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    -
    Customer : {table2Data?.CustSuppName}
    -
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet && -
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - : (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    } - -
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - -
    -
    ) - } -
    } - - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {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
    -
    - - } - - } -
    - ))} - - {shouldFooterBeOnNewPage && FormatTheme && -
    -
    - <> -
    -
    -
    Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    Qty : {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off : {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } -
    -
    - {(table2Data?.OrderType === "E") ? '' :
    - - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -
    - --------- GST Breakup Details -----------
    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - - } -
    } -
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    Take Away : ₹{Number(TakeawayTotal).toFixed(2)}
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    Dine In: ₹{Number(DineInTotal).toFixed(2)}
    - } -
    Amount : ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - -
    -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} - {(GlobaldummyData && GlobalCashierName) && -
    -
    Cashier : Cashier Name
    -
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    -
    Cashier : {CashierName}
    -
    - } - {GlobaldummyData && -
    -
    Customer : Customer Name
    -
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    -
    Customer : {table2Data?.CustSuppName}
    -
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet && -
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - : (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    } - -
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - -
    -
    ) - } -
    } - - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {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
    -
    - - } - -
    -
    - } -
    - - - : -
    -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    -
    - {(GlobaldummyData && GlobalLogo) ? image : null} - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    - -
    {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?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    )} - {(!estimatePrintHeader && table2Data?.OrderType === "E") &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } -
    - -
    -
    -
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    -
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    -
    - -
    - -
    - - - - {(TakeawayData?.length > 0 || GlobaldummyData) && - <> - {takeAwayPreference &&
    TakeAway
    } -
    - - - - - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - - - {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => ( - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && - : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - ))} - -
    S.NoS.NoItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount} PCS {item.ParcelQty} PACK ({item.ParcelType}) - - ))} -
    - :
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    )} -
    {item?.HSN}{item?.HSN}{item?.SalesQty}{item?.SalesQty}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - } - {(DineInData?.length > 0 && dinePreference) && - <> -
    Dine In
    - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - - - {(GlobaldummyData ? products : DineInData)?.map((item, index) => ( - - {GlobaldummyData ? GlobalSlNo && : SLNO == true && } - {GlobaldummyData ? GlobalItem && - : Item == true && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode == true && } - {GlobaldummyData ? GlobalQuantity && : Quantity == true && } - {GlobaldummyData ? GlobalMRP && : MRP == true && } - {GlobaldummyData ? GlobalRate && : Rate == true && } - {GlobaldummyData ? GlobalDiscount && : Discount == true && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalAmount && : Amount == true && } - - ))} - -
    SSItemItemHSNHSNQty{ WeightasKg ?'Qty/Kg' :'Qty'}MRPMRPRateRateDis Dis Tax % Tax % AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
    {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}{item?.HSN}{item?.SalesQty}{item?.SalesQty}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - } -
    - -
    -
    -
    Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    Qty : {GlobaldummyData ? '9' : totalQuantity}
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) &&
    Off : {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    } -
    -
    - {(table2Data?.OrderType === "E") ? '' :
    - - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -
    - --------- GST Breakup Details -----------
    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - - } -
    } -
    - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    Take Away : ₹{Number(TakeawayTotal).toFixed(2)}
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    Dine In: ₹{Number(DineInTotal).toFixed(2)}
    - } -
    Amount : ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - -
    -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} - {(GlobaldummyData && GlobalCashierName) && -
    -
    Cashier : Cashier Name
    -
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    -
    Cashier : {CashierName}
    -
    - } - {GlobaldummyData && -
    -
    Customer : Customer Name
    -
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    -
    Customer : {table2Data?.CustSuppName}
    -
    - } - - - {table2Data?.BookingTypeName == 'Dine In' && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) && -
    - Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} -
    } - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet && -
    - QRcode -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    - : (Qrcodet && paymentTypeUPI) && -
    - -
    Scan to Pay
    -
    ₹{GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    } -
    } - -
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - -
    -
    ) - } -
    } - - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {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
    -
    - - } -
    - } - + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ); + + let TermsAndConditions = printDatas?.TermsandConditions; + let SignatureImg = printDatas?.Signature; + let Notestext = printDatas?.Notes; + let BillName = printDatas?.PrintHdrName; + let FormatTheme = printDatas?.PrintType == 'S' ? true : false; + let PageSize = printDatas?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + const PackageDetails = table2Data?.PackageDtl; + + 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 formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; + const TakeawayData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' + ); + const DineInData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' + ); + + const TakeawayTotal = TakeawayData?.reduce( + (accumulator, currentValue) => accumulator + currentValue.TotalAmt, + 0 + ); + const DineInTotal = DineInData?.reduce( + (accumulator, currentValue) => accumulator + currentValue.TotalAmt, + 0 + ); + const aggregatedPayments = PaymentStatusSuccess?.reduce( + (acc, paymentdata) => { + const paymentType = paymentdata?.PaymentTypeName; + const amount = Number(paymentdata?.Amount); + + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } + + return acc; + }, + {} + ); + 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.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 18, + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 40, + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + ]; + + const chunkSize = PageSize == 'A5' ? 8 : 11; + let dataSource = []; + + if (GlobaldummyData || TakeawayData?.length > 0) { + dataSource = GlobaldummyData ? products : TakeawayData; + } else if (DineInData?.length > 0) { + dataSource = DineInData; + } + + // 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); + + return ( + <> + {FormatTheme ? ( +
    + {paginatedChunks.map((dataChunk, chunkIndex) => ( +
    0 ? ' print-page-break' : ''}` + } + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: isMobile + ? '295mm' + : FormatTheme + ? PageSize == 'A5' + ? '170mm' + : '257mm' + : '', + }} + key={chunkIndex} + > + {/*
    */} +
    +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {/*
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    */} +
    + {GlobaldummyData && GlobalLogo ? ( + image + ) : null} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    + {' '} + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    +
    +
    + {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?.OrderType === 'E' && ( +
    + {' '} + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? 'Cash' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + {' '} + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    + +
    +
    +
    + Bill No : + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    +
    +
    + {GlobaldummyData ? formattedDate : Date1} +
    +
    +
    + +
    +
    + +
    +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( + <> + {takeAwayPreference && ( +
    + TakeAway +
    + )} +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + + + {dataChunk?.map((item, index) => ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + ))} + +
    SSItemItemHSNHSNQty + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateDis Dis Tax % Tax % + Amt + + Amt +
    + {index + 1} + + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +
    + {item?.HSN} + + {item?.HSN} + + {item?.SalesQty} + + {item?.SalesQty} + + {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    +
    + + )} + {DineInData?.length > 0 && dinePreference && ( + <> +
    + Dine In +
    + +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + + + {dataChunk?.map((item, index) => ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + ))} + +
    S.NoS.NOItemItemHSNHSNQty + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateDis Dis Tax % Tax % + Amt + + Amt +
    + {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?.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} + + {item?.HSN} + + {item?.SalesQty} + + {item?.SalesQty} + + {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    +
    + + )} +
    +
    + + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> +
    +
    +
    + Items :{' '} + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    + Qty : {GlobaldummyData ? '9' : totalQuantity} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + Off :{' '} + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} +
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +
    + --------- GST Breakup Details ----------- +
    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed( + 2 + )} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed( + 2 + )} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} +
    +
    + + )} +
    + )} +
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + Take Away : ₹{Number(TakeawayTotal).toFixed(2)} +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + Dine In: ₹{Number(DineInTotal).toFixed(2)} +
    + )} +
    + Amount : ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + +
    + + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} + +
    +
    +
    + )} +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + )} + + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} + {GlobaldummyData && GlobalCashierName && ( +
    +
    + Cashier : Cashier Name +
    +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    +
    + Cashier : {CashierName} +
    +
    + )} + {GlobaldummyData && ( +
    +
    + Customer : Customer Name +
    +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    +
    + Customer : {table2Data?.CustSuppName} +
    +
    + )} + + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + )} + +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

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

    + {Notestext} +

    + +
    +
    + )} +
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {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 +
    +
    + + )} + + )} +
    + ))} + + {shouldFooterBeOnNewPage && FormatTheme && ( +
    +
    + <> +
    +
    +
    + Items :{' '} + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    + Qty : {GlobaldummyData ? '9' : totalQuantity} +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    + Off :{' '} + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} +
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +
    + --------- GST Breakup Details ----------- +
    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} +
    +
    + + )} +
    + )} +
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + Take Away : ₹{Number(TakeawayTotal).toFixed(2)} +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + Dine In: ₹{Number(DineInTotal).toFixed(2)} +
    + )} +
    + Amount : ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + +
    + + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + )} + + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} + {GlobaldummyData && GlobalCashierName && ( +
    +
    + Cashier : Cashier Name +
    +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    +
    + Cashier : {CashierName} +
    +
    + )} + {GlobaldummyData && ( +
    +
    + Customer : Customer Name +
    +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    +
    + Customer : {table2Data?.CustSuppName} +
    +
    + )} + + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain :{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + )} + +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

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

    + {Notestext} +

    + +
    +
    + )} +
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {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 +
    +
    + + )} + +
    +
    + )} +
    + ) : ( +
    +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {GlobaldummyData && GlobalLogo ? ( + image + ) : null} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    + {' '} + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    +
    + +
    + {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?.OrderType === 'E' && ( +
    + {' '} + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' && ( +
    + {' '} + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} +
    + +
    +
    +
    + Bill No : + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    +
    +
    + {GlobaldummyData ? formattedDate : Date1} +
    +
    +
    + +
    + +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( + <> + {takeAwayPreference && ( +
    + TakeAway +
    + )} +
    + + + + {GlobaldummyData + ? GlobalSlNo && + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item == true && } + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + + + {(GlobaldummyData ? products : TakeawayData)?.map( + (item, index) => ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + ) + )} + +
    S.NoS.No + Item + ItemHSNHSNQty + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateDis Dis Tax % Tax % Amt + Amt +
    + {index + 1} + + {index + 1} + {item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +
    + {item?.HSN} + + {item?.HSN} + + {item?.SalesQty} + + {item?.SalesQty} + + {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    +
    + + )} + {DineInData?.length > 0 && dinePreference && ( + <> +
    + Dine In +
    + +
    + + + + {GlobaldummyData + ? GlobalSlNo && + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + + + {(GlobaldummyData ? products : DineInData)?.map( + (item, index) => ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO == true && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item == true && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode == true && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity == true && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP == true && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate == true && ( + + )} + {GlobaldummyData + ? GlobalDiscount && + : Discount == true && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount == true && ( + + )} + + ) + )} + +
    SSItemItemHSNHSNQty + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPRateRateDis Dis Tax % Tax % + Amt + + Amt +
    + {index + 1} + + {index + 1} + {item?.ProdName} +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return
    {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} + + {item?.HSN} + + {item?.SalesQty} + + {item?.SalesQty} + + {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    +
    + + )} +
    + +
    +
    +
    + Items : {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    + Qty : {GlobaldummyData ? '9' : totalQuantity} +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    + Off :{' '} + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    + )} +
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +
    + --------- GST Breakup Details ----------- +
    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed( + 2 + )} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed( + 2 + )} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )} +
    +
    + + )} +
    + )} +
    + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    + Take Away : ₹{Number(TakeawayTotal).toFixed(2)} +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    + Dine In: ₹{Number(DineInTotal).toFixed(2)} +
    + )} +
    + Amount : ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + +
    + + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + )} + + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} +

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} +

    + ) : null} +
    + )} + {GlobaldummyData && GlobalCashierName && ( +
    +
    + Cashier : Cashier Name +
    +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    +
    + Cashier : {CashierName} +
    +
    + )} + {GlobaldummyData && ( +
    +
    + Customer : Customer Name +
    +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    +
    + Customer : {table2Data?.CustSuppName} +
    +
    + )} + + {table2Data?.BookingTypeName == 'Dine In' && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain : {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + )} + +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    + +
    +
    + )} +
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {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 PrintStyle7; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx index 1838949..4a347d7 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle8.jsx @@ -1,1517 +1,4771 @@ 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, - GlobalprintCashierName, - GlobalprintLogo, - GlobalprintCredit, - GlobalprintTax, + extractLastNumber, + extractLastNumberOrderId, +} from '../../../../Services/Others'; +import { + GlobalprintSlNo, + GlobalprintItem, + GlobalprintMRP, + GlobalprintDiscount, + GlobalprintQuantity, + GlobalprintRate, + GlobalprintAmount, + GlobalprintHsnCode, + GlobalprintQrcodet, + GlobalPritdummyData, + changeReprintDataFound, + GloabalFieldDetails, + GlobalprintSignature, + GlobalprinttermsAndConditions, + GlobalSignatureImage, + Globalnotes, + GlobalthemeFormat, + GlobalBillName, + GlobalprintCashierName, + GlobalprintLogo, + GlobalprintCredit, + GlobalprintTax, } from '../../../../Features/ThemeChange/ThemeChange'; -import Logo from '../../../../Images/Logo.jpg' -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import Logo from '../../../../Images/Logo.jpg'; +import { + GlobalUpiIDprint, + PreferenceData, +} 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'; import { settingDataSelector } from '../../../../Features/PreferenceMaster/PreferenceMaster'; -const Printstyle8 = ({ index, ExtraChargeTotal, Date1, totalQuantityFilter, BranchAddress, BranchCity, BranchZip, CashierName, totalQuantity, OrderDetailGST, OrderDetailIGST, - OrderDetailVAT, table2Data, PaymentStatus, PrintGreeting, base64Image, PrintLogo, printDatas, isPdf, sportsAppPreference, SalesModePref, MembershipApplied = null }) => { +const Printstyle8 = ({ + index, + ExtraChargeTotal, + Date1, + totalQuantityFilter, + BranchAddress, + BranchCity, + BranchZip, + CashierName, + totalQuantity, + OrderDetailGST, + OrderDetailIGST, + OrderDetailVAT, + table2Data, + PaymentStatus, + PrintGreeting, + base64Image, + PrintLogo, + printDatas, + isPdf, + sportsAppPreference, + SalesModePref, + MembershipApplied = null, +}) => { + const dispatch = useDispatch(); + const GlobalUpiID = useSelector(GlobalUpiIDprint); + const FieldDetails = useSelector(GloabalFieldDetails); + const SLNO = FieldDetails?.['Sl.No']; + const Item = FieldDetails?.['Item']; + const MRP = FieldDetails?.['MRP']; + const Discount = FieldDetails?.['Discount']; + const Tax = FieldDetails?.['Tax']; + const Quantity = FieldDetails?.['Quantity']; + const Rate = FieldDetails?.['Rate']; + const Amount = FieldDetails?.['Amount']; + const HsnCode = FieldDetails?.['HsnCode']; + const Qrcodet = FieldDetails?.['Qrcode']; + const CashierNameField = FieldDetails?.['CashierName']; + const LogoField = FieldDetails?.['Logo']; + const CreditDetails = FieldDetails?.['Credit details']; + const WeightasKg = FieldDetails?.['Weight']; + const GlobalSlNo = useSelector(GlobalprintSlNo); + const GlobalItem = useSelector(GlobalprintItem); + const GlobalMRP = useSelector(GlobalprintMRP); + const GlobalDiscount = useSelector(GlobalprintDiscount); + const GlobalTax = useSelector(GlobalprintTax); + 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); + const appPreferences = useSelector(ApplicationPreferences); + const GlobalCashierName = useSelector(GlobalprintCashierName); + const GlobalLogo = useSelector(GlobalprintLogo); + const GlobalCredit = useSelector(GlobalprintCredit); + const SettingData = useSelector(PreferenceData); + const estimatePrintHeader = + SettingData?.[0]?.SettingDtlDetails?.find( + (setting) => + setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' + )?.SettingValue === 'Y'; + const bookingTypePreference = appPreferences?.find( + (preference) => preference?.PreferredCatName === 'Booking Type' + )?.PreferenceCatDetails; + const dinePreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'dine in' && + type?.PreferredStatus === 'Y' + ); + const takeAwayPreference = bookingTypePreference?.find( + (type) => + type?.PreferredSubCatName?.toLowerCase() === 'take away' && + type?.PreferredStatus === 'Y' + ); + const paymentTypeUPI = PaymentStatus?.find( + (ps) => ps.PaymentTypeName === 'UPI' + ); - const dispatch = useDispatch(); - const GlobalUpiID = useSelector(GlobalUpiIDprint) - const FieldDetails = useSelector(GloabalFieldDetails); - const SLNO = FieldDetails?.["Sl.No"]; - const Item = FieldDetails?.["Item"]; - const MRP = FieldDetails?.["MRP"]; - const Discount = FieldDetails?.["Discount"]; - const Tax = FieldDetails?.["Tax"]; - const Quantity = FieldDetails?.["Quantity"]; - const Rate = FieldDetails?.["Rate"]; - const Amount = FieldDetails?.["Amount"]; - const HsnCode = FieldDetails?.["HsnCode"]; - const Qrcodet = FieldDetails?.["Qrcode"]; - const CashierNameField = FieldDetails?.["CashierName"]; - const LogoField = FieldDetails?.["Logo"]; - const CreditDetails = FieldDetails?.["Credit details"]; - const WeightasKg = FieldDetails?.['Weight']; - const GlobalSlNo = useSelector(GlobalprintSlNo); - const GlobalItem = useSelector(GlobalprintItem); - const GlobalMRP = useSelector(GlobalprintMRP); - const GlobalDiscount = useSelector(GlobalprintDiscount); - const GlobalTax = useSelector(GlobalprintTax); - 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) - const appPreferences = useSelector(ApplicationPreferences); - const GlobalCashierName = useSelector(GlobalprintCashierName); - const GlobalLogo = useSelector(GlobalprintLogo); - const GlobalCredit = useSelector(GlobalprintCredit); - const SettingData = useSelector(PreferenceData); - const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find(setting => setting?.SettingIdName?.toLowerCase() === 'estimateprintheader')?.SettingValue === 'Y' - const bookingTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Booking Type')?.PreferenceCatDetails - const dinePreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "dine in" && type?.PreferredStatus === 'Y') - const takeAwayPreference = bookingTypePreference?.find((type) => type?.PreferredSubCatName?.toLowerCase() === "take away" && type?.PreferredStatus === 'Y') - const paymentTypeUPI = PaymentStatus?.find((ps) => ps.PaymentTypeName === "UPI") - - console.log(GlobalDiscount, Discount, "Discount"); - - let TermsAndConditions = printDatas?.TermsandConditions - let SignatureImg = printDatas?.Signature - let Notestext = printDatas?.Notes - let BillName = printDatas?.PrintHdrName - let FormatTheme = printDatas?.PrintType == "S" ? true : false - let PageSize = printDatas?.PageSize; - const Signature = FieldDetails?.["signature"]; - const TermsnAdCondition = FieldDetails?.["terms&conditions"]; - - let PaymentStatusSuccess = PaymentStatus?.filter(ps => ps.PaymentStatus === "S") - const keysLength = Object.keys(table2Data ?? {}).length; - if (keysLength > 0) { - dispatch(changeReprintDataFound(true)); - } - const PackageDetails = table2Data?.PackageDtl; - 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 formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; - - const TakeawayData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "takeaway") - const DineInData = table2Data?.productDetails?.filter(item => item.BookingTypeName?.toLowerCase() === "dine in") - - const TakeawayTotal = TakeawayData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, - ); - const DineInTotal = DineInData?.reduce( - (accumulator, currentValue) => accumulator + currentValue.TotalAmt, - 0, - ); - - const aggregatedPayments = PaymentStatusSuccess?.reduce((acc, paymentdata) => { - const paymentType = paymentdata?.PaymentTypeName; - const amount = Number(paymentdata?.Amount); - - if (acc[paymentType]) { - acc[paymentType] += amount; - } else { - acc[paymentType] = amount; - } - - return acc; - }, {}); - 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', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 2', Rate: 300.00, SalesQty: 1, MRP: 350, TotalAmt: 300, discount: 0, HSN: '02', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - { ProdName: 'ITEM 3', Rate: 200.00, SalesQty: 1, MRP: 250, TotalAmt: 200, discount: 0, HSN: '03', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 4', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '04', Size: 250, UomName: 'g', ProdTaxPercentage: 18 }, - { ProdName: 'ITEM 5', Rate: 30.00, SalesQty: 1, MRP: 50, TotalAmt: 30, discount: 0, HSN: '05', Size: 250, UomName: 'g', ProdTaxPercentage: 40 }, - { ProdName: 'ITEM 6', Rate: 130.00, SalesQty: 1, MRP: 150, TotalAmt: 130, discount: 0, HSN: '06', Size: 250, UomName: 'g', ProdTaxPercentage: 0 }, - { ProdName: 'ITEM 7', Rate: 230.00, SalesQty: 1, MRP: 250, TotalAmt: 230, discount: 0, HSN: '08', Size: 250, UomName: 'g', ProdTaxPercentage: 5 }, - ]; - - console.log(printDatas, "printDatasjk") - const chunkSize = PageSize == "A5" ? 10 : 16; - let dataSource = []; - - if (GlobaldummyData || TakeawayData?.length > 0) { - dataSource = GlobaldummyData ? products : TakeawayData; - } else if (DineInData?.length > 0) { - dataSource = DineInData; - } - - // 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); + console.log(GlobalDiscount, Discount, 'Discount'); + const isEditedBill = PaymentStatus?.some((payment) => { + const type = payment?.AdjustmentType?.toLowerCase(); return ( - <> - {FormatTheme ? -
    - {paginatedChunks.map((dataChunk, chunkIndex) => ( -
    0 ? ' print-page-break' : ''}`} - style={{ display: "flex", flexDirection: "column", justifyContent: ((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme ? "space-between" : "", height: isMobile ? "295mm" : FormatTheme ? PageSize == "A5" ? '170mm' : "257mm" : "", }} key={chunkIndex}> - - - {/*
    */} -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {/*

    {table2Data?.BrName}

    */} - -
    - {(GlobalLogo && GlobaldummyData) ? image : null} - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    - - -
    - {GlobaldummyData ? - 'BranchAddress, Town- 635XXX City - State' : - (BranchAddress || '') + (BranchCity ? (BranchAddress && BranchCity ? '-' : '') + BranchCity : '') + (BranchZip ? (BranchCity && BranchZip ? '-' : '') + BranchZip : '')} -
    -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    -
    )} - {table2Data?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? 'Cash' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - -
    -
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    - -
    -
    -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && - <> - {takeAwayPreference &&
    TakeAway
    } - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - - - {dataChunk?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} - -
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {chunkIndex * chunkSize + index + 1}{chunkIndex * chunkSize + index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {( - PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount}PCS{item.ParcelQty}PACK({item.ParcelType}) - - ))} -
    - :
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    )} -
    {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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - - } - {(DineInData?.length > 0 && dinePreference) && - <> -
    Dine In
    - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - - - {dataChunk?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} - -
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {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?.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}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - - } -
    - - {((chunkIndex === paginatedChunks.length - 1) && (!shouldFooterBeOnNewPage)) && FormatTheme && - - <> -
    -
    -
    -
    Items
    -
    :
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    -
    Qty
    -
    :
    -
    {GlobaldummyData ? '9' : totalQuantity}
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    Off
    -
    :
    -
    {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    -
    Take Away
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(TakeawayTotal).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    -
    Dine In
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)}
    -
    - } -
    -
    Amount
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    -
    - -
    - - {(table2Data?.OrderType === "E") ? '' :
    -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - - } -
    -
    } - -
    - -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    -
    - - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} -
    - -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} -
    - } - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} -
    - } - - - {(table2Data?.BookingTypeName === "Dine In" && dinePreference) && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) &&
    Captain: {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } -
    - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet &&
    -
    - 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)}
    -
    } -
    } -
    - -
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - -
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - -
    -
    ) - } -
    } - - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {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 -
    - } - - } -
    - ))} - - {shouldFooterBeOnNewPage && FormatTheme && -
    -
    - <> -
    -
    -
    -
    Items
    -
    :
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    -
    Qty
    -
    :
    -
    {GlobaldummyData ? '9' : totalQuantity}
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    Off
    -
    :
    -
    {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    -
    Take Away
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(TakeawayTotal).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    -
    Dine In
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)}
    -
    - } -
    -
    Amount
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    -
    - -
    - - {(table2Data?.OrderType === "E") ? '' :
    -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - - } -
    -
    } - -
    - -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    -
    - - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) - )} -
    - -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} -
    - ))} - - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    - - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} -
    - } - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} -
    - } - {(table2Data?.BookingTypeName === "Dine In" && dinePreference) && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) &&
    Captain: {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } -
    - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet &&
    -
    - 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)}
    -
    } -
    } -
    - -
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } - -
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    - -
    -
    ) : - Notestext && (
    -

    {Notestext}

    - -
    -
    ) - } -
    } - - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {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 -
    - } - -
    -
    - } - + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ); + + let TermsAndConditions = printDatas?.TermsandConditions; + let SignatureImg = printDatas?.Signature; + let Notestext = printDatas?.Notes; + let BillName = printDatas?.PrintHdrName; + let FormatTheme = printDatas?.PrintType == 'S' ? true : false; + let PageSize = printDatas?.PageSize; + const Signature = FieldDetails?.['signature']; + const TermsnAdCondition = FieldDetails?.['terms&conditions']; + + let PaymentStatusSuccess = PaymentStatus?.filter( + (ps) => ps.PaymentStatus === 'S' + ); + const keysLength = Object.keys(table2Data ?? {}).length; + if (keysLength > 0) { + dispatch(changeReprintDataFound(true)); + } + const PackageDetails = table2Data?.PackageDtl; + 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 formattedDate = `${day}-${monthNames[monthIndex]}-${year}`; + + const TakeawayData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'takeaway' + ); + const DineInData = table2Data?.productDetails?.filter( + (item) => item.BookingTypeName?.toLowerCase() === 'dine in' + ); + + const TakeawayTotal = TakeawayData?.reduce( + (accumulator, currentValue) => accumulator + currentValue.TotalAmt, + 0 + ); + const DineInTotal = DineInData?.reduce( + (accumulator, currentValue) => accumulator + currentValue.TotalAmt, + 0 + ); + + const aggregatedPayments = PaymentStatusSuccess?.reduce( + (acc, paymentdata) => { + const paymentType = paymentdata?.PaymentTypeName; + const amount = Number(paymentdata?.Amount); + + if (acc[paymentType]) { + acc[paymentType] += amount; + } else { + acc[paymentType] = amount; + } + + return acc; + }, + {} + ); + 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.0, + SalesQty: 2, + MRP: 100, + TotalAmt: 176, + discount: 0, + HSN: '01', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 2', + Rate: 300.0, + SalesQty: 1, + MRP: 350, + TotalAmt: 300, + discount: 0, + HSN: '02', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + { + ProdName: 'ITEM 3', + Rate: 200.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 200, + discount: 0, + HSN: '03', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 4', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '04', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 18, + }, + { + ProdName: 'ITEM 5', + Rate: 30.0, + SalesQty: 1, + MRP: 50, + TotalAmt: 30, + discount: 0, + HSN: '05', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 40, + }, + { + ProdName: 'ITEM 6', + Rate: 130.0, + SalesQty: 1, + MRP: 150, + TotalAmt: 130, + discount: 0, + HSN: '06', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 0, + }, + { + ProdName: 'ITEM 7', + Rate: 230.0, + SalesQty: 1, + MRP: 250, + TotalAmt: 230, + discount: 0, + HSN: '08', + Size: 250, + UomName: 'g', + ProdTaxPercentage: 5, + }, + ]; + + console.log(printDatas, 'printDatasjk'); + const chunkSize = PageSize == 'A5' ? 10 : 16; + let dataSource = []; + + if (GlobaldummyData || TakeawayData?.length > 0) { + dataSource = GlobaldummyData ? products : TakeawayData; + } else if (DineInData?.length > 0) { + dataSource = DineInData; + } + + // 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); + + return ( + <> + {FormatTheme ? ( +
    + {paginatedChunks.map((dataChunk, chunkIndex) => ( +
    0 ? ' print-page-break' : ''}` + } + style={{ + display: 'flex', + flexDirection: 'column', + justifyContent: + chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme + ? 'space-between' + : '', + height: isMobile + ? '295mm' + : FormatTheme + ? PageSize == 'A5' + ? '170mm' + : '257mm' + : '', + }} + key={chunkIndex} + > + {/*
    */} +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {/*

    {table2Data?.BrName}

    */} + +
    + {GlobalLogo && GlobaldummyData ? ( + image + ) : null} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} +
    +
    + +
    + {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +
    +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} +
    +
    + )} + {table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? 'Cash' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + +
    +
    + Bill No : + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    + {GlobaldummyData ? formattedDate : Date1} +
    - : -
    - {((!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {/*

    {table2Data?.BrName}

    */} -
    - {(GlobalLogo && GlobaldummyData) ? image : null} - {(base64Image && (PrintLogo?.SettingValue === "Y" || LogoField)) ? image : null} -
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    -
    -
    - {GlobaldummyData ? - 'BranchAddress, Town- 635XXX City - State' : - (BranchAddress || '') + (BranchCity ? (BranchAddress && BranchCity ? '-' : '') + BranchCity : '') + (BranchZip ? (BranchCity && BranchZip ? '-' : '') + BranchZip : '')} -
    -
    Mobile : +91 {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
    -
    )} - {table2Data?.OrderType === "E" &&
    Estimate {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - - {table2Data?.OrderType === "E" ? "" :
    {GlobaldummyData ? GlobalBilltext ? GlobalBilltext : "Cash" + ' Bill' : BillName ? BillName : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' : ""} {SalesModePref?.SettingValue == 'Y' && `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`}
    } - -
    -
    Bill No :{GlobaldummyData ? '553' : table2Data?.OrderId && extractLastNumberOrderId(table2Data?.OrderId, table2Data?.FYStatus)}
    -
    {GlobaldummyData ? formattedDate : Date1}
    -
    - -
    - {(TakeawayData?.length > 0 || GlobaldummyData) && - <> - {takeAwayPreference &&
    TakeAway
    } - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - - - {(GlobaldummyData ? products : TakeawayData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} - -
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    - {(PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId).length > 0 ? -
    - {PackageDetails?.filter((pkg) => pkg.ProdId === item.ProdId)?.map((item, index) => ( - - {item.ParcelCount}PCS{item.ParcelQty}PACK({item.ParcelType}) - - ))} -
    - :
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"})
    )} -
    {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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - - } - {(DineInData?.length > 0 && dinePreference) && - <> -
    Dine In
    - -
    - - - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - - - {(GlobaldummyData ? products : DineInData)?.map((item, index) => { - return ( - - {GlobaldummyData ? GlobalSlNo && : SLNO && } - {GlobaldummyData ? GlobalItem && : Item && } - {GlobaldummyData ? GlobalHsnCode && : HsnCode && } - {GlobaldummyData ? GlobalMRP && : MRP && } - {GlobaldummyData ? GlobalRate && : Rate && } - {GlobaldummyData ? GlobalDiscount && : Discount && } - {GlobaldummyData ? GlobalTax && : (Tax && table2Data?.OrderType !== 'E') && } - {GlobaldummyData ? GlobalQuantity && : Quantity && } - {GlobaldummyData ? GlobalAmount && : Amount && } - - ) - })} - -
    S.NoS.NoDisDesHSNHSNMRPMRPRateRt(%)(%)Tax %Tax %Qty{ WeightasKg ?'Qty/Kg' :'Qty'}AmtAmt
    {index + 1}{index + 1}{item?.ProdName} -
    {item?.ProdName}
    -
    ({item?.Size ? item?.Size : "1"} {item?.SinglePc == 'Y' ? 'PCS' : item?.Type != "C" ? item?.UomName : "COMBO"}){item?.BrandName !== null ? item?.BrandName : ""}  - {item?.ProductIdentifierDtls?.length > 0 ? (item?.ProductIdentifierDtls?.filter((items) => !(items.SerialNumber == "" || items.SerialNumber == null)) - ?.map(a => { return (
    {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}{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?.ProdTaxPercentage}{item?.ProdTaxPercentage || 0}{item?.SalesQty}{item?.SalesQty}{item?.TotalAmt}{item?.Type != "C" ? item?.TotalAmt - item?.OfferAmt || 0 : item?.TotalAmt - item?.OfferValue || 0}
    -
    - - } -
    -
    -
    -
    Items
    -
    :
    -
    {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    -
    -
    -
    Qty
    -
    :
    -
    {GlobaldummyData ? '9' : totalQuantity}
    -
    - {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && -
    -
    Off
    -
    :
    -
    {GlobaldummyData ? '10' : Number(TotalOfferAmount + table2Data?.OverallDisc).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && takeAwayPreference) && -
    -
    Take Away
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(TakeawayTotal).toFixed(2)}
    -
    - } - {(DineInData?.length > 0 && TakeawayData?.length > 0 && dinePreference) && -
    -
    Dine In
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)}
    -
    - } -
    -
    Amount
    -
    :
    -
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}
    -
    -
    - -
    - - {(table2Data?.OrderType === "E") ? '' :
    -
    - {((OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && (table2Data?.NetAmount !== 0) && - <> -
    - -
    -

    - --------- GST Breakup Details -----------

    - {(OrderDetailGST?.length > 0 && OrderDetailGST?.[0]?.TaxAmt > 0) && - - - - - - - - - - {OrderDetailGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - CGST - - SGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - } - - {(OrderDetailIGST?.length > 0 && OrderDetailIGST?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailIGST?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - IGST - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - {(OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0) && - <> -
    - - - - - - - - - - {OrderDetailVAT?.map((item) => - - - - - - - - ) - } -
    - - Taxable Amount - - VAT - - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - {Number(item.TotalAmt).toFixed(2)}
    - - } - -
    -
    - - - } -
    -
    } - -
    - -
    -
    {PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : "Split"}  Payment :  {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/-
    -
    -
    - {GlobaldummyData ? ( - GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - ) : ( - CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === "Credit" && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    Advance Amount:{table2Data.CustomerDetails[0].OldCreditBal}

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    Opening Balance: {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)}

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    Current Advance Amount: {table2Data.CustomerDetails[0].CurrentCreditBal}

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    Current Balance Amount: {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)}

    - ) : null} -
    - ) +
    +
    +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( + <> + {takeAwayPreference && ( +
    + TakeAway +
    )} -
    -
    - {PaymentStatusSuccess?.length > 1 && - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map((paymentType) => ( -
    - {paymentType}: {aggregatedPayments[paymentType].toFixed(2)} +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + + + {dataChunk?.map((item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode && } + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + })} + +
    + S.No + + S.No + DisDes + HSN + + HSN + + MRP + + MRP + + Rate + + Rt + + (%) + + (%) + + Tax % + + Tax % + + Qty + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + Amt + + Amt +
    + {chunkIndex * chunkSize + index + 1} + + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount}PCS + {item.ParcelQty}PACK( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +
    {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.SalesQty} + + {item?.SalesQty} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    +
    + + )} + {DineInData?.length > 0 && dinePreference && ( + <> +
    + Dine In +
    + +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + + + {dataChunk?.map((item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode && } + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + })} + +
    + S.No + + S.No + DisDes + HSN + + HSN + + MRP + + MRP + + Rate + + Rt + + (%) + + (%) + + Tax % + + Tax % + + Qty + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + Amt + + Amt +
    + {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?.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(',')} +
    + ); + }) + : ''}
    - ))} - - } - {GlobaldummyData && GlobalCashierName && -
    Cashier : Cashier Name
    +
    {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.SalesQty} + + {item?.SalesQty} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || + 0} +
    +
    + + )} +
    - } - {CashierName && CashierName !== undefined && CashierName !== null && !GlobaldummyData && CashierNameField && -
    Cashier : {CashierName} -
    - } - {GlobaldummyData && -
    Customer : Customer Name
    - - } - {table2Data?.CustSuppName && table2Data?.CustSuppName !== undefined && table2Data?.CustSuppName !== null && !GlobaldummyData && -
    Customer : {table2Data?.CustSuppName} -
    - } - - - {table2Data?.BookingTypeName === "Dine In" && dinePreference && (table2Data?.SalesTableLinkDetails?.[0]?.WaiterName) &&
    Captain: {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName}
    } + {chunkIndex === paginatedChunks.length - 1 && + !shouldFooterBeOnNewPage && + FormatTheme && ( + <> +
    +
    +
    +
    Items
    +
    :
    +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length}
    +
    +
    +
    Qty
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    +
    Take Away
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(TakeawayTotal).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    +
    Dine In
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(DineInTotal).toFixed(2)} +
    +
    + )} +
    +
    Amount
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    +
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalQrcodet &&
    +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed( + 2 + )} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed( + 2 + )} + + {Number( + item.TotalAmt + ).toFixed(2)} +
    + + )} +
    +
    + + )} +
    +
    + )} +
    + +
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {( + lastTransaction?.BeforeAdjustment || 0 + ).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {( + lastTransaction?.AfterAdjustment || 0 + ).toFixed(2)} + +
    +
    +
    + )} + +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    +
    + + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} + + )} + {GlobaldummyData && GlobalCashierName && ( +
    + {' '} + Cashier : Cashier Name +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + + {table2Data?.BookingTypeName === 'Dine In' && + dinePreference && + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName && ( +
    + Captain:{' '} + { + table2Data?.SalesTableLinkDetails?.[0] + ?.WaiterName + } +
    + )} +
    + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    +
    + 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 + )} +
    +
    + )} +
    + )} +
    + +
    + Your Order No : + {GlobaldummyData + ? '01' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && (
    - image +

    + Notes : 10 days Return policy +

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

    + {Notestext} +

    + +
    +
    + )} +
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {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 +
    + )} + + )} +
    + ))} + + {shouldFooterBeOnNewPage && FormatTheme && ( +
    +
    + <> +
    +
    +
    +
    Items
    +
    :
    +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    +
    +
    Qty
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    +
    Take Away
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(TakeawayTotal).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    +
    Dine In
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(DineInTotal).toFixed(2)} +
    +
    + )} +
    +
    Amount
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    +
    + +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} +
    +
    + + )} +
    +
    + )} +
    + +
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} + +
    +
    +
    + )} +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    +
    + + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} + + )} + {GlobaldummyData && GlobalCashierName && ( +
    + {' '} + Cashier : Cashier Name +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + {table2Data?.BookingTypeName === 'Dine In' && + dinePreference && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain:{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} +
    + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    +
    + 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)}
    -
    } -
    } -
    +
    + {' '} + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + ) + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + )} +
    -
    Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}
    - {(sportsAppPreference && MembershipApplied) &&
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    } +
    + Your Order No : + {GlobaldummyData + ? '01' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} -
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

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

    + {Notestext} +

    + +
    +
    + )} +
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {GlobaldummyData ? GlobalIsnotes && - (
    -

    Notes : 10 days Return policy

    + > + {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. */} +
    +
    + )} -
    -
    ) : - Notestext && (
    -

    {Notestext}

    + {GlobaldummyData + ? GlobalSignature && ( +
    +

    + Signature +

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

    + Signature +

    + +
    + )} +
    + )} +
    -
    -
    ) - } -
    } - - - {(!estimatePrintHeader && table2Data?.OrderType === "E") ? '' :
    - {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
    - - - {PrintGreeting?.SettingValue === "Y" && -
    - Thank You Visit Again -
    - } - {/*
    print
    */} + )} + +
    +
    + )} +
    + ) : ( +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {/*

    {table2Data?.BrName}

    */} +
    + {GlobalLogo && GlobaldummyData ? ( + image + ) : null} + {base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + image + ) : null} +
    + {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    - } +
    - - ) -} +
    + {GlobaldummyData + ? 'BranchAddress, Town- 635XXX City - State' + : (BranchAddress || '') + + (BranchCity + ? (BranchAddress && BranchCity ? '-' : '') + BranchCity + : '') + + (BranchZip + ? (BranchCity && BranchZip ? '-' : '') + BranchZip + : '')} +
    +
    + {' '} + Mobile : +91{' '} + {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} +
    +
    + )} + {table2Data?.OrderType === 'E' && ( +
    + Estimate{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} -export default Printstyle8 + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalBilltext + ? GlobalBilltext + : 'Cash' + ' Bill' + : BillName + ? BillName + : PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + ' Bill' + : ''}{' '} + {SalesModePref?.SettingValue == 'Y' && + `(${table2Data?.SalesMode ? table2Data?.SalesMode : 'R'})`} +
    + )} + +
    +
    + Bill No : + {GlobaldummyData + ? '553' + : table2Data?.OrderId && + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )} +
    +
    + {GlobaldummyData ? formattedDate : Date1} +
    +
    + +
    + {(TakeawayData?.length > 0 || GlobaldummyData) && ( + <> + {takeAwayPreference && ( +
    + TakeAway +
    + )} + +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && ( + + ) + : Item && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + + + {(GlobaldummyData ? products : TakeawayData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode && } + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )} + +
    + S.No + + S.No + DisDes + HSN + + HSN + + MRP + + MRP + + Rate + + Rt + + (%) + + (%) + + Tax % + + Tax % + + Qty + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + Amt + + Amt +
    + {index + 1} + + {index + 1} + {item?.ProdName} +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount}PCS + {item.ParcelQty}PACK( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} +
    {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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.SalesQty} + + {item?.SalesQty} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    +
    + + )} + {DineInData?.length > 0 && dinePreference && ( + <> +
    + Dine In +
    + +
    + + + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && } + {GlobaldummyData + ? GlobalHsnCode && ( + + ) + : HsnCode && ( + + )} + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + + + {(GlobaldummyData ? products : DineInData)?.map( + (item, index) => { + return ( + + {GlobaldummyData + ? GlobalSlNo && ( + + ) + : SLNO && ( + + )} + {GlobaldummyData + ? GlobalItem && + : Item && ( + + )} + {GlobaldummyData + ? GlobalHsnCode && + : HsnCode && } + {GlobaldummyData + ? GlobalMRP && ( + + ) + : MRP && ( + + )} + {GlobaldummyData + ? GlobalRate && ( + + ) + : Rate && ( + + )} + {GlobaldummyData + ? GlobalDiscount && ( + + ) + : Discount && ( + + )} + {GlobaldummyData + ? GlobalTax && ( + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + )} + {GlobaldummyData + ? GlobalQuantity && ( + + ) + : Quantity && ( + + )} + {GlobaldummyData + ? GlobalAmount && ( + + ) + : Amount && ( + + )} + + ); + } + )} + +
    + S.No + + S.No + DisDes + HSN + + HSN + + MRP + + MRP + + Rate + + Rt + + (%) + + (%) + + Tax % + + Tax % + + Qty + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + Amt + + Amt +
    + {index + 1} + + {index + 1} + {item?.ProdName} +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return
    {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}{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?.ProdTaxPercentage} + + {item?.ProdTaxPercentage || 0} + + {item?.SalesQty} + + {item?.SalesQty} + + {item?.TotalAmt} + + {item?.Type != 'C' + ? item?.TotalAmt - item?.OfferAmt || 0 + : item?.TotalAmt - item?.OfferValue || 0} +
    +
    + + )} +
    +
    +
    +
    Items
    +
    :
    +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    +
    +
    Qty
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( +
    +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '10' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + takeAwayPreference && ( +
    +
    Take Away
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(TakeawayTotal).toFixed(2)} +
    +
    + )} + {DineInData?.length > 0 && + TakeawayData?.length > 0 && + dinePreference && ( +
    +
    Dine In
    +
    :
    +
    + {GlobaldummyData ? '1,066' : Number(DineInTotal).toFixed(2)} +
    +
    + )} +
    +
    Amount
    +
    :
    +
    + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    +
    + +
    + {table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && + table2Data?.NetAmount !== 0 && ( + <> +
    + +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed( + 2 + )} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed( + 2 + )} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )} +
    +
    + + )} +
    +
    + )} +
    + +
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +  Payment :   + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} + /-{' '} +
    +
    +
    + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} +

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} +

    + ) : null} +
    + )} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map((paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ))} + + )} + {GlobaldummyData && GlobalCashierName && ( +
    + {' '} + Cashier : Cashier Name +
    + )} + {CashierName && + CashierName !== undefined && + CashierName !== null && + !GlobaldummyData && + CashierNameField && ( +
    + Cashier : {CashierName} +
    + )} + {GlobaldummyData && ( +
    + {' '} + Customer : Customer Name +
    + )} + {table2Data?.CustSuppName && + table2Data?.CustSuppName !== undefined && + table2Data?.CustSuppName !== null && + !GlobaldummyData && ( +
    + Customer : {table2Data?.CustSuppName} +
    + )} + + {table2Data?.BookingTypeName === 'Dine In' && + dinePreference && + table2Data?.SalesTableLinkDetails?.[0]?.WaiterName && ( +
    + Captain:{' '} + {table2Data?.SalesTableLinkDetails?.[0]?.WaiterName} +
    + )} +
    + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalQrcodet && ( +
    +
    + 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)} +
    +
    + )} +
    + )} +
    + +
    + Your Order No : + {GlobaldummyData + ? '01' + : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)} +
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + +
    + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    + +
    +
    + )} +
    + )} + + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {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
    + )} + {/*
    print
    */} +
    + )} + + ); +}; + +export default Printstyle8; diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx index 67d49e8..d7f4463 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.jsx @@ -30,7 +30,10 @@ import { GlobalprintTax, } from '../../../../Features/ThemeChange/ThemeChange'; import Logo from '../../../../Images/Logo.jpg'; -import { GlobalUpiIDprint, PreferenceData } from '../../../../Features/BookingScreen/BookingData/BookingData'; +import { + GlobalUpiIDprint, + PreferenceData, +} from '../../../../Features/BookingScreen/BookingData/BookingData'; import '../../../../Styles/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle9.scss'; import QRCode from 'react-qr-code'; import signature from '../../../../Images/signatureimage.jpg'; @@ -119,6 +122,19 @@ const PrintStyle9 = ({ const paymentTypeUPI = PaymentStatus?.find( (ps) => ps.PaymentTypeName === 'UPI' ); + + const isEditedBill = PaymentStatus?.some((payment) => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ); + let TermsAndConditions = printDatas?.TermsandConditions; let SignatureImg = printDatas?.Signature; let Notestext = printDatas?.Notes; @@ -230,7 +246,7 @@ const PrintStyle9 = ({ HSN: '01', Size: 250, UomName: 'g', - ProdTaxPercentage: 5 + ProdTaxPercentage: 5, }, { ProdName: 'ITEM 2', @@ -242,7 +258,7 @@ const PrintStyle9 = ({ HSN: '02', Size: 250, UomName: 'g', - ProdTaxPercentage: 5 + ProdTaxPercentage: 5, }, { ProdName: 'ITEM 3', @@ -254,7 +270,7 @@ const PrintStyle9 = ({ HSN: '03', Size: 250, UomName: 'g', - ProdTaxPercentage: 0 + ProdTaxPercentage: 0, }, { ProdName: 'ITEM 4', @@ -266,7 +282,7 @@ const PrintStyle9 = ({ HSN: '04', Size: 250, UomName: 'g', - ProdTaxPercentage: 18 + ProdTaxPercentage: 18, }, { ProdName: 'ITEM 5', @@ -278,7 +294,7 @@ const PrintStyle9 = ({ HSN: '05', Size: 250, UomName: 'g', - ProdTaxPercentage: 40 + ProdTaxPercentage: 40, }, { ProdName: 'ITEM 6', @@ -290,7 +306,7 @@ const PrintStyle9 = ({ HSN: '06', Size: 250, UomName: 'g', - ProdTaxPercentage: 0 + ProdTaxPercentage: 0, }, { ProdName: 'ITEM 7', @@ -302,7 +318,7 @@ const PrintStyle9 = ({ HSN: '08', Size: 250, UomName: 'g', - ProdTaxPercentage: 5 + ProdTaxPercentage: 5, }, ]; @@ -351,8 +367,8 @@ const PrintStyle9 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -399,7 +415,7 @@ const PrintStyle9 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    @@ -495,10 +511,10 @@ const PrintStyle9 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    {' '} @@ -551,114 +567,120 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && ( - Item - ) + Item + ) : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - { WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData ? - GlobalTax && - - Tax % - : - (Tax && table2Data?.OrderType !== 'E') && - - Tax % - - } + + Dis{' '} + + )} + {GlobaldummyData + ? GlobalTax && ( + + Tax % + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -668,205 +690,207 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount}PCS - {item.ParcelQty}PACK( - {item.ParcelType}) - - ))} - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount}PCS + {item.ParcelQty}PACK( + {item.ParcelType}) + + ))} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {a.SerialNumber}
    - ); - }) - : ''}{' '} - {item?.ProductIdentifierDtls?.length > + ? 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?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > + ? 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {a.SerialNumber}
    - ); - }) - : ''}{' '} - {item?.ProductIdentifierDtls?.length > + ? 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?.ProductIdentifierDtls.filter( + (item1) => + item1.IMEI1 !== '' || + item1.IMEI2 !== '' + )?.map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) + : ''} +
    + )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && - - {item?.ProdTaxPercentage} - : - (Tax && table2Data?.OrderType !== 'E') && - - {item?.ProdTaxPercentage || 0} - - } + ? GlobalTax && ( + + {item?.ProdTaxPercentage} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); })} @@ -893,114 +917,120 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && ( - Item - ) + Item + ) : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - { WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData ? - GlobalTax && - - Tax % - : - (Tax && table2Data?.OrderType !== 'E') && - - Tax % - - } + + Dis{' '} + + )} + {GlobaldummyData + ? GlobalTax && ( + + Tax % + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -1010,114 +1040,116 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && {index + 1} : SLNO && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && - - {item?.ProdTaxPercentage} - : - (Tax && table2Data?.OrderType !== 'E') && - - {item?.ProdTaxPercentage || 0} - - } + ? GlobalTax && ( + + {item?.ProdTaxPercentage} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); })} @@ -1162,25 +1194,25 @@ const PrintStyle9 = ({ )} {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off : -
    - {GlobaldummyData - ? '1,066' - : Number( +
    + Off : +
    + {GlobaldummyData + ? '1,066' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )}
    {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -1621,28 +1659,28 @@ const PrintStyle9 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    - {PaymentStatusSuccess?.length > 1 && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map( @@ -1747,64 +1785,142 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} +
    + QRcode +
    + 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 - )} -
    -
    - )} + )}
    )}
    -
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} + +
    +
    +
    + )} + +
    Your Order No : {GlobaldummyData ? '01' : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} + extractLastNumber(table2Data?.SalesId)}
    @@ -1833,23 +1949,23 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -1869,137 +1985,137 @@ const PrintStyle9 = ({ > {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 +

    + +
    + )}
    )}
    @@ -2097,8 +2213,8 @@ const PrintStyle9 = ({ {GlobaldummyData ? '1,066' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -2237,7 +2353,9 @@ const PrintStyle9 = ({ fontSize: '11px', textAlign: 'right', }} - >{item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -2530,28 +2652,28 @@ const PrintStyle9 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    - {PaymentStatusSuccess?.length > 1 && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -2650,60 +2772,135 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} +
    + QRcode +
    + 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)} -
    -
    - )} + )}
    )}
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} -
    +
    Your Order No : {GlobaldummyData ? '01' : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} + extractLastNumber(table2Data?.SalesId)}
    @@ -2732,23 +2929,23 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2768,137 +2965,137 @@ const PrintStyle9 = ({ > {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 +

    + +
    + )}
    )}
    @@ -2955,7 +3152,7 @@ const PrintStyle9 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? (
    @@ -3060,10 +3257,10 @@ const PrintStyle9 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    {' '} @@ -3112,90 +3309,92 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalSlNo && ( - - S.No - - ) + + S.No + + ) : SLNO && S.No} {GlobaldummyData ? GlobalItem && Item : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - { WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData ? - GlobalTax && - - Tax % - : - (Tax && table2Data?.OrderType !== 'E') && - - Tax % - - } + + Dis{' '} + + )} + {GlobaldummyData + ? GlobalTax && ( + + Tax % + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3209,138 +3408,140 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return
    {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?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return
    {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(',')} +
    + ); + }) + : ''} +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && - - {item?.ProdTaxPercentage} - : - (Tax && table2Data?.OrderType !== 'E') && - - {item?.ProdTaxPercentage || 0} - - } + ? GlobalTax && ( + + {item?.ProdTaxPercentage} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3374,80 +3575,82 @@ const PrintStyle9 = ({ : Item && Item} {GlobaldummyData ? GlobalQuantity && ( - - Qty - - ) + + Qty + + ) : Quantity && ( - - { WeightasKg ?'Qty/Kg' :'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - HSN - - ) + + HSN + + ) : HsnCode && ( - - HSN - - )} + + HSN + + )} {GlobaldummyData ? GlobalMRP && ( - - MRP - - ) + + MRP + + ) : MRP && ( - - MRP - - )} + + MRP + + )} {GlobaldummyData ? GlobalDiscount && ( - - Dis{' '} - - ) + + Dis{' '} + + ) : Discount && ( - - Dis{' '} - - )} - {GlobaldummyData ? - GlobalTax && - - Tax % - : - (Tax && table2Data?.OrderType !== 'E') && - - Tax % - - } + + Dis{' '} + + )} + {GlobaldummyData + ? GlobalTax && ( + + Tax % + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + Tax % + + )} {GlobaldummyData ? GlobalRate && ( - - Rate - - ) + + Rate + + ) : Rate && ( - - Rate - - )} + + Rate + + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount && ( - - Amt - - )} + + Amt + + )} @@ -3461,106 +3664,108 @@ const PrintStyle9 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item.discount} - - ) + + {item.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData - ? GlobalTax && - - {item?.ProdTaxPercentage} - : - (Tax && table2Data?.OrderType !== 'E') && - - {item?.ProdTaxPercentage || 0} - - } + ? GlobalTax && ( + + {item?.ProdTaxPercentage} + + ) + : Tax && + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3613,8 +3818,8 @@ const PrintStyle9 = ({ {GlobaldummyData ? '1,066' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -3754,7 +3959,9 @@ const PrintStyle9 = ({ fontSize: '11px', textAlign: 'right', }} - >{item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {item?.TaxPercentage || 0}% + > + {item?.TaxPercentage || 0}% + {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > 0 ? (

    @@ -4040,26 +4251,26 @@ const PrintStyle9 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    - {PaymentStatusSuccess?.length > 1 && ( + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments).map((paymentType) => ( @@ -4146,51 +4357,123 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹{' '} - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} +
    + QRcode +
    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)} +
    -
    - )} + )}
    )}
    -
    + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} + +
    +
    +
    + )} + +
    Your Order No : {GlobaldummyData ? '01' @@ -4229,26 +4512,26 @@ const PrintStyle9 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -4268,137 +4551,137 @@ const PrintStyle9 = ({ > {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/DashBoard/RetailDashboard.jsx b/src/Pages/DashBoard/RetailDashboard.jsx index 750e020..4a48c3d 100644 --- a/src/Pages/DashBoard/RetailDashboard.jsx +++ b/src/Pages/DashBoard/RetailDashboard.jsx @@ -264,7 +264,6 @@ const RetailDashboard = () => { useEffect(() => { if (isInitialLoad && CompId && AppId && selection === 'dashboard') { - // debugger if (dates && dates?.[0] && dates?.[1] && !initialDate) { onRangeChange(dates, [ dates?.[0]?.format('DD-MM-YYYY'), diff --git a/src/Pages/Kiosk/CardPage/SelfCardPage1.jsx b/src/Pages/Kiosk/CardPage/SelfCardPage1.jsx index 1f19cca..3fd8b34 100644 --- a/src/Pages/Kiosk/CardPage/SelfCardPage1.jsx +++ b/src/Pages/Kiosk/CardPage/SelfCardPage1.jsx @@ -257,29 +257,29 @@ const CardPage1 = (props) => { if (isItemInCart) { newOrderDetails = newOrderDetails.map((cartItem) => cartItem.ProdId === item.ProdId && - cartItem.InwardDtlId === item.InwardDtlId && - cartItem.OrderRate === item.OrderRate && - cartItem?.BookingTypeName === item?.BookingTypeName && - !cartItem?.disabled + cartItem.InwardDtlId === item.InwardDtlId && + cartItem.OrderRate === item.OrderRate && + cartItem?.BookingTypeName === item?.BookingTypeName && + !cartItem?.disabled ? { - ...cartItem, - OrderQty: cartItem.OrderQty + 1, - TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate, - TaxAmt: ( + ...cartItem, + OrderQty: cartItem.OrderQty + 1, + TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate, + TaxAmt: ( + ((cartItem.OrderQty + 1) * + cartItem.OrderRate * + cartItem.TaxPercentage) / + (100 + cartItem.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (cartItem.OrderQty + 1) * cartItem.OrderRate - + ( ((cartItem.OrderQty + 1) * cartItem.OrderRate * cartItem.TaxPercentage) / (100 + cartItem.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (cartItem.OrderQty + 1) * cartItem.OrderRate - - ( - ((cartItem.OrderQty + 1) * - cartItem.OrderRate * - cartItem.TaxPercentage) / - (100 + cartItem.TaxPercentage) - ).toFixed(2), - } + } : cartItem ); } else { @@ -360,11 +360,11 @@ const CardPage1 = (props) => { (cartItem) => cartItem?.ProdId === item?.ProductDetail?.[0]?.ProdId && cartItem?.InwardDtlId === - item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0] - ?.InwardDtlId && + item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0] + ?.InwardDtlId && cartItem?.OrderRate === - item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0] - ?.SellPrice + item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0] + ?.SellPrice ); if (Isincart && Isincart?.StockAvailable === 'Y') { if (Isincart?.BalanceQty > Isincart?.OrderQty) { @@ -419,13 +419,13 @@ const CardPage1 = (props) => { (cartItem) => cartItem?.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 ); console.log(Isincart, item, KioskOrderDetails, 'IsincartsingleVarient'); if (Isincart && Isincart?.StockAvailable === 'Y') { @@ -543,7 +543,7 @@ const CardPage1 = (props) => { SinglePc: onePcs ? 'Y' : 'N', NoOfPcs: onePcs ? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] - ?.StockDetails?.[stockIndex]?.NoOfPcs + ?.StockDetails?.[stockIndex]?.NoOfPcs : null, ProdVariantName: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] @@ -568,14 +568,14 @@ const CardPage1 = (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, SuppId: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex] ?.StockDetails?.[stockIndex]?.SuppId, @@ -603,7 +603,6 @@ const CardPage1 = (props) => { }; // add Product in cart state const AddOrderDetails = async (item) => { - // debugger message.success(`${item?.ProdName} Added in the Cart`); const isItemInCart = KioskOrderDetails?.find( (cartItem) => @@ -619,29 +618,29 @@ const CardPage1 = (props) => { changeKioskOrderDetails( KioskOrderDetails?.map((cartItem) => cartItem.ProdId === item.ProdId && - cartItem.InwardDtlId === item.InwardDtlId && - cartItem.OrderRate === item.OrderRate && - cartItem?.BookingTypeName === item?.BookingTypeName && - !cartItem?.disabled + cartItem.InwardDtlId === item.InwardDtlId && + cartItem.OrderRate === item.OrderRate && + cartItem?.BookingTypeName === item?.BookingTypeName && + !cartItem?.disabled ? { - ...cartItem, - OrderQty: cartItem.OrderQty + 1, - TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate, - TaxAmt: ( + ...cartItem, + OrderQty: cartItem.OrderQty + 1, + TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate, + TaxAmt: ( + ((cartItem.OrderQty + 1) * + cartItem.OrderRate * + cartItem.TaxPercentage) / + (100 + cartItem.TaxPercentage) + ).toFixed(2), + WithoutTaxRate: + (cartItem.OrderQty + 1) * cartItem.OrderRate - + ( ((cartItem.OrderQty + 1) * cartItem.OrderRate * cartItem.TaxPercentage) / (100 + cartItem.TaxPercentage) ).toFixed(2), - WithoutTaxRate: - (cartItem.OrderQty + 1) * cartItem.OrderRate - - ( - ((cartItem.OrderQty + 1) * - cartItem.OrderRate * - cartItem.TaxPercentage) / - (100 + cartItem.TaxPercentage) - ).toFixed(2), - } + } : cartItem ) ) @@ -862,7 +861,7 @@ const CardPage1 = (props) => { return (
    {/* Top area */}
    @@ -875,7 +874,7 @@ const CardPage1 = (props) => { ? props.class : 'KioskCard-card-main' } - // style={{ backgroundColor: getKioskLightColourdata }} + // style={{ backgroundColor: getKioskLightColourdata }} > {/* Mapping through kioskCategoriesCard */} {(selfBookingOption === 'Card Only' || @@ -891,9 +890,9 @@ const CardPage1 = (props) => { card?.OverAllQty, KioskOrderDetails ) > 0) || - card?.ProductDetail?.some( - (item) => item?.StockAvailable !== 'Y' - ) + card?.ProductDetail?.some( + (item) => item?.StockAvailable !== 'Y' + ) ? 'KioskCard-card' : 'KioskCard-card-dis' } @@ -923,9 +922,9 @@ const CardPage1 = (props) => { card?.OverAllQty, KioskOrderDetails ) > 0) || - card?.ProductDetail?.some( - (item) => item?.StockAvailable !== 'Y' - ) ? ( + card?.ProductDetail?.some( + (item) => item?.StockAvailable !== 'Y' + ) ? ( '' ) : (
    { {card?.ProductDetail?.filter( (item) => item.OnePcsAvailable == 'Y' ).length !== 0 && ( -
    { - e.stopPropagation(); // Stop event propagation to the parent div +
    { + e.stopPropagation(); // Stop event propagation to the parent div - if ( - !( - (card?.OverAllQty !== undefined && - returnOnepcCount( - card?.ProductDetail?.[0]?.ProdName, - card?.OverAllPcs, - CartOrderDetails - ) > 0) || - card?.ProductDetail?.some( - (item) => item?.StockAvailable !== 'Y' + if ( + !( + (card?.OverAllQty !== undefined && + returnOnepcCount( + card?.ProductDetail?.[0]?.ProdName, + card?.OverAllPcs, + CartOrderDetails + ) > 0) || + card?.ProductDetail?.some( + (item) => item?.StockAvailable !== 'Y' + ) ) - ) - ) { - return; // Don't proceed if the condition isn't met - } else { - CardOnClick(card, 'OnePeiceProduct'); // This only runs when you click the "One Piece" button - } - }} - style={{ - fontFamily: SelectedCardFont || '', - backgroundColor: - SelectedCardColor?.FontColor || '#f00000ff', - color: - returnOnepcCount( - card?.ProductDetail?.[0]?.ProdName, - card?.OverAllPcs, - CartOrderDetails - ) > 0 || - card?.ProductDetail?.some( - (product) => product?.StockAvailable !== 'Y' - ) - ? true - ? SelectedCardColor?.BackgroundColor || + ) { + return; // Don't proceed if the condition isn't met + } else { + CardOnClick(card, 'OnePeiceProduct'); // This only runs when you click the "One Piece" button + } + }} + style={{ + fontFamily: SelectedCardFont || '', + backgroundColor: + SelectedCardColor?.FontColor || '#f00000ff', + color: + returnOnepcCount( + card?.ProductDetail?.[0]?.ProdName, + card?.OverAllPcs, + CartOrderDetails + ) > 0 || + card?.ProductDetail?.some( + (product) => product?.StockAvailable !== 'Y' + ) + ? true + ? SelectedCardColor?.BackgroundColor || '#000000' - : '#fff' - : '#ff4d4f', - }} - > -
    - {' '} - {AppName?.toLowerCase() === 'sports' - ? 'Single' - : '1PCS'}{' '} + : '#fff' + : '#ff4d4f', + }} + > +
    + {' '} + {AppName?.toLowerCase() === 'sports' + ? 'Single' + : '1PCS'}{' '} +
    -
    - )} + )}
    ) )} diff --git a/src/Pages/Preference/PreferenceList.jsx b/src/Pages/Preference/PreferenceList.jsx index a966c06..9bb5ac1 100644 --- a/src/Pages/Preference/PreferenceList.jsx +++ b/src/Pages/Preference/PreferenceList.jsx @@ -108,6 +108,7 @@ const PreferenceList = () => { weeklysalesreport: allSettingsMap['weeklysalesreport'] === 'Y', notificationblink: allSettingsMap['notificationblink'] === 'Y', onlineindivdualslots: allSettingsMap['onlineindivdualslots'] === 'Y', + editbill: allSettingsMap['editbill'] === 'Y', notification: [ ...(allSettingsMap['onbilltime'] === 'Y' ? ['onbilltime'] : []), ...(allSettingsMap['1daybefore'] === 'Y' ? ['1daybefore'] : []), @@ -308,6 +309,7 @@ const PreferenceList = () => { lowstockreport: values.lowstockreport, weeklysalesreport: values.weeklysalesreport, notificationblink: values.notificationblink, + editbill: values.editbill, }; const arrayValues = { @@ -627,6 +629,7 @@ const PreferenceList = () => { 'Do you Want Customised Bill Number?' )} {renderCheckbox('upiqr', 'Do you want to show the UPI QR code?')} + {/* {renderCheckbox('editbill', 'Do you want to edit the previously created bill?')} */}
    diff --git a/src/Pages/Tablebooking/TableBooking.jsx b/src/Pages/Tablebooking/TableBooking.jsx index 3c03f1a..7568463 100644 --- a/src/Pages/Tablebooking/TableBooking.jsx +++ b/src/Pages/Tablebooking/TableBooking.jsx @@ -1034,7 +1034,6 @@ const TableBooking = ({ PaymentStatus }) => { ); const navigatetoBooking = async (data) => { - const OrderDetails = data?.OrderDetails?.[0]; const { OrderDtlDetails, diff --git a/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx b/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx index 5722742..a787009 100644 --- a/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx +++ b/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx @@ -49,6 +49,18 @@ const PaymentPdfBooking = ({ let PaymentStatusSuccess = PaymentStatus?.filter( (ps) => ps.PaymentStatus === 'S' ); + const isEditedBill = PaymentStatus?.some(payment => { + const type = payment?.AdjustmentType?.toLowerCase(); + return ( + (type === 'extra' || type === 'refund') && + payment?.BeforeAdjustment != null && + payment?.AfterAdjustment != null + ); + }); + const lastTransaction = PaymentStatus?.find( + (ps) => ps.PaymentStatus === 'S' && ps?.LastOrderTran === 'Y' + ) + console.log(singleData2?.filter(data => data?.EditTokenAvailable !== 'N'), "singleData2") const ExtraChargeTotal = table2Data?.ExtraChargeDetails?.reduce( (accumulator, currentObject) => { return accumulator + currentObject.TotalAmt; @@ -80,6 +92,7 @@ const PaymentPdfBooking = ({ const [BranchZip, setBranchZip] = useState(); const CashierName = getSession('userName'); const printerTemplateStyle = useSelector(SelectedPrintTemplate); + console.log(printerTemplateStyle, "printerTemplateStyle") const appPreferences = useSelector(ApplicationPreferences); const SettingData = useSelector(PreferenceData); const estimatePrintHeader = @@ -297,6 +310,21 @@ const PaymentPdfBooking = ({ return `${h}:${m}${suffix}`; }; + const getAdjustmentLabel = (type) => { + switch (type?.toUpperCase()) { + case 'REFUND': + return 'Returned Item Amount'; + case 'EXTRA': + return 'Additional Amount'; + case 'DISCOUNT': + return 'Discount Applied'; + case 'ROUND_OFF': + return 'Round Off'; + default: + return 'Adjustment Amount'; + } + }; + return ( <>
    @@ -341,8 +369,8 @@ const PaymentPdfBooking = ({ {table2Data?.AddressDetails?.[0]?.City && table2Data?.AddressDetails?.[0]?.Zip && table2Data?.AddressDetails?.[0]?.City + - '- ' + - table2Data?.AddressDetails?.[0]?.Zip} + '- ' + + table2Data?.AddressDetails?.[0]?.Zip}

    )} @@ -358,9 +386,9 @@ const PaymentPdfBooking = ({ GSTIN: {table2Data?.BrGSTIN}

    )} -

    + {table2Data?.BrMobile &&

    Mobile:+91 {table2Data?.BrMobile} -

    +

    }
    @@ -435,7 +463,7 @@ const PaymentPdfBooking = ({
    - BillNo: + Bill No: {table2Data?.OrderId && extractLastNumberOrderId( table2Data?.OrderId, @@ -512,27 +540,27 @@ const PaymentPdfBooking = ({   {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (items) => - items.SerialNumber && - items.SerialNumber !== '' - ).map((a, i) => ( -
    {a.SerialNumber}
    - )) + (items) => + items.SerialNumber && + items.SerialNumber !== '' + ).map((a, i) => ( +
    {a.SerialNumber}
    + )) : ''} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (id) => id.IMEI1 !== '' || id.IMEI2 !== '' - ).map((id, i) => { - const imei1 = id.IMEI1 || ''; - const imei2 = id.IMEI2 || ''; - return ( -
    - {[imei1, imei2] - .filter(Boolean) - .join(',')} -
    - ); - }) + (id) => id.IMEI1 !== '' || id.IMEI2 !== '' + ).map((id, i) => { + const imei1 = id.IMEI1 || ''; + const imei2 = id.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) : ''}
    @@ -549,25 +577,25 @@ const PaymentPdfBooking = ({   {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (items) => - items.SerialNumber && - items.SerialNumber !== '' - ).map((a, i) => ( -
    {a.SerialNumber}
    - )) + (items) => + items.SerialNumber && + items.SerialNumber !== '' + ).map((a, i) => ( +
    {a.SerialNumber}
    + )) : ''} {item?.ProductIdentifierDtls?.length > 0 ? item?.ProductIdentifierDtls.filter( - (id) => id.IMEI1 !== '' || id.IMEI2 !== '' - ).map((id, i) => { - const imei1 = id.IMEI1 || ''; - const imei2 = id.IMEI2 || ''; - return ( -
    - {[imei1, imei2].filter(Boolean).join(',')} -
    - ); - }) + (id) => id.IMEI1 !== '' || id.IMEI2 !== '' + ).map((id, i) => { + const imei1 = id.IMEI1 || ''; + const imei2 = id.IMEI2 || ''; + return ( +
    + {[imei1, imei2].filter(Boolean).join(',')} +
    + ); + }) : ''} )} @@ -1109,7 +1137,7 @@ const PaymentPdfBooking = ({ >
    )} - {PaymentStatusSuccess?.length > 1 && ( + {(PaymentStatusSuccess?.length > 1 && !isEditedBill) && ( <> {/*

    Split Payment:

    */} {Object.keys(aggregatedPayments)?.map((paymentType) => ( @@ -1122,6 +1150,48 @@ const PaymentPdfBooking = ({ ))} )} + {isEditedBill && lastTransaction && ( +
    +
    +
    + Bill Gross Amount + {(lastTransaction?.BeforeAdjustment || 0).toFixed(2)} +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + Net Bill Amount + {(lastTransaction?.AfterAdjustment || 0).toFixed(2)} +
    +
    +
    + )} {table2Data?.CustSuppName && (

    { + singleData2?.filter(data => data?.EditTokenAvailable !== 'N')?.reduce((acc, item, idx) => { if (item.TokenAvailable === 'Y') { if (!item.CounterName) { // For null or empty CounterName, print each item individually @@ -1607,7 +1677,7 @@ const PaymentPdfBooking = ({

    Token

    -

    BillNo: {orderId}

    +

    Bill No: {orderId}

    {Date1}

    @@ -1625,9 +1695,9 @@ const PaymentPdfBooking = ({ - + - + ))} From 0340bd9e08cb09cf766eb133840072ef56bb42a7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 Feb 2026 09:30:32 +0530 Subject: [PATCH 5/5] sales bill edit print --- .../UtillComponents/ProductPriceChange.jsx | 899 ++-- .../ThermalPrinter/PrintStyle11.jsx | 2755 +++++----- .../ThermalPrinter/PrintStyle12.jsx | 4547 +++++++++-------- .../ThermalPrinter/PrintStyle6.jsx | 3 +- .../ThermalPrinter/PrintStyle7.jsx | 2595 +++++----- 5 files changed, 5367 insertions(+), 5432 deletions(-) diff --git a/src/Pages/BookingScreen/Components/UtillComponents/ProductPriceChange.jsx b/src/Pages/BookingScreen/Components/UtillComponents/ProductPriceChange.jsx index 2e20526..c9f35a6 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/ProductPriceChange.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/ProductPriceChange.jsx @@ -1,518 +1,449 @@ -import { shallowEqual, useSelector } from 'react-redux'; -import { - GlobalAccessForOthers, - GlobalCardAccess, - GlobalCombosearch, - GlobalItemCard, - GlobalProductCategorie, - GlobalSelectedDatas, - GlobalWithoutSubCatItemCard, - triggerProductCard, -} from '../../../../Features/BookingScreen/BookingData/BookingData'; -import { DefaultModal } from '../../../../Components/Modal/DefaultModal'; -import { useCallback, useEffect, useRef, useState } from 'react'; -import { Tables } from '../../../../Components/Tables/Table'; -import { InputField } from '../../../../Components/Forms/InputField'; -import { Form, Pagination, Tooltip } from 'antd'; -import { getSession } from '../../../../Services/Others'; -import { Messages } from '../../../../Components/Notifications/Messages'; -import { useDispatch } from 'react-redux'; -import { PutStockPrice } from '../../../../Features/StockPriceUpdate/StockPriceUpdateMaster'; -import PriceChange from '../../../../Images/PayOptImgs/PriceChange.svg'; +import { shallowEqual, useSelector } from "react-redux"; +import { GlobalAccessForOthers, GlobalCardAccess, GlobalCombosearch, GlobalItemCard, GlobalProductCategorie, GlobalSelectedDatas, GlobalWithoutSubCatItemCard, triggerProductCard } from "../../../../Features/BookingScreen/BookingData/BookingData"; +import { DefaultModal } from "../../../../Components/Modal/DefaultModal"; +import { useCallback, useEffect, useRef, useState } from "react"; +import { Tables } from "../../../../Components/Tables/Table"; +import { InputField } from "../../../../Components/Forms/InputField"; +import { Form, Pagination, Tooltip } from "antd"; +import { getSession } from "../../../../Services/Others"; +import { Messages } from "../../../../Components/Notifications/Messages"; +import { useDispatch } from "react-redux"; +import { PutStockPrice } from "../../../../Features/StockPriceUpdate/StockPriceUpdateMaster"; +import PriceChange from "../../../../Images/PayOptImgs/PriceChange.svg" -const ProductPriceChange = ({ - showButton = true, - priceChangeProduct = [], - productPriceChange = false, - setProductPriceChange = () => {}, - setPriceChangeProduct = () => {}, -}) => { - const formRef = useRef(null); - const dispatch = useDispatch(); +const ProductPriceChange = ({ showButton = true, priceChangeProduct = null, productPriceChange = false, setProductPriceChange = () => { }, setPriceChangeProduct = () => { } }) => { - const AppId = getSession('AppId'); - const CompId = getSession('CompId'); - const BranchId = getSession('BranchId'); - const UserId = getSession('UserId'); + const formRef = useRef(null); + const dispatch = useDispatch(); - const [messageData, setMessageData] = useState(null); - const [messageType, setMessageType] = useState(null); - const [currentPage, setCurrentPage] = useState(1); - const [pageSize] = useState(10); + const AppId = getSession('AppId'); + const CompId = getSession('CompId'); + const BranchId = getSession('BranchId'); + const UserId = getSession('UserId'); - const [noSubcatCardData, setNoSubcatCardData] = useState(); - const [priceChangeModal, setPriceChangeModal] = useState(false); + const [messageData, setMessageData] = useState(null); + const [messageType, setMessageType] = useState(null); + const [currentPage, setCurrentPage] = useState(1); + const [pageSize] = useState(10); - const comboSearch = useSelector(GlobalCombosearch); - const ProdCat = useSelector(GlobalProductCategorie, shallowEqual); - const ItemCard = useSelector(GlobalItemCard, shallowEqual); - const withoutSubCatItemCard = useSelector( - GlobalWithoutSubCatItemCard, - shallowEqual - ); - const CardAccess = useSelector(GlobalCardAccess, shallowEqual); - const globalAccessForOthers = useSelector( - GlobalAccessForOthers, - shallowEqual - ); - const SelectedDatas = useSelector(GlobalSelectedDatas, shallowEqual); - const [tableData, setTableData] = useState([]); - const [editingKey, setEditingKey] = useState(null); - const [priceChangedProducts, setPriceChangedProducts] = useState([]); - console.log(comboSearch, 'comboSearch'); + const [noSubcatCardData, setNoSubcatCardData] = useState(); + const [priceChangeModal, setPriceChangeModal] = useState(false); - // console.log(noSubcatCardData, "noSubcatCardData") + const comboSearch = useSelector(GlobalCombosearch); + const ProdCat = useSelector(GlobalProductCategorie, shallowEqual); + const ItemCard = useSelector(GlobalItemCard, shallowEqual); + const withoutSubCatItemCard = useSelector(GlobalWithoutSubCatItemCard, shallowEqual); + const CardAccess = useSelector(GlobalCardAccess, shallowEqual); + const globalAccessForOthers = useSelector(GlobalAccessForOthers, shallowEqual); + const SelectedDatas = useSelector(GlobalSelectedDatas, shallowEqual); + const [tableData, setTableData] = useState([]); + const [editingKey, setEditingKey] = useState(null); + const [priceChangedProducts, setPriceChangedProducts] = useState([]); + console.log(comboSearch, "comboSearch") - useEffect(() => { - if ( - ProdCat && - (ItemCard || withoutSubCatItemCard) && - (!noSubcatCardData || noSubcatCardData?.length === 0) - ) { - setNoSubcatCardData( - ItemCard?.length === 0 ? withoutSubCatItemCard : ItemCard - ); - } - }, [ProdCat, ItemCard, withoutSubCatItemCard, noSubcatCardData]); + // console.log(noSubcatCardData, "noSubcatCardData") - const priceChangeColumns = [ - { - title: 'S.No', - dataIndex: 'SlNo', - key: 'SlNo', - width: '60px', - align: 'center', - render: (text, record, index) => ( -
    {(currentPage - 1) * pageSize + index + 1}
    - ), - }, - { - title: 'Product Name', - dataIndex: 'ProdName', - key: 'ProdName', - }, - { - title: 'Old MRP', - dataIndex: 'MRP', - key: 'MRP', - width: '100px', - align: 'right', - }, - { - title: 'New MRP (Optional)', - dataIndex: 'NewMRP', - key: 'NewMRP', - width: '100px', - align: 'right', - render: (text, record, index) => { - // if (index === editingKey) { + useEffect(() => { + if (ProdCat && (ItemCard || withoutSubCatItemCard) && (!noSubcatCardData || noSubcatCardData?.length === 0)) { + setNoSubcatCardData(ItemCard?.length === 0 ? withoutSubCatItemCard : ItemCard); + } + }, [ProdCat, ItemCard, withoutSubCatItemCard, noSubcatCardData]); - // } - // return
    {text ? text : 'Enter New MRP'}
    - return ( - { - if (value === '') { - return Promise.resolve(); - } else if (parseFloat(value) < 1) { - return Promise.reject(`MRP should be greater than 0`); - } - return Promise.resolve(); - }, - }, - ]} - > - handleNewMRPChange(e?.target?.value, index)} - inputMode="decimal" - onInput={(e) => { - let cleanedValue = e.target.value.replace(/[^0-9.]/g, ''); // Remove invalid characters - const parts = cleanedValue.split('.'); + const priceChangeColumns = [ + { + title: 'S.No', + dataIndex: 'SlNo', + key: 'SlNo', + width: '60px', + align: 'center', + render: (text, record, index) =>
    {(currentPage - 1) * pageSize + index + 1}
    + }, + { + title: 'Product Name', + dataIndex: 'ProdName', + key: 'ProdName', + }, + { + title: 'Old MRP', + dataIndex: 'MRP', + key: 'MRP', + width: '100px', + align: 'right', + }, + { + title: 'New MRP (Optional)', + dataIndex: 'NewMRP', + key: 'NewMRP', + width: '100px', + align: 'right', + render: (text, record, index) => { + // if (index === editingKey) { - if (cleanedValue.startsWith('.')) { - cleanedValue = '0' + cleanedValue; - } + // } + // return
    {text ? text : 'Enter New MRP'}
    + return ( + { + if (value === '') { + return Promise.resolve(); + } else if (parseFloat(value) < 1) { + return Promise.reject(`MRP should be greater than 0`) + } + return Promise.resolve(); + }, + }, + ]}> + handleNewMRPChange(e?.target?.value, index)} + inputMode="decimal" + onInput={(e) => { + let cleanedValue = e.target.value.replace( + /[^0-9.]/g, + '' + ); // Remove invalid characters + const parts = cleanedValue.split('.'); - e.target.value = - parts.length > 2 - ? `${parts[0]}.${parts.slice(1).join('')}` - : cleanedValue; - }} - /> - - ); - }, - }, - { - title: 'Old Sell Price', - dataIndex: 'SellPrice', - key: 'SellPrice', - width: '120px', - align: 'right', - }, - { - title: 'New Sell Price', - dataIndex: 'NewSellPrice', - key: 'NewSellPrice', - width: '160px', - align: 'right', - render: (text, record, index) => { - // if (index === editingKey) { + if (cleanedValue.startsWith('.')) { + cleanedValue = '0' + cleanedValue; + } - // } - // return
    {text ? text : 'Enter New Sell Price'}
    - return ( - { - if (value === '') { - return Promise.resolve(); - } else if (parseFloat(value) < 1) { - return Promise.reject( - `Sell Price should be greater than 0` - ); - } - return Promise.resolve(); - }, - }, - ]} - > - - handleNewSellPriceChange(e?.target?.value, index) - } - inputMode="decimal" - onInput={(e) => { - let cleanedValue = e.target.value.replace(/[^0-9.]/g, ''); // Remove invalid characters - const parts = cleanedValue.split('.'); + e.target.value = + parts.length > 2 + ? `${parts[0]}.${parts.slice(1).join('')}` + : cleanedValue; + }} + /> + + ); + }, + }, + { + title: 'Old Sell Price', + dataIndex: 'SellPrice', + key: 'SellPrice', + width: '120px', + align: 'right', + }, + { + title: 'New Sell Price', + dataIndex: 'NewSellPrice', + key: 'NewSellPrice', + width: '160px', + align: 'right', + render: (text, record, index) => { + // if (index === editingKey) { - if (cleanedValue.startsWith('.')) { - cleanedValue = '0' + cleanedValue; - } + // } + // return
    {text ? text : 'Enter New Sell Price'}
    + return ( + { + if (value === '') { + return Promise.resolve(); + } else if (parseFloat(value) < 1) { + return Promise.reject(`Sell Price should be greater than 0`) + } + return Promise.resolve(); + }, + }, + ]} + > + handleNewSellPriceChange(e?.target?.value, index)} + inputMode="decimal" + onInput={(e) => { + let cleanedValue = e.target.value.replace( + /[^0-9.]/g, + '' + ); // Remove invalid characters + const parts = cleanedValue.split('.'); - e.target.value = - parts.length > 2 - ? `${parts[0]}.${parts.slice(1).join('')}` - : cleanedValue; - }} - /> - - ); - }, - }, - ]; + if (cleanedValue.startsWith('.')) { + cleanedValue = '0' + cleanedValue; + } - const cardData = !globalAccessForOthers - ? CardAccess - ? SelectedDatas?.length > 1 - ? SelectedDatas - : SelectedDatas?.[0]?.AppId === 0 && SelectedDatas?.[0]?.CompId === 0 - ? [] - : SelectedDatas - : ItemCard?.length === 0 || - (ItemCard?.[0]?.AppId === 0 && ItemCard?.[0]?.CompId === 0) - ? noSubcatCardData - : ItemCard - : []; + e.target.value = + parts.length > 2 + ? `${parts[0]}.${parts.slice(1).join('')}` + : cleanedValue; + }} + /> +
    + ); + }, + }, + ]; - console.log(cardData, 'noSubcatCardDatanoSubcatCardData', ItemCard); + const cardData = !globalAccessForOthers + ? CardAccess + ? SelectedDatas?.length > 1 + ? SelectedDatas + : SelectedDatas?.[0]?.AppId === 0 && SelectedDatas?.[0]?.CompId === 0 + ? [] + : SelectedDatas + : ItemCard?.length === 0 || (ItemCard?.[0]?.AppId === 0 && ItemCard?.[0]?.CompId === 0) + ? noSubcatCardData + : ItemCard + : ''; - useEffect(() => { - if (priceChangeModal || productPriceChange) { - const extractStockDtls = (data) => { - if (data?.length === 0 || !data) return []; + console.log(cardData, "noSubcatCardDatanoSubcatCardData", ItemCard) - let stockDtls = []; + useEffect(() => { + const extractStockDtls = (data) => { + if (data?.length === 0) return []; - data?.forEach((item) => { - let products = item?.ProductDetail?.flatMap((product) => product); + let stockDtls = []; - let variants = products?.flatMap( - (product) => product?.ProdVariantDetails - ); - const filteredVariants = variants?.filter( - (variant) => variant?.StockDetails?.length > 0 - ); - const stocks = filteredVariants?.flatMap((variant) => - variant?.StockDetails?.map((stock) => ({ - ...stock, - ProdName: - products?.[0]?.ProdName + - (variant?.ProdVariantName - ? ` (${variant?.ProdVariantName})` - : ''), - StockAvailable: products?.[0]?.StockAvailable, - ProdVariantName: variant?.ProdVariantName, - })) - ); + data?.forEach(item => { + let products = item?.ProductDetail?.flatMap(product => product); - stockDtls.push( - ...stocks?.filter((stock) => - stock?.StockAvailable === 'Y' ? stock?.BatchRef : true - ) - ); - }); - console.log('extractStockDtls', stockDtls); - return stockDtls; - }; - setTableData(extractStockDtls(priceChangeProduct || cardData || [])); - setCurrentPage(1); - } - }, [cardData, priceChangeProduct, priceChangeModal, productPriceChange]); + let variants = products?.flatMap(product => product?.ProdVariantDetails); + const filteredVariants = variants?.filter(variant => variant?.StockDetails?.length > 0); + const stocks = filteredVariants?.flatMap(variant => + variant?.StockDetails?.map(stock => ({ + ...stock, + ProdName: products?.[0]?.ProdName + (variant?.ProdVariantName ? ` (${variant?.ProdVariantName})` : ''), + StockAvailable: products?.[0]?.StockAvailable, + ProdVariantName: variant?.ProdVariantName + })) + ); - const handleNewMRPChange = (value, index) => { - const updatedTableData = [...tableData]; - updatedTableData[index].NewMRP = value; - setTableData(updatedTableData); - updatedTableData[index].NewSellPrice = null; - formRef.current.setFieldsValue({ - [`NewMRP${index}`]: value, - [`NewSellPrice${index}`]: null, - }); + stockDtls.push(...stocks?.filter(stock => + stock?.StockAvailable === 'Y' + ? stock?.BatchRef + : true + )); - const priceChangedProdList = [...priceChangedProducts]; - const prodIndex = priceChangedProdList?.findIndex( - (prod) => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId - ); - if (prodIndex !== -1) { - priceChangedProdList[prodIndex] = { - ...priceChangedProdList?.[prodIndex], - NewMRP: value, - NewSellPrice: null, - }; - } - setPriceChangedProducts(priceChangedProdList); - }; + }); + console.log("extractStockDtls", stockDtls); + return stockDtls; + } + setTableData(extractStockDtls(priceChangeProduct || cardData)) + setCurrentPage(1) + }, [cardData, priceChangeProduct]) - const handleNewSellPriceChange = (value, index) => { - const updatedTableData = [...tableData]; - if (updatedTableData[index]?.NewMRP) { - if (parseFloat(value) > parseFloat(updatedTableData[index]?.NewMRP)) { - setMessageType('error'); - setMessageData('New Sell Price cannot be greater than New MRP'); - formRef.current.setFieldsValue({ - [`NewSellPrice${index}`]: null, - }); - updatedTableData[index].NewSellPrice = null; + const handleNewMRPChange = (value, index) => { + + const updatedTableData = [...tableData]; + updatedTableData[index].NewMRP = value; setTableData(updatedTableData); - const priceChangedProdList = [...priceChangedProducts]; - const prodIndex = priceChangedProdList?.findIndex( - (prod) => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId - ); + updatedTableData[index].NewSellPrice = null; + formRef.current.setFieldsValue({ + [`NewMRP${index}`]: value, + [`NewSellPrice${index}`]: null, + }); + const priceChangedProdList = [...priceChangedProducts]; + const prodIndex = priceChangedProdList?.findIndex(prod => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId); if (prodIndex !== -1) { - priceChangedProdList.splice(prodIndex, 1); + priceChangedProdList[prodIndex] = { + ...priceChangedProdList?.[prodIndex], + NewMRP: value, + NewSellPrice: null, + }; } setPriceChangedProducts(priceChangedProdList); - return; - } - } - if (!updatedTableData[index]?.NewMRP && updatedTableData[index]?.MRP) { - if (parseFloat(value) > parseFloat(updatedTableData[index]?.MRP)) { - setMessageType('error'); - setMessageData('New Sell Price cannot be greater than MRP'); - formRef.current.setFieldsValue({ - [`NewSellPrice${index}`]: null, - }); - updatedTableData[index].NewSellPrice = null; - setTableData(updatedTableData); - const priceChangedProdList = [...priceChangedProducts]; - const prodIndex = priceChangedProdList?.findIndex( - (prod) => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId - ); - - if (prodIndex !== -1) { - priceChangedProdList.splice(prodIndex, 1); - } - setPriceChangedProducts(priceChangedProdList); - return; - } - } - updatedTableData[index].NewSellPrice = value; - setTableData(updatedTableData); - formRef.current.setFieldsValue({ - [`NewSellPrice${index}`]: value, - }); - - const priceChangedProdList = [...priceChangedProducts]; - const prodIndex = priceChangedProdList?.findIndex( - (prod) => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId - ); - - if (prodIndex !== -1) { - priceChangedProdList[prodIndex] = { - ...priceChangedProdList[prodIndex], - SellPrice: String(value), - }; - } else { - priceChangedProdList.push({ - ProdId: updatedTableData[index]?.ProdId, - ProdName: updatedTableData[index]?.ProdName, - MRP: String( - updatedTableData[index]?.NewMRP || updatedTableData[index]?.MRP - ), - SellPrice: String(value), - AdjComment: 'string', - InwardDtlId: updatedTableData[index]?.InwardDtlId, - }); } - setPriceChangedProducts(priceChangedProdList); - }; + const handleNewSellPriceChange = (value, index) => { + const updatedTableData = [...tableData]; + if (updatedTableData[index]?.NewMRP) { + if (parseFloat(value) > parseFloat(updatedTableData[index]?.NewMRP)) { + setMessageType('error'); + setMessageData('New Sell Price cannot be greater than New MRP'); + formRef.current.setFieldsValue({ + [`NewSellPrice${index}`]: null, + }); + updatedTableData[index].NewSellPrice = null; + setTableData(updatedTableData); + const priceChangedProdList = [...priceChangedProducts]; + const prodIndex = priceChangedProdList?.findIndex(prod => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId); - const edit = (record, index) => { - console.log('edit', record, index); - setEditingKey(index); - }; - - const handleSubmit = async () => { - console.log('submit'); - - if (priceChangedProducts?.length > 0) { - console.log('priceChangedProducts', priceChangedProducts); - const validation = priceChangedProducts?.every((prod) => { - if (parseFloat(prod?.MRP) < parseFloat(prod?.SellPrice)) { - setMessageType('error'); - setMessageData( - `${prod?.ProdName}: MRP cannot be less than Sell Price` - ); - return false; - } - if (!parseFloat(prod?.SellPrice) || !parseFloat(prod?.MRP)) { - setMessageType('error'); - setMessageData(`${prod?.ProdName}: Please give Sell Price or MRP`); - return false; - } - return true; - }); - if (!validation) return; - - const data = { - AppId: AppId, - CompId: CompId, - BranchId: BranchId, - ProductDetails: priceChangedProducts, - UpdatedBy: UserId, - }; - - const res = await dispatch(PutStockPrice(data))?.unwrap(); - if (res?.data?.statusCode === 1) { - setMessageData('Price Changed Successfully'); - setMessageType('success'); - setPriceChangeModal(false); - setProductPriceChange(false); - setEditingKey(null); - setPriceChangedProducts([]); - setTableData([]); - dispatch(triggerProductCard()); - setPriceChangeProduct(null); - formRef.current.resetFields(); - } else { - setMessageData('Error Updating Product Price'); - setMessageType('error'); - } - } else { - setMessageType('error'); - setMessageData('No changes made / No sell price entered'); - } - }; - - const onComplete = useCallback(() => { - setMessageData(null); - setMessageType(null); - }, []); - - return ( - <> - - {showButton ? ( - - - - ) : ( - <> - )} - { - setPriceChangeModal(false); - setProductPriceChange(false); - setEditingKey(null); - setPriceChangedProducts([]); - formRef?.current?.resetFields(); - setPriceChangeProduct(null); - }} - handleSubmit={handleSubmit} - > -
    - {/*
    Note : Click on a row to edit/modify
    */} -
    - ({ - onClick: () => { - edit(record, index); - }, - })} - /> -
    - setCurrentPage(page)} - showSizeChanger={false} - showTotal={(total, range) => - `${range[0]}-${range[1]} of ${total} items` - } - /> -
    - -
    -
    - - ); -}; + } + } + if (!updatedTableData[index]?.NewMRP && updatedTableData[index]?.MRP) { + if (parseFloat(value) > parseFloat(updatedTableData[index]?.MRP)) { + setMessageType('error'); + setMessageData('New Sell Price cannot be greater than MRP'); + formRef.current.setFieldsValue({ + [`NewSellPrice${index}`]: null, + }); + updatedTableData[index].NewSellPrice = null; + setTableData(updatedTableData); + const priceChangedProdList = [...priceChangedProducts]; + const prodIndex = priceChangedProdList?.findIndex(prod => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId); -export default ProductPriceChange; + if (prodIndex !== -1) { + priceChangedProdList.splice(prodIndex, 1); + } + setPriceChangedProducts(priceChangedProdList); + return; + } + } + updatedTableData[index].NewSellPrice = value; + setTableData(updatedTableData); + formRef.current.setFieldsValue({ + [`NewSellPrice${index}`]: value, + }); + + const priceChangedProdList = [...priceChangedProducts]; + const prodIndex = priceChangedProdList?.findIndex(prod => prod?.InwardDtlId === updatedTableData[index]?.InwardDtlId); + + if (prodIndex !== -1) { + priceChangedProdList[prodIndex] = { + ...priceChangedProdList[prodIndex], + SellPrice: String(value) + }; + } else { + priceChangedProdList.push({ + ProdId: updatedTableData[index]?.ProdId, + ProdName: updatedTableData[index]?.ProdName, + MRP: String(updatedTableData[index]?.NewMRP || updatedTableData[index]?.MRP), + SellPrice: String(value), + AdjComment: "string", + InwardDtlId: updatedTableData[index]?.InwardDtlId + }); + } + + setPriceChangedProducts(priceChangedProdList); + } + + const edit = (record, index) => { + console.log("edit", record, index); + setEditingKey(index); + } + + const handleSubmit = async () => { + console.log("submit"); + + if (priceChangedProducts?.length > 0) { + console.log("priceChangedProducts", priceChangedProducts); + const validation = priceChangedProducts?.every((prod) => { + if (parseFloat(prod?.MRP) < parseFloat(prod?.SellPrice)) { + setMessageType('error'); + setMessageData(`${prod?.ProdName}: MRP cannot be less than Sell Price`); + return false; + } + if (!parseFloat(prod?.SellPrice) || !parseFloat(prod?.MRP)) { + setMessageType('error'); + setMessageData(`${prod?.ProdName}: Please give Sell Price or MRP`); + return false; + } + return true; + }); + if (!validation) return; + + const data = { + AppId: AppId, + CompId: CompId, + BranchId: BranchId, + ProductDetails: priceChangedProducts, + UpdatedBy: UserId, + } + + const res = await dispatch(PutStockPrice(data))?.unwrap(); + if (res?.data?.statusCode === 1) { + setMessageData('Price Changed Successfully'); + setMessageType('success'); + setPriceChangeModal(false); + setProductPriceChange(false); + setEditingKey(null); + setPriceChangedProducts([]); + setTableData([]); + dispatch(triggerProductCard()) + setPriceChangeProduct(null); + formRef.current.resetFields(); + } else { + setMessageData('Error Updating Product Price') + setMessageType('error'); + } + } else { + setMessageType('error'); + setMessageData('No changes made / No sell price entered'); + } + + } + + const onComplete = useCallback(() => { + setMessageData(null); + setMessageType(null); + }, []) + + return ( + <> + + + {showButton ? + + : <>} + { + setPriceChangeModal(false); + setProductPriceChange(false); + setEditingKey(null); + setPriceChangedProducts([]); + formRef?.current?.resetFields(); + setPriceChangeProduct(null); + }} + handleSubmit={handleSubmit} + > +
    + {/*
    Note : Click on a row to edit/modify
    */} +
    + ({ + onClick: () => { + edit(record, index); + }, + })} + /> +
    + setCurrentPage(page)} + showSizeChanger={false} + showTotal={(total, range) => `${range[0]}-${range[1]} of ${total} items`} + /> +
    + +
    +
    + + ) +} + +export default ProductPriceChange; \ No newline at end of file diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx index b12c765..0d6de8f 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle11.jsx @@ -104,6 +104,7 @@ const PrintStyle11 = ({ const GlobalCashierName = useSelector(GlobalprintCashierName); const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find( (setting) => @@ -350,8 +351,8 @@ const PrintStyle11 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -392,7 +393,7 @@ const PrintStyle11 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} @@ -422,18 +423,18 @@ const PrintStyle11 = ({ {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 + : '')}
    {' '} @@ -473,10 +474,10 @@ const PrintStyle11 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    )} @@ -518,121 +519,121 @@ const PrintStyle11 = ({
    {GlobaldummyData ? GlobalSlNo && ( - - ) + + ) : SLNO && } {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 && ( - - )} + + )} @@ -642,207 +643,207 @@ const PrintStyle11 = ({ {GlobaldummyData ? GlobalSlNo && : SLNO && ( - - )} + + )} {GlobaldummyData ? GlobalItem && : Item && ( - - )} + ? item?.ProductIdentifierDtls.filter( + (item1) => + item1.IMEI1 !== '' || + item1.IMEI2 !== '' + )?.map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) + : ''} + + )} + + )} {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 && ( - - )} + + )} ); })} @@ -870,121 +871,121 @@ const PrintStyle11 = ({ {GlobaldummyData ? GlobalSlNo && ( - - ) + + ) : SLNO && } {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 && ( - - )} + + )} @@ -994,116 +995,116 @@ const PrintStyle11 = ({ {GlobaldummyData ? GlobalSlNo && : SLNO && ( - - )} + + )} {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 && ( - - )} + + )} ); })} @@ -1136,12 +1137,12 @@ const PrintStyle11 = ({ {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off -
    - )} +
    + Off +
    + )} {/*
    SUB TOTAL
    ROUND OFF
    */} @@ -1162,14 +1163,14 @@ const PrintStyle11 = ({ {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - {GlobaldummyData - ? '8' - : Number( +
    + {GlobaldummyData + ? '8' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */} @@ -1574,34 +1575,34 @@ const PrintStyle11 = ({ {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -1619,26 +1620,26 @@ const PrintStyle11 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    - ) +
    + ) : !estimatePrintHeader && table2Data?.OrderType === 'E' ? '' : Qrcodet && - paymentTypeUPI && ( + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    - -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)}
    - )} +
    + )}

    @@ -1876,25 +1877,25 @@ const PrintStyle11 = ({ > {GlobaldummyData ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Notestext && (

    - Notes : 10 days Return policy + {Notestext}


    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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. +
    +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && (

    -

  • - Once goods are sold, they are not - exchangeable or refundable. -
  • -
  • - Please check the product before leaving the - counter. -
  • + {TermsAndConditions?.map((item) => ( +
  • + {item?.TermsandConditions} +
  • + ))} + {/*
  • Please check the product before leaving the counter.
  • */}
    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : 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 +

    + +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : Signature == true && (
    @@ -2007,45 +2041,12 @@ const PrintStyle11 = ({ Signature

    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} + )}
    @@ -2105,12 +2106,12 @@ const PrintStyle11 = ({ {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off -
    - )} +
    + Off +
    + )} {/*
    SUB TOTAL
    ROUND OFF
    */} @@ -2131,14 +2132,14 @@ const PrintStyle11 = ({ {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - {GlobaldummyData - ? '8' - : Number( +
    + {GlobaldummyData + ? '8' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0}
    */} @@ -2536,34 +2537,34 @@ const PrintStyle11 = ({ )} {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -2581,26 +2582,26 @@ const PrintStyle11 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    - ) +
    + ) : !estimatePrintHeader && table2Data?.OrderType === 'E' ? '' : 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)} +
    +
    + )}

    {isEditedBill && lastTransaction && ( @@ -2828,25 +2829,25 @@ const PrintStyle11 = ({ > {GlobaldummyData ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Notestext && (

    - Notes : 10 days Return policy + {Notestext}


    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && (

    -

  • - Once goods are sold, they are not exchangeable - or refundable. -
  • -
  • - Please check the product before leaving the - counter. -
  • + {TermsAndConditions?.map((item) => ( +
  • + {item?.TermsandConditions} +
  • + ))} + {/*
  • Please check the product before leaving the counter.
  • */}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && (
    @@ -2958,44 +2991,12 @@ const PrintStyle11 = ({ Signature

    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} + )}
    @@ -3038,8 +3039,8 @@ const PrintStyle11 = ({ /> ) : null} {base64Image && - base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + base64Image && + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName} @@ -3069,18 +3070,18 @@ const PrintStyle11 = ({ {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 + : '')}
    {' '} @@ -3122,10 +3123,10 @@ const PrintStyle11 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    )} @@ -3170,83 +3171,83 @@ const PrintStyle11 = ({ : 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 && ( - - )} + + )} @@ -3260,195 +3261,195 @@ const PrintStyle11 = ({ {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 && ( - - )} + + )} ); } @@ -3483,83 +3484,83 @@ const PrintStyle11 = ({ : 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 && ( - - )} + + )} @@ -3573,108 +3574,108 @@ const PrintStyle11 = ({ {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 && ( - - )} + + )} ); } @@ -3721,8 +3722,8 @@ const PrintStyle11 = ({ {GlobaldummyData ? '8' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} )} {/*
    {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount) ? Number(table2Data?.NetAmount) : 0}
    */} @@ -4201,48 +4202,48 @@ const PrintStyle11 = ({ {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    +
    + QRcode +
    Scan to Pay
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0}
    - ) +
    + ) : !estimatePrintHeader && table2Data?.OrderType === 'E' ? '' : 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)}
    - )} +
    + )}

    @@ -4334,28 +4335,28 @@ const PrintStyle11 = ({ > {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : !estimatePrintHeader && table2Data?.OrderType === 'E' ? '' : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && (

    -

  • - Once goods are sold, they are not exchangeable or - refundable. -
  • -
  • - Please check the product before leaving the counter. -
  • + {TermsAndConditions?.map((item) => ( +
  • + {item?.TermsandConditions} +
  • + ))} + {/*
  • Please check the product before leaving the counter.
  • */}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && (
    @@ -4466,44 +4499,12 @@ const PrintStyle11 = ({ Signature

    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} + )}
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx index 5197d9b..fbfeaa2 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle12.jsx @@ -103,6 +103,7 @@ const Printstyle12 = ({ const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); const SettingData = useSelector(PreferenceData); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find( (setting) => @@ -495,8 +496,8 @@ const Printstyle12 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -550,18 +551,18 @@ const Printstyle12 = ({ {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 + : '')}
    @@ -689,10 +690,10 @@ const Printstyle12 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    Des} {GlobaldummyData ? GlobalQuantity && ( -
    - ) + + ) : Quantity && ( - - )} + + )} {GlobaldummyData ? GlobalMRP && ( - - ) + + ) : MRP && ( - - )} + + )} {GlobaldummyData ? GlobalRate && ( - - ) + + ) : Rate && ( - - )} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - ) + + ) : HsnCode && ( - - )} + + )} {GlobaldummyData ? GlobalDiscount && ( - - ) + + ) : Discount && ( - - )} + + )} {GlobaldummyData ? GlobalTax && ( - - ) + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - )} + table2Data?.OrderType !== 'E' && ( + + )} {GlobaldummyData ? GlobalAmount && ( - - ) + + ) : Amount && ( - - )} + + )} @@ -801,214 +802,214 @@ const Printstyle12 = ({ {GlobaldummyData ? GlobalSlNo && : SLNO && ( - - )} + + )} {GlobaldummyData ? GlobalItem && : Item && ( - - )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - ) + + ) : Quantity && ( - - )} + + )} {GlobaldummyData ? GlobalMRP && ( - - ) + + ) : MRP && ( - - )} + + )} {GlobaldummyData ? GlobalRate && ( - - ) + + ) : Rate && ( - - )} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - ) + + ) : HsnCode && ( - - )} + + )} {GlobaldummyData ? GlobalDiscount && ( - - ) + + ) : Discount && ( - - )} + + )} {GlobaldummyData ? GlobalTax && ( - - ) + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - )} + table2Data?.OrderType !== 'E' && ( + + )} {GlobaldummyData ? GlobalAmount && ( - - ) + + ) : Amount && ( - - )} + + )} ); })} @@ -1043,61 +1044,61 @@ const Printstyle12 = ({ : Item && } {GlobaldummyData ? GlobalQuantity && ( - - ) + + ) : Quantity && ( - - )} + + )} {GlobaldummyData ? GlobalMRP && ( - - ) + + ) : MRP && ( - - )} + + )} {GlobaldummyData ? GlobalRate && ( - - ) + + ) : Rate && ( - - )} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - ) + + ) : HsnCode && ( - - )} + + )} {GlobaldummyData ? GlobalDiscount && ( - - ) + + ) : Discount && ( - - )} + + )} {GlobaldummyData ? GlobalTax && ( - - ) + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - )} + table2Data?.OrderType !== 'E' && ( + + )} {GlobaldummyData ? GlobalAmount && ( - - ) + + ) : Amount && ( - - )} + + )} @@ -1107,116 +1108,116 @@ const Printstyle12 = ({ {GlobaldummyData ? GlobalSlNo && : SLNO && ( - - )} + + )} {GlobaldummyData ? GlobalItem && : Item && ( - - )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - ) + + ) : Quantity && ( - - )} + + )} {GlobaldummyData ? GlobalMRP && ( - - ) + + ) : MRP && ( - - )} + + )} {GlobaldummyData ? GlobalRate && ( - - ) + + ) : Rate && ( - - )} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - ) + + ) : HsnCode && ( - - )} + + )} {GlobaldummyData ? GlobalDiscount && ( - - ) + + ) : Discount && ( - - )} + + )} {GlobaldummyData ? GlobalTax && ( - - ) + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - )} + table2Data?.OrderType !== 'E' && ( + + )} {GlobaldummyData ? GlobalAmount && ( - - ) + + ) : Amount && ( - - )} + + )} ); })} @@ -1285,30 +1286,30 @@ const Printstyle12 = ({ {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    -
    Off
    -
    :
    - {GlobaldummyData - ? '9' - : Number( +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '9' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} +
    -
    - )} + )} {/*
    Extra Charges @@ -1439,6 +1440,997 @@ const Printstyle12 = ({ OrderDetailIGST?.[0]?.TaxAmt > 0) || (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( + <> +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( +
    {idx + 1} {item.ProdName}{item.SalesQty}{item?.EditTokenAvailable === 'Y' ? item?.EditTokenQty : item.SalesQty} {item.Rate}{item.TotalAmt}{((item?.EditTokenAvailable === 'Y' ? item?.EditTokenQty : item.SalesQty) * item.Rate) - ((item?.EditTokenAvailable === 'Y' ? (item?.OfferAmt / item?.EditTokenQty) : item?.OfferAmt))}
    S.NS.NS.NItemItemItem - Qty - + Qty + - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + - HSN - + HSN + - HSN - + HSN + - MRP - + MRP + - MRP - + MRP + - Dis{' '} - + Dis{' '} + - Dis{' '} - + Dis{' '} + - Tax %{' '} - + Tax %{' '} + - Tax %{' '} - + Tax %{' '} + - Rate - + Rate + - Rate - + Rate + - Amt - + Amt + - Amt - + Amt +
    {index + 1} - {chunkIndex * chunkSize + index + 1} - + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > +
    +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {a.SerialNumber}
    - ); - }) - : ''}{' '} - {item?.ProductIdentifierDtls?.length > + ? 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?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > + ? 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {a.SerialNumber}
    - ); - }) - : ''}{' '} - {item?.ProductIdentifierDtls?.length > + ? 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?.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} - + {item.ProdTaxPercentage} + - {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} +
    S.NS.NS.NItemItemItem - Qty - + Qty + - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + - HSN - + HSN + - HSN - + HSN + - MRP - + MRP + - MRP - + MRP + - Dis{' '} - + Dis{' '} + - Dis{' '} - + Dis{' '} + - Tax %{' '} - + Tax %{' '} + - Tax %{' '} - + Tax %{' '} + - Rate - + Rate + - Rate - + Rate + - Amt - + Amt + - Amt - + Amt +
    {index + 1} - {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?.ProdName}
    +
    + ({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} - + {item.ProdTaxPercentage} + - {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} +
    Item - Qty - + Qty + - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + - HSN - + HSN + - HSN - + HSN + - MRP - + MRP + - MRP - + MRP + - Dis{' '} - + Dis{' '} + - Dis{' '} - + Dis{' '} + - Tax %{' '} - + Tax %{' '} + - Tax %{' '} - + Tax %{' '} + - Rate - + Rate + - Rate - + Rate + - Amt - + Amt + - Amt - + Amt +
    {item?.ProdName} -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {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?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return ( +
    {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?.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} - + {item.ProdTaxPercentage} + - {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} +
    Item - Qty - + Qty + - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + - HSN - + HSN + - HSN - + HSN + - MRP - + MRP + - MRP - + MRP + - Dis{' '} - + Dis{' '} + - Dis{' '} - + Dis{' '} + - Tax %{' '} - + Tax %{' '} + - Tax %{' '} - + Tax %{' '} + - Rate - + Rate + - Rate - + Rate + - Amt - + Amt + - Amt - + Amt +
    {item?.ProdName} -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    -
    +
    {item?.ProdName}
    +
    + ({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} - + {item.ProdTaxPercentage} + - {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} +
    QtyQty - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPMRPMRPRateRateRateRateHSNHSNHSNHSN(%)(%)(%)(%) - Tax (%) - + Tax (%) + - Tax (%) - + Tax (%) + AmtAmtAmtAmt
    {index + 1} - {chunkIndex * chunkSize + index + 1} - + {chunkIndex * chunkSize + index + 1} + {item?.ProdName} -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => - pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls - ?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == - '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {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?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls + ?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == + '' || + items.SerialNumber == null + ) + )?.map((a) => { + return ( +
    {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?.SalesQty} - + {item?.SalesQty} + - {item?.SalesQty} - + {item?.SalesQty} + - {item?.MRP} - + {item?.MRP} + - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + - {item?.Rate} - + {item?.Rate} + - {item?.Rate} - + {item?.Rate} + - {item?.HSN} - + {item?.HSN} + - {item?.HSN} - + {item?.HSN} + - {item?.discount} - + {item?.discount} + - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + - {item?.ProdTaxPercentage} - + {item?.ProdTaxPercentage} + - {item?.ProdTaxPercentage || 0} - + {item?.ProdTaxPercentage || 0} + - {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} +
    DesQtyQty - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + MRPMRPMRPMRPRateRateRateRateHSNHSNHSNHSN(%)(%)(%)(%) - Tax (%) - + Tax (%) + - Tax (%) - + Tax (%) + AmtAmtAmtAmt
    {index + 1} - {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?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    +
    - {item?.SalesQty} - + {item?.SalesQty} + - {item?.SalesQty} - + {item?.SalesQty} + - {item?.MRP} - + {item?.MRP} + - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + - {item?.Rate} - + {item?.Rate} + - {item?.Rate} - + {item?.Rate} + - {item?.HSN} - + {item?.HSN} + - {item?.HSN} - + {item?.HSN} + - {item?.discount} - + {item?.discount} + - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + - {item?.ProdTaxPercentage} - + {item?.ProdTaxPercentage} + - {item?.ProdTaxPercentage || 0} - + {item?.ProdTaxPercentage || 0} + - {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} +
    + + + + + + + + {OrderDetailGST?.map((item) => ( + + + + + + + + ))} +
    + Taxable Amount + + CGST + + SGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailIGST?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + IGST + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number( + item.WithOutTaxAmount + ).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed( + 2 + )} +
    + + )} +
    + + )} +
    + )} +
    + +
    +
    + {PaymentStatusSuccess?.length === 1 + ? PaymentStatusSuccess?.[0]?.PaymentTypeName + : 'Split'}{' '} +   Payment +
    +
    :
    +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + {/*
    +
    + Recived Amt +
    +
    :
    +
    + {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} +
    +
    +
    +
    + Balance Amt +
    +
    :
    +
    + 0.00 +
    +
    */} +
    +
    + + {isEditedBill && lastTransaction && ( +
    +
    +
    + + Bill Gross Amount + + + {(lastTransaction?.BeforeAdjustment || 0).toFixed( + 2 + )} + +
    +
    + {'Adjustment Amount'} + + {lastTransaction?.AdjustmentType === 'REFUND' + ? '-' + : '+'} + {(lastTransaction?.Amount || 0).toFixed(2)} + +
    +
    + + Net Bill Amount + + + {(lastTransaction?.AfterAdjustment || 0).toFixed( + 2 + )} + +
    +
    +
    + )} + + {GlobaldummyData + ? GlobalCredit && ( +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) + : CreditDetails && + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > + 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < + 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs( + table2Data.CustomerDetails[0].OldCreditBal + )} +

    + ) : null} + + )} + + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > + 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} +
    + +
    +
    +
    + Your Order No:{' '} + {GlobaldummyData + ? '53' + : table2Data?.SalesId && + extractLastNumber(table2Data?.SalesId)} +
    +
    + + {GlobaldummyData + ? GlobalQrcodet && ( +
    + image +
    + {' '} + Scan to Pay:{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    + +
    + Scan to Pay{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2)} +
    +
    + )} +
    + {sportsAppPreference && MembershipApplied && ( +
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    + )} + +
    + {GlobaldummyData + ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : 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. +
    +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : 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 +

    + +
    + ) + : !estimatePrintHeader && + table2Data?.OrderType === 'E' + ? '' + : Signature == true && ( +
    +

    + Signature +

    + +
    + )} +
    +
    + + {PrintGreeting?.SettingValue === 'Y' && ( +
    + Thank You Visit Again +
    + )} + + )} +
    + ))} + + {shouldFooterBeOnNewPage && FormatTheme && ( +
    +
    + <> +
    +
    +
    +
    +
    Items
    +
    :
    +
    + {GlobaldummyData ? '8' : totalQuantityFilter?.length} +
    +
    +
    +
    Qty
    +
    :
    +
    + {GlobaldummyData ? '9' : totalQuantity} +
    +
    + {(table2Data?.OverallDisc > 0 || + TotalOfferAmount > 0) && ( +
    +
    Off
    +
    :
    +
    + {GlobaldummyData + ? '9' + : Number( + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)} +
    +
    + )} + {/*
    +
    + Extra Charges +
    +
    :
    +
    + 0 +
    +
    */} + +
    + + {DineInData?.length > 0 && TakeawayData?.length > 0 && ( + <> + {takeAwayPreference && ( +
    +
    + TakeAway +
    +
    :
    +
    + {Number(TakeawayTotal).toFixed(2)} +
    +
    + )} + {dinePreference && ( +
    +
    + Dine In +
    +
    :
    +
    + {Number(DineInTotal).toFixed(2)} +
    +
    + )} + + )} +
    +
    + Amount +
    +
    :
    +
    + {GlobaldummyData + ? '1,066.00' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( + <> + {/*

    Split Payment:

    */} + {Object.keys(aggregatedPayments).map( + (paymentType) => ( +
    + {paymentType}:{' '} + {aggregatedPayments[paymentType].toFixed(2)} +
    + ) + )} + + )} + {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( + '' + ) : ( +
    + {((OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0) || + (OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0) || + (OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( <>

    - {Number(item.TotalAmt).toFixed( - 2 - )} + {Number(item.TotalAmt).toFixed(2)} ))} @@ -1706,9 +2696,7 @@ const Printstyle12 = ({ textAlign: 'center', }} > - {Number(item.TotalAmt).toFixed( - 2 - )} + {Number(item.TotalAmt).toFixed(2)} ))} @@ -1718,993 +2706,6 @@ const Printstyle12 = ({

    )} -
    - )} -
    - -
    -
    - {PaymentStatusSuccess?.length === 1 - ? PaymentStatusSuccess?.[0]?.PaymentTypeName - : 'Split'}{' '} -   Payment -
    -
    :
    -
    - {GlobaldummyData - ? '1,066.00' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    -
    - {/*
    -
    - Recived Amt -
    -
    :
    -
    - {GlobaldummyData ? '1,066.00' : Number(table2Data?.NetAmount).toFixed(2) ? Number(table2Data?.NetAmount).toFixed(2) : 0} -
    -
    -
    -
    - Balance Amt -
    -
    :
    -
    - 0.00 -
    -
    */} -
    -
    - - {isEditedBill && lastTransaction && ( -
    -
    -
    - - Bill Gross Amount - - - {(lastTransaction?.BeforeAdjustment || 0).toFixed( - 2 - )} - -
    -
    - {'Adjustment Amount'} - - {lastTransaction?.AdjustmentType === 'REFUND' - ? '-' - : '+'} - {(lastTransaction?.Amount || 0).toFixed(2)} - -
    -
    - - Net Bill Amount - - - {(lastTransaction?.AfterAdjustment || 0).toFixed( - 2 - )} - -
    -
    -
    - )} - - {GlobaldummyData - ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) - : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < - 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs( - table2Data.CustomerDetails[0].OldCreditBal - )} -

    - ) : null} - - )} - - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > - 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} -
    - -
    -
    -
    - Your Order No:{' '} - {GlobaldummyData - ? '53' - : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} -
    -
    - - {GlobaldummyData - ? GlobalQrcodet && ( -
    - image -
    - {' '} - Scan to Pay:{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} -
    - {sportsAppPreference && MembershipApplied && ( -
    {`*** Membership ${table2Data?.NetAmount === 0 ? 'Free Hours' : 'Discount'} Utilized - ${MembershipApplied?.Detail?.[0]?.MembershipName} ***`}
    - )} - -
    - {GlobaldummyData - ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    - -
    -
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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. -
    -
    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : 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 -

    - -
    - ) - : !estimatePrintHeader && - table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} -
    -
    - - {PrintGreeting?.SettingValue === 'Y' && ( -
    - Thank You Visit Again -
    - )} - - )} -
    - ))} - - {shouldFooterBeOnNewPage && FormatTheme && ( -
    -
    - <> -
    -
    -
    -
    -
    Items
    -
    :
    -
    - {GlobaldummyData ? '8' : totalQuantityFilter?.length} -
    -
    -
    -
    Qty
    -
    :
    -
    - {GlobaldummyData ? '9' : totalQuantity} -
    -
    - {(table2Data?.OverallDisc > 0 || - TotalOfferAmount > 0) && ( -
    -
    Off
    -
    :
    -
    - {GlobaldummyData - ? '9' - : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} -
    -
    - )} - {/*
    -
    - Extra Charges -
    -
    :
    -
    - 0 -
    -
    */} - -
    - - {DineInData?.length > 0 && TakeawayData?.length > 0 && ( - <> - {takeAwayPreference && ( -
    -
    - TakeAway -
    -
    :
    -
    - {Number(TakeawayTotal).toFixed(2)} -
    -
    - )} - {dinePreference && ( -
    -
    - Dine In -
    -
    :
    -
    - {Number(DineInTotal).toFixed(2)} -
    -
    - )} - - )} -
    -
    - Amount -
    -
    :
    -
    - {GlobaldummyData - ? '1,066.00' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    -
    - {PaymentStatusSuccess?.length > 1 && !isEditedBill && ( - <> - {/*

    Split Payment:

    */} - {Object.keys(aggregatedPayments).map( - (paymentType) => ( -
    - {paymentType}:{' '} - {aggregatedPayments[paymentType].toFixed(2)} -
    - ) - )} - - )} - {!estimatePrintHeader && table2Data?.OrderType === 'E' ? ( - '' - ) : ( -
    - {((OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0) || - (OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0) || - (OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( - <> -
    -

    - --------- GST Breakup Details ----------- -

    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - - - - - - - - - {OrderDetailGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - )} - - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailIGST?.map((item) => ( - - - - - - - ))} -
    - Taxable Amount - - IGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailVAT?.map((item) => ( - - - - - - - ))} -
    - Taxable Amount - - VAT - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number( - item.WithOutTaxAmount - ).toFixed(2)} - - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - - )} -
    - - )}
    )}
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -2880,26 +2881,26 @@ const Printstyle12 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )}
    @@ -2914,78 +2915,78 @@ const Printstyle12 = ({ {GlobaldummyData ? '53' : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} + extractLastNumber(table2Data?.SalesId)}
    {GlobaldummyData ? GlobalQrcodet && ( -
    - image + image +
    + {' '} + Scan to Pay:{' '} +
    +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Qrcodet && + paymentTypeUPI && ( +
    +
    - {' '} - Scan to Pay:{' '} + Scan to Pay{' '}
    - ₹ + ₹ {GlobaldummyData ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} + : Number(table2Data?.NetAmount).toFixed(2)}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Qrcodet && - paymentTypeUPI && ( -
    - -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    -
    - )} + )}
    {sportsAppPreference && MembershipApplied && ( @@ -3010,25 +3011,25 @@ const Printstyle12 = ({ > {GlobaldummyData ? GlobalIsnotes && ( +
    +

    + Notes : 10 days Return policy +

    + +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Notestext && (

    - Notes : 10 days Return policy + {Notestext}


    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && (

    -

  • - Once goods are sold, they are not exchangeable - or refundable. -
  • -
  • - Please check the product before leaving the - counter. -
  • + {TermsAndConditions?.map((item) => ( +
  • + {item?.TermsandConditions} +
  • + ))} + {/*
  • Please check the product before leaving the counter.
  • */}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && (
    @@ -3140,44 +3173,12 @@ const Printstyle12 = ({ Signature

    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} + )}
    @@ -3225,18 +3226,18 @@ const Printstyle12 = ({ {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 + : '')}
    {' '} @@ -3340,10 +3341,10 @@ const Printstyle12 = ({ {GlobaldummyData ? '553' : table2Data?.OrderId && - extractLastNumberOrderId( - table2Data?.OrderId, - table2Data?.FYStatus - )} + extractLastNumberOrderId( + table2Data?.OrderId, + table2Data?.FYStatus + )}
    Des} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity && ( - - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - MRP - ) + MRP + ) : MRP && MRP} {GlobaldummyData ? GlobalRate && ( - Rate - ) + Rate + ) : Rate && Rate} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalDiscount && ( - (%) - ) + (%) + ) : Discount && ( - (%) - )} + (%) + )} {GlobaldummyData ? GlobalTax && ( - Tax (%) - ) + Tax (%) + ) : Tax && - table2Data?.OrderType !== 'E' && ( - Tax (%) - )} + table2Data?.OrderType !== 'E' && ( + Tax (%) + )} {GlobaldummyData ? GlobalAmount && ( - Amt - ) + Amt + ) : Amount && Amt} @@ -3442,195 +3443,195 @@ const Printstyle12 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} - {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {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?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} + {item?.BrandName !== 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?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return ( +
    {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(',')} +
    + ); + }) + : ''} +
    + )} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3666,50 +3667,50 @@ const Printstyle12 = ({ : Item && Des} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity && ( - - {' '} - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {' '} + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - MRP - ) + MRP + ) : MRP && MRP} {GlobaldummyData ? GlobalRate && ( - Rate - ) + Rate + ) : Rate && Rate} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalDiscount && ( - (%) - ) + (%) + ) : Discount && ( - (%) - )} + (%) + )} {GlobaldummyData ? GlobalTax && ( - Tax (%) - ) + Tax (%) + ) : Tax && - table2Data?.OrderType !== 'E' && ( - Tax (%) - )} + table2Data?.OrderType !== 'E' && ( + Tax (%) + )} {GlobaldummyData ? GlobalAmount && ( - Amt - ) + Amt + ) : Amount && Amt} @@ -3724,108 +3725,108 @@ const Printstyle12 = ({ {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - - )} + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalDiscount && ( - - {item?.discount} - - ) + + {item?.discount} + + ) : Discount && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount && ( - - {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} + + )} ); } @@ -3892,8 +3893,8 @@ const Printstyle12 = ({ {GlobaldummyData ? '9' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )} @@ -4010,118 +4011,20 @@ const Printstyle12 = ({ OrderDetailIGST?.[0]?.TaxAmt > 0) || (OrderDetailVAT?.length > 0 && OrderDetailVAT?.[0]?.TaxAmt > 0)) && ( - <> -
    -

    - --------- GST Breakup Details ----------- -

    - {OrderDetailGST?.length > 0 && - OrderDetailGST?.[0]?.TaxAmt > 0 && ( - - - - - - - - - {OrderDetailGST?.map((item) => ( - - - - - - - - ))} -
    - Taxable Amount - - CGST - - SGST - - Total Amount -
    - {item?.TaxPercentage || 0}% - - {Number(item.WithOutTaxAmount).toFixed(2)} - - {Number(item.CGST).toFixed(2)} - - {Number(item.SGST).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} -
    - )} - - {OrderDetailIGST?.length > 0 && - OrderDetailIGST?.[0]?.TaxAmt > 0 && ( - <> -
    + <> +
    +

    + --------- GST Breakup Details ----------- +

    + {OrderDetailGST?.length > 0 && + OrderDetailGST?.[0]?.TaxAmt > 0 && ( + - {OrderDetailIGST?.map((item) => ( + {OrderDetailGST?.map((item) => ( + -
    - IGST + CGST + + SGST
    - {Number(item.TaxAmt).toFixed(2)} + {Number(item.CGST).toFixed(2)} + + {Number(item.SGST).toFixed(2)} ))}
    - - )} - {OrderDetailVAT?.length > 0 && - OrderDetailVAT?.[0]?.TaxAmt > 0 && ( - <> -
    - - - - - - - - {OrderDetailVAT?.map((item) => ( + )} + + {OrderDetailIGST?.length > 0 && + OrderDetailIGST?.[0]?.TaxAmt > 0 && ( + <> +
    +
    - Taxable Amount - - VAT - - Total Amount -
    + - - ))} -
    - {item?.TaxPercentage || 0}% + Taxable Amount - {Number(item.WithOutTaxAmount).toFixed(2)} + IGST - {Number(item.TaxAmt).toFixed(2)} - - {Number(item.TotalAmt).toFixed(2)} + Total Amount
    - - )} -
    - - )} + {OrderDetailIGST?.map((item) => ( + + + {item?.TaxPercentage || 0}% + + + {Number(item.WithOutTaxAmount).toFixed(2)} + + + {Number(item.TaxAmt).toFixed(2)} + + + + {Number(item.TotalAmt).toFixed(2)} + + + ))} + + + )} + {OrderDetailVAT?.length > 0 && + OrderDetailVAT?.[0]?.TaxAmt > 0 && ( + <> +
    + + + + + + + + {OrderDetailVAT?.map((item) => ( + + + + + + + ))} +
    + Taxable Amount + + VAT + + Total Amount +
    + {item?.TaxPercentage || 0}% + + {Number(item.WithOutTaxAmount).toFixed(2)} + + {Number(item.TaxAmt).toFixed(2)} + + {Number(item.TotalAmt).toFixed(2)} +
    + + )} +
    + + )}
    )}
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} -

    - ) : null} - - )} + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} +

    + ) : null} + + )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} -

    - ) : null} -
    - )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} +

    + ) : null} +
    + )}
    @@ -4487,70 +4488,70 @@ const Printstyle12 = ({ {GlobaldummyData ? '53' : table2Data?.SalesId && - extractLastNumber(table2Data?.SalesId)} + extractLastNumber(table2Data?.SalesId)}
    {GlobaldummyData ? GlobalQrcodet && ( -
    - image -
    - {' '} - Scan to Pay:{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2) - ? Number(table2Data?.NetAmount).toFixed(2) - : 0} -
    +
    + image +
    + {' '} + Scan to Pay:{' '}
    - ) +
    + ₹ + {GlobaldummyData + ? '1,066' + : Number(table2Data?.NetAmount).toFixed(2) + ? Number(table2Data?.NetAmount).toFixed(2) + : 0} +
    +
    + ) : !estimatePrintHeader && table2Data?.OrderType === 'E' ? '' : 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)} +
    +
    + )}
    {sportsAppPreference && MembershipApplied && (
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

    -
    -
    - ) +
    +
    + ) : !estimatePrintHeader && table2Data?.OrderType === 'E' ? '' : 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. +
    +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : TermsnAdCondition == true && + TermsAndConditions?.length > 0 && (

    -

  • - Once goods are sold, they are not exchangeable or - refundable. -
  • -
  • - Please check the product before leaving the counter. -
  • + {TermsAndConditions?.map((item) => ( +
  • + {item?.TermsandConditions} +
  • + ))} + {/*
  • Please check the product before leaving the counter.
  • */}
    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : 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 +

    + +
    + ) + : !estimatePrintHeader && table2Data?.OrderType === 'E' + ? '' + : Signature == true && (
    @@ -4706,44 +4739,12 @@ const Printstyle12 = ({ Signature

    - ) - : !estimatePrintHeader && table2Data?.OrderType === 'E' - ? '' - : Signature == true && ( -
    -

    - Signature -

    - -
    - )} + )}
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx index f4ea976..e05dd88 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle6.jsx @@ -103,6 +103,7 @@ const Printstyle6 = ({ const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); const SettingData = useSelector(PreferenceData); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); console.log(CashierNameField, "GlobaldummyData") const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find( @@ -3267,7 +3268,7 @@ const Printstyle6 = ({ /> ) : null}
    -
    +
    {GlobaldummyData ? 'XYZ Shop' : table2Data?.BrName}
    diff --git a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx index 6d67baa..9cb2131 100644 --- a/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/ThermalPrinter/PrintStyle7.jsx @@ -99,6 +99,7 @@ const PrintStyle7 = ({ const GlobalLogo = useSelector(GlobalprintLogo); const GlobalCredit = useSelector(GlobalprintCredit); const SettingData = useSelector(PreferenceData); + const SelectedHeaderColor = useSelector(GlobalSelectedPrintHeaderColor); const estimatePrintHeader = SettingData?.[0]?.SettingDtlDetails?.find( (setting) => @@ -366,8 +367,8 @@ const PrintStyle7 = ({ flexDirection: 'column', justifyContent: chunkIndex === paginatedChunks.length - 1 && - !shouldFooterBeOnNewPage && - FormatTheme + !shouldFooterBeOnNewPage && + FormatTheme ? 'space-between' : '', height: isMobile @@ -416,7 +417,7 @@ const PrintStyle7 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( {table2Data?.OrderType === 'E' && (
    @@ -562,80 +563,80 @@ const PrintStyle7 = ({ {GlobaldummyData ? GlobalSlNo && ( - S - ) + S + ) : SLNO == true && ( - S - )} + S + )} {GlobaldummyData ? GlobalItem && Item : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - MRP - ) + MRP + ) : MRP == true && ( - MRP - )} + MRP + )} {GlobaldummyData ? GlobalRate && ( - Rate - ) + Rate + ) : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && ( - Tax % - ) + Tax % + ) : Tax && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -643,137 +644,137 @@ const PrintStyle7 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => - pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - )} - - )} + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => + pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ))} @@ -802,80 +803,80 @@ const PrintStyle7 = ({ {GlobaldummyData ? GlobalSlNo && ( - S.No - ) + S.No + ) : SLNO == true && ( - S.NO - )} + S.NO + )} {GlobaldummyData ? GlobalItem && Item : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && ( - MRP - ) + MRP + ) : MRP == true && ( - MRP - )} + MRP + )} {GlobaldummyData ? GlobalRate && ( - Rate - ) + Rate + ) : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && ( - Tax % - ) + Tax % + ) : Tax && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -883,153 +884,153 @@ const PrintStyle7 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {chunkIndex * chunkSize + index + 1} - - )} + + {chunkIndex * chunkSize + index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > + +
    {item?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return ( -
    {a.SerialNumber}
    - ); - }) - : ''}{' '} - {item?.ProductIdentifierDtls?.length > + ? 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?.ProductIdentifierDtls.filter( + (item1) => + item1.IMEI1 !== '' || + item1.IMEI2 !== '' + )?.map((item2) => { + const imei1 = item2.IMEI1 || ''; + const imei2 = item2.IMEI2 || ''; + return ( +
    + {[imei1, imei2] + .filter(Boolean) + .join(',')} +
    + ); + }) + : ''} +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ))} @@ -1055,15 +1056,15 @@ const PrintStyle7 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off :{' '} - {GlobaldummyData - ? '10' - : Number( +
    + Off :{' '} + {GlobaldummyData + ? '10' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )}
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -1572,26 +1573,26 @@ const PrintStyle7 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} {GlobaldummyData && GlobalCashierName && (
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    +
    + QRcode +
    + 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)} +
    +
    + )}
    )} @@ -1747,23 +1748,23 @@ const PrintStyle7 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -1783,137 +1784,137 @@ const PrintStyle7 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -1970,15 +1971,15 @@ const PrintStyle7 = ({
    {(table2Data?.OverallDisc > 0 || TotalOfferAmount > 0) && ( -
    - Off :{' '} - {GlobaldummyData - ? '10' - : Number( +
    + Off :{' '} + {GlobaldummyData + ? '10' + : Number( TotalOfferAmount + table2Data?.OverallDisc ).toFixed(2)} -
    - )} +
    + )}
    {table2Data?.OrderType === 'E' ? ( @@ -2431,34 +2432,34 @@ const PrintStyle7 = ({ {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === - 'Credit' && ( + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === + 'Credit' && ( <> {table2Data.CustomerDetails[0].OldCreditBal > - 0 ? ( + 0 ? (

    Advance Amount: {table2Data.CustomerDetails[0].OldCreditBal} @@ -2476,26 +2477,26 @@ const PrintStyle7 = ({ )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < - 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs( - table2Data.CustomerDetails[0].CurrentCreditBal - )} -

    - ) : null} -
    - )} +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < + 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs( + table2Data.CustomerDetails[0].CurrentCreditBal + )} +

    + ) : null} +
    + )} {GlobaldummyData && GlobalCashierName && (
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    - Scan to Pay{' '} -
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    +
    + QRcode +
    + 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)} +
    +
    + )}
    )} @@ -2651,23 +2652,23 @@ const PrintStyle7 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    - {Notestext} -

    +
    +

    + {Notestext} +

    -
    -
    - )} +
    +
    + )}
    )} @@ -2687,137 +2688,137 @@ const PrintStyle7 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}
    @@ -2868,7 +2869,7 @@ const PrintStyle7 = ({ /> ) : null} {base64Image && - (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( + (PrintLogo?.SettingValue === 'Y' || LogoField) ? ( {table2Data?.OrderType === 'E' && (
    @@ -3016,59 +3017,59 @@ const PrintStyle7 = ({ {GlobaldummyData ? GlobalSlNo && S.No : SLNO == true && ( - S.No - )} + S.No + )} {GlobaldummyData ? GlobalItem && ( - - Item - - ) + + Item + + ) : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && HSN : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && Qty : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && MRP : MRP == true && ( - MRP - )} + MRP + )} {GlobaldummyData ? GlobalRate && Rate : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && Dis : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && ( - Tax % - ) + Tax % + ) : Tax && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - Amt - ) + Amt + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -3077,135 +3078,135 @@ const PrintStyle7 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - ).length > 0 ? ( -
    - {PackageDetails?.filter( - (pkg) => pkg.ProdId === item.ProdId - )?.map((item, index) => ( - - {item.ParcelCount} PCS{' '} - {item.ParcelQty} PACK ( - {item.ParcelType}) - - ))} -
    - ) : ( -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) -
    - )} - - )} + +
    {item?.ProdName}
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + ).length > 0 ? ( +
    + {PackageDetails?.filter( + (pkg) => pkg.ProdId === item.ProdId + )?.map((item, index) => ( + + {item.ParcelCount} PCS{' '} + {item.ParcelQty} PACK ( + {item.ParcelType}) + + ))} +
    + ) : ( +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) +
    + )} + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ) )} @@ -3236,65 +3237,65 @@ const PrintStyle7 = ({ {GlobaldummyData ? GlobalSlNo && S : SLNO == true && ( - S - )} + S + )} {GlobaldummyData ? GlobalItem && Item : Item == true && Item} {GlobaldummyData ? GlobalHsnCode && ( - HSN - ) + HSN + ) : HsnCode == true && ( - HSN - )} + HSN + )} {GlobaldummyData ? GlobalQuantity && ( - Qty - ) + Qty + ) : Quantity == true && ( - - {WeightasKg ? 'Qty/Kg' : 'Qty'} - - )} + + {WeightasKg ? 'Qty/Kg' : 'Qty'} + + )} {GlobaldummyData ? GlobalMRP && MRP : MRP == true && ( - MRP - )} + MRP + )} {GlobaldummyData ? GlobalRate && ( - Rate - ) + Rate + ) : Rate == true && ( - Rate - )} + Rate + )} {GlobaldummyData ? GlobalDiscount && ( - Dis - ) + Dis + ) : Discount == true && ( - Dis - )} + Dis + )} {GlobaldummyData ? GlobalTax && ( - Tax % - ) + Tax % + ) : Tax && - table2Data?.OrderType !== 'E' && ( - Tax % - )} + table2Data?.OrderType !== 'E' && ( + Tax % + )} {GlobaldummyData ? GlobalAmount && ( - - Amt - - ) + + Amt + + ) : Amount == true && ( - - Amt - - )} + + Amt + + )} @@ -3303,148 +3304,148 @@ const PrintStyle7 = ({ {GlobaldummyData ? GlobalSlNo && ( - - {index + 1} - - ) + + {index + 1} + + ) : SLNO == true && ( - - {index + 1} - - )} + + {index + 1} + + )} {GlobaldummyData ? GlobalItem && {item?.ProdName} : Item == true && ( - -
    {item?.ProdName}
    -
    - ({item?.Size ? item?.Size : '1'}{' '} - {item?.SinglePc == 'Y' - ? 'PCS' - : item?.Type != 'C' - ? item?.UomName - : 'COMBO'} - ) - {item?.BrandName !== null - ? item?.BrandName - : ''} -   - {item?.ProductIdentifierDtls?.length > 0 - ? item?.ProductIdentifierDtls?.filter( - (items) => - !( - items.SerialNumber == '' || - items.SerialNumber == null - ) - )?.map((a) => { - return
    {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?.ProdName}
    +
    + ({item?.Size ? item?.Size : '1'}{' '} + {item?.SinglePc == 'Y' + ? 'PCS' + : item?.Type != 'C' + ? item?.UomName + : 'COMBO'} + ) + {item?.BrandName !== null + ? item?.BrandName + : ''} +   + {item?.ProductIdentifierDtls?.length > 0 + ? item?.ProductIdentifierDtls?.filter( + (items) => + !( + items.SerialNumber == '' || + items.SerialNumber == null + ) + )?.map((a) => { + return
    {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(',')} +
    + ); + }) + : ''} +
    + + )} {GlobaldummyData ? GlobalHsnCode && ( - - {item?.HSN} - - ) + + {item?.HSN} + + ) : HsnCode == true && ( - - {item?.HSN} - - )} + + {item?.HSN} + + )} {GlobaldummyData ? GlobalQuantity && ( - - {item?.SalesQty} - - ) + + {item?.SalesQty} + + ) : Quantity == true && ( - - {item?.SalesQty} - - )} + + {item?.SalesQty} + + )} {GlobaldummyData ? GlobalMRP && ( - - {item?.MRP} - - ) + + {item?.MRP} + + ) : MRP == true && ( - - {item?.SinglePc === 'Y' - ? item?.Rate - : item?.MRP} - - )} + + {item?.SinglePc === 'Y' + ? item?.Rate + : item?.MRP} + + )} {GlobaldummyData ? GlobalRate && ( - - {item?.Rate} - - ) + + {item?.Rate} + + ) : Rate == true && ( - - {item?.Rate} - - )} + + {item?.Rate} + + )} {GlobaldummyData ? GlobalDiscount && {item.discount} : Discount == true && ( - - {item?.Type != 'C' - ? item?.OfferAmt || 0 - : item?.OfferValue || 0} - - )} + + {item?.Type != 'C' + ? item?.OfferAmt || 0 + : item?.OfferValue || 0} + + )} {GlobaldummyData ? GlobalTax && ( - - {item?.ProdTaxPercentage} - - ) + + {item?.ProdTaxPercentage} + + ) : Tax && - table2Data?.OrderType !== 'E' && ( - - {item?.ProdTaxPercentage || 0} - - )} + table2Data?.OrderType !== 'E' && ( + + {item?.ProdTaxPercentage || 0} + + )} {GlobaldummyData ? GlobalAmount && ( - - {item?.TotalAmt} - - ) + + {item?.TotalAmt} + + ) : Amount == true && ( - - {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} + + )} ) )} @@ -3469,8 +3470,8 @@ const PrintStyle7 = ({ {GlobaldummyData ? '10' : Number( - TotalOfferAmount + table2Data?.OverallDisc - ).toFixed(2)} + TotalOfferAmount + table2Data?.OverallDisc + ).toFixed(2)}
    )}
    @@ -3915,62 +3916,62 @@ const PrintStyle7 = ({ {GlobaldummyData ? GlobalCredit && ( -
    -
    Advance Amount:
    -
    Opening Balance:
    -
    - ) +
    +
    Advance Amount:
    +
    Opening Balance:
    +
    + ) : CreditDetails && - table2Data?.CustomerDetails?.length > 0 && ( -
    - {/* OLD CREDIT BAL */} - {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( - <> - {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( -

    - Advance Amount: - {table2Data.CustomerDetails[0].OldCreditBal} -

    - ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( -

    - {' '} - Opening Balance:{' '} - {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} -

    - ) : null} - - )} + table2Data?.CustomerDetails?.length > 0 && ( +
    + {/* OLD CREDIT BAL */} + {PaymentStatusSuccess?.[0]?.PaymentTypeName === 'Credit' && ( + <> + {table2Data.CustomerDetails[0].OldCreditBal > 0 ? ( +

    + Advance Amount: + {table2Data.CustomerDetails[0].OldCreditBal} +

    + ) : table2Data.CustomerDetails[0].OldCreditBal < 0 ? ( +

    + {' '} + Opening Balance:{' '} + {Math.abs(table2Data.CustomerDetails[0].OldCreditBal)} +

    + ) : null} + + )} - {/* CURRENT CREDIT BAL */} - {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( -

    - {' '} - Current Advance Amount:{' '} - {table2Data.CustomerDetails[0].CurrentCreditBal} -

    - ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( -

    - {' '} - Current Balance Amount:{' '} - {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} -

    - ) : null} -
    - )} + {/* CURRENT CREDIT BAL */} + {table2Data.CustomerDetails[0].CurrentCreditBal > 0 ? ( +

    + {' '} + Current Advance Amount:{' '} + {table2Data.CustomerDetails[0].CurrentCreditBal} +

    + ) : table2Data.CustomerDetails[0].CurrentCreditBal < 0 ? ( +

    + {' '} + Current Balance Amount:{' '} + {Math.abs(table2Data.CustomerDetails[0].CurrentCreditBal)} +

    + ) : null} +
    + )} {GlobaldummyData && GlobalCashierName && (
    {GlobaldummyData ? GlobalQrcodet && ( -
    - QRcode -
    Scan to Pay
    -
    - ₹ - {GlobaldummyData - ? '1,066' - : Number(table2Data?.NetAmount).toFixed(2)} -
    +
    + QRcode +
    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)}
    - )} +
    + )}
    )} @@ -4121,21 +4122,21 @@ const PrintStyle7 = ({
    {GlobaldummyData ? GlobalIsnotes && ( -
    -

    - Notes : 10 days Return policy -

    +
    +

    + Notes : 10 days Return policy +

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

    {Notestext}

    +
    +

    {Notestext}

    -
    -
    - )} +
    +
    + )}
    )} @@ -4155,136 +4156,136 @@ const PrintStyle7 = ({ > {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. -
    -
    - ) + 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 && ( -
    0 && ( +
    +

    -

    - Terms & Conditions -

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

    + +
    + )}
    )}