after-removing-conflicts
This commit is contained in:
parent
2f4f8d3e5e
commit
60f8a58c4d
|
|
@ -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 && (
|
||||
<span
|
||||
|
|
|
|||
|
|
@ -168,6 +168,14 @@ export const PutBookingData = createAsyncThunk(
|
|||
return await axiosRetailInstanceData.put(`/Booking`, putData);
|
||||
}
|
||||
);
|
||||
|
||||
export const putSalesBillEdit = createAsyncThunk(
|
||||
'BookingData/putSalesBillEdit',
|
||||
async (putData) => {
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -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) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
className={
|
||||
paybtnselected === payment.ModeId &&
|
||||
(UpinotSelected || CardoptionnotSelected)
|
||||
(UpinotSelected || CardoptionnotSelected)
|
||||
? 'Btn-payment-mode-notupisel'
|
||||
: paybtnselected === payment.ModeId &&
|
||||
(!UpinotSelected || !CardoptionnotSelected)
|
||||
(!UpinotSelected || !CardoptionnotSelected)
|
||||
? 'Btn-payment-mode'
|
||||
: 'Btn-payment-mode-sel'
|
||||
}
|
||||
|
|
@ -3474,13 +3562,13 @@ export default function BST1Payment() {
|
|||
onClick={() =>
|
||||
payment?.ModeName?.toLowerCase() === 'upi' // Change the condition to payment.Id
|
||||
? handleUPIButtonClick(
|
||||
payment.ModeId,
|
||||
payment.ModeName
|
||||
)
|
||||
payment.ModeId,
|
||||
payment.ModeName
|
||||
)
|
||||
: handlePaymentMode(
|
||||
payment.ModeId,
|
||||
payment.ModeName
|
||||
)
|
||||
payment.ModeId,
|
||||
payment.ModeName
|
||||
)
|
||||
}
|
||||
>
|
||||
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
|
||||
|
|
@ -3531,6 +3619,42 @@ export default function BST1Payment() {
|
|||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
|
||||
refundPayBtns.map((payment) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
className={
|
||||
refundPaySelected === payment.ConfigId &&
|
||||
(UpinotSelected || CardoptionnotSelected)
|
||||
? 'Btn-payment-mode-notupisel'
|
||||
: refundPaySelected === payment.ConfigId &&
|
||||
(!UpinotSelected || !CardoptionnotSelected)
|
||||
? 'Btn-payment-mode'
|
||||
: 'Btn-payment-mode-sel'
|
||||
}
|
||||
style={{
|
||||
fontFamily: FontFamily['para'],
|
||||
position: 'relative',
|
||||
animation: blink
|
||||
? 'blink-animation 0.5s infinite alternate'
|
||||
: 'none',
|
||||
}}
|
||||
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
|
||||
>
|
||||
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
columnGap: '0.5rem',
|
||||
}}
|
||||
>
|
||||
{payment.ConfigName}
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div
|
||||
onClick={handlepaymentoptions}
|
||||
|
|
@ -3574,9 +3698,9 @@ export default function BST1Payment() {
|
|||
OrderCardDetail?.length > 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() {
|
|||
<div>
|
||||
{unpaidFlow == false
|
||||
? holdCheckedSalesSetup &&
|
||||
BookingType !== 'Dine In' &&
|
||||
!BookingTypeBoth &&
|
||||
OrderCardDetail?.length != 0 &&
|
||||
CheckOrderType?.length === 0 &&
|
||||
OrderType != 'Failed' &&
|
||||
CheckBookingStatus != 'Close' &&
|
||||
paybtns?.length > 0 &&
|
||||
!addnewAccess && (
|
||||
<TooltipWrapper title={'Hold'} isMobile={isMobile}>
|
||||
{' '}
|
||||
<PozoHoldIcon
|
||||
className="BSBillingNav-icon-table-icon"
|
||||
onClick={() => AddBookingDetails('Hold')}
|
||||
style={{
|
||||
fontSize: '30px',
|
||||
cursor: 'pointer',
|
||||
color: '' ? '#52c41a' : '#1292EE',
|
||||
}}
|
||||
/>
|
||||
</TooltipWrapper>
|
||||
)
|
||||
BookingType !== 'Dine In' &&
|
||||
!BookingTypeBoth &&
|
||||
OrderCardDetail?.length != 0 &&
|
||||
CheckOrderType?.length === 0 &&
|
||||
OrderType != 'Failed' &&
|
||||
CheckBookingStatus != 'Close' &&
|
||||
paybtns?.length > 0 &&
|
||||
!addnewAccess && (
|
||||
<TooltipWrapper title={'Hold'} isMobile={isMobile}>
|
||||
{' '}
|
||||
<PozoHoldIcon
|
||||
className="BSBillingNav-icon-table-icon"
|
||||
onClick={() => AddBookingDetails('Hold')}
|
||||
style={{
|
||||
fontSize: '30px',
|
||||
cursor: 'pointer',
|
||||
color: '' ? '#52c41a' : '#1292EE',
|
||||
}}
|
||||
/>
|
||||
</TooltipWrapper>
|
||||
)
|
||||
: ''}
|
||||
{unpaidFlow == false
|
||||
? holdCheckedSalesSetup &&
|
||||
paybtns?.length > 0 &&
|
||||
BookingType !== 'Dine In' &&
|
||||
!BookingTypeBoth &&
|
||||
Holddata?.length > 0 &&
|
||||
OrderCardDetail?.length == 0 &&
|
||||
CheckBookingStatus != 'Close' &&
|
||||
!addnewAccess && (
|
||||
<TooltipWrapper title={'Recall'} isMobile={isMobile}>
|
||||
{' '}
|
||||
<Badge
|
||||
count={Holddata?.length}
|
||||
size={'small'}
|
||||
offset={[0, 7]}
|
||||
>
|
||||
<PozoHoldIcon
|
||||
className="BSBillingNav-icon-table-icon"
|
||||
onClick={() => HandleholdModelOpen()}
|
||||
style={{
|
||||
fontSize: '28px',
|
||||
cursor: 'pointer',
|
||||
color: Holddata ? '#52c41a' : 'default',
|
||||
pointerEvents:
|
||||
OrderType === 'Failed' ? 'none' : 'auto',
|
||||
}}
|
||||
/>
|
||||
</Badge>
|
||||
</TooltipWrapper>
|
||||
)
|
||||
paybtns?.length > 0 &&
|
||||
BookingType !== 'Dine In' &&
|
||||
!BookingTypeBoth &&
|
||||
Holddata?.length > 0 &&
|
||||
OrderCardDetail?.length == 0 &&
|
||||
CheckBookingStatus != 'Close' &&
|
||||
!addnewAccess && (
|
||||
<TooltipWrapper title={'Recall'} isMobile={isMobile}>
|
||||
{' '}
|
||||
<Badge
|
||||
count={Holddata?.length}
|
||||
size={'small'}
|
||||
offset={[0, 7]}
|
||||
>
|
||||
<PozoHoldIcon
|
||||
className="BSBillingNav-icon-table-icon"
|
||||
onClick={() => HandleholdModelOpen()}
|
||||
style={{
|
||||
fontSize: '28px',
|
||||
cursor: 'pointer',
|
||||
color: Holddata ? '#52c41a' : 'default',
|
||||
pointerEvents:
|
||||
OrderType === 'Failed' ? 'none' : 'auto',
|
||||
}}
|
||||
/>
|
||||
</Badge>
|
||||
</TooltipWrapper>
|
||||
)
|
||||
: ''}
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -3896,6 +4020,11 @@ export default function BST1Payment() {
|
|||
}
|
||||
BillingTableName="BillingTable1"
|
||||
CheckBookingStatus={CheckBookingStatus}
|
||||
salesBillEdit={salesBillEdit}
|
||||
currentOrderNetAmount={currentOrderNetAmount}
|
||||
previousNetAmount={previousNetAmount}
|
||||
credit={credit}
|
||||
overAllBal={overAllBal}
|
||||
/>
|
||||
) : (
|
||||
<TooltipWrapper title="Create Bill (F4)" isMobile={isMobile}>
|
||||
|
|
@ -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) ? <div>Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div> : (
|
||||
`₹ ${Math.round(
|
||||
OrderType === 'Failed'
|
||||
? FailedTotalAmt
|
||||
|
|
@ -3935,7 +4065,7 @@ export default function BST1Payment() {
|
|||
) : (
|
||||
'ORDER'
|
||||
)
|
||||
) : !OrderStatus ? (
|
||||
) : !OrderStatus ? (salesBillEdit && (currentOrderNetAmount < previousNetAmount)) ? (<div>Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div>) : (
|
||||
<div>
|
||||
₹{' '}
|
||||
<CountUp
|
||||
|
|
@ -4133,7 +4263,10 @@ export default function BST1Payment() {
|
|||
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}
|
||||
/>
|
||||
|
|
@ -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?
|
||||
</Modal>
|
||||
)}
|
||||
|
||||
{customerPreviesOrders && (
|
||||
<DefaultModal
|
||||
open={customerPreviesOrders}
|
||||
handleCancel={() => setCustomerPreviesOrders(false)}
|
||||
footer={false}
|
||||
width={700}
|
||||
className={'ModalPaymentGatewayEmbedded'}
|
||||
children={
|
||||
<>
|
||||
<CustomerOrders
|
||||
CustomerDetails={selOption}
|
||||
close={() => setCustomerPreviesOrders(false)}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
|
||||
{customerPreviesOrders && (
|
||||
<DefaultModal
|
||||
open={customerPreviesOrders}
|
||||
handleCancel={() => setCustomerPreviesOrders(false)}
|
||||
footer={false}
|
||||
width={700}
|
||||
className={'ModalPaymentGatewayEmbedded'}
|
||||
children={
|
||||
<>
|
||||
<CustomerOrders
|
||||
CustomerDetails={selOption}
|
||||
close={() => setCustomerPreviesOrders(false)}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) ? <div>Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div> :
|
||||
`₹ ${Math.round(
|
||||
OrderType === 'Failed' ? failedTotalAmt : credit && overAllBal >= 0
|
||||
? Math.max(0, totalAmount - overAllBal)
|
||||
: totalAmount
|
||||
)}`
|
||||
: 'ORDER')}
|
||||
|
||||
{!isMobile && !OrderStatus && (
|
||||
{!isMobile && !OrderStatus && ((salesBillEdit && (currentOrderNetAmount < previousNetAmount)) ? <div>Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div> : (
|
||||
<>
|
||||
₹{' '}
|
||||
{/* <CountUp
|
||||
|
|
@ -170,9 +177,11 @@ const PaymentInput = ({
|
|||
/> */}
|
||||
{OrderType === 'Failed'
|
||||
? failedTotalAmt
|
||||
: safeRound(totalAmount)}
|
||||
: safeRound((credit && overAllBal >= 0)
|
||||
? Math.max(0, totalAmount - overAllBal)
|
||||
: totalAmount)}
|
||||
</>
|
||||
)}
|
||||
))}
|
||||
|
||||
{!isMobile && OrderStatus && 'ORDER'}
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -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) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
|
|
@ -3895,6 +3982,42 @@ const BSBillingTable2 = () => {
|
|||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
|
||||
refundPayBtns.map((payment) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
className={
|
||||
refundPaySelected === payment.ConfigId &&
|
||||
(UpinotSelected || CardoptionnotSelected)
|
||||
? 'Btn-payment-mode-notupisel'
|
||||
: refundPaySelected === payment.ConfigId &&
|
||||
(!UpinotSelected || !CardoptionnotSelected)
|
||||
? 'Btn-payment-mode'
|
||||
: 'Btn-payment-mode-sel'
|
||||
}
|
||||
style={{
|
||||
fontFamily: FontFamily['para'],
|
||||
position: 'relative',
|
||||
animation: blink
|
||||
? 'blink-animation 0.5s infinite alternate'
|
||||
: 'none',
|
||||
}}
|
||||
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
|
||||
>
|
||||
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
columnGap: '0.5rem',
|
||||
}}
|
||||
>
|
||||
{payment.ConfigName}
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div
|
||||
onClick={handlepaymentoptions}
|
||||
|
|
@ -4131,7 +4254,9 @@ const BSBillingTable2 = () => {
|
|||
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) ? <div
|
||||
className="billing-in-style-Order"
|
||||
style={{ fontFamily: FontFamily['head'] }}>Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div> : (
|
||||
<>
|
||||
<div className="billing-in-style">
|
||||
<h1 style={{ fontFamily: FontFamily['head'] }}>Total</h1>
|
||||
|
|
@ -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 = () => {
|
|||
</div>
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
<DefaultModal
|
||||
open={businessUPI}
|
||||
handleCancel={() => setShowCancelConfirm(true)}
|
||||
|
|
|
|||
|
|
@ -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) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
|
|
@ -4035,6 +4122,42 @@ const BSBillingTable3Pay = () => {
|
|||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
|
||||
refundPayBtns.map((payment) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
className={
|
||||
refundPaySelected === payment.ConfigId &&
|
||||
(UpinotSelected || CardoptionnotSelected)
|
||||
? 'Btn-payment-mode-notupisel'
|
||||
: refundPaySelected === payment.ConfigId &&
|
||||
(!UpinotSelected || !CardoptionnotSelected)
|
||||
? 'Btn-payment-mode'
|
||||
: 'Btn-payment-mode-sel'
|
||||
}
|
||||
style={{
|
||||
fontFamily: FontFamily['para'],
|
||||
position: 'relative',
|
||||
animation: blink
|
||||
? 'blink-animation 0.5s infinite alternate'
|
||||
: 'none',
|
||||
}}
|
||||
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
|
||||
>
|
||||
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
columnGap: '0.5rem',
|
||||
}}
|
||||
>
|
||||
{payment.ConfigName}
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div
|
||||
onClick={handlepaymentoptions}
|
||||
|
|
@ -4276,8 +4399,9 @@ const BSBillingTable3Pay = () => {
|
|||
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) ? <p className="Table4-Order">Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</p> : (
|
||||
<>
|
||||
<p style={{ fontFamily: FontFamily['head'] }}>
|
||||
{' '}
|
||||
|
|
@ -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}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -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) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
|
|
@ -3683,6 +3770,42 @@ const BSBillingTable5 = () => {
|
|||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
|
||||
refundPayBtns.map((payment) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
className={
|
||||
refundPaySelected === payment.ConfigId &&
|
||||
(UpinotSelected || CardoptionnotSelected)
|
||||
? 'Btn-payment-mode-notupisel'
|
||||
: refundPaySelected === payment.ConfigId &&
|
||||
(!UpinotSelected || !CardoptionnotSelected)
|
||||
? 'Btn-payment-mode'
|
||||
: 'Btn-payment-mode-sel'
|
||||
}
|
||||
style={{
|
||||
fontFamily: FontFamily['para'],
|
||||
position: 'relative',
|
||||
animation: blink
|
||||
? 'blink-animation 0.5s infinite alternate'
|
||||
: 'none',
|
||||
}}
|
||||
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
|
||||
>
|
||||
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
columnGap: '0.5rem',
|
||||
}}
|
||||
>
|
||||
{payment.ConfigName}
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div
|
||||
onClick={handlepaymentoptions}
|
||||
|
|
@ -4154,8 +4277,9 @@ const BSBillingTable5 = () => {
|
|||
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) ? <div>Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div> : (
|
||||
<>
|
||||
{/* ₹ {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}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -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) => (
|
||||
<div className="Table6-cash">
|
||||
<button
|
||||
|
|
@ -3758,6 +3842,40 @@ const BST6Payment = () => {
|
|||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
|
||||
refundPayBtns.map((payment) => (
|
||||
<div className="Table6-cash">
|
||||
<button
|
||||
className={
|
||||
refundPaySelected === payment.ConfigId &&
|
||||
(UpinotSelected || CardoptionnotSelected)
|
||||
? 'Btn-payment-mode-notupisel'
|
||||
: refundPaySelected === payment.ConfigId &&
|
||||
(!UpinotSelected || !CardoptionnotSelected)
|
||||
? 'Btn-payment-mode'
|
||||
: 'Btn-payment-mode-sel'
|
||||
}
|
||||
style={{
|
||||
fontFamily: FontFamily['para'],
|
||||
position: 'relative',
|
||||
animation: blink
|
||||
? 'blink-animation 0.5s infinite alternate'
|
||||
: 'none',
|
||||
}}
|
||||
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
columnGap: '0.5rem',
|
||||
}}
|
||||
>
|
||||
{payment.ConfigName}
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div
|
||||
onClick={handlepaymentoptions}
|
||||
|
|
@ -3782,8 +3900,9 @@ const BST6Payment = () => {
|
|||
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) ? <div>Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div> : (
|
||||
<>
|
||||
<p style={{ fontFamily: FontFamily['head'] }}>
|
||||
{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}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -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) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
|
|
@ -3917,6 +4009,42 @@ const BSBilling7Payment = () => {
|
|||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
|
||||
refundPayBtns.map((payment) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
className={
|
||||
refundPaySelected === payment.ConfigId &&
|
||||
(UpinotSelected || CardoptionnotSelected)
|
||||
? 'Btn-payment-mode-notupisel'
|
||||
: refundPaySelected === payment.ConfigId &&
|
||||
(!UpinotSelected || !CardoptionnotSelected)
|
||||
? 'Btn-payment-mode'
|
||||
: 'Btn-payment-mode-sel'
|
||||
}
|
||||
style={{
|
||||
fontFamily: FontFamily['para'],
|
||||
position: 'relative',
|
||||
animation: blink
|
||||
? 'blink-animation 0.5s infinite alternate'
|
||||
: 'none',
|
||||
}}
|
||||
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
|
||||
>
|
||||
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
columnGap: '0.5rem',
|
||||
}}
|
||||
>
|
||||
{payment.ConfigName}
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div
|
||||
onClick={handlepaymentoptions}
|
||||
|
|
@ -4154,8 +4282,9 @@ const BSBilling7Payment = () => {
|
|||
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) ? <p className="Table4-Order">Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</p> : (
|
||||
<>
|
||||
<div className="Table4-fullrate">
|
||||
<div
|
||||
|
|
@ -4501,7 +4630,10 @@ const BSBilling7Payment = () => {
|
|||
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}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -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) => (
|
||||
<tr
|
||||
key={index}
|
||||
className={`${
|
||||
item?.SalesId && OrderType !== 'Hold'
|
||||
? 'booking-billing-table-row-disabled'
|
||||
: 'booking-billing-table-row'
|
||||
}`}
|
||||
className={`${item?.SalesId && OrderType !== 'Hold'
|
||||
? 'booking-billing-table-row-disabled'
|
||||
: 'booking-billing-table-row'
|
||||
}`}
|
||||
style={{
|
||||
fontFamily:
|
||||
"'Inter', ui-sans-serif, system-ui, sans-serif",
|
||||
|
|
@ -2524,16 +2532,16 @@ const StandardTable = () => {
|
|||
? 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 && (
|
||||
<div
|
||||
style={{
|
||||
fontSize: '10px',
|
||||
fontWeight: '500',
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
Extra Charges :{' '}
|
||||
{
|
||||
productBasedExtraCharges?.find(
|
||||
(find) => find.ProdId === item.ProdId
|
||||
)?.TotalAmt
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
style={{
|
||||
fontSize: '10px',
|
||||
fontWeight: '500',
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
Extra Charges :{' '}
|
||||
{
|
||||
productBasedExtraCharges?.find(
|
||||
(find) => find.ProdId === item.ProdId
|
||||
)?.TotalAmt
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
</td>
|
||||
</>
|
||||
)}
|
||||
|
|
@ -2784,7 +2792,7 @@ const StandardTable = () => {
|
|||
}
|
||||
}}
|
||||
>
|
||||
{safeRound(item?.TotalAmt)}
|
||||
{safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)}
|
||||
</td>
|
||||
)}
|
||||
{tableitem.OptionName == 'Delete' && (
|
||||
|
|
@ -2828,11 +2836,10 @@ const StandardTable = () => {
|
|||
{OldtableDataDinein?.map((item, index) => (
|
||||
<tr
|
||||
key={OldtableDataTakeAway?.length + index}
|
||||
className={`${
|
||||
item?.SalesId
|
||||
? 'booking-billing-table-row-disabled'
|
||||
: 'booking-billing-table-row'
|
||||
}
|
||||
className={`${item?.SalesId
|
||||
? 'booking-billing-table-row-disabled'
|
||||
: 'booking-billing-table-row'
|
||||
}
|
||||
|
||||
`}
|
||||
style={{
|
||||
|
|
@ -2844,27 +2851,27 @@ const StandardTable = () => {
|
|||
? 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 && (
|
||||
<div
|
||||
style={{
|
||||
fontSize: '10px',
|
||||
fontWeight: '500',
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
Extra Charges :{' '}
|
||||
{
|
||||
productBasedExtraCharges?.find(
|
||||
(find) => find.ProdId === item.ProdId
|
||||
)?.TotalAmt
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
style={{
|
||||
fontSize: '10px',
|
||||
fontWeight: '500',
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
Extra Charges :{' '}
|
||||
{
|
||||
productBasedExtraCharges?.find(
|
||||
(find) => find.ProdId === item.ProdId
|
||||
)?.TotalAmt
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
</td>
|
||||
</>
|
||||
)}
|
||||
|
|
@ -3099,7 +3106,7 @@ const StandardTable = () => {
|
|||
}
|
||||
}}
|
||||
>
|
||||
{safeRound(item?.TotalAmt)}
|
||||
{safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)}
|
||||
</td>
|
||||
)}
|
||||
|
||||
|
|
@ -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'
|
||||
) && (
|
||||
<span>{item?.ProdVariantName} </span>
|
||||
)}
|
||||
<span>{item?.ProdVariantName} </span>
|
||||
)}
|
||||
{AvailableDate ? (
|
||||
<>
|
||||
{' '}
|
||||
|
|
@ -3353,21 +3359,21 @@ const StandardTable = () => {
|
|||
{productBasedExtraCharges?.find(
|
||||
(find) => find.ProdId === item.ProdId
|
||||
) !== undefined && (
|
||||
<div
|
||||
style={{
|
||||
fontSize: '10px',
|
||||
fontWeight: '500',
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
Extra Charges :{' '}
|
||||
{
|
||||
productBasedExtraCharges?.find(
|
||||
(find) => find.ProdId === item.ProdId
|
||||
)?.TotalAmt
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
style={{
|
||||
fontSize: '10px',
|
||||
fontWeight: '500',
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
Extra Charges :{' '}
|
||||
{
|
||||
productBasedExtraCharges?.find(
|
||||
(find) => find.ProdId === item.ProdId
|
||||
)?.TotalAmt
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
</td>
|
||||
</>
|
||||
)}
|
||||
|
|
@ -3462,7 +3468,7 @@ const StandardTable = () => {
|
|||
}
|
||||
}}
|
||||
>
|
||||
{safeRound(item?.TotalAmt)}
|
||||
{safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)}
|
||||
</td>
|
||||
)}
|
||||
|
||||
|
|
@ -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 && (
|
||||
<div
|
||||
style={{
|
||||
fontSize: '10px',
|
||||
fontWeight: '500',
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
Extra Charges :{' '}
|
||||
{
|
||||
productBasedExtraCharges?.find(
|
||||
(find) => find.ProdId === item.ProdId
|
||||
)?.TotalAmt
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
style={{
|
||||
fontSize: '10px',
|
||||
fontWeight: '500',
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
Extra Charges :{' '}
|
||||
{
|
||||
productBasedExtraCharges?.find(
|
||||
(find) => find.ProdId === item.ProdId
|
||||
)?.TotalAmt
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
</td>
|
||||
</>
|
||||
)}
|
||||
|
|
@ -3806,7 +3811,7 @@ const StandardTable = () => {
|
|||
}
|
||||
}}
|
||||
>
|
||||
{safeRound(item?.TotalAmt)}
|
||||
{safeRound(item?.TotalAmt - (item?.Offer || 0) || 0)}
|
||||
</td>
|
||||
)}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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 = () => {
|
|||
</div>
|
||||
);
|
||||
})
|
||||
) : (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 (
|
||||
<div className="standard-pay-btns" key={payment?.ConfigId}>
|
||||
<button
|
||||
className={buttonClass}
|
||||
style={{
|
||||
// fontFamily: FontFamily['para'],
|
||||
backgroundColor:
|
||||
mode === 'upi'
|
||||
? '#2563eb'
|
||||
: mode === 'card'
|
||||
? '#9333ea'
|
||||
: mode === 'credit'
|
||||
? '#9333ea'
|
||||
: '#16a34a',
|
||||
animation: blink
|
||||
? 'blink-animation 0.5s infinite alternate'
|
||||
: 'none',
|
||||
}}
|
||||
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '0.5rem',
|
||||
}}
|
||||
>
|
||||
{mode === 'cash' && <FaMoneyBillWave />}
|
||||
{mode === 'upi' && <FaMobileScreenButton />}
|
||||
|
||||
{mode === 'credit' && (
|
||||
<>
|
||||
<img src={Credit} alt="" width={20} />
|
||||
</>
|
||||
)}
|
||||
{payment?.ConfigName}
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
) : (
|
||||
<div
|
||||
onClick={handlePaymentOptions}
|
||||
|
|
@ -3721,14 +3864,15 @@ const StandardTablePayment = () => {
|
|||
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) ? <p>Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</p> : (
|
||||
<>
|
||||
<p
|
||||
className="standard-pay-amount"
|
||||
|
|
|
|||
|
|
@ -124,6 +124,16 @@ import {
|
|||
changeCurrentOrderId,
|
||||
getCreditCustomer,
|
||||
ChangeSelectedCustDisable,
|
||||
GlobalSalesBillEdit,
|
||||
GlobalPreviousOrderPayment,
|
||||
GlobalPreviousOrderOfferDetails,
|
||||
GlobalpaymentOptionData,
|
||||
getPaymentOptions,
|
||||
putSalesBillEdit,
|
||||
changeBillEditingMode,
|
||||
changePreviousOrderPayment,
|
||||
changePreviousOrderOfferDetail,
|
||||
GlobalPaymentTrigger,
|
||||
} from '../../../../Features/BookingScreen/BookingData/BookingData';
|
||||
import { PrintStyleFunction } from '../../../paymentpdfPage/PrintStyleFunction.js';
|
||||
import {
|
||||
|
|
@ -148,7 +158,9 @@ import {
|
|||
} from '../../../../Features/ExteraCharges/ExtraCharges';
|
||||
import {
|
||||
getAddCustomerDetails,
|
||||
getDefaultPaymentOptions,
|
||||
GlobalAddCustomerDetails,
|
||||
ReprintDetails,
|
||||
triggerCustomerRefresh,
|
||||
} from '../../../../Features/BookingScreen/Customer/addCustomer';
|
||||
import BSCustomerSelect from '../UtillComponents/BSSelectCustomer.jsx';
|
||||
|
|
@ -233,6 +245,8 @@ import { useDateStore } from '../../../../Features/BookingScreen/BookingData/Dat
|
|||
import { getPaymentOptionsData } from '../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
|
||||
import { GlobalFreeProdList, GlobalOfferAppliedProducts, GlobalOverAllOfferAmt } from '../../../../Features/Offer/Offernew/BookingOffernew.js';
|
||||
import BSNavBarTable from '../UtillComponents/BSNavBarTable.jsx';
|
||||
import pozologoimg from '../../../../Images/pozologoimg.png';
|
||||
import PaymentGatewayEmbedded from '../UtillComponents/PaymentGatewayEmbedded.jsx';
|
||||
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
|
||||
|
|
@ -250,6 +264,10 @@ const BSC1Payment = (props) => {
|
|||
|
||||
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) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
|
|
@ -3680,6 +3908,9 @@ const BSC1Payment = (props) => {
|
|||
)}
|
||||
{payment?.ModeName?.toLowerCase() === 'upi' && (
|
||||
<UpiPopover
|
||||
defaultPaymentMode={defaultPaymentMode}
|
||||
defaultEnabled={defaultEnabled}
|
||||
setDefaultEnabled={setDefaultEnabled}
|
||||
UpiOptionOpen={UpiOptionOpen}
|
||||
UpiPayOption={UpiPayOption}
|
||||
SelectedUPIPayOption={SelectedUPIPayOption}
|
||||
|
|
@ -3687,6 +3918,7 @@ const BSC1Payment = (props) => {
|
|||
PaymentUpiOptions={PaymentUpiOptions}
|
||||
UpiOption={UpiOption}
|
||||
UpiId={UpiId}
|
||||
BusinessPayOption={BusinessPayOption}
|
||||
paygate={paygate}
|
||||
paydevice={paydevice}
|
||||
EnableUpiOptions={EnableUpiOptions}
|
||||
|
|
@ -3701,6 +3933,41 @@ const BSC1Payment = (props) => {
|
|||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? (
|
||||
refundPayBtns.map((payment) => (
|
||||
<div className="Table3-cash">
|
||||
<button
|
||||
className={
|
||||
refundPaySelected === payment.ConfigId &&
|
||||
(UpinotSelected || CardoptionnotSelected)
|
||||
? 'Btn-payment-mode-notupisel'
|
||||
: refundPaySelected === payment.ConfigId &&
|
||||
(!UpinotSelected || !CardoptionnotSelected)
|
||||
? 'Btn-payment-mode'
|
||||
: 'Btn-payment-mode-sel'
|
||||
}
|
||||
style={{
|
||||
position: 'relative',
|
||||
animation: blink
|
||||
? 'blink-animation 0.5s infinite alternate'
|
||||
: 'none',
|
||||
}}
|
||||
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)}
|
||||
>
|
||||
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
columnGap: '0.5rem',
|
||||
}}
|
||||
>
|
||||
{payment.ConfigName}
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div
|
||||
onClick={handlepaymentoptions}
|
||||
|
|
@ -4231,8 +4498,9 @@ const BSC1Payment = (props) => {
|
|||
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) ? <div className="Table4-Order">Refund: ₹{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div> : (
|
||||
<>
|
||||
{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) => {
|
|||
</div>
|
||||
}
|
||||
/>
|
||||
<DefaultModal
|
||||
open={businessUPI}
|
||||
handleCancel={() => setShowCancelConfirm(true)}
|
||||
footer={false}
|
||||
width={500}
|
||||
children={
|
||||
<>
|
||||
<PaymentGatewayEmbedded
|
||||
orderId={businessUPIOrderId}
|
||||
setBusinessUPIOrderId={setBusinessUPIOrderId}
|
||||
businessUPILink={businessUPILink}
|
||||
setBusinessUPI={setBusinessUPI}
|
||||
setPaymentSuccess={setPaymentSuccess}
|
||||
paymentSucess={paymentSucess}
|
||||
ClearAllGlobalStateDatas={ClearAllGlobalStateDatas}
|
||||
CustomerDisplay={CustomerDisplay}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
{showCancelConfirm && (
|
||||
<Modal
|
||||
open={showCancelConfirm}
|
||||
title="Cancel Payment"
|
||||
onOk={() => {
|
||||
setBusinessUPI(false);
|
||||
setShowCancelConfirm(false);
|
||||
ClearAllGlobalStateDatas();
|
||||
CustomerDisplay();
|
||||
}}
|
||||
onCancel={() => setShowCancelConfirm(false)}
|
||||
okText="Yes"
|
||||
cancelText="No"
|
||||
>
|
||||
Do you want to cancel the payment?
|
||||
</Modal>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 || '',
|
||||
|
|
|
|||
|
|
@ -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) => (
|
||||
<a
|
||||
style={{ color: 'black' }}
|
||||
onClick={() => HoldPutfun(productDetails, record)}
|
||||
>
|
||||
{record?.productDetails?.[0]?.ProdSubCatName}
|
||||
</a>
|
||||
),
|
||||
return {
|
||||
onClick: () => {
|
||||
HoldPutfun(productDetails, record, Combodtl);
|
||||
},
|
||||
};
|
||||
},
|
||||
]
|
||||
render: (productDetails, record) => (
|
||||
<a
|
||||
style={{ color: 'black' }}
|
||||
onClick={() => HoldPutfun(productDetails, record)}
|
||||
>
|
||||
{record?.productDetails?.[0]?.ProdSubCatName}
|
||||
</a>
|
||||
),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
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) => {
|
|||
<Space size="middle">
|
||||
<a>
|
||||
{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
|
||||
) ? (
|
||||
<DeleteFilled
|
||||
style={{
|
||||
color: '#FF4D4F',
|
||||
|
|
@ -1702,7 +1702,7 @@ const FeaturesFunctionalities = (props) => {
|
|||
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
|
||||
</Button>
|
||||
|
|
@ -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'}
|
||||
</label>
|
||||
}
|
||||
|
|
@ -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) => {
|
|||
<p>Upload Profile</p>
|
||||
<Form.Item
|
||||
name="CustomerProfile"
|
||||
// getValueFromEvent={(e) =>
|
||||
// formType === 'edit' ? editstate?.EmpPhotoLink : e
|
||||
// }
|
||||
// getValueFromEvent={(e) =>
|
||||
// formType === 'edit' ? editstate?.EmpPhotoLink : e
|
||||
// }
|
||||
>
|
||||
<Imageupload
|
||||
singleImage={true}
|
||||
|
|
@ -3196,133 +3196,133 @@ const FeaturesFunctionalities = (props) => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div className="address-type-section">
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
flexWrap: 'wrap',
|
||||
}}
|
||||
>
|
||||
<Checkbox
|
||||
checked={(
|
||||
addressTypes[idx] || []
|
||||
).includes('Delivery Address')}
|
||||
onChange={(e) =>
|
||||
handleAddressTypeChange(
|
||||
idx,
|
||||
'Delivery Address',
|
||||
e.target.checked
|
||||
)
|
||||
}
|
||||
<div className="address-type-section">
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
flexWrap: 'wrap',
|
||||
}}
|
||||
>
|
||||
Delivery Address
|
||||
</Checkbox>
|
||||
<Checkbox
|
||||
checked={(
|
||||
addressTypes[idx] || []
|
||||
).includes('Billing Address')}
|
||||
onChange={(e) =>
|
||||
handleAddressTypeChange(
|
||||
idx,
|
||||
'Billing Address',
|
||||
e.target.checked
|
||||
)
|
||||
}
|
||||
>
|
||||
Billing Address
|
||||
</Checkbox>
|
||||
<Checkbox
|
||||
checked={(
|
||||
addressTypes[idx] || []
|
||||
).includes('Both Address')}
|
||||
onChange={(e) =>
|
||||
handleAddressTypeChange(
|
||||
idx,
|
||||
'Both Address',
|
||||
e.target.checked
|
||||
)
|
||||
}
|
||||
>
|
||||
Both Address
|
||||
</Checkbox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="address-details-grid">
|
||||
<div className="address-detail-item address1">
|
||||
<div className="value">
|
||||
{addr?.Address1 || ''}
|
||||
<Checkbox
|
||||
checked={(
|
||||
addressTypes[idx] || []
|
||||
).includes('Delivery Address')}
|
||||
onChange={(e) =>
|
||||
handleAddressTypeChange(
|
||||
idx,
|
||||
'Delivery Address',
|
||||
e.target.checked
|
||||
)
|
||||
}
|
||||
>
|
||||
Delivery Address
|
||||
</Checkbox>
|
||||
<Checkbox
|
||||
checked={(
|
||||
addressTypes[idx] || []
|
||||
).includes('Billing Address')}
|
||||
onChange={(e) =>
|
||||
handleAddressTypeChange(
|
||||
idx,
|
||||
'Billing Address',
|
||||
e.target.checked
|
||||
)
|
||||
}
|
||||
>
|
||||
Billing Address
|
||||
</Checkbox>
|
||||
<Checkbox
|
||||
checked={(
|
||||
addressTypes[idx] || []
|
||||
).includes('Both Address')}
|
||||
onChange={(e) =>
|
||||
handleAddressTypeChange(
|
||||
idx,
|
||||
'Both Address',
|
||||
e.target.checked
|
||||
)
|
||||
}
|
||||
>
|
||||
Both Address
|
||||
</Checkbox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="address-detail-item address2">
|
||||
<div className="value">
|
||||
{addr?.Address2 || ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="address-detail-item zip">
|
||||
<div className="value">
|
||||
{addr?.Zip || ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="address-detail-item city">
|
||||
<div className="value">
|
||||
{addr?.City || ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="address-detail-item district">
|
||||
<div className="value">
|
||||
{addr?.Dist || ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="address-detail-item state">
|
||||
<div className="value">
|
||||
{addr?.State || ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{addr?.Latitude && (
|
||||
<div className="address-detail-item coordinates">
|
||||
<div className="value coordinates">
|
||||
<MdLocationOn />{' '}
|
||||
{addr?.Latitude || ''},{' '}
|
||||
{addr?.Longitude || ''}
|
||||
<div className="address-details-grid">
|
||||
<div className="address-detail-item address1">
|
||||
<div className="value">
|
||||
{addr?.Address1 || ''}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="header-actions">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleEditAddress(idx)}
|
||||
className="edit-btn"
|
||||
>
|
||||
<FaEdit /> Edit
|
||||
</button>
|
||||
|
||||
<Popconfirm
|
||||
title="Remove Address"
|
||||
description="Are you sure you want to remove this address?"
|
||||
onConfirm={() => handleRemoveAddress(idx)}
|
||||
okText="Yes, Remove"
|
||||
cancelText="Cancel"
|
||||
okType="danger"
|
||||
>
|
||||
<div className="address-detail-item address2">
|
||||
<div className="value">
|
||||
{addr?.Address2 || ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="address-detail-item zip">
|
||||
<div className="value">
|
||||
{addr?.Zip || ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="address-detail-item city">
|
||||
<div className="value">
|
||||
{addr?.City || ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="address-detail-item district">
|
||||
<div className="value">
|
||||
{addr?.Dist || ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="address-detail-item state">
|
||||
<div className="value">
|
||||
{addr?.State || ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{addr?.Latitude && (
|
||||
<div className="address-detail-item coordinates">
|
||||
<div className="value coordinates">
|
||||
<MdLocationOn />{' '}
|
||||
{addr?.Latitude || ''},{' '}
|
||||
{addr?.Longitude || ''}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="header-actions">
|
||||
<button
|
||||
className="remove-btn"
|
||||
type="button"
|
||||
onClick={() => handleEditAddress(idx)}
|
||||
className="edit-btn"
|
||||
>
|
||||
<FaTrash /> Remove
|
||||
<FaEdit /> Edit
|
||||
</button>
|
||||
</Popconfirm>
|
||||
|
||||
<Popconfirm
|
||||
title="Remove Address"
|
||||
description="Are you sure you want to remove this address?"
|
||||
onConfirm={() => handleRemoveAddress(idx)}
|
||||
okText="Yes, Remove"
|
||||
cancelText="Cancel"
|
||||
okType="danger"
|
||||
>
|
||||
<button
|
||||
className="remove-btn"
|
||||
type="button"
|
||||
>
|
||||
<FaTrash /> Remove
|
||||
</button>
|
||||
</Popconfirm>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
))
|
||||
) : (
|
||||
<div className="empty-state">
|
||||
<MdHome />
|
||||
|
|
@ -3484,7 +3484,7 @@ const FeaturesFunctionalities = (props) => {
|
|||
|
||||
<Form.Item
|
||||
name="State"
|
||||
// rules={[{ required: true }]}
|
||||
// rules={[{ required: true }]}
|
||||
>
|
||||
<InputField
|
||||
field="State"
|
||||
|
|
@ -3527,13 +3527,13 @@ 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={<ArrowRightOutlined />}
|
||||
// handleSubmit={() => { globalamount1() }}
|
||||
// handleSubmit={() => { globalamount1() }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -4041,7 +4041,7 @@ const FeaturesFunctionalities = (props) => {
|
|||
bordered
|
||||
dataSource={TableName}
|
||||
width={'120px'}
|
||||
//pagination={column2?.length < "11" ? false : true}
|
||||
//pagination={column2?.length < "11" ? false : true}
|
||||
></Table>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -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) => {
|
|||
<button
|
||||
className={
|
||||
SplitSelPayMode[`PaymentStatus-${i}`] === 'S' ||
|
||||
SplitSelPayMode[`FirstPaymentclick-${i}`] === 'Y'
|
||||
SplitSelPayMode[`FirstPaymentclick-${i}`] === 'Y'
|
||||
? 'Splitbutton-diabled'
|
||||
: 'Splitbutton'
|
||||
}
|
||||
// onClick={(e) => (SplitSelPayMode[`PaymentStatus-${i}`] === "S" || SplitSelPayMode[`FirstPaymentclick-${i}`] === "Y") ? e.stopPropagation() : onFinish(i)}
|
||||
// onClick={(e) => (SplitSelPayMode[`PaymentStatus-${i}`] === "S" || SplitSelPayMode[`FirstPaymentclick-${i}`] === "Y") ? e.stopPropagation() : onFinish(i)}
|
||||
>
|
||||
Pay
|
||||
</button>
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
|||
<a style={{ color: 'black' }}>{(page - 1) * 10 + index + 1}</a>
|
||||
),
|
||||
},
|
||||
|
||||
{
|
||||
title: 'Bill No',
|
||||
dataIndex: 'BillNo',
|
||||
|
|
@ -895,6 +925,21 @@ function BSReprint() {
|
|||
/>
|
||||
),
|
||||
},
|
||||
// ...(editBill ? [
|
||||
{
|
||||
title: 'Edit Bill',
|
||||
key: 'EditBill',
|
||||
dataIndex: 'EditBill',
|
||||
align: 'center',
|
||||
render: (text, row) => (
|
||||
<MdEdit
|
||||
style={{ color: '#1292EE', fontSize: '25px', cursor: 'pointer' }}
|
||||
onClick={async (e) => await handleEditBill(e, row)}
|
||||
/>
|
||||
),
|
||||
}
|
||||
// ] : [])
|
||||
,
|
||||
{
|
||||
title: () => (
|
||||
<div
|
||||
|
|
@ -1192,24 +1237,162 @@ function BSReprint() {
|
|||
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 (
|
||||
<>
|
||||
<div>
|
||||
|
|
@ -1295,7 +1478,7 @@ function BSReprint() {
|
|||
<Tables
|
||||
columns={columns}
|
||||
data={filteredData}
|
||||
// pagination={handlePageChange}
|
||||
// pagination={handlePageChange}
|
||||
/>
|
||||
{countOfProduct > 10 && (
|
||||
<Pagination
|
||||
|
|
|
|||
|
|
@ -177,9 +177,9 @@ const PrintPreviewPage = (props) => {
|
|||
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 (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>
|
||||
<Messages
|
||||
|
|
@ -618,32 +618,32 @@ const onfinish = async (values) => {
|
|||
</div>
|
||||
{style.component}
|
||||
</div>
|
||||
)):(
|
||||
<div
|
||||
style={{
|
||||
padding: "1rem",
|
||||
textAlign: "center",
|
||||
fontWeight: 500,
|
||||
color: "#777",
|
||||
}}
|
||||
>
|
||||
Please set up Print form to view or change here.
|
||||
<br />
|
||||
<span
|
||||
onClick={goToPrintSetup} // <-- call your function here
|
||||
style={{
|
||||
marginTop: "0.5rem",
|
||||
display: "inline-block",
|
||||
color: "#2ba01b",
|
||||
cursor: "pointer",
|
||||
textDecoration: "underline",
|
||||
fontWeight: 600,
|
||||
}}
|
||||
>
|
||||
Click here to go there
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
)) : (
|
||||
<div
|
||||
style={{
|
||||
padding: "1rem",
|
||||
textAlign: "center",
|
||||
fontWeight: 500,
|
||||
color: "#777",
|
||||
}}
|
||||
>
|
||||
Please set up Print form to view or change here.
|
||||
<br />
|
||||
<span
|
||||
onClick={goToPrintSetup} // <-- call your function here
|
||||
style={{
|
||||
marginTop: "0.5rem",
|
||||
display: "inline-block",
|
||||
color: "#2ba01b",
|
||||
cursor: "pointer",
|
||||
textDecoration: "underline",
|
||||
fontWeight: 600,
|
||||
}}
|
||||
>
|
||||
Click here to go there
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</Carousel>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1752,7 +1752,6 @@ const BSCreditCustomer = (props) => {
|
|||
</label>
|
||||
}
|
||||
onChange={(e) => {
|
||||
// debugger
|
||||
const value = parseFloat(e?.target?.value) || 0;
|
||||
if (value <= SelectedBillData?.OrderPendingAmount) {
|
||||
HandleAmount(e?.target?.value);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
>
|
||||
<TabPane tab="Sales Reprint" key="reprint">
|
||||
{reprintShow && <BSReprint />}
|
||||
{reprintShow && <BSReprint setOpenModel={closeModel} />}
|
||||
</TabPane>
|
||||
<TabPane tab="Receipt Reprint" key="receiptReprint">
|
||||
{receiptReprintShow && <CreditCustomerReprint />}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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'}
|
||||
</th>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
|
|
@ -932,6 +944,46 @@ const PrintA4Style11 = ({
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '100%', marginTop: '2px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'flex-start',
|
||||
flexDirection: 'column', borderTop: '1px dashed #000'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#000'
|
||||
: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
? GlobalCredit && (
|
||||
<div
|
||||
|
|
@ -1506,7 +1558,7 @@ const PrintA4Style11 = ({
|
|||
textAlign: 'center',
|
||||
}}
|
||||
>
|
||||
{ WeightasKg ?'Qty/Kg' :'Qty'}
|
||||
{WeightasKg ? 'Qty/Kg' : 'Qty'}
|
||||
</th>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
|
|
@ -1872,6 +1924,46 @@ const PrintA4Style11 = ({
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '100%', marginTop: '2px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'flex-start',
|
||||
flexDirection: 'column', borderTop: '1px dashed #000'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#000'
|
||||
: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
? GlobalCredit && (
|
||||
<div
|
||||
|
|
@ -2327,7 +2419,7 @@ const PrintA4Style11 = ({
|
|||
)}
|
||||
</div>
|
||||
|
||||
{PaymentStatusSuccess?.length > 1 && (
|
||||
{(PaymentStatusSuccess?.length > 1 && !isEditedBill) && (
|
||||
<>
|
||||
{/* <p>Split Payment:</p> */}
|
||||
{Object.keys(aggregatedPayments).map((paymentType) => (
|
||||
|
|
@ -2424,6 +2516,46 @@ const PrintA4Style11 = ({
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '100%', marginTop: '2px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'flex-start',
|
||||
flexDirection: 'column', borderTop: '1px dashed #000'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#000'
|
||||
: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
? GlobalCredit && (
|
||||
<div
|
||||
|
|
@ -2931,6 +3063,46 @@ const PrintA4Style11 = ({
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '100%', marginTop: '2px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'flex-start',
|
||||
flexDirection: 'column', borderTop: '1px dashed #000'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#000'
|
||||
: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
? GlobalCredit && (
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ const PrintA5Style11 = ({
|
|||
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);
|
||||
|
|
@ -137,6 +137,17 @@ const PrintA5Style11 = ({
|
|||
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 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'}
|
||||
</th>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
|
|
@ -936,6 +947,46 @@ const PrintA5Style11 = ({
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '100%', marginTop: '2px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'flex-start',
|
||||
flexDirection: 'column', borderTop: '1px dashed #000'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#000'
|
||||
: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
? GlobalCredit && (
|
||||
<div
|
||||
|
|
@ -1510,7 +1561,7 @@ const PrintA5Style11 = ({
|
|||
textAlign: 'center',
|
||||
}}
|
||||
>
|
||||
{ WeightasKg ?'Qty/Kg' :'Qty'}
|
||||
{WeightasKg ? 'Qty/Kg' : 'Qty'}
|
||||
</th>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
|
|
@ -1876,6 +1927,46 @@ const PrintA5Style11 = ({
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '100%', marginTop: '2px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'flex-start',
|
||||
flexDirection: 'column', borderTop: '1px dashed #000'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#000'
|
||||
: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
? GlobalCredit && (
|
||||
<div
|
||||
|
|
@ -2331,7 +2422,7 @@ const PrintA5Style11 = ({
|
|||
)}
|
||||
</div>
|
||||
|
||||
{PaymentStatusSuccess?.length > 1 && (
|
||||
{(PaymentStatusSuccess?.length > 1 && !isEditedBill) && (
|
||||
<>
|
||||
{/* <p>Split Payment:</p> */}
|
||||
{Object.keys(aggregatedPayments).map((paymentType) => (
|
||||
|
|
@ -2428,6 +2519,86 @@ const PrintA5Style11 = ({
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '100%', marginTop: '2px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'flex-start',
|
||||
flexDirection: 'column', borderTop: '1px dashed #000'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#000'
|
||||
: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '100%', marginTop: '2px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'flex-start',
|
||||
flexDirection: 'column', borderTop: '1px dashed #000'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#000'
|
||||
: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
? GlobalCredit && (
|
||||
<div
|
||||
|
|
@ -2935,6 +3106,86 @@ const PrintA5Style11 = ({
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '100%', marginTop: '2px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'flex-start',
|
||||
flexDirection: 'column', borderTop: '1px dashed #000'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#000'
|
||||
: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '100%', marginTop: '2px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'flex-start',
|
||||
flexDirection: 'column', borderTop: '1px dashed #000'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#000'
|
||||
: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
? GlobalCredit && (
|
||||
<div
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -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 = ({
|
|||
<th
|
||||
style={{ width: '10px', textAlign: 'right' }}
|
||||
>
|
||||
{ WeightasKg ?'Qty/Kg' :'Qty'}
|
||||
{WeightasKg ? 'Qty/Kg' : 'Qty'}
|
||||
</th>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
|
|
@ -904,7 +916,7 @@ const PrintStyle10 = ({
|
|||
<th
|
||||
style={{ width: '10px', textAlign: 'right' }}
|
||||
>
|
||||
{ WeightasKg ?'Qty/Kg' :'Qty'}
|
||||
{WeightasKg ? 'Qty/Kg' : 'Qty'}
|
||||
</th>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
|
|
@ -1646,7 +1658,7 @@ const PrintStyle10 = ({
|
|||
table2Data?.FYStatus
|
||||
)}{' '}
|
||||
</div>
|
||||
{PaymentStatusSuccess?.length > 1 && (
|
||||
{PaymentStatusSuccess?.length > 1 && !isEditedBill && (
|
||||
<>
|
||||
{/* <p>Split Payment:</p> */}
|
||||
{Object.keys(aggregatedPayments).map(
|
||||
|
|
@ -1793,6 +1805,77 @@ const PrintStyle10 = ({
|
|||
)}
|
||||
</div>
|
||||
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
margin: '2px 0',
|
||||
padding: '2px 0',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'column',
|
||||
borderTop: '1px dashed #000',
|
||||
borderBottom: '1px dashed #000',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '90%',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
}}
|
||||
>
|
||||
<span style={{ color: '#000', fontWeight: '600' }}>
|
||||
Bill Gross Amount
|
||||
</span>
|
||||
<strong>
|
||||
{(lastTransaction?.BeforeAdjustment || 0).toFixed(
|
||||
2
|
||||
)}
|
||||
</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: '800',
|
||||
color: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '-'
|
||||
: '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
marginTop: '4px',
|
||||
}}
|
||||
>
|
||||
<span style={{ color: '#000', fontWeight: '600' }}>
|
||||
Net Bill Amount
|
||||
</span>
|
||||
<strong>
|
||||
{(lastTransaction?.AfterAdjustment || 0).toFixed(
|
||||
2
|
||||
)}
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
|
|
@ -2537,7 +2620,7 @@ const PrintStyle10 = ({
|
|||
table2Data?.FYStatus
|
||||
)}{' '}
|
||||
</div>
|
||||
{PaymentStatusSuccess?.length > 1 && (
|
||||
{PaymentStatusSuccess?.length > 1 && !isEditedBill && (
|
||||
<>
|
||||
{/* <p>Split Payment:</p> */}
|
||||
{Object.keys(aggregatedPayments).map(
|
||||
|
|
@ -2671,6 +2754,75 @@ const PrintStyle10 = ({
|
|||
)}
|
||||
</div>
|
||||
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
margin: '2px 0',
|
||||
padding: '2px 0',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'column',
|
||||
borderTop: '1px dashed #000',
|
||||
borderBottom: '1px dashed #000',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '90%',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
}}
|
||||
>
|
||||
<span style={{ color: '#000', fontWeight: '600' }}>
|
||||
Bill Gross Amount
|
||||
</span>
|
||||
<strong>
|
||||
{(lastTransaction?.BeforeAdjustment || 0).toFixed(
|
||||
2
|
||||
)}
|
||||
</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: '800',
|
||||
color: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '-'
|
||||
: '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
marginTop: '4px',
|
||||
}}
|
||||
>
|
||||
<span style={{ color: '#000', fontWeight: '600' }}>
|
||||
Net Bill Amount
|
||||
</span>
|
||||
<strong>
|
||||
{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
|
|
@ -3030,7 +3182,7 @@ const PrintStyle10 = ({
|
|||
)
|
||||
: Quantity && (
|
||||
<th style={{ width: '10px', textAlign: 'right' }}>
|
||||
{ WeightasKg ?'Qty/Kg' :'Qty'}
|
||||
{WeightasKg ? 'Qty/Kg' : 'Qty'}
|
||||
</th>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
|
|
@ -3356,7 +3508,7 @@ const PrintStyle10 = ({
|
|||
)
|
||||
: Quantity && (
|
||||
<th style={{ width: '10px', textAlign: 'right' }}>
|
||||
{ WeightasKg ?'Qty/Kg' :'Qty'}
|
||||
{WeightasKg ? 'Qty/Kg' : 'Qty'}
|
||||
</th>
|
||||
)}
|
||||
{GlobaldummyData
|
||||
|
|
@ -4035,7 +4187,7 @@ const PrintStyle10 = ({
|
|||
table2Data?.FYStatus
|
||||
)}{' '}
|
||||
</div>
|
||||
{PaymentStatusSuccess?.length > 1 && (
|
||||
{PaymentStatusSuccess?.length > 1 && !isEditedBill && (
|
||||
<>
|
||||
{/* <p>Split Payment:</p> */}
|
||||
{Object.keys(aggregatedPayments).map((paymentType) => (
|
||||
|
|
@ -4153,6 +4305,71 @@ const PrintStyle10 = ({
|
|||
)}
|
||||
</div>
|
||||
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
margin: '2px 0',
|
||||
padding: '2px 0',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'column',
|
||||
borderTop: '1px dashed #000',
|
||||
borderBottom: '1px dashed #000',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '90%',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
}}
|
||||
>
|
||||
<span style={{ color: '#000', fontWeight: '600' }}>
|
||||
Bill Gross Amount
|
||||
</span>
|
||||
<strong>
|
||||
{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}
|
||||
</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: '800',
|
||||
color: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
marginTop: '4px',
|
||||
}}
|
||||
>
|
||||
<span style={{ color: '#000', fontWeight: '600' }}>
|
||||
Net Bill Amount
|
||||
</span>
|
||||
<strong>
|
||||
{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -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 && <div style={{ width: '200%', textAlign: 'left', fontWeight: 600 }}>ITEM</div> : Item && <div style={{ width: '300%', textAlign: 'left', fontWeight: 600 }}>ITEM</div>}
|
||||
{GlobaldummyData ? GlobalHsnCode && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>HSN</div> : HsnCode && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>HSN</div>}
|
||||
{GlobaldummyData ? GlobalMRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>MRP</div> : MRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>MRP</div>}
|
||||
{GlobaldummyData ? GlobalQuantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>QTY</div> : Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}> {WeightasKg ?'QTY/KG' :'QTY'}</div>}
|
||||
{GlobaldummyData ? GlobalQuantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>QTY</div> : Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}> {WeightasKg ? 'QTY/KG' : 'QTY'}</div>}
|
||||
{GlobaldummyData ? GlobalRate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>RATE</div> : Rate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>RATE</div>}
|
||||
{GlobaldummyData ? GlobalDiscount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>DIS </div> : Discount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>DIS </div>}
|
||||
{GlobaldummyData ? GlobalTax && (<div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>TAX %</div>) : (Tax == true && table2Data?.OrderType !== 'E') && (<div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>TAX %</div>)}
|
||||
|
|
@ -302,7 +314,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
|
|||
{GlobaldummyData ? GlobalItem && <div style={{ width: '300%', textAlign: 'center', fontWeight: 600 }}>ITEM</div> : Item && <div style={{ width: '300%', textAlign: 'center', fontWeight: 600 }}>ITEM</div>}
|
||||
{GlobaldummyData ? GlobalHsnCode && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>HSN</div> : HsnCode && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>HSN</div>}
|
||||
{GlobaldummyData ? GlobalMRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>MRP</div> : MRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>MRP</div>}
|
||||
{GlobaldummyData ? GlobalQuantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>QTY</div> : Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}> {WeightasKg ?'QTY/KG' :'QTY'}</div>}
|
||||
{GlobaldummyData ? GlobalQuantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>QTY</div> : Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}> {WeightasKg ? 'QTY/KG' : 'QTY'}</div>}
|
||||
{GlobaldummyData ? GlobalRate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>RATE</div> : Rate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>RATE</div>}
|
||||
{GlobaldummyData ? GlobalDiscount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>DIS </div> : Discount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>DIS </div>}
|
||||
{GlobaldummyData ? GlobalTax && (<div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>TAX %</div>) : (Tax == true && table2Data?.OrderType !== 'E') && (<div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>TAX %</div>)}
|
||||
|
|
@ -494,11 +506,51 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
|
|||
<div style={{ marginTop: '5px', padding: 0, fontSize: "17px", fontWeight: "600" }}>{GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment : {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/- </div>
|
||||
</div>
|
||||
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '100%', marginTop: '2px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'center',
|
||||
flexDirection: 'column', borderTop: '1px dashed #000'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '10px',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#000'
|
||||
: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="PrintStyle3-print-stradrs" style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
|
||||
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', width: "100%" }}>
|
||||
<div style={{ fontSize: "14px", fontWeight: 600 }}>Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}</div>
|
||||
{PaymentStatusSuccess?.length > 1 &&
|
||||
{(PaymentStatusSuccess?.length > 1 && !isEditedBill) && (
|
||||
<>
|
||||
{/* <p>Split Payment:</p> */}
|
||||
{Object.keys(aggregatedPayments).map((paymentType) => (
|
||||
|
|
@ -507,7 +559,8 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
|
|||
</div>
|
||||
))}
|
||||
</>
|
||||
}
|
||||
)}
|
||||
|
||||
{GlobaldummyData && GlobalCashierName &&
|
||||
<div style={{ fontSize: "14px", fontWeight: 600 }}>Cashier : Cashier Name
|
||||
</div>
|
||||
|
|
@ -851,11 +904,52 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
|
|||
<div style={{ marginTop: '5px', padding: 0, fontSize: "17px", fontWeight: "600" }}>{GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment : {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/- </div>
|
||||
</div>
|
||||
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '100%', marginTop: '2px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'center',
|
||||
flexDirection: 'column', borderTop: '1px dashed #000'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '10px',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#000'
|
||||
: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="PrintStyle3-print-stradrs" style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
|
||||
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', width: "100%" }}>
|
||||
<div style={{ fontSize: "14px", fontWeight: 600 }}>Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}</div>
|
||||
{PaymentStatusSuccess?.length > 1 &&
|
||||
{(PaymentStatusSuccess?.length > 1 && !isEditedBill) && (
|
||||
<>
|
||||
{/* <p>Split Payment:</p> */}
|
||||
{Object.keys(aggregatedPayments).map((paymentType) => (
|
||||
|
|
@ -864,7 +958,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
|
|||
</div>
|
||||
))}
|
||||
</>
|
||||
}
|
||||
)}
|
||||
{GlobaldummyData && GlobalCashierName &&
|
||||
<div style={{ fontSize: "14px", fontWeight: 600 }}>Cashier : Cashier Name
|
||||
</div>
|
||||
|
|
@ -1077,7 +1171,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
|
|||
{GlobaldummyData ? GlobalItem && <div style={{ width: '200%', textAlign: 'left', fontWeight: 600 }}>ITEM</div> : Item && <div style={{ width: '300%', textAlign: 'left', fontWeight: 600 }}>ITEM</div>}
|
||||
{GlobaldummyData ? GlobalHsnCode && <div style={{ width: '150%', textAlign: 'right', fontWeight: 600 }}>HSN</div> : HsnCode && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>HSN</div>}
|
||||
{GlobaldummyData ? GlobalMRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>MRP</div> : MRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>MRP</div>}
|
||||
{GlobaldummyData ? GlobalQuantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>QTY</div> : Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}> {WeightasKg ?'QTY/KG' :'QTY'}</div>}
|
||||
{GlobaldummyData ? GlobalQuantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>QTY</div> : Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}> {WeightasKg ? 'QTY/KG' : 'QTY'}</div>}
|
||||
{GlobaldummyData ? GlobalRate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>RATE</div> : Rate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>RATE</div>}
|
||||
{GlobaldummyData ? GlobalDiscount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>DIS </div> : Discount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>DIS </div>}
|
||||
{GlobaldummyData ? GlobalTax && (<div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>TAX %</div>) : (Tax == true && table2Data?.OrderType !== 'E') && (<div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>TAX %</div>)}
|
||||
|
|
@ -1139,7 +1233,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
|
|||
{GlobaldummyData ? GlobalItem && <div style={{ width: '300%', textAlign: 'center', fontWeight: 600 }}>ITEM</div> : Item && <div style={{ width: '300%', textAlign: 'center', fontWeight: 600 }}>ITEM</div>}
|
||||
{GlobaldummyData ? GlobalHsnCode && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>HSN</div> : HsnCode && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>HSN</div>}
|
||||
{GlobaldummyData ? GlobalMRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>MRP</div> : MRP && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>MRP</div>}
|
||||
{GlobaldummyData ? GlobalQuantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>QTY</div> : Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>{WeightasKg ?'QTY/KG' :'QTY'}</div>}
|
||||
{GlobaldummyData ? GlobalQuantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>QTY</div> : Quantity && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>{WeightasKg ? 'QTY/KG' : 'QTY'}</div>}
|
||||
{GlobaldummyData ? GlobalRate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>RATE</div> : Rate && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>RATE</div>}
|
||||
{GlobaldummyData ? GlobalDiscount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>DIS </div> : Discount && <div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>DIS </div>}
|
||||
{GlobaldummyData ? GlobalTax && (<div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>TAX %</div>) : (Tax == true && table2Data?.OrderType !== 'E') && (<div style={{ width: '100%', textAlign: 'right', fontWeight: 600 }}>TAX %</div>)}
|
||||
|
|
@ -1327,6 +1421,46 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
|
|||
<div style={{ marginTop: '5px', padding: 0, fontSize: "17px", fontWeight: "600" }}>{GlobaldummyData ? 'Cash' : PaymentStatusSuccess?.length === 1 ? PaymentStatusSuccess?.[0]?.PaymentTypeName : ""}Payment : {GlobaldummyData ? '1,066' : Number(table2Data?.NetAmount).toFixed(2)}/- </div>
|
||||
</div>
|
||||
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '100%', marginTop: '2px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'center',
|
||||
flexDirection: 'column', borderTop: '1px dashed #000'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '10px',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600, }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#000'
|
||||
: '#000',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
|
||||
<span style={{ color: '#000', fontWeight: 600 }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{GlobaldummyData ? (
|
||||
GlobalCredit && (
|
||||
|
|
@ -1385,7 +1519,7 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
|
|||
|
||||
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', width: "100%" }}>
|
||||
<div style={{ fontSize: "14px", fontWeight: 600 }}>Your Order No :{GlobaldummyData ? '01' : table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)}</div>
|
||||
{PaymentStatusSuccess?.length > 1 &&
|
||||
{(PaymentStatusSuccess?.length > 1 && !isEditedBill) && (
|
||||
<>
|
||||
{/* <p>Split Payment:</p> */}
|
||||
{Object.keys(aggregatedPayments).map((paymentType) => (
|
||||
|
|
@ -1394,7 +1528,8 @@ const PrintStyle3 = ({ index, totalQuantityFilter, Date1, CashierName, totalQuan
|
|||
</div>
|
||||
))}
|
||||
</>
|
||||
}
|
||||
)}
|
||||
|
||||
{GlobaldummyData && GlobalCashierName &&
|
||||
<div style={{ fontSize: "14px", fontWeight: 600 }}>Cashier : Cashier Name
|
||||
</div>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -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'),
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<div
|
||||
className="KioskCardmaster"
|
||||
style={{ height: '100vh', }}
|
||||
style={{ height: '100vh', }}
|
||||
>
|
||||
{/* Top area */}
|
||||
<div style={{ backgroundColor: '#EEEEEE', overflow: 'auto' }}>
|
||||
|
|
@ -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'
|
||||
) ? (
|
||||
''
|
||||
) : (
|
||||
<div
|
||||
|
|
@ -957,57 +956,57 @@ const CardPage1 = (props) => {
|
|||
{card?.ProductDetail?.filter(
|
||||
(item) => item.OnePcsAvailable == 'Y'
|
||||
).length !== 0 && (
|
||||
<div
|
||||
className="card4Main-onepiece-selfBooking"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation(); // Stop event propagation to the parent div
|
||||
<div
|
||||
className="card4Main-onepiece-selfBooking"
|
||||
onClick={(e) => {
|
||||
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',
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
{' '}
|
||||
{AppName?.toLowerCase() === 'sports'
|
||||
? 'Single'
|
||||
: '1PCS'}{' '}
|
||||
: '#fff'
|
||||
: '#ff4d4f',
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
{' '}
|
||||
{AppName?.toLowerCase() === 'sports'
|
||||
? 'Single'
|
||||
: '1PCS'}{' '}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -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?')} */}
|
||||
</div>
|
||||
|
||||
<Divider />
|
||||
|
|
|
|||
|
|
@ -1034,7 +1034,6 @@ const TableBooking = ({ PaymentStatus }) => {
|
|||
);
|
||||
|
||||
const navigatetoBooking = async (data) => {
|
||||
|
||||
const OrderDetails = data?.OrderDetails?.[0];
|
||||
const {
|
||||
OrderDtlDetails,
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<>
|
||||
<div className="Reprint-body" id={`RePrint-${index}`}>
|
||||
|
|
@ -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}
|
||||
</p>
|
||||
)}
|
||||
|
||||
|
|
@ -358,9 +386,9 @@ const PaymentPdfBooking = ({
|
|||
GSTIN: {table2Data?.BrGSTIN}
|
||||
</p>
|
||||
)}
|
||||
<p style={{ fontSize: '9px', margin: '7px 0 0 0', padding: 0 }}>
|
||||
{table2Data?.BrMobile && <p style={{ fontSize: '9px', margin: '7px 0 0 0', padding: 0 }}>
|
||||
Mobile:+91 {table2Data?.BrMobile}
|
||||
</p>
|
||||
</p>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -435,7 +463,7 @@ const PaymentPdfBooking = ({
|
|||
|
||||
<div className="Re-print-top2">
|
||||
<div className="Re-print-bold1">
|
||||
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) => (
|
||||
<div key={i}>{a.SerialNumber}</div>
|
||||
))
|
||||
(items) =>
|
||||
items.SerialNumber &&
|
||||
items.SerialNumber !== ''
|
||||
).map((a, i) => (
|
||||
<div key={i}>{a.SerialNumber}</div>
|
||||
))
|
||||
: ''}
|
||||
{item?.ProductIdentifierDtls?.length > 0
|
||||
? item?.ProductIdentifierDtls.filter(
|
||||
(id) => id.IMEI1 !== '' || id.IMEI2 !== ''
|
||||
).map((id, i) => {
|
||||
const imei1 = id.IMEI1 || '';
|
||||
const imei2 = id.IMEI2 || '';
|
||||
return (
|
||||
<div key={i}>
|
||||
{[imei1, imei2]
|
||||
.filter(Boolean)
|
||||
.join(',')}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
(id) => id.IMEI1 !== '' || id.IMEI2 !== ''
|
||||
).map((id, i) => {
|
||||
const imei1 = id.IMEI1 || '';
|
||||
const imei2 = id.IMEI2 || '';
|
||||
return (
|
||||
<div key={i}>
|
||||
{[imei1, imei2]
|
||||
.filter(Boolean)
|
||||
.join(',')}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
: ''}
|
||||
</span>
|
||||
</div>
|
||||
|
|
@ -549,25 +577,25 @@ const PaymentPdfBooking = ({
|
|||
|
||||
{item?.ProductIdentifierDtls?.length > 0
|
||||
? item?.ProductIdentifierDtls.filter(
|
||||
(items) =>
|
||||
items.SerialNumber &&
|
||||
items.SerialNumber !== ''
|
||||
).map((a, i) => (
|
||||
<div key={i}>{a.SerialNumber}</div>
|
||||
))
|
||||
(items) =>
|
||||
items.SerialNumber &&
|
||||
items.SerialNumber !== ''
|
||||
).map((a, i) => (
|
||||
<div key={i}>{a.SerialNumber}</div>
|
||||
))
|
||||
: ''}
|
||||
{item?.ProductIdentifierDtls?.length > 0
|
||||
? item?.ProductIdentifierDtls.filter(
|
||||
(id) => id.IMEI1 !== '' || id.IMEI2 !== ''
|
||||
).map((id, i) => {
|
||||
const imei1 = id.IMEI1 || '';
|
||||
const imei2 = id.IMEI2 || '';
|
||||
return (
|
||||
<div key={i}>
|
||||
{[imei1, imei2].filter(Boolean).join(',')}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
(id) => id.IMEI1 !== '' || id.IMEI2 !== ''
|
||||
).map((id, i) => {
|
||||
const imei1 = id.IMEI1 || '';
|
||||
const imei2 = id.IMEI2 || '';
|
||||
return (
|
||||
<div key={i}>
|
||||
{[imei1, imei2].filter(Boolean).join(',')}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
: ''}
|
||||
</span>
|
||||
)}
|
||||
|
|
@ -1109,7 +1137,7 @@ const PaymentPdfBooking = ({
|
|||
></div>
|
||||
)}
|
||||
|
||||
{PaymentStatusSuccess?.length > 1 && (
|
||||
{(PaymentStatusSuccess?.length > 1 && !isEditedBill) && (
|
||||
<>
|
||||
{/* <p>Split Payment:</p> */}
|
||||
{Object.keys(aggregatedPayments)?.map((paymentType) => (
|
||||
|
|
@ -1122,6 +1150,48 @@ const PaymentPdfBooking = ({
|
|||
))}
|
||||
</>
|
||||
)}
|
||||
{isEditedBill && lastTransaction && (
|
||||
<div style={{
|
||||
width: '90%', marginTop: '2px',
|
||||
marginLeft: '10px',
|
||||
paddingTop: '2px', display: 'flex', justifyContent: 'center', alignItems: 'center',
|
||||
flexDirection: 'column', borderTop: '1px dashed #ccc'
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
width: '70%'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#333' }}>Bill Gross Amount</span>
|
||||
<strong>{(lastTransaction?.BeforeAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
marginTop: '4px',
|
||||
fontWeight: 600,
|
||||
color:
|
||||
lastTransaction?.AdjustmentType === 'REFUND'
|
||||
? '#d32f2f'
|
||||
: '#2e7d32',
|
||||
}}
|
||||
>
|
||||
<span>{'Adjustment Amount'}</span>
|
||||
<span>
|
||||
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
|
||||
{(lastTransaction?.Amount || 0).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#333' }}>Net Bill Amount</span>
|
||||
<strong>{(lastTransaction?.AfterAdjustment || 0).toFixed(2)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{table2Data?.CustSuppName && (
|
||||
<div>
|
||||
<p
|
||||
|
|
@ -1582,7 +1652,7 @@ const PaymentPdfBooking = ({
|
|||
|
||||
{/* Token print */}
|
||||
{Object.entries(
|
||||
singleData2?.reduce((acc, item, idx) => {
|
||||
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 = ({
|
|||
<p className="Re-print-title">Token</p>
|
||||
</div>
|
||||
<div className="Re-print-top2">
|
||||
<p className="Re-print-bold">BillNo: {orderId}</p>
|
||||
<p className="Re-print-bold">Bill No: {orderId}</p>
|
||||
<p className="Re-print-bold">{Date1}</p>
|
||||
</div>
|
||||
<table className="Re-print-Table">
|
||||
|
|
@ -1625,9 +1695,9 @@ const PaymentPdfBooking = ({
|
|||
<tr className="Re-print-body-Tr" key={idx}>
|
||||
<td className="Re-print-td">{idx + 1}</td>
|
||||
<td className="Re-print-body-Product">{item.ProdName}</td>
|
||||
<td className="Re-print-body-Rate">{item.SalesQty}</td>
|
||||
<td className="Re-print-body-Rate">{item?.EditTokenAvailable === 'Y' ? item?.EditTokenQty : item.SalesQty}</td>
|
||||
<td className="Re-print-body-Rate">{item.Rate}</td>
|
||||
<td className="Re-print-body-Rate">{item.TotalAmt}</td>
|
||||
<td className="Re-print-body-Rate">{((item?.EditTokenAvailable === 'Y' ? item?.EditTokenQty : item.SalesQty) * item.Rate) - ((item?.EditTokenAvailable === 'Y' ? (item?.OfferAmt / item?.EditTokenQty) : item?.OfferAmt))}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
|
|
|
|||
Loading…
Reference in New Issue