combo screen edit qty and rate added

This commit is contained in:
Your Name 2026-02-06 13:54:33 +05:30
parent 1d7944d28c
commit 4c10e36840
7 changed files with 7092 additions and 354 deletions

View File

@ -48,6 +48,8 @@ const BSBillingEditQuantity = (props) => {
const priceChangeInputRef = useRef(null); const priceChangeInputRef = useRef(null);
const reductionInputRef = useRef(null); const reductionInputRef = useRef(null);
const { setIndex = () => {} } = props;
const [disableSubmitButton, setDisableSubmitButton] = useState(false); const [disableSubmitButton, setDisableSubmitButton] = useState(false);
const SessionData = useSelector(StoredSessionData); const SessionData = useSelector(StoredSessionData);
// const AppId = SessionData?.AppId; // const AppId = SessionData?.AppId;
@ -670,6 +672,7 @@ const BSBillingEditQuantity = (props) => {
props.handleEditQuantityCancel(); props.handleEditQuantityCancel();
setClearQuantity(false); setClearQuantity(false);
} }
setIndex(null);
}; };
const handleEditQuantity = async ( const handleEditQuantity = async (

View File

@ -0,0 +1,56 @@
.EditQTYcomboInput {
width: 80px;
height: 25px;
border: none;
outline: none !important;
padding: 2px;
text-align: center;
font-family: "Poppins", sans-serif;
font-weight: 500;
vertical-align: middle;
background-color: #1292ee;
color: #fff;
border-radius: 4px;
&::placeholder {
color: #bdd4ff;
}
}
.EditQTYcomboInputRate {
width: 80px;
height: 25px;
border: none;
outline: none !important;
padding: 2px !important;
text-align: center;
font-family: "Poppins", sans-serif;
font-weight: 500;
vertical-align: middle;
background-color: #1292ee;
color: #fff;
border-radius: 4px;
font-size: 14px;
margin-top: 0 !important;
padding-top: unset !important;
&::placeholder {
color: #bdd4ff;
}
&:hover {
background-color: #1292ee !important;
padding: 2px !important;
}
}
// .EditQuantity-Content .ant-form-item
.rateTdEditRate {
.ant-form-item {
padding-bottom: 0 !important;
margin-bottom: 0 !important;
}
.ant-form-item-control-input {
min-height: unset;
}
}

View File

@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import './ComboSalesBillTable.scss'; import './ComboSalesBillTable.scss';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import { Popconfirm, Tooltip } from 'antd'; import { Popconfirm, Tooltip } from 'antd';
@ -73,6 +73,8 @@ import {
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js'; } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { useRemoveProducts } from '../BSBillingTable3/RemoveCartWithOffer.jsx'; import { useRemoveProducts } from '../BSBillingTable3/RemoveCartWithOffer.jsx';
import { useUtilsComponent } from '../../../../../Services/utils.js'; import { useUtilsComponent } from '../../../../../Services/utils.js';
import ComboEditQty from '../ComboBillTableEdit/ComboEditQty.jsx';
import ComboEditRate from '../ComboBillTableEdit/ComboEditRate.jsx';
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx'; import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const ComboSalesBillTable = () => { const ComboSalesBillTable = () => {
@ -131,7 +133,8 @@ const ComboSalesBillTable = () => {
const GetCustId = useSelector(GlobalCustId); const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption); const selectedCustomer = useSelector(GlobalSelOption);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false); const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null); const [customerProduct, setCustomerProduct] = useState(null);
const tableDataDinein = tableData?.filter( const tableDataDinein = tableData?.filter(
@ -155,6 +158,8 @@ const ComboSalesBillTable = () => {
: []; : [];
const [EditQuantity, setEditQuantity] = useState(false); const [EditQuantity, setEditQuantity] = useState(false);
const [EditQtyCombo, setEditQtyCombo] = useState(false);
const [EditRateCombo, setEditRateCombo] = useState(false);
const [Modaldata, setModaldata] = useState([]); const [Modaldata, setModaldata] = useState([]);
const [triggerAnimation, setTriggerAnimation] = useState(true); const [triggerAnimation, setTriggerAnimation] = useState(true);
// const editField = // const editField =
@ -169,6 +174,32 @@ const ComboSalesBillTable = () => {
// const [BillOrderPre, setBillOrderPre] = useState(); // const [BillOrderPre, setBillOrderPre] = useState();
// console.log(BillOrderPre,'BillOrderPre'); // console.log(BillOrderPre,'BillOrderPre');
const [qtyEdit, setQtyEdit] = useState(false);
const qtyTdRef = useRef(null);
const qtyInputRef = useRef(null);
const handleEditQTYcombo = () => {
if (!qtyEdit) {
setQtyEdit(true);
}
};
// Outside click handler for quantity edit
useEffect(() => {
const handleOutsideClick = (e) => {
if (qtyEdit && qtyTdRef.current && !qtyTdRef.current.contains(e.target)) {
setQtyEdit(false); // 👈 outside click close edit
}
};
document.addEventListener('mousedown', handleOutsideClick);
return () => {
document.removeEventListener('mousedown', handleOutsideClick);
};
}, [qtyEdit]);
// Outside click handler for quantity edit End
useEffect(() => { useEffect(() => {
if (tableOptions?.length > 0) { if (tableOptions?.length > 0) {
let editFieldValue = tableOptions?.filter( let editFieldValue = tableOptions?.filter(
@ -255,7 +286,7 @@ const ComboSalesBillTable = () => {
const handleCustomerProductPriceHistory = (item) => { const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true); setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId); setCustomerProduct(item?.ProdId);
} };
const handleEditQuantity = (value) => { const handleEditQuantity = (value) => {
if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') { if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
@ -270,10 +301,43 @@ const ComboSalesBillTable = () => {
} }
} }
}; };
const handleEditQuantityCombo = (value) => {
if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
setEditQtyCombo(false);
} else {
if (value?.SalesId) {
setEditQtyCombo(false);
} else {
setEditQtyCombo(true);
setEditRateCombo(false);
setModaldata(value);
setIndex(value?.localId);
}
}
};
const handleEditRateCombo = (value) => {
if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
setEditRateCombo(false);
} else {
if (value?.SalesId) {
setEditRateCombo(false);
} else {
setEditRateCombo(true);
setModaldata(value);
setIndex(value?.localId);
}
}
};
const handleEditQuantityCancel = () => { const handleEditQuantityCancel = () => {
setEditQuantity(false); setEditQuantity(false);
}; };
const handleEditQuantityComboCancel = () => {
setEditQtyCombo(false);
};
const handleEditRateComboCancel = () => {
setEditRateCombo(false);
};
const OpenEditTotalAmount = () => { const OpenEditTotalAmount = () => {
setOpenEditTotalAmt(true); setOpenEditTotalAmt(true);
@ -2115,9 +2179,11 @@ const ComboSalesBillTable = () => {
{/* Delete */} {/* Delete */}
{item.OptionName === 'Delete' && ( {item.OptionName === 'Delete' && (
<th className="deleteTh" <th
className="deleteTh"
style={{ textAlign: 'center', width: '80px' }} style={{ textAlign: 'center', width: '80px' }}
key={item.OptionId}> key={item.OptionId}
>
{tableData?.length > 0 ? ( {tableData?.length > 0 ? (
<Popconfirm <Popconfirm
title="Delete the items" title="Delete the items"
@ -2248,9 +2314,7 @@ const ComboSalesBillTable = () => {
'variant' 'variant'
) && <span>{row?.ProdVariantName} </span>} ) && <span>{row?.ProdVariantName} </span>}
{row?.Size} {row?.Size}
{row?.SinglePc == 'Y' ? 'PCS' : row?.UomName} {row?.SinglePc == 'Y' ? 'PCS' : row?.UomName})
)
</p> </p>
)} )}
{row?.Type === 'C' && {row?.Type === 'C' &&
@ -2276,11 +2340,36 @@ const ComboSalesBillTable = () => {
{/* Quantity */} {/* Quantity */}
{item.OptionName === 'Quantity' && ( {item.OptionName === 'Quantity' && (
<td <td
ref={qtyTdRef}
key={`qty-${index}`} key={`qty-${index}`}
className="qtyTd" // className="qtyTd"
onClick={() => editField && handleEditQuantity(row)} className={
EditQtyCombo && row?.localId === Index
? 'EditQTYcomboTD'
: 'qtyTd'
}
onClick={() =>
editField && handleEditQuantityCombo(row)
}
// onClick={() => handleEditQTYcombo()}
> >
{row.OrderQty} {(!EditQtyCombo || row?.localId !== Index) && (
<>{row.OrderQty}</>
)}
{EditQtyCombo && row?.localId === Index && (
<ComboEditQty
key={`edit-qty-${Index}`}
handleEditQuantityCancel={
handleEditQuantityComboCancel
}
BSBillingEditQuantity={EditQtyCombo}
Productdata={Modaldata}
Index={Index}
setIndex={setIndex}
setEditQtyCombo={setEditQtyCombo}
// id={`qty-${index}`}
/>
)}
</td> </td>
)} )}
@ -2288,12 +2377,31 @@ const ComboSalesBillTable = () => {
{item.OptionName === 'Rate' && ( {item.OptionName === 'Rate' && (
<td <td
key={`rate-${index}`} key={`rate-${index}`}
className="rateTd" // className="rateTd"
onClick={() => editField && handleEditQuantity(row)} className={EditRateCombo ? 'rateTdEditRate' : 'rateTd'}
// onClick={() => editField && handleEditQuantity(row)}
onClick={() => editField && handleEditRateCombo(row)}
> >
{!EditRateCombo || row?.localId !== Index ? (
<>
{allowDecimal {allowDecimal
? Number(row?.OrderRate).toFixed(2) ? Number(row?.OrderRate).toFixed(2)
: Number(row?.OrderRate)} : Number(row?.OrderRate)}
</>
) : null}
{EditRateCombo && row?.localId === Index && (
<ComboEditRate
key={`edit-rate-${Index}`}
handleEditRateComboCancel={
handleEditRateComboCancel
}
BSBillingEditRate={EditRateCombo}
Productdata={Modaldata}
Index={Index}
setIndex={setIndex}
setEditRateCombo={setEditRateCombo}
/>
)}
</td> </td>
)} )}
@ -2411,9 +2519,10 @@ const ComboSalesBillTable = () => {
BSBillingEditQuantity={EditQuantity} BSBillingEditQuantity={EditQuantity}
Productdata={Modaldata} Productdata={Modaldata}
Index={Index} Index={Index}
setIndex={setIndex}
/> />
)} )}
{(customerPriceHistoryOpen && GetCustId) && {customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory <CustomerPriceHistory
open={customerPriceHistoryOpen} open={customerPriceHistoryOpen}
custId={GetCustId} custId={GetCustId}
@ -2422,7 +2531,7 @@ const ComboSalesBillTable = () => {
setCustomerProduct={setCustomerProduct} setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer} selectedCustomer={selectedCustomer}
/> />
} )}
</div> </div>
); );
}; };

View File

@ -1,8 +1,8 @@
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap'); @import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");
.combo-sales-bill-table { .combo-sales-bill-table {
width: 100%; width: 100%;
font-family: 'Inter', sans-serif; font-family: "Inter", sans-serif;
.bill-table { .bill-table {
width: 100%; width: 100%;
@ -22,7 +22,7 @@
border: 1px solid #9c9c9c; border: 1px solid #9c9c9c;
font-size: 13px; font-size: 13px;
white-space: nowrap; white-space: nowrap;
font-family: 'Poppins', sans-serif !important; font-family: "Poppins", sans-serif !important;
} }
} }
} }
@ -102,7 +102,7 @@
} }
.rateTd { .rateTd {
width: 90px; width: 90px;
text-align: right; text-align: center;
} }
.discPerTh { .discPerTh {
text-align: center; text-align: center;
@ -119,7 +119,7 @@
text-align: right; text-align: right;
} }
.totalTh { .totalTh {
text-align: center; text-align: right;
width: 170px; width: 170px;
} }
.totalTd { .totalTd {
@ -161,3 +161,31 @@
text-align: right; text-align: right;
} }
} }
.EditQTYcomboInput {
width: 80px;
height: 25px;
border: none;
outline: none !important;
padding: 2px;
text-align: center;
font-family: "Poppins", sans-serif;
font-weight: 500;
vertical-align: middle;
background-color: #1292ee;
color: #fff;
border-radius: 4px;
&::placeholder {
color: #bdd4ff;
}
}
.EditQTYcomboTD {
padding: 1px !important;
text-align: center;
}
.rateTdEditRate {
padding: 1px !important;
text-align: center;
}

View File

@ -243,7 +243,11 @@ import CardPopover from '../BSBillingTables/StandardTable/Utils/CardPopover.jsx'
import UpiPopover from '../BSBillingTables/StandardTable/Utils/UpiPopOver.jsx'; import UpiPopover from '../BSBillingTables/StandardTable/Utils/UpiPopOver.jsx';
import { useDateStore } from '../../../../Features/BookingScreen/BookingData/DateStore.js'; import { useDateStore } from '../../../../Features/BookingScreen/BookingData/DateStore.js';
import { getPaymentOptionsData } from '../../../../Features/BookingScreen/BookingData/KioskBookingData.js'; import { getPaymentOptionsData } from '../../../../Features/BookingScreen/BookingData/KioskBookingData.js';
import { GlobalFreeProdList, GlobalOfferAppliedProducts, GlobalOverAllOfferAmt } from '../../../../Features/Offer/Offernew/BookingOffernew.js'; import {
GlobalFreeProdList,
GlobalOfferAppliedProducts,
GlobalOverAllOfferAmt,
} from '../../../../Features/Offer/Offernew/BookingOffernew.js';
import BSNavBarTable from '../UtillComponents/BSNavBarTable.jsx'; import BSNavBarTable from '../UtillComponents/BSNavBarTable.jsx';
import pozologoimg from '../../../../Images/pozologoimg.png'; import pozologoimg from '../../../../Images/pozologoimg.png';
import PaymentGatewayEmbedded from '../UtillComponents/PaymentGatewayEmbedded.jsx'; import PaymentGatewayEmbedded from '../UtillComponents/PaymentGatewayEmbedded.jsx';
@ -266,7 +270,9 @@ const BSC1Payment = (props) => {
const navigate = useNavigate(); const navigate = useNavigate();
const salesBillEdit = useSelector(GlobalSalesBillEdit); const salesBillEdit = useSelector(GlobalSalesBillEdit);
const previousOrderPayment = useSelector(GlobalPreviousOrderPayment); const previousOrderPayment = useSelector(GlobalPreviousOrderPayment);
const previousOrderOfferDetails = useSelector(GlobalPreviousOrderOfferDetails); const previousOrderOfferDetails = useSelector(
GlobalPreviousOrderOfferDetails
);
const AllPaymentOptions = useSelector(GlobalpaymentOptionData); const AllPaymentOptions = useSelector(GlobalpaymentOptionData);
const SessionData = useSelector(StoredSessionData); const SessionData = useSelector(StoredSessionData);
const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus); const BranchFinancialStatus = useSelector(GlobalBranchFinancialStatus);
@ -349,11 +355,15 @@ const BSC1Payment = (props) => {
(preference) => preference?.PreferredCatName === 'Common Module' (preference) => preference?.PreferredCatName === 'Common Module'
)?.PreferenceCatDetails; )?.PreferenceCatDetails;
const sportsAppPreference = commonModulePreference?.find( const sportsAppPreference = commonModulePreference?.find(
(preference) => preference?.PreferredSubCatName === 'SportsApp' (preference) =>
&& preference?.PreferredSubCatName === 'SportsApp' &&
preference?.PreferredStatus == 'Y' preference?.PreferredStatus == 'Y'
); );
console.log(sportsAppPreference,commonModulePreference,"sportsAppPreference") console.log(
sportsAppPreference,
commonModulePreference,
'sportsAppPreference'
);
const bookingTypePreference = appPreferences?.find( const bookingTypePreference = appPreferences?.find(
(preference) => preference?.PreferredCatName === 'Booking Type' (preference) => preference?.PreferredCatName === 'Booking Type'
)?.PreferenceCatDetails; )?.PreferenceCatDetails;
@ -683,7 +693,6 @@ const BSC1Payment = (props) => {
}, [salesBillEdit]); }, [salesBillEdit]);
useEffect(() => { useEffect(() => {
if (salesBillEdit) { if (salesBillEdit) {
if (SelCustId) { if (SelCustId) {
setRefundPayBtns(AllPaymentOptions); setRefundPayBtns(AllPaymentOptions);
@ -698,8 +707,7 @@ const BSC1Payment = (props) => {
setRefundPayBtns(withoutCustomer); setRefundPayBtns(withoutCustomer);
} }
} }
}, [AllPaymentOptions, SelCustId, salesBillEdit]);
}, [AllPaymentOptions, SelCustId, salesBillEdit])
useEffect(() => { useEffect(() => {
if (!preOrder) { if (!preOrder) {
@ -760,14 +768,21 @@ const BSC1Payment = (props) => {
const filteredPayments = const filteredPayments =
previousOrderPayment?.filter( previousOrderPayment?.filter(
p => p?.LastOrderTran === 'Y' && p?.AfterAdjustment != null && p?.AfterAdjustment !== '' && p?.AfterAdjustment (p) =>
p?.LastOrderTran === 'Y' &&
p?.AfterAdjustment != null &&
p?.AfterAdjustment !== '' &&
p?.AfterAdjustment
) || []; ) || [];
const paymentsToUse = const paymentsToUse =
filteredPayments.length > 0 ? filteredPayments : previousOrderPayment || []; filteredPayments.length > 0
? filteredPayments
: previousOrderPayment || [];
const totalPreviouspayment = paymentsToUse?.reduce( const totalPreviouspayment = paymentsToUse?.reduce(
(acc, payment) => acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0), (acc, payment) =>
acc + parseFloat(payment.AfterAdjustment || payment.Amount || 0),
0 0
); );
@ -776,23 +791,38 @@ const BSC1Payment = (props) => {
0 0
); );
const previousNetAmount = const previousNetAmount = totalPreviouspayment || 0;
(totalPreviouspayment) || 0;
let withdiscTotal = let withdiscTotal =
Total - ((OverAllSales || 0) + (OverAllEstimate || 0) + Total -
((OverAllSales || 0) +
(OverAllEstimate || 0) +
(Discount > 0 ? Discount : 0)); (Discount > 0 ? Discount : 0));
const currentOrderNetAmount = formatAmount( const currentOrderNetAmount = formatAmount(
withdiscTotal >= 0 withdiscTotal >= 0
? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2) ? (Number(withdiscTotal) + Number(globalTipAmount)).toFixed(2)
: (Number(Total) + Number(globalTipAmount)).toFixed(2) : (Number(Total) + Number(globalTipAmount)).toFixed(2)
) );
setTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount); setTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
);
setCurrentOrderNetAmount(currentOrderNetAmount); setCurrentOrderNetAmount(currentOrderNetAmount);
setPreviousNetAmount(previousNetAmount); setPreviousNetAmount(previousNetAmount);
dispatch(changeSummeryTotalAmount(salesBillEdit ? (currentOrderNetAmount > previousNetAmount) ? (currentOrderNetAmount - previousNetAmount) : 0 : currentOrderNetAmount)); dispatch(
changeSummeryTotalAmount(
salesBillEdit
? currentOrderNetAmount > previousNetAmount
? currentOrderNetAmount - previousNetAmount
: 0
: currentOrderNetAmount
)
);
dispatch(changeSummeryComboOfferAmount(withComboSum)); dispatch(changeSummeryComboOfferAmount(withComboSum));
@ -812,7 +842,7 @@ const BSC1Payment = (props) => {
OverAllEstimate, OverAllEstimate,
globalTipAmount, globalTipAmount,
OtherServiceTicketClaim, OtherServiceTicketClaim,
Discount Discount,
]); ]);
useEffect(() => { useEffect(() => {
let data = { let data = {
@ -1233,7 +1263,11 @@ const BSC1Payment = (props) => {
const handleButtonClick = () => { const handleButtonClick = () => {
if (qrCode && SelectedUPIPayOption === 'Default') { if (qrCode && SelectedUPIPayOption === 'Default') {
UpiPayment(); UpiPayment();
} else if (salesBillEdit && currentOrderNetAmount < previousNetAmount && !refundPaySelected) { } else if (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
!refundPaySelected
) {
setMessageType('warning'); setMessageType('warning');
setMessageData('Please Select Refund Payment Method'); setMessageData('Please Select Refund Payment Method');
return; return;
@ -1425,7 +1459,7 @@ const BSC1Payment = (props) => {
const handleRefundPaymentMode = (id, name) => { const handleRefundPaymentMode = (id, name) => {
setRefundPaySelected(id); setRefundPaySelected(id);
setRefundPaySelectedName(name); setRefundPaySelectedName(name);
} };
const AddCardOption = (data) => { const AddCardOption = (data) => {
setSelectedCardOption(data); setSelectedCardOption(data);
@ -2289,8 +2323,10 @@ const BSC1Payment = (props) => {
SalesPaymentType: 'normal', SalesPaymentType: 'normal',
PaymentDetail: [ PaymentDetail: [
{ {
PaymentType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? refundPaySelected : PaymentType:
Paybtnnameselected?.toLowerCase() === 'upi' salesBillEdit && currentOrderNetAmount < previousNetAmount
? refundPaySelected
: Paybtnnameselected?.toLowerCase() === 'upi'
? SelectedUPIPayOption?.toLowerCase() === 'pd' ? SelectedUPIPayOption?.toLowerCase() === 'pd'
? PaymentDeviceUPI?.[0]?.ModeId ? PaymentDeviceUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'pg' : SelectedUPIPayOption?.toLowerCase() === 'pg'
@ -2303,15 +2339,25 @@ const BSC1Payment = (props) => {
: paybtnselected : paybtnselected
? paybtnselected ? paybtnselected
: null, : null,
Amount: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? previousNetAmount - currentOrderNetAmount : Math.round(TotalAmount), Amount:
MerchantId: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : salesBillEdit && currentOrderNetAmount < previousNetAmount
Paybtnnameselected?.toLowerCase() === 'upi' && ? 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) ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId ?.MerchantId
: null, : null,
PaymentOptionType: (salesBillEdit && currentOrderNetAmount < previousNetAmount) && (refundPaySelectedName?.toLowerCase() === 'cash' || refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : PaymentOptionType:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC' ? 'PC'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'PC' ? 'PC'
@ -2324,16 +2370,21 @@ const BSC1Payment = (props) => {
? 'BU' ? 'BU'
: SelectedUPIPayOption : SelectedUPIPayOption
: null, : null,
ModeOfPayment: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? null : ModeOfPayment:
SelectedUPIPayOption?.toLowerCase() === 'default' salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId ?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business' : SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) ? BusinessPayOption?.find(
?.MerchantUPIId (busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null, : null,
AccountDtl: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? [] : AccountDtl:
Paybtnnameselected?.toLowerCase() === 'upi' && salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId (upipay) => upipay?.UPIId === UpiId
@ -2349,8 +2400,10 @@ const BSC1Payment = (props) => {
SelectedCardOption?.toLowerCase() === 'pg') SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway ? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [], : [],
PaymentStatus: (salesBillEdit && currentOrderNetAmount < previousNetAmount) ? 'S' : PaymentStatus:
Paybtnnameselected?.toLowerCase() === 'cash' salesBillEdit && currentOrderNetAmount < previousNetAmount
? 'S'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'S' ? 'S'
: Paybtnnameselected?.toLowerCase() === 'credit' : Paybtnnameselected?.toLowerCase() === 'credit'
? 'S' ? 'S'
@ -2358,9 +2411,18 @@ const BSC1Payment = (props) => {
SelectedUPIPayOption?.toLowerCase() === 'default' SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S' ? 'S'
: 'P', : 'P',
Debit: (salesBillEdit && currentOrderNetAmount < previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, Debit:
Credit: salesBillEdit ? (currentOrderNetAmount > previousNetAmount && refundPaySelectedName?.toLowerCase() === 'credit') ? Math.round(TotalAmount) : 0 : salesBillEdit &&
Paybtnnameselected?.toLowerCase() === 'credit' 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) ? Math.round(TotalAmount)
: 0, : 0,
}, },
@ -2583,7 +2645,8 @@ const BSC1Payment = (props) => {
item?.PaymentStatus === 'P' item?.PaymentStatus === 'P'
); );
if (PayatCounterfilter?.length === 1 || if (
PayatCounterfilter?.length === 1 ||
response?.data?.PaymentOrderDtl?.length === 0 response?.data?.PaymentOrderDtl?.length === 0
) { ) {
setMessageType('success'); setMessageType('success');
@ -3862,7 +3925,8 @@ const BSC1Payment = (props) => {
: 1, : 1,
}} }}
> >
{paybtns?.length > 0 && (currentOrderNetAmount >= previousNetAmount) ? ( {paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => ( paybtns?.map((payment) => (
<div className="Table3-cash"> <div className="Table3-cash">
<button <button
@ -3936,7 +4000,9 @@ const BSC1Payment = (props) => {
</button> </button>
</div> </div>
)) ))
) : (currentOrderNetAmount < previousNetAmount && salesBillEdit && refundPayBtns.length > 0) ? ( ) : currentOrderNetAmount < previousNetAmount &&
salesBillEdit &&
refundPayBtns.length > 0 ? (
refundPayBtns.map((payment) => ( refundPayBtns.map((payment) => (
<div className="Table3-cash"> <div className="Table3-cash">
<button <button
@ -3955,7 +4021,12 @@ const BSC1Payment = (props) => {
? 'blink-animation 0.5s infinite alternate' ? 'blink-animation 0.5s infinite alternate'
: 'none', : 'none',
}} }}
onClick={() => handleRefundPaymentMode(payment?.ConfigId, payment?.ConfigName)} onClick={() =>
handleRefundPaymentMode(
payment?.ConfigId,
payment?.ConfigName
)
}
> >
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */} {/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -4087,6 +4158,17 @@ const BSC1Payment = (props) => {
<div style={{ width: '4px' }}> : </div> <div style={{ width: '4px' }}> : </div>
<div style={{ textAlign: 'right', width: '1rem' }}> {Qty} </div> <div style={{ textAlign: 'right', width: '1rem' }}> {Qty} </div>
</div> </div>
<div
style={{ display: 'flex', alignItems: 'center' }}
className="BSC1Payment-div4-naming"
>
<div style={{ width: '3rem' }}>Dis </div>
<div style={{ width: '4px' }}> : </div>
<div style={{ textAlign: 'right', width: '1rem' }}>
{' '}
{Discount}{' '}
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -4501,8 +4583,10 @@ const BSC1Payment = (props) => {
OrderCardDetail?.length > 0 && OrderCardDetail?.length > 0 &&
paybtnselected && paybtnselected &&
CheckBookingStatus != 'Close' CheckBookingStatus != 'Close'
? !OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? ? !OrderStatus
'BSC1Payment-div4-button' ? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
? 'BSC1Payment-div4-button'
: 'BSC1Payment-div4-button' : 'BSC1Payment-div4-button'
: 'BSC1Payment-div4-button Order' : 'BSC1Payment-div4-button Order'
: 'BSC1Payment-div4-button-disable' : 'BSC1Payment-div4-button-disable'
@ -4513,7 +4597,13 @@ const BSC1Payment = (props) => {
onClick={handleButtonClick} onClick={handleButtonClick}
style={{ borderRadius: '6px 0 0 6px' }} style={{ borderRadius: '6px 0 0 6px' }}
> >
{!OrderStatus ? salesBillEdit && (currentOrderNetAmount < previousNetAmount) ? <div className="Table4-Order">Refund: {(previousNetAmount || 0) - (currentOrderNetAmount || 0)}</div> : ( {!OrderStatus ? (
salesBillEdit && currentOrderNetAmount < previousNetAmount ? (
<div className="Table4-Order">
Refund:
{(previousNetAmount || 0) - (currentOrderNetAmount || 0)}
</div>
) : (
<> <>
{isMobile ? ( {isMobile ? (
`${safeRound( `${safeRound(
@ -4541,6 +4631,7 @@ const BSC1Payment = (props) => {
)} )}
<AiOutlineArrowRight width="25px" height="25px" /> <AiOutlineArrowRight width="25px" height="25px" />
</> </>
)
) : ( ) : (
<div className="Table4-Order">ORDER</div> <div className="Table4-Order">ORDER</div>
)} )}
@ -4762,10 +4853,17 @@ const BSC1Payment = (props) => {
SplitPaymentModal={Splitpayment} SplitPaymentModal={Splitpayment}
handlesplitpaymentclose={handlesplitpaymentclose} handlesplitpaymentclose={handlesplitpaymentclose}
TotalNetAmount={ TotalNetAmount={
OrderType === 'Failed' ? FailedTotalAmt : Math.round(OrderCardDetail?.reduce((acc, data) => data?.TotalAmt + acc, 0) - OrderType === 'Failed'
? FailedTotalAmt
: Math.round(
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) + ((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) + (OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))) (Discount > 0 ? Discount : 0))
)
} }
failedOrderData={failedOrderData} failedOrderData={failedOrderData}
/> />