priceoveride

This commit is contained in:
Tamilselvan 2026-03-04 17:32:24 +05:30
parent 2bdba61c17
commit 6720cc48ab
3 changed files with 437 additions and 258 deletions

View File

@ -46,13 +46,15 @@ import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
const BSBillingEditQuantity = (props) => {
const dispatch = useDispatch();
const formRef = useRef(null);
const detailedFormRef = useRef(null);
const itemDiscountFormRef = useRef(null);
const quantityInputRef = useRef(null);
const priceChangeInputRef = useRef(null);
const reductionInputRef = useRef(null);
const { setIndex = () => { } } = props;
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
console.log(disableSubmitButton, "disableSubmitButton")
const SessionData = useSelector(StoredSessionData);
// const AppId = SessionData?.AppId;
// const CompId = SessionData?.CompId;
@ -141,6 +143,8 @@ const BSBillingEditQuantity = (props) => {
const [PercentageSelection, setPercentageSelection] = useState('Fixed');
const [RadioDetails, setRadioDetails] = useState(false);
const [editedPrice, setEditedPrice] = useState(0);
const [itemDiscountPercentageSelection, setItemDiscountPercentageSelection] = useState('Fixed');
const [itemDiscountPrice, setItemDiscountPrice] = useState(0);
const allowDecimal = preferenceDatas?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'decimal' &&
@ -156,7 +160,7 @@ const BSBillingEditQuantity = (props) => {
shallowEqual
);
const FreeProdList = useSelector(GlobalFreeProdList);
console.log(CartOrderDetails, 'CartOrderDetails');
console.log(editedPrice, 'editedPrice');
const TakAwayId = ConfigDataList?.find(
(a) => a?.ConfigName === 'TakeAway'
@ -183,9 +187,9 @@ const BSBillingEditQuantity = (props) => {
? parseInt(props.Productdata.OrderQty)
: props.Productdata.OrderQty
);
SellingPriceChange(parseFloat(props.Productdata?.SellingPrice || 0));
},
[props.BSBillingEditQuantity],
[props.Productdata]
[props.BSBillingEditQuantity, props.Productdata]
);
useEffect(() => {
@ -264,6 +268,13 @@ const BSBillingEditQuantity = (props) => {
}
}, [PackageDtl]);
useEffect(() => {
if (RadioBtnSelection === 'Price' && !RadioDetails) {
setEditedPrice(parseFloat(props.Productdata?.SellingPrice || 0));
}
}, [RadioBtnSelection, RadioDetails]);
const getBookingTypeId = async () => {
let tempconfigdata = await dispatch(
getConfigType({ TypeName: 'Booking Type' })
@ -302,9 +313,12 @@ const BSBillingEditQuantity = (props) => {
setQuantity(tempremovedata);
};
const openRadioDetails = () => {
setDisableSubmitButton(false);
// setDisableSubmitButton(false);
setRadioDetails(!RadioDetails);
setEditedPrice(0);
// Clear ItemDiscount field and reset discount price
setItemDiscountPrice(0);
itemDiscountFormRef.current?.resetFields();
};
// const AddQuantityonly = () => {
@ -424,7 +438,8 @@ const BSBillingEditQuantity = (props) => {
};
const AddProductQuantity = async () => {
let newPrice = editedPrice > 0 ? editedPrice : props.Productdata.OrderRate;
let disCountprice = editedPrice - itemDiscountPrice
let newPrice = safeRound(disCountprice > 0 ? disCountprice : props.Productdata.OrderRate);
await dispatch(changeHoldOrderDtl(false));
await dispatch(changePreviousOrderLength(CartOrderDetails?.length));
@ -3154,6 +3169,26 @@ const BSBillingEditQuantity = (props) => {
...(offerApply && {
Offer: qty * (newPrice > 0 ? newPrice : editedProduct?.OrderRate),
}),
...(
!offerApply && itemDiscountPrice > 0
? {
DiscountAmt: safeRound(itemDiscountPrice),
DiscountType: itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P',
DiscountValue:
itemDiscountPercentageSelection === 'Fixed'
? itemDiscountPrice
: (
(itemDiscountPrice /
(newPrice > 0 ? newPrice : editedProduct?.OrderRate)) * 100
)
}
: {
DiscountAmt: null,
DiscountType: null,
DiscountValue: null
}
)
};
if (hasOffer) {
@ -3213,6 +3248,7 @@ const BSBillingEditQuantity = (props) => {
OfferMessage: updatedProduct?.OfferMessage || bestOffer?.OfferMessage,
};
console.log(updatedProduct, 'updatedProduct');
const shouldRemove = (c) =>
@ -3292,11 +3328,52 @@ const BSBillingEditQuantity = (props) => {
const onPercentageSelectionChange = (data) => {
setPercentageSelection(data);
setEditedPrice(0);
formRef.current?.resetFields();
detailedFormRef.current?.resetFields();
setDisableSubmitButton(false);
};
const onItemDiscountPercentageChange = (data) => {
setItemDiscountPercentageSelection(data);
setItemDiscountPrice(0);
itemDiscountFormRef.current?.resetFields();
};
const ItemDiscountChangefun = (data) => {
const enteredDiscount = parseFloat(data?.target.value);
if (enteredDiscount) {
let roundedrice = safeRound(editedPrice ? editedPrice : 0)
const sellingPrice = parseFloat(roundedrice || props.Productdata?.SellingPrice || 0);
if (itemDiscountPercentageSelection === 'Fixed') {
if (parseFloat(enteredDiscount) < parseFloat(sellingPrice)) {
setItemDiscountPrice(parseFloat(enteredDiscount));
} else {
setMessageType('error');
setMessageData('Discount cannot exceed selling price');
setItemDiscountPrice(0);
itemDiscountFormRef.current?.resetFields();
}
} else {
if (parseFloat(enteredDiscount) < 100) {
let discountAmt = (parseFloat(enteredDiscount) * parseFloat(sellingPrice)) / 100;
setItemDiscountPrice(parseFloat(discountAmt));
} else {
setMessageType('error');
setMessageData('Percentage cannot exceed 100%');
setItemDiscountPrice(0);
itemDiscountFormRef.current?.resetFields();
}
}
} else {
setItemDiscountPrice(0);
}
};
const PriceChangefun = (data) => {
const enteredDiscount = parseFloat(data?.target.value);
// Clear ItemDiscount field and reset discount price
setItemDiscountPrice(0);
itemDiscountFormRef.current?.resetFields();
if (enteredDiscount) {
const sellingPrice = parseFloat(props.Productdata?.SellingPrice || 0);
const limit = parseFloat(props.Productdata?.DiscountLimit || 0);
@ -3408,11 +3485,15 @@ const BSBillingEditQuantity = (props) => {
}
};
const SellingPriceChange = (data) => {
if (data?.target.value) {
if (data) {
const sellingPrice = parseFloat(props.Productdata?.SellingPrice || 0);
const limit = parseFloat(props.Productdata?.DiscountLimit || 0);
const limitType = props.Productdata?.DiscountLimitType;
const enteredDiscount = parseFloat(data?.target.value);
const enteredDiscount = parseFloat(data);
// Clear ItemDiscount field and reset discount price
setItemDiscountPrice(0);
itemDiscountFormRef.current?.resetFields();
if (limit === null || limit === undefined || limit === 0) {
// if (
@ -3420,6 +3501,7 @@ const BSBillingEditQuantity = (props) => {
// parseFloat(enteredDiscount) === parseFloat(sellingPrice)
// ) {
setEditedPrice(enteredDiscount);
formRef.current?.setFieldsValue({ SellPrice: enteredDiscount });
setDisableSubmitButton(true);
// } else {
// setMessageType('error');
@ -3440,7 +3522,8 @@ const BSBillingEditQuantity = (props) => {
}
if (enteredDiscount === maxDiscount) {
setEditedPrice(data?.target.value);
setEditedPrice(data);
formRef.current?.setFieldsValue({ SellPrice: data });
setDisableSubmitButton(true);
return;
}
@ -3449,14 +3532,20 @@ const BSBillingEditQuantity = (props) => {
setMessageType('error');
setMessageData(`You cannot sell below ₹${maxDiscount.toFixed(2)}`);
setEditedPrice(0);
formRef.current?.setFieldsValue({ SellPrice: 0 });
setDisableSubmitButton(false);
return;
}
setDisableSubmitButton(true);
setEditedPrice(data?.target.value);
setEditedPrice(data);
formRef.current?.setFieldsValue({ SellPrice: data });
} else {
setDisableSubmitButton(false);
setEditedPrice(0);
formRef.current?.setFieldsValue({ SellPrice: 0 });
// Clear ItemDiscount field and reset discount price
setItemDiscountPrice(0);
itemDiscountFormRef.current?.resetFields();
}
};
@ -3573,7 +3662,7 @@ const BSBillingEditQuantity = (props) => {
}
}}
>
Price Change
OverRide / Discount
</button>
)}
@ -3663,62 +3752,147 @@ const BSBillingEditQuantity = (props) => {
</>
)}
{RadioBtnSelection == 'Price' && (
<div className="EditQuantity-PriceChange">
<label className="EditQuantity-itemname">
Item Price: {safeRound(props.Productdata.SellingPrice)} /
per item{' '}
</label>
<div style={{ display: "flex" }} >
<div className="EditQuantity-PriceChange">
<label className="EditQuantity-itemname">
Item Price: {safeRound(props.Productdata.SellingPrice)} /
per item{' '}
</label>
{!RadioDetails && (
<Form.Item
name="SellPrice"
rules={[
{
pattern: /^(0\d+|[1-9]\d*)(\.\d+)?$/,
message: 'Please Enter Number Only',
},
{
validator: async (_, value) => {
await validateSafeInput(value);
{!RadioDetails && (
<Form ref={formRef}>
<Form.Item
name="SellPrice"
initialValue={editedPrice}
rules={[
{
pattern: /^(0\d+|[1-9]\d*)(\.\d+)?$/,
message: 'Please Enter Number Only',
},
{
validator: async (_, value) => {
await validateSafeInput(value);
if (value && value.length > 10) {
return Promise.reject(
'Selling Price should not exceed 10 characters'
if (value && value.length > 10) {
return Promise.reject(
'Selling Price should not exceed 10 characters'
);
}
return Promise.resolve();
},
},
]}
>
<InputField
ref={priceChangeInputRef}
value={editedPrice}
label="Price Override"
autocomplete="off"
onChange={(e) => { SellingPriceChange(e?.target?.value) }}
inputMode="decimal"
isOnChange={editedPrice > 0 ? true : false}
onInput={(e) => {
const cleanedValue = e.target.value.replace(
/[^0-9.]/g,
''
);
}
const parts = cleanedValue.split('.');
e.target.value =
parts.length > 2
? `${parts[0]}.${parts.slice(1).join('')}`
: cleanedValue;
}}
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
/>
</Form.Item>
</Form>
)}
return Promise.resolve();
},
},
]}
>
<InputField
ref={priceChangeInputRef}
value={editedPrice}
label="Selling Price"
autocomplete="off"
onChange={SellingPriceChange}
inputMode="decimal"
onInput={(e) => {
const cleanedValue = e.target.value.replace(
/[^0-9.]/g,
''
);
const parts = cleanedValue.split('.');
e.target.value =
parts.length > 2
? `${parts[0]}.${parts.slice(1).join('')}`
: cleanedValue;
}}
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
/>
</Form.Item>
)}
<div className="prodAddDetails" onClick={openRadioDetails}>
More
</div>
{RadioDetails && (
<>
<div className="EditQuantity-Quantity">
<RadioGrpButton
content={[
{ value: 'Fixed', label: 'Fixed' },
{ value: 'Percentage', label: 'Percentage' },
]}
fieldState={true}
defaultSelect={PercentageSelection}
onSelectFuntion={(e) => {
onPercentageSelectionChange(e);
}}
/>
</div>
<div className="EditQuantity-Quantity">
<Form ref={detailedFormRef}>
<Form.Item
name="SellPrice"
initialValue={editedPrice}
rules={[
{
pattern: /^[0-9]\d*(\.\d+)?$/,
message: 'Please Enter Number Only',
},
{
validator: async (_, value) => {
await validateSafeInput(value); // To block HTML tags & SQL keywords
return Promise.resolve();
},
},
]}
>
<InputField
ref={reductionInputRef}
field="SellPrice"
name="SellPrice"
value={editedPrice}
label="Reduction"
fieldState={true}
fieldApi={true}
// id="error2"
autocomplete="off"
onChange={(e) => PriceChangefun(e)}
inputMode="decimal"
isOnChange={editedPrice > 0 ? true : false}
onInput={(e) => {
const cleanedValue = e.target.value.replace(
/[^0-9.]/g,
''
);
const parts = cleanedValue.split('.');
e.target.value =
parts.length > 2
? `${parts[0]}.${parts.slice(1).join('')}`
: cleanedValue;
}}
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
/>
</Form.Item>
{/* <input type="text"
onChange={(e)=>PriceChangefun(e)}
className="EditQuantity-Pricebox"
/> */}
</Form>
</div>
{editedPrice > 0 && <div className="EditQuantity-Quantity">
<div className="EditQuantity-itemname">
{' '}
Price: {safeRound(editedPrice ? editedPrice : 0)}
</div>
</div>}
</>
)}
<div className="prodAddDetails" onClick={openRadioDetails}>
More
</div>
{RadioDetails && (
<div style={{ borderLeft: "1px solid #ddd", paddingLeft: "15px", marginLeft: "15px" }}>
<label className="EditQuantity-itemname">
Item Discount
</label>
<>
<div className="EditQuantity-Quantity">
<RadioGrpButton
@ -3727,16 +3901,16 @@ const BSBillingEditQuantity = (props) => {
{ value: 'Percentage', label: 'Percentage' },
]}
fieldState={true}
defaultSelect={PercentageSelection}
defaultSelect={itemDiscountPercentageSelection}
onSelectFuntion={(e) => {
onPercentageSelectionChange(e);
onItemDiscountPercentageChange(e);
}}
/>
</div>
<div className="EditQuantity-Quantity">
<Form ref={formRef}>
<Form ref={itemDiscountFormRef}>
<Form.Item
name="SellPrice"
name="ItemDiscount"
rules={[
{
pattern: /^[1-9]\d*(\.\d+)?$/,
@ -3744,23 +3918,21 @@ const BSBillingEditQuantity = (props) => {
},
{
validator: async (_, value) => {
await validateSafeInput(value); // To block HTML tags & SQL keywords
await validateSafeInput(value);
return Promise.resolve();
},
},
]}
>
<InputField
ref={reductionInputRef}
field="SellPrice"
name="SellPrice"
value={editedPrice}
label="Reduction"
field="ItemDiscount"
name="ItemDiscount"
value={itemDiscountPrice}
label="Discount Amount"
fieldState={true}
fieldApi={true}
// id="error2"
autocomplete="off"
onChange={(e) => PriceChangefun(e)}
onChange={(e) => ItemDiscountChangefun(e)}
inputMode="decimal"
onInput={(e) => {
const cleanedValue = e.target.value.replace(
@ -3773,24 +3945,22 @@ const BSBillingEditQuantity = (props) => {
? `${parts[0]}.${parts.slice(1).join('')}`
: cleanedValue;
}}
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
/>
</Form.Item>
{/* <input type="text"
onChange={(e)=>PriceChangefun(e)}
className="EditQuantity-Pricebox"
/> */}
</Form>
</div>
<div className="EditQuantity-Quantity">
{itemDiscountPrice > 0 && editedPrice > 0 && <div className="EditQuantity-Quantity">
<div className="EditQuantity-itemname">
{' '}
Price: {safeRound(editedPrice ? editedPrice : 0)}
{console.log(editedPrice, itemDiscountPrice, "itemDiscountPrice")}
Final Price: {safeRound(editedPrice) - (itemDiscountPrice || 0)}
</div>
</div>
</div>}
</>
)}
</div>
</div>
)}
{RadioBtnSelection == 'Parcel' && (
<>

View File

@ -2596,7 +2596,7 @@ const BSBillingTable3 = () => {
{item?.Type != 'C'
? item.Offer && item.Offer > 0
? item.Offer
: '-'
:item.DiscountAmt ? item.DiscountAmt : '-'
: item?.OfferPrice && item?.OfferPrice > 0
? item?.OfferType === 'F'
? `${safeRound(item.OfferPrice)}`
@ -2873,7 +2873,7 @@ const BSBillingTable3 = () => {
{item?.Type != 'C'
? item.Offer && item.Offer > 0
? item.Offer
: '-'
: item.DiscountAmt ? item.DiscountAmt : '-'
: item?.OfferPrice && item?.OfferPrice > 0
? item?.OfferType === 'F'
? `${safeRound(item.OfferPrice)}`
@ -3198,7 +3198,7 @@ const BSBillingTable3 = () => {
{item?.Type != 'C'
? item.Offer && item.Offer > 0
? item.Offer
: '-'
: item.DiscountAmt ? item.DiscountAmt : '-'
: item?.OfferPrice && item?.OfferPrice > 0
? item?.OfferType === 'F'
? `${safeRound(item.OfferPrice)}`
@ -3508,7 +3508,7 @@ const BSBillingTable3 = () => {
{item?.Type != 'C'
? item.Offer && item.Offer > 0
? item.Offer
: '-'
: item.DiscountAmt ? item.DiscountAmt : '-'
: item?.OfferPrice && item?.OfferPrice > 0
? item?.OfferType === 'F'
? `${safeRound(item.OfferPrice)}`

View File

@ -321,7 +321,7 @@ const BSBillingTable3Pay = () => {
const ProdSubCat = useSelector(GlobalProductSubCategorie);
const BSLayoutData = useSelector(getTemplateData);
const Combodata = useSelector(GlobalCombocarddata, shallowEqual);
console.log(PaymentOptions, "PaymentOptions")
const Custdisable = useSelector(GlobalSelectedCustDisable);
const SettingDataSelector = useSelector(PreferenceData);
@ -379,7 +379,7 @@ const BSBillingTable3Pay = () => {
const OrderCardDetail = useSelector(GlobalOrderCardDetails);
const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false);
console.log(OrderCardDetail, 'OrderCardDetail');
console.log(paybtns, 'paybtns');
//Total calculation
const TotalItems = OrderCardDetail?.length;
const [formattedDate, setFormattedDate] = useState('');
@ -423,6 +423,7 @@ const BSBillingTable3Pay = () => {
const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]);
const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]);
const [UpiPayOption, setUpiPayOption] = useState([]);
console.log(UpiPayOption, "UpiPayOption")
const [BusinessPayOption, setBusinessPayoption] = useState([]);
const [CardPayOption, setCardPayOption] = useState([]);
const [Splitpayment, setSplitpayment] = useState(false);
@ -469,6 +470,7 @@ const BSBillingTable3Pay = () => {
const [OrderStatus, setOrderStatus] = useState(true);
const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions);
console.log(GlobaluseOptions, "GlobaluseOptions")
const [useOptions, setuseOptions] = useState([]);
const paymentloader = useSelector(GlobalPayementloader);
const [UnpaidConfirmation, setUnpaidConfirmation] = useState(false);
@ -993,7 +995,7 @@ const BSBillingTable3Pay = () => {
const selectedStyle =
stylesMap[
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
];
if (selectedStyle) {
@ -1072,9 +1074,9 @@ const BSBillingTable3Pay = () => {
setDefaultPaymentMode([]);
}
};
if (salesBillEdit) {
setDefaultPaymentOption();
}
// if (salesBillEdit) {
setDefaultPaymentOption();
// }
}, [defaultPaymentTrigger, salesBillEdit]);
const TokenPrint = async (index) => {
@ -1614,6 +1616,7 @@ const BSBillingTable3Pay = () => {
//dhana
const getPaymentOptionFeature = async () => {
const FiltersalesPayment = GlobaluseOptions?.filter(
(item) => item.FlowName?.toLowerCase() === 'sales'
);
@ -1648,6 +1651,7 @@ const BSBillingTable3Pay = () => {
filterpaymentdevice?.[0]?.ModeDetails?.filter((item) =>
item?.ModeName?.toLowerCase()?.includes('upi')
) || [];
setPaymentOptions(filterpaycounter?.[0]?.ModeDetails);
setPaymentUpiOptions(
FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter
@ -2189,6 +2193,7 @@ const BSBillingTable3Pay = () => {
};
const Booking = async (value, pay) => {
const TakAwayId = ConfigDataList?.find(
(a) => a?.ConfigName === 'TakeAway'
)?.ConfigId;
@ -2214,15 +2219,15 @@ const BSBillingTable3Pay = () => {
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',
@ -2239,6 +2244,10 @@ const BSBillingTable3Pay = () => {
BatchRef: a.BatchRef,
PackageDtl: a.PackageDtl,
SetCount: a.SetCount,
...(a?.DiscountValue && { DiscountValue: a.DiscountValue }),
...(a?.DiscountType && { DiscountType: a.DiscountType }),
...(a?.DiscountAmt && { DiscountAmt: a.DiscountAmt })
}));
const NotSlectedTypeFind = temporderdetail?.find(
(a) => a?.BookingType != SelectedBookingType
@ -2314,7 +2323,7 @@ const BSBillingTable3Pay = () => {
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
OrderDtlDetails:
@ -2331,9 +2340,9 @@ const BSBillingTable3Pay = () => {
? globalTipAmount === 0
? SelectedTableDetails
: SelectedTableDetails?.map((item) => ({
...item,
TipsAmount: globalTipAmount,
}))
...item,
TipsAmount: globalTipAmount,
}))
: null,
SalesPaymentType: 'normal',
PaymentDetail: [
@ -2348,8 +2357,8 @@ const BSBillingTable3Pay = () => {
? PaymentgatewayUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.ModeId
(busupi) => busupi?.ModeId === UpiId
)?.ModeId
: paybtnselected
: paybtnselected
? paybtnselected
@ -2362,15 +2371,15 @@ const BSBillingTable3Pay = () => {
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business'
SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId
?.MerchantId
: null,
PaymentOptionType:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC'
@ -2390,29 +2399,29 @@ const BSBillingTable3Pay = () => {
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId
?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null,
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:
@ -2423,13 +2432,13 @@ const BSBillingTable3Pay = () => {
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
Debit:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
@ -2507,14 +2516,14 @@ const BSBillingTable3Pay = () => {
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]);
@ -2674,14 +2683,14 @@ const BSBillingTable3Pay = () => {
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]);
@ -2784,14 +2793,14 @@ const BSBillingTable3Pay = () => {
}
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]);
@ -2968,14 +2977,14 @@ const BSBillingTable3Pay = () => {
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]);
@ -2994,7 +3003,7 @@ const BSBillingTable3Pay = () => {
if (
Date.now() - startTime >
useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes *
60000
60000
) {
// 60,000 ms = 1 minute
@ -3713,9 +3722,9 @@ const BSBillingTable3Pay = () => {
'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',
@ -3737,16 +3746,16 @@ const BSBillingTable3Pay = () => {
(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,
width: '2rem',
@ -3769,14 +3778,14 @@ const BSBillingTable3Pay = () => {
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',
@ -3809,8 +3818,8 @@ const BSBillingTable3Pay = () => {
cursor: OrderCardDetail?.length > 0 && 'not-allowed',
color:
OrderCardDetail?.length > 0 ||
(OrderCardDetail?.length > 0 &&
GetCustId?.CustMobile === undefined)
(OrderCardDetail?.length > 0 &&
GetCustId?.CustMobile === undefined)
? 'gray'
: 'rgb(18, 146, 238)',
fontSize: '25px',
@ -3897,65 +3906,65 @@ const BSBillingTable3Pay = () => {
<>
{unpaidFlow == false
? item?.OptionName == 'Hold' &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
OrderCardDetail?.length != 0 &&
CheckOrderType?.length === 0 &&
OrderType != 'Failed' &&
CheckBookingStatus != 'Close' &&
paybtns?.length > 0 &&
!addnewAccess && (
<TooltipWrapper
title={'Hold (Alt+W)'}
isMobile={isMobile}
>
{' '}
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => AddBookingDetails('Hold', false)}
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 (Alt+W)'}
isMobile={isMobile}
>
{' '}
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => AddBookingDetails('Hold', false)}
style={{
fontSize: '30px',
cursor: 'pointer',
color: '' ? '#52c41a' : '#1292EE',
}}
/>
</TooltipWrapper>
)
: ''}
{unpaidFlow == false
? item?.OptionName == 'Hold' &&
paybtns?.length > 0 &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
Holddata?.length > 0 &&
OrderCardDetail?.length == 0 &&
CheckBookingStatus != 'Close' &&
!addnewAccess && (
<TooltipWrapper
title={'Recall (Alt+W)'}
isMobile={isMobile}
paybtns?.length > 0 &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
Holddata?.length > 0 &&
OrderCardDetail?.length == 0 &&
CheckBookingStatus != 'Close' &&
!addnewAccess && (
<TooltipWrapper
title={'Recall (Alt+W)'}
isMobile={isMobile}
>
{' '}
<Badge
count={Holddata?.length}
size={'small'}
offset={[0, 7]}
>
{' '}
<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>
)
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => HandleholdModelOpen()}
style={{
fontSize: '28px',
cursor: 'pointer',
color: Holddata ? '#52c41a' : 'default',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
/>
</Badge>
</TooltipWrapper>
)
: ''}
</>
))}
@ -4001,14 +4010,14 @@ const BSBillingTable3Pay = () => {
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',
@ -4070,31 +4079,31 @@ const BSBillingTable3Pay = () => {
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 'none'
: 'auto',
opacity:
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 0.5
: 1,
}}
>
{paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
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'
}
@ -4108,13 +4117,13 @@ const BSBillingTable3Pay = () => {
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>} */}
@ -4174,10 +4183,10 @@ const BSBillingTable3Pay = () => {
<button
className={
refundPaySelected === payment.ConfigId &&
(UpinotSelected || CardoptionnotSelected)
(UpinotSelected || CardoptionnotSelected)
? 'Btn-payment-mode-notupisel'
: refundPaySelected === payment.ConfigId &&
(!UpinotSelected || !CardoptionnotSelected)
(!UpinotSelected || !CardoptionnotSelected)
? 'Btn-payment-mode'
: 'Btn-payment-mode-sel'
}
@ -4449,9 +4458,9 @@ const BSBillingTable3Pay = () => {
addnewAccess
? 'BSBillingTable3-paybtn-deactive'
: FirstPaymentclick === false &&
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
? !OrderStatus
? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
@ -4469,7 +4478,7 @@ const BSBillingTable3Pay = () => {
// financialYearError:
handleButtonClick
}
//dhana
//dhana
>
{!OrderStatus ? (
salesBillEdit && currentOrderNetAmount < previousNetAmount ? (
@ -4698,14 +4707,14 @@ const BSBillingTable3Pay = () => {
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))
)
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))
)
}
failedOrderData={failedOrderData}
/>
@ -4781,9 +4790,9 @@ const BSBillingTable3Pay = () => {
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 (