added customer search based, Ledger Download Excel, Branch Login, Edit item-wise limit

This commit is contained in:
unknown 2026-03-05 19:11:12 +05:30
parent 0236fee8af
commit 14b857aa6d
19 changed files with 698 additions and 333 deletions

View File

@ -391,9 +391,27 @@ export const getAllCustomer = createAsyncThunk(
} }
} }
); );
export const getSearchedCustomer = createAsyncThunk(
'product/getSearchedCustomer',
async ({ CompId, AppId, branchId, searchValue }) => {
if (
CompId !== null &&
CompId !== undefined &&
branchId !== null &&
branchId !== undefined &&
AppId !== null &&
AppId !== undefined
&& searchValue !== '' && searchValue !== null && searchValue !== undefined
) {
return await axiosRetailInstanceData.get(
`/Customer?compId=${CompId}&branchId=${branchId}&appId=${AppId}&custName=${encodeURIComponent(searchValue)}`
);
}
}
);
export const getCustomerForHold = createAsyncThunk( export const getCustomerForHold = createAsyncThunk(
'product/getAllCustomer', 'product/getCustomerForHold',
async ({ CompId, AppId, branchId, OrderId }) => { async ({ CompId, AppId, branchId, OrderId }) => {
if ( if (
CompId != null && CompId != null &&

BIN
src/Images/xls-export.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -469,6 +469,14 @@ const BSBillingEditQuantity = (props) => {
setMessageType('warning'); setMessageType('warning');
return; return;
} }
} else if (itemWiseLimitPreferenece) {
const exceptEditedItemCart = calculateOverAllQtyLimit(CartOrderDetails?.filter((_, index) => index !== editedProductIndex && _.ProdId === editedProduct?.ProdId && _.InwardDtlId === editedProduct?.InwardDtlId));
const totalQtyForItem = ((exceptEditedItemCart || 0) + (editedQty || 0));
if (totalQtyForItem > maxQtyLimit) {
setMessageData(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
setMessageType('warning');
return;
}
} }
} }

View File

@ -1146,6 +1146,8 @@ const BSBillingTable1 = () => {
e?.BookingTypeName != item?.BookingTypeName e?.BookingTypeName != item?.BookingTypeName
); );
if (tableData?.length <= 1) { if (tableData?.length <= 1) {
await dispatch(changeSelectedOption(null));
await dispatch(ChangeSelectedCustDisable(false));
await dispatch(changeReorderHoldDetails({})); await dispatch(changeReorderHoldDetails({}));
await dispatch(changeReorderProductDetails([])); await dispatch(changeReorderProductDetails([]));
await dispatch(changeUnpaidData(false)); await dispatch(changeUnpaidData(false));

View File

@ -1062,6 +1062,8 @@ const BsBill2 = () => {
await dispatch(changeSelProdWiseEst([])); await dispatch(changeSelProdWiseEst([]));
await dispatch(ChangeTotalAmount([])); await dispatch(ChangeTotalAmount([]));
dispatch(changeBillEditingMode(false)); dispatch(changeBillEditingMode(false));
await dispatch(changeSelectedOption(null));
await dispatch(ChangeSelectedCustDisable(false));
await dispatch(changePreviousOrderPayment([])); await dispatch(changePreviousOrderPayment([]));
await dispatch(changePreviousOrderOfferDetail([])); await dispatch(changePreviousOrderOfferDetail([]));
} }
@ -1101,6 +1103,8 @@ const BsBill2 = () => {
await dispatch(changeSelProdWiseEst([])); await dispatch(changeSelProdWiseEst([]));
await dispatch(ChangeTotalAmount([])); await dispatch(ChangeTotalAmount([]));
dispatch(changeBillEditingMode(false)); dispatch(changeBillEditingMode(false));
await dispatch(changeSelectedOption(null));
await dispatch(ChangeSelectedCustDisable(false));
await dispatch(changePreviousOrderPayment([])); await dispatch(changePreviousOrderPayment([]));
await dispatch(changePreviousOrderOfferDetail([])); await dispatch(changePreviousOrderOfferDetail([]));
} }

View File

@ -1107,6 +1107,8 @@ const BSBillingTable3 = () => {
); );
if (tableData?.length <= 1) { if (tableData?.length <= 1) {
await dispatch(changeSelectedOption(null));
await dispatch(ChangeSelectedCustDisable(false));
await dispatch(changeReorderHoldDetails({})); await dispatch(changeReorderHoldDetails({}));
await dispatch(changeReorderProductDetails([])); await dispatch(changeReorderProductDetails([]));
await dispatch(changeUnpaidData(false)); await dispatch(changeUnpaidData(false));
@ -2360,7 +2362,7 @@ const BSBillingTable3 = () => {
fontSize: '16px', fontSize: '16px',
}} }}
> >
{(tableData?.length > 0)? ( {(tableData?.length > 0) ? (
<Popconfirm <Popconfirm
title="Delete the items" title="Delete the items"
description="Are you sure you want to clear these items?" description="Are you sure you want to clear these items?"
@ -2599,7 +2601,7 @@ const BSBillingTable3 = () => {
{item?.Type != 'C' {item?.Type != 'C'
? item.Offer && item.Offer > 0 ? item.Offer && item.Offer > 0
? item.Offer ? item.Offer
:item.DiscountAmt ? item.DiscountAmt : '-' : item.DiscountAmt ? item.DiscountAmt : '-'
: item?.OfferPrice && item?.OfferPrice > 0 : item?.OfferPrice && item?.OfferPrice > 0
? item?.OfferType === 'F' ? item?.OfferType === 'F'
? `${safeRound(item.OfferPrice)}` ? `${safeRound(item.OfferPrice)}`

View File

@ -1050,6 +1050,8 @@ const BSBillingTable4 = () => {
); );
if (tableData?.length <= 1) { if (tableData?.length <= 1) {
await dispatch(changeSelectedOption(null));
await dispatch(ChangeSelectedCustDisable(false));
await dispatch(changeReorderHoldDetails({})); await dispatch(changeReorderHoldDetails({}));
await dispatch(changeReorderProductDetails([])); await dispatch(changeReorderProductDetails([]));
await dispatch(changeUnpaidData(false)); await dispatch(changeUnpaidData(false));

View File

@ -870,6 +870,8 @@ const BsBill = () => {
); );
if (TableData?.length <= 1) { if (TableData?.length <= 1) {
await dispatch(changeSelectedOption(null));
await dispatch(ChangeSelectedCustDisable(false));
await dispatch(changeReorderHoldDetails({})); await dispatch(changeReorderHoldDetails({}));
await dispatch(changeReorderProductDetails([])); await dispatch(changeReorderProductDetails([]));
await dispatch(changeUnpaidData(false)); await dispatch(changeUnpaidData(false));
@ -2944,6 +2946,8 @@ const BsBill = () => {
// if the quantity of the item is 1, remove the item from the cart // if the quantity of the item is 1, remove the item from the cart
if (TableData?.length <= 1) { if (TableData?.length <= 1) {
await dispatch(changeSelectedOption(null));
await dispatch(ChangeSelectedCustDisable(false));
await dispatch(changeReorderHoldDetails({})); await dispatch(changeReorderHoldDetails({}));
await dispatch(changeReorderProductDetails([])); await dispatch(changeReorderProductDetails([]));
await dispatch(changeUnpaidData(false)); await dispatch(changeUnpaidData(false));
@ -2975,6 +2979,8 @@ const BsBill = () => {
// if the quantity of the item is 1, remove the item from the cart // if the quantity of the item is 1, remove the item from the cart
if (TableData?.length <= 1) { if (TableData?.length <= 1) {
await dispatch(changeSelectedOption(null));
await dispatch(ChangeSelectedCustDisable(false));
await dispatch(changeReorderHoldDetails({})); await dispatch(changeReorderHoldDetails({}));
await dispatch(changeReorderProductDetails([])); await dispatch(changeReorderProductDetails([]));
await dispatch(changeUnpaidData(false)); await dispatch(changeUnpaidData(false));
@ -3013,6 +3019,7 @@ const BsBill = () => {
await dispatch(ChangeOverAllDiscEstimate(null)); await dispatch(ChangeOverAllDiscEstimate(null));
await dispatch(changeSelProdWiseEst([])); await dispatch(changeSelProdWiseEst([]));
await dispatch(ChangeTotalAmount([])); await dispatch(ChangeTotalAmount([]));
} }
} }
} }

View File

@ -1106,6 +1106,8 @@ const BSBillingTable6 = () => {
dispatch(changeBillEditingMode(false)); dispatch(changeBillEditingMode(false));
await dispatch(changePreviousOrderPayment([])); await dispatch(changePreviousOrderPayment([]));
await dispatch(changePreviousOrderOfferDetail([])); await dispatch(changePreviousOrderOfferDetail([]));
await dispatch(changeSelectedOption(null));
await dispatch(ChangeSelectedCustDisable(false));
} }
if (item?.Offer > 0) { if (item?.Offer > 0) {

View File

@ -40,6 +40,7 @@ import {
changeBillEditingMode, changeBillEditingMode,
changePreviousOrderPayment, changePreviousOrderPayment,
changePreviousOrderOfferDetail, changePreviousOrderOfferDetail,
ChangeSelectedCustDisable,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData';
import { import {
ChangeFullFreeProductList, ChangeFullFreeProductList,
@ -139,16 +140,16 @@ const BSBillingTable7 = () => {
OrderType === 'Hold' OrderType === 'Hold'
? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway') ? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
: tableData?.filter( : tableData?.filter(
(a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
); );
const OldtableDataDinein = tableData?.filter( const OldtableDataDinein = tableData?.filter(
(a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId (a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId
); );
const OldtableDataTakeAway = const OldtableDataTakeAway =
OrderType != 'Hold' OrderType != 'Hold'
? tableData?.filter( ? tableData?.filter(
(a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
) )
: []; : [];
const productBasedExtraCharges = GlobalExtraCharge.filter( const productBasedExtraCharges = GlobalExtraCharge.filter(
(obj) => 'ProdName' in obj (obj) => 'ProdName' in obj
@ -946,9 +947,9 @@ const BSBillingTable7 = () => {
)?.map((item, idx) => )?.map((item, idx) =>
idx === 0 idx === 0
? { ? {
...item, ...item,
FreeQty, FreeQty,
} }
: item : item
), ),
}; };
@ -985,6 +986,8 @@ const BSBillingTable7 = () => {
dispatch(changeBillEditingMode(false)); dispatch(changeBillEditingMode(false));
await dispatch(changePreviousOrderPayment([])); await dispatch(changePreviousOrderPayment([]));
await dispatch(changePreviousOrderOfferDetail([])); await dispatch(changePreviousOrderOfferDetail([]));
await dispatch(changeSelectedOption(null));
await dispatch(ChangeSelectedCustDisable(false));
} }
if (item?.Offer > 0) { if (item?.Offer > 0) {
//check is Buyxgetx Or something //check is Buyxgetx Or something
@ -2144,16 +2147,16 @@ const BSBillingTable7 = () => {
? item?.SalesId && OrderType !== 'Hold' ? item?.SalesId && OrderType !== 'Hold'
? 'rgb(243, 248, 213)' ? 'rgb(243, 248, 213)'
: triggerAnimation && : triggerAnimation &&
index === 0 && index === 0 &&
!item?.SalesId && !item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength tableDataTakeAway?.length >= PreviousdataLength
? 'wheat' ? 'wheat'
: triggerAnimation && : triggerAnimation &&
index === 0 && index === 0 &&
tableDataTakeAway?.length >= tableDataTakeAway?.length >=
PreviousdataLength && PreviousdataLength &&
!HoldOrderDtl && !HoldOrderDtl &&
!UnpaidData !UnpaidData
? 'wheat' ? 'wheat'
: 'inherit' : 'inherit'
: 'none', : 'none',
@ -2161,9 +2164,9 @@ const BSBillingTable7 = () => {
item?.SalesId && OrderType !== 'Hold' item?.SalesId && OrderType !== 'Hold'
? 'rgb(243, 248, 213)' ? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' && : GlobEstBooking === 'ParEst' &&
GlobProdwisedata?.includes( GlobProdwisedata?.includes(
item?.InwardDtlId + ' ' + item?.BookingTypeName item?.InwardDtlId + ' ' + item?.BookingTypeName
) )
? '#b2d1f7' ? '#b2d1f7'
: index % 2 === 0 : index % 2 === 0
? 'white' ? 'white'
@ -2188,15 +2191,14 @@ const BSBillingTable7 = () => {
? () => handleEditQuantity(item) ? () => handleEditQuantity(item)
: editdelete === 'Delete' : editdelete === 'Delete'
? () => removeFromCart(item) ? () => removeFromCart(item)
: () => {} : () => { }
} }
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""} // onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
className={`${ className={`${item?.SalesId && OrderType !== 'Hold'
item?.SalesId && OrderType !== 'Hold'
? 'BSBill-Table7-content-disabled' ? 'BSBill-Table7-content-disabled'
: 'BSBill-Table7-content' : 'BSBill-Table7-content'
} }
`} `}
> >
@ -2280,21 +2282,21 @@ const BSBillingTable7 = () => {
{productBasedExtraCharges?.find( {productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId (find) => find.ProdId === item.ProdId
) !== undefined && ( ) !== undefined && (
<div <div
style={{ style={{
fontSize: '10px', fontSize: '10px',
fontWeight: '500', fontWeight: '500',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
}} }}
> >
Extra Charges :{' '} Extra Charges :{' '}
{ {
productBasedExtraCharges?.find( productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId (find) => find.ProdId === item.ProdId
)?.TotalAmt )?.TotalAmt
} }
</div> </div>
)} )}
</td> </td>
)} )}
{tableitem.OptionName == 'MRP' && ( {tableitem.OptionName == 'MRP' && (
@ -2373,27 +2375,27 @@ const BSBillingTable7 = () => {
? item?.SalesId ? item?.SalesId
? 'rgb(243, 248, 213)' ? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' && : BookingType === 'Dine In' &&
triggerAnimation && triggerAnimation &&
OldtableDataTakeAway?.length + index === 0 && OldtableDataTakeAway?.length + index === 0 &&
!item?.SalesId && !item?.SalesId &&
tableDataDinein?.length >= PreviousdataLength tableDataDinein?.length >= PreviousdataLength
? 'wheat' ? 'wheat'
: BookingType !== 'Dine In' && : BookingType !== 'Dine In' &&
triggerAnimation && triggerAnimation &&
OldtableDataTakeAway?.length + index === 0 && OldtableDataTakeAway?.length + index === 0 &&
tableDataDinein?.length >= tableDataDinein?.length >=
PreviousdataLength && PreviousdataLength &&
!HoldOrderDtl && !HoldOrderDtl &&
!UnpaidData !UnpaidData
? 'wheat' ? 'wheat'
: 'inherit' : 'inherit'
: 'none', : 'none',
background: item?.SalesId background: item?.SalesId
? 'rgb(243, 248, 213)' ? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' && : GlobEstBooking === 'ParEst' &&
GlobProdwisedata?.includes( GlobProdwisedata?.includes(
item?.InwardDtlId + ' ' + item?.BookingTypeName item?.InwardDtlId + ' ' + item?.BookingTypeName
) )
? '#b2d1f7' ? '#b2d1f7'
: (OldtableDataTakeAway?.length + index) % 2 === 0 : (OldtableDataTakeAway?.length + index) % 2 === 0
? 'white' ? 'white'
@ -2418,15 +2420,14 @@ const BSBillingTable7 = () => {
? () => handleEditQuantity(item) ? () => handleEditQuantity(item)
: editdelete === 'Delete' : editdelete === 'Delete'
? () => removeFromCart(item) ? () => removeFromCart(item)
: () => {} : () => { }
} }
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""} // onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
className={`${ className={`${item?.SalesId
item?.SalesId
? 'BSBill-Table7-content-disabled' ? 'BSBill-Table7-content-disabled'
: 'BSBill-Table7-content' : 'BSBill-Table7-content'
} }
`} `}
> >
@ -2506,21 +2507,21 @@ const BSBillingTable7 = () => {
{productBasedExtraCharges?.find( {productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId (find) => find.ProdId === item.ProdId
) !== undefined && ( ) !== undefined && (
<div <div
style={{ style={{
fontSize: '10px', fontSize: '10px',
fontWeight: '500', fontWeight: '500',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
}} }}
> >
Extra Charges :{' '} Extra Charges :{' '}
{ {
productBasedExtraCharges?.find( productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId (find) => find.ProdId === item.ProdId
)?.TotalAmt )?.TotalAmt
} }
</div> </div>
)} )}
</td> </td>
)} )}
{tableitem.OptionName == 'MRP' && ( {tableitem.OptionName == 'MRP' && (
@ -2599,43 +2600,43 @@ const BSBillingTable7 = () => {
? BookingType === 'Dine In' && item?.SalesId ? BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)' ? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' && : BookingType === 'Dine In' &&
triggerAnimation && triggerAnimation &&
OldtableDataDinein?.length + OldtableDataDinein?.length +
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
index === index ===
0 && 0 &&
!item?.SalesId && !item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength tableDataTakeAway?.length >= PreviousdataLength
? 'wheat' ? 'wheat'
: BookingType !== 'Dine In' && : BookingType !== 'Dine In' &&
triggerAnimation && triggerAnimation &&
OldtableDataDinein?.length + OldtableDataDinein?.length +
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
index === index ===
0 && 0 &&
tableDataTakeAway?.length >= tableDataTakeAway?.length >=
PreviousdataLength && PreviousdataLength &&
!HoldOrderDtl && !HoldOrderDtl &&
!UnpaidData !UnpaidData
? 'wheat' ? 'wheat'
: (OldtableDataDinein?.length + : (OldtableDataDinein?.length +
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
index) % index) %
2 === 2 ===
0 0
? 'white' ? 'white'
: SelectedBillColor?.[ : SelectedBillColor?.[
'OverallBackgroundColor' 'OverallBackgroundColor'
] ]
? SelectedBillColor?.[ ? SelectedBillColor?.[
'OverallBackgroundColor' 'OverallBackgroundColor'
] ]
: '#d6d6d6' : '#d6d6d6'
: (OldtableDataDinein?.length + : (OldtableDataDinein?.length +
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
index) % index) %
2 === 2 ===
0 0
? 'white' ? 'white'
: SelectedBillColor?.['OverallBackgroundColor'] : SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.['OverallBackgroundColor']
@ -2644,15 +2645,15 @@ const BSBillingTable7 = () => {
BookingType === 'Dine In' && item?.SalesId BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)' ? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' && : GlobEstBooking === 'ParEst' &&
GlobProdwisedata?.includes( GlobProdwisedata?.includes(
item?.InwardDtlId + ' ' + item?.BookingTypeName item?.InwardDtlId + ' ' + item?.BookingTypeName
) )
? '#b2d1f7' ? '#b2d1f7'
: (OldtableDataDinein?.length + : (OldtableDataDinein?.length +
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
index) % index) %
2 === 2 ===
0 0
? 'white' ? 'white'
: SelectedBillColor?.['OverallBackgroundColor'] : SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.['OverallBackgroundColor']
@ -2661,9 +2662,9 @@ const BSBillingTable7 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation && ? triggerAnimation &&
OldtableDataDinein?.length + OldtableDataDinein?.length +
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
index === index ===
0 && 0 &&
!item?.SalesId && !item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength && tableDataTakeAway?.length >= PreviousdataLength &&
!HoldOrderDtl && !HoldOrderDtl &&
@ -2680,22 +2681,21 @@ const BSBillingTable7 = () => {
onClick={ onClick={
editdelete === 'Edit' editdelete === 'Edit'
? () => ? () =>
item.Type == 'P' || item.Type == 'C' item.Type == 'P' || item.Type == 'C'
? handleEditQuantity(item)
: item.ServiceType == 'G'
? handleEditQuantity(item) ? handleEditQuantity(item)
: item.ServiceType == 'G' : ''
? handleEditQuantity(item)
: ''
: editdelete === 'Delete' : editdelete === 'Delete'
? () => removeFromCart(item) ? () => removeFromCart(item)
: () => {} : () => { }
} }
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""} // onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
className={`${ className={`${BookingType === 'Dine In' && item?.SalesId
BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table7-content-disabled' ? 'BSBill-Table7-content-disabled'
: 'BSBill-Table7-content' : 'BSBill-Table7-content'
} }
`} `}
> >
@ -2734,8 +2734,8 @@ const BSBillingTable7 = () => {
padding: '8px', padding: '8px',
}} }}
onClick={() => onClick={() =>
(item.FullProductIdentifierDtls?.length > 0 || (item.FullProductIdentifierDtls?.length > 0 ||
item.ProductIdentifierDtls?.length > 0 || imeiModal) && item.ProductIdentifierDtls?.length > 0 || imeiModal) &&
handleImeiDetails(item) handleImeiDetails(item)
} }
> >
@ -2755,8 +2755,8 @@ const BSBillingTable7 = () => {
{!item?.ProdVariantName?.toLowerCase()?.includes( {!item?.ProdVariantName?.toLowerCase()?.includes(
'variant' 'variant'
) && ( ) && (
<span>{item?.ProdVariantName} </span> <span>{item?.ProdVariantName} </span>
)} )}
{item?.Size} {item?.Size}
{item?.SinglePc == 'Y' {item?.SinglePc == 'Y'
? 'PCS' ? 'PCS'
@ -2790,21 +2790,21 @@ const BSBillingTable7 = () => {
{productBasedExtraCharges?.find( {productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId (find) => find.ProdId === item.ProdId
) !== undefined && ( ) !== undefined && (
<div <div
style={{ style={{
fontSize: '10px', fontSize: '10px',
fontWeight: '500', fontWeight: '500',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
}} }}
> >
Extra Charges :{' '} Extra Charges :{' '}
{ {
productBasedExtraCharges?.find( productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId (find) => find.ProdId === item.ProdId
)?.TotalAmt )?.TotalAmt
} }
</div> </div>
)} )}
</td> </td>
)} )}
{tableitem.OptionName == 'MRP' && ( {tableitem.OptionName == 'MRP' && (
@ -2885,45 +2885,45 @@ const BSBillingTable7 = () => {
!BookingTypeBoth !BookingTypeBoth
? 'rgb(243, 248, 213)' ? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' && : BookingType === 'Dine In' &&
triggerAnimation && triggerAnimation &&
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
OldtableDataDinein?.length + OldtableDataDinein?.length +
tableDataTakeAway?.length + tableDataTakeAway?.length +
index === index ===
0 && 0 &&
!item?.SalesId && !item?.SalesId &&
tableDataDinein?.length >= PreviousdataLength tableDataDinein?.length >= PreviousdataLength
? 'wheat' ? 'wheat'
: BookingType !== 'Dine In' && : BookingType !== 'Dine In' &&
triggerAnimation && triggerAnimation &&
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
OldtableDataDinein?.length + OldtableDataDinein?.length +
tableDataTakeAway?.length + tableDataTakeAway?.length +
index === index ===
0 && 0 &&
tableDataDinein?.length >= tableDataDinein?.length >=
PreviousdataLength && PreviousdataLength &&
!HoldOrderDtl && !HoldOrderDtl &&
!UnpaidData !UnpaidData
? 'wheat' ? 'wheat'
: 'inherit' : 'inherit'
: 'none', : 'none',
background: background:
BookingType === 'Dine In' && BookingType === 'Dine In' &&
item?.SalesId && item?.SalesId &&
!BookingTypeBoth !BookingTypeBoth
? 'rgb(243, 248, 213)' ? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' && : GlobEstBooking === 'ParEst' &&
GlobProdwisedata?.includes( GlobProdwisedata?.includes(
item?.InwardDtlId + ' ' + item?.BookingTypeName item?.InwardDtlId + ' ' + item?.BookingTypeName
) )
? '#b2d1f7' ? '#b2d1f7'
: (OldtableDataTakeAway?.length + : (OldtableDataTakeAway?.length +
OldtableDataDinein?.length + OldtableDataDinein?.length +
tableDataTakeAway?.length + tableDataTakeAway?.length +
index) % index) %
2 === 2 ===
0 0
? 'white' ? 'white'
: SelectedBillColor?.['OverallBackgroundColor'] : SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor'] ? SelectedBillColor?.['OverallBackgroundColor']
@ -2932,10 +2932,10 @@ const BSBillingTable7 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation && ? triggerAnimation &&
OldtableDataTakeAway?.length + OldtableDataTakeAway?.length +
OldtableDataDinein?.length + OldtableDataDinein?.length +
tableDataTakeAway?.length + tableDataTakeAway?.length +
index === index ===
0 && 0 &&
!item?.SalesId && !item?.SalesId &&
tableDataDinein?.length >= PreviousdataLength && tableDataDinein?.length >= PreviousdataLength &&
!HoldOrderDtl && !HoldOrderDtl &&
@ -2955,15 +2955,14 @@ const BSBillingTable7 = () => {
? () => handleEditQuantity(item) ? () => handleEditQuantity(item)
: editdelete === 'Delete' : editdelete === 'Delete'
? () => removeFromCart(item) ? () => removeFromCart(item)
: () => {} : () => { }
} }
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""} // onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
className={`${ className={`${BookingType === 'Dine In' && item?.SalesId
BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table7-content-disabled' ? 'BSBill-Table7-content-disabled'
: 'BSBill-Table7-content' : 'BSBill-Table7-content'
} }
`} `}
> >
@ -3047,21 +3046,21 @@ const BSBillingTable7 = () => {
{productBasedExtraCharges?.find( {productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId (find) => find.ProdId === item.ProdId
) !== undefined && ( ) !== undefined && (
<div <div
style={{ style={{
fontSize: '10px', fontSize: '10px',
fontWeight: '500', fontWeight: '500',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
}} }}
> >
Extra Charges :{' '} Extra Charges :{' '}
{ {
productBasedExtraCharges?.find( productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId (find) => find.ProdId === item.ProdId
)?.TotalAmt )?.TotalAmt
} }
</div> </div>
)} )}
</td> </td>
)} )}
{tableitem.OptionName == 'MRP' && ( {tableitem.OptionName == 'MRP' && (

View File

@ -341,6 +341,16 @@ const ComboEditQtyAndRate = (props) => {
setQuantity(removeProds1?.OrderQty || 1) setQuantity(removeProds1?.OrderQty || 1)
return; return;
} }
} else if (itemWiseLimitPreferenece) {
let editedProduct = CartOrderDetails?.find((_, index) => index === editedProductIndex)
const exceptEditedItemCart = calculateOverAllQtyLimit(CartOrderDetails?.filter((_, index) => index !== editedProductIndex && _.ProdId === editedProduct?.ProdId && _.InwardDtlId === editedProduct?.InwardDtlId));
const totalQtyForItem = ((exceptEditedItemCart || 0) + (editedQty || 0));
if (totalQtyForItem > maxQtyLimit) {
setMessageData(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
setMessageType('warning');
setQuantity(editedProduct?.OrderQty || 1)
return;
}
} }
} }
const editedProduct = CartOrderDetails[editedProductIndex]; const editedProduct = CartOrderDetails[editedProductIndex];

View File

@ -94,9 +94,9 @@ const ComboSalesBillTable = () => {
const removeProducts = useRemoveProducts(); const removeProducts = useRemoveProducts();
const applyOffer = useApplyOfferto_CardDetail(); const applyOffer = useApplyOfferto_CardDetail();
const preferenceDatas = useSelector(PreferenceData); const preferenceDatas = useSelector(PreferenceData);
const UomPrint = preferenceDatas?.[0]?.SettingDtlDetails?.filter( const UomPrint = preferenceDatas?.[0]?.SettingDtlDetails?.filter(
(i) => i.SettingIdName === 'PrintUom' (i) => i.SettingIdName === 'PrintUom'
)?.[0]; )?.[0];
const preferenceDetails = preferenceDatas?.[0]?.SettingDtlDetails; const preferenceDetails = preferenceDatas?.[0]?.SettingDtlDetails;
const preferenceOffer = const preferenceOffer =
preferenceDetails?.find((item) => item.SettingIdName === 'Offer') preferenceDetails?.find((item) => item.SettingIdName === 'Offer')
@ -1292,6 +1292,8 @@ const ComboSalesBillTable = () => {
await dispatch(ChangeOverAllDiscEstimate(null)); await dispatch(ChangeOverAllDiscEstimate(null));
await dispatch(changeSelProdWiseEst([])); await dispatch(changeSelProdWiseEst([]));
dispatch(changeBillEditingMode(false)); dispatch(changeBillEditingMode(false));
await dispatch(changeSelectedOption(null));
await dispatch(ChangeSelectedCustDisable(false));
await dispatch(changePreviousOrderPayment([])); await dispatch(changePreviousOrderPayment([]));
await dispatch(changePreviousOrderOfferDetail([])); await dispatch(changePreviousOrderOfferDetail([]));
} }
@ -2548,13 +2550,13 @@ const ComboSalesBillTable = () => {
<td <td
key={`prod-${index}`} key={`prod-${index}`}
className={`productNameTd ${isActiveCell ? 'active-cell' : ''}`} className={`productNameTd ${isActiveCell ? 'active-cell' : ''}`}
onClick={() => { onClick={() => {
dispatch(changeCombofocus(true)); dispatch(changeCombofocus(true));
row.FullProductIdentifierDtls?.length > 0 || row.FullProductIdentifierDtls?.length > 0 ||
row.ProductIdentifierDtls?.length > 0 row.ProductIdentifierDtls?.length > 0
? handleImeiDetails(row) ? handleImeiDetails(row)
: editField && handleEditQuantity(row); : editField && handleEditQuantity(row);
}} }}
> >
{row?.Type !== 'OS' ? row.ProdName : row.ServiceName} {row?.Type !== 'OS' ? row.ProdName : row.ServiceName}
{row?.BrandName ? ` ${row.BrandName}` : ''} {row?.BrandName ? ` ${row.BrandName}` : ''}
@ -2610,10 +2612,9 @@ const ComboSalesBillTable = () => {
}} }}
key={`qty-${index}`} key={`qty-${index}`}
tabIndex={0} tabIndex={0}
className={`${ className={`${EditQtyCombo && row?.localId === Index
EditQtyCombo && row?.localId === Index ? 'EditQTYcomboTD'
? 'EditQTYcomboTD' : 'qtyTd'
: 'qtyTd'
} ${isActiveCell ? 'active-cell' : ''}`} } ${isActiveCell ? 'active-cell' : ''}`}
onClick={() => { onClick={() => {
dispatch(changeCombofocus(true)); dispatch(changeCombofocus(true));

View File

@ -1170,6 +1170,8 @@ const StandardTable = () => {
await dispatch(changeUnpaidData(false)); await dispatch(changeUnpaidData(false));
await dispatch(changeBookingType('TakeAway')); await dispatch(changeBookingType('TakeAway'));
await dispatch(changeTokenOnly(false)); await dispatch(changeTokenOnly(false));
await dispatch(changeSelectedOption(null));
await dispatch(ChangeSelectedCustDisable(false));
await dispatch(ChangeTotalAmount([])); await dispatch(ChangeTotalAmount([]));
await dispatch(changeAllProductTokenAvailable(false)); await dispatch(changeAllProductTokenAvailable(false));
await dispatch(ChangeOverAllDiscSales(null)); await dispatch(ChangeOverAllDiscSales(null));

View File

@ -223,9 +223,9 @@ export const useRemoveFromCart = () => {
AppId: AppId, AppId: AppId,
...(AvailableDate && selectedDate ...(AvailableDate && selectedDate
? { ? {
fromDate: selectedDate?.[0], fromDate: selectedDate?.[0],
toDate: selectedDate?.[1], toDate: selectedDate?.[1],
} }
: {}), : {}),
}; };
await dispatch(getSelectedFavItems(data)).unwrap(); await dispatch(getSelectedFavItems(data)).unwrap();
@ -237,9 +237,9 @@ export const useRemoveFromCart = () => {
ProdSubCat: useSelector((state) => state.BookingData.ProductSubCategorie), ProdSubCat: useSelector((state) => state.BookingData.ProductSubCategorie),
...(AvailableDate && selectedDate ...(AvailableDate && selectedDate
? { ? {
fromDate: selectedDate?.[0], fromDate: selectedDate?.[0],
toDate: selectedDate?.[1], toDate: selectedDate?.[1],
} }
: {}), : {}),
}; };
@ -250,9 +250,9 @@ export const useRemoveFromCart = () => {
prodCat: useSelector((state) => state.BookingData.ProductCategorie), prodCat: useSelector((state) => state.BookingData.ProductCategorie),
...(AvailableDate && selectedDate ...(AvailableDate && selectedDate
? { ? {
fromDate: selectedDate?.[0], fromDate: selectedDate?.[0],
toDate: selectedDate?.[1], toDate: selectedDate?.[1],
} }
: {}), : {}),
}; };
@ -312,6 +312,8 @@ export const useRemoveFromCart = () => {
dispatch(changeBillEditingMode(false)); dispatch(changeBillEditingMode(false));
await dispatch(changePreviousOrderPayment([])); await dispatch(changePreviousOrderPayment([]));
await dispatch(changePreviousOrderOfferDetail([])); await dispatch(changePreviousOrderOfferDetail([]));
await dispatch(changeSelectedOption(null));
await dispatch(ChangeSelectedCustDisable(false));
} else { } else {
let putData = { OrderId: [ReportholdData?.OrderId] }; let putData = { OrderId: [ReportholdData?.OrderId] };
let response = await dispatch(puttinghold(putData)).unwrap(); let response = await dispatch(puttinghold(putData)).unwrap();
@ -345,26 +347,26 @@ export const useRemoveFromCart = () => {
console.log('isItemInCart', isItemInCart); console.log('isItemInCart', isItemInCart);
if (isItemInCart?.OrderQty > 1) { if (isItemInCart?.OrderQty > 1) {
const UpdatedCartItem = const UpdatedCartItem =
// if the item is already in the cart, increase the quantity of the item // if the item is already in the cart, increase the quantity of the item
{ {
...isItemInCart, ...isItemInCart,
OrderQty: isItemInCart?.OrderQty - 1, OrderQty: isItemInCart?.OrderQty - 1,
TotalAmt: (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate, TotalAmt: (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
TaxAmt: ( TaxAmt: (
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
WithoutTaxRate:
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty - 1) * ((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate * isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) / isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage) (100 + isItemInCart?.TaxPercentage)
).toFixed(2), ).toFixed(2),
WithoutTaxRate: };
(isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
(
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
};
const UpdatedcardData = [UpdatedCartItem, ...UpdatedData]; const UpdatedcardData = [UpdatedCartItem, ...UpdatedData];
if (OfferCheckedInSetup && preferenceOffer) { if (OfferCheckedInSetup && preferenceOffer) {

View File

@ -59,6 +59,7 @@
padding: 10px 10px; padding: 10px 10px;
border-radius: 8px; border-radius: 8px;
width: 60%; width: 60%;
@media (max-width: 768px) { @media (max-width: 768px) {
width: 100%; width: 100%;
} }
@ -105,6 +106,7 @@
width: 100%; width: 100%;
overflow-x: hidden; overflow-x: hidden;
} }
.BSOTPKioskPayment-dailpad-1, .BSOTPKioskPayment-dailpad-1,
.BSOTPKioskPayment-dailpad-2, .BSOTPKioskPayment-dailpad-2,
.BSOTPKioskPayment-dailpad-3 { .BSOTPKioskPayment-dailpad-3 {
@ -330,7 +332,7 @@
} }
.paymentCardMain .ant-radio-group, .paymentCardMain .ant-radio-group,
.ant-radio-wrapper span.ant-radio + * { .ant-radio-wrapper span.ant-radio+* {
padding: 10px 10px; padding: 10px 10px;
} }
@ -338,10 +340,7 @@
padding: 54px 35px !important; padding: 54px 35px !important;
} }
.paymentCardMain .paymentCardMain .ant-collapse .ant-collapse-item:last-child>.ant-collapse-content {
.ant-collapse
.ant-collapse-item:last-child
> .ant-collapse-content {
overflow: scroll; overflow: scroll;
height: 26vh; height: 26vh;
} }
@ -465,6 +464,7 @@
color: #fff; color: #fff;
border-radius: 10px; border-radius: 10px;
cursor: pointer; cursor: pointer;
@media (max-width: 768px) { @media (max-width: 768px) {
width: 100%; width: 100%;
} }
@ -573,6 +573,7 @@
} }
} }
} }
.BSOTPItem3Warning { .BSOTPItem3Warning {
position: fixed; position: fixed;
top: 0%; top: 0%;
@ -635,12 +636,14 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
.input-err { .input-err {
font-family: 'Poppins', sans-serif; font-family: 'Poppins', sans-serif;
font-size: 12px; font-size: 12px;
margin-top: 6px; margin-top: 6px;
color: rgb(224, 0, 0); color: rgb(224, 0, 0);
} }
input { input {
width: 60%; width: 60%;
outline: none; outline: none;
@ -652,11 +655,13 @@
border-radius: 6px; border-radius: 6px;
border: 1px solid #333; border: 1px solid #333;
font-size: 20px; font-size: 20px;
@media (max-width: 768px) { @media (max-width: 768px) {
width: 100%; width: 100%;
} }
} }
} }
.BSOTPdailpad-main { .BSOTPdailpad-main {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -688,11 +693,14 @@
.BSOTPotp-box.active { .BSOTPotp-box.active {
border: 2px solid #28a745; border: 2px solid #28a745;
} }
.BSOTPpaymentModal-Master { .BSOTPpaymentModal-Master {
scrollbar-width: thin; scrollbar-width: thin;
height: 90vh; height: max-content;
max-height: 90vh;
overflow: auto; overflow: auto;
} }
.optEnterResendOTP { .optEnterResendOTP {
display: flex; display: flex;
align-items: center; align-items: center;

View File

@ -26,6 +26,7 @@ import {
changeOrderCardDetails, changeOrderCardDetails,
changeCustomerID, changeCustomerID,
changeCombofocus, changeCombofocus,
getSearchedCustomer,
} from '../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../Features/BookingScreen/BookingData/BookingData';
import Select from 'react-select'; import Select from 'react-select';
import { import {
@ -45,6 +46,7 @@ import {
FaPlus, FaPlus,
FaMinus, FaMinus,
FaEye, FaEye,
FaLessThanEqual,
} from 'react-icons/fa'; } from 'react-icons/fa';
import { DefaultModal } from '../../../../Components/Modal/DefaultModal'; import { DefaultModal } from '../../../../Components/Modal/DefaultModal';
import WsPreOrderForm from '../../../Wholesalespreorder/WholesalePreorderForm'; import WsPreOrderForm from '../../../Wholesalespreorder/WholesalePreorderForm';
@ -246,10 +248,16 @@ const BSCustomerSelect = ({ TopName = null }) => {
// Customer data // Customer data
const [allCustomers, setAllCustomers] = useState([]); const [allCustomers, setAllCustomers] = useState([]);
// useEffect(() => {
// dispatch(getAllCustomer({ CompId, AppId, branchId: BranchId }))
// .unwrap()
// .then((res) => setAllCustomers(res?.data?.data || []));
// setProductQuantities({});
// }, [CompId, AppId, BranchId, dispatch, customerRefreshTrigger]);
useEffect(() => { useEffect(() => {
dispatch(getAllCustomer({ CompId, AppId, branchId: BranchId })) if (!CompId || !AppId || !BranchId) return;
.unwrap() setAllCustomers([]);
.then((res) => setAllCustomers(res?.data?.data || []));
setProductQuantities({}); setProductQuantities({});
}, [CompId, AppId, BranchId, dispatch, customerRefreshTrigger]); }, [CompId, AppId, BranchId, dispatch, customerRefreshTrigger]);
@ -286,11 +294,11 @@ const BSCustomerSelect = ({ TopName = null }) => {
() => () =>
GetCustId GetCustId
? { ? {
value: GetCustId?.CustMobile, value: GetCustId?.CustMobile,
label: GetCustId?.CustName || GetCustId?.CustMobile, label: GetCustId?.CustName || GetCustId?.CustMobile,
CustId: GetCustId?.CustId, CustId: GetCustId?.CustId,
CustName: GetCustId?.CustName, CustName: GetCustId?.CustName,
} }
: null, : null,
[GetCustId] [GetCustId]
); );
@ -307,7 +315,7 @@ const BSCustomerSelect = ({ TopName = null }) => {
setCustLoyaltyPoint(selOption?.TotalLoyaltyPoints || 0); setCustLoyaltyPoint(selOption?.TotalLoyaltyPoints || 0);
setCashLoyaltyPoint( setCashLoyaltyPoint(
selOption?.LoyaltyPointsDetail?.filter((l) => l?.RewardType === 'Cash') || selOption?.LoyaltyPointsDetail?.filter((l) => l?.RewardType === 'Cash') ||
[] []
); );
setFreeProductLoyalty( setFreeProductLoyalty(
selOption?.LoyaltyPointsDetail?.filter( selOption?.LoyaltyPointsDetail?.filter(
@ -540,6 +548,9 @@ const BSCustomerSelect = ({ TopName = null }) => {
) )
); );
} }
if (selectedOption === undefined || selectedOption === null) {
setAllCustomers([]);
}
setCustomerpreorder(true); setCustomerpreorder(true);
}; };
@ -978,6 +989,33 @@ const BSCustomerSelect = ({ TopName = null }) => {
setMessageType(null); setMessageType(null);
}, []); }, []);
let debounceTimer;
const debounceSearch = (value) => {
clearTimeout(debounceTimer);
debounceTimer = setTimeout(() => {
handleSearchCustomer(value, false);
}, 500);
};
const handleSearchCustomer = async (value, open = true) => {
const data = {
AppId,
CompId,
branchId: BranchId,
searchValue: value,
}
const response = await dispatch(getSearchedCustomer(data))?.unwrap(); // your API
if (response?.data?.data?.length > 0 && response?.data?.statusCode === 1) {
setAllCustomers(response?.data?.data || []);
} else if (open) {
handleAddCustomer(value);
} else if (!open) {
setAllCustomers([]);
}
};
// Render // Render
return ( return (
<> <>
@ -1020,11 +1058,11 @@ const BSCustomerSelect = ({ TopName = null }) => {
OrderCardDetail?.length > 0 OrderCardDetail?.length > 0
? handleLoyaltyPoints ? handleLoyaltyPoints
: () => { : () => {
setMessageData( setMessageData(
'Add products to cart to redeem loyalty points.' 'Add products to cart to redeem loyalty points.'
); );
setMessageType('error'); setMessageType('error');
} }
} }
> >
<GiTwoCoins /> {custLoyaltyPoint || 0} <GiTwoCoins /> {custLoyaltyPoint || 0}
@ -1066,7 +1104,7 @@ const BSCustomerSelect = ({ TopName = null }) => {
AppType AppType
? null ? null
: selOption || : selOption ||
(selectedCustomerData?.label ? selectedCustomerData : null) (selectedCustomerData?.label ? selectedCustomerData : null)
} }
onChange={handleChange} onChange={handleChange}
onMenuOpen={() => dispatch(changeCombofocus(true))} onMenuOpen={() => dispatch(changeCombofocus(true))}
@ -1078,14 +1116,25 @@ const BSCustomerSelect = ({ TopName = null }) => {
className="customer-select-option" className="customer-select-option"
onInputChange={(value) => { onInputChange={(value) => {
if (!value) return; if (!value) return;
const onlyNumbers = /^\d+$/.test(value);
const isIndianMobile = const isIndianMobile =
/^\d{10}$/.test(value) && /^[6-9]/.test(value); /^\d{10}$/.test(value) && /^[6-9]/.test(value);
const existingCustomer = options?.filter( // const existingCustomer = options?.filter(
(option) => option?.value === value || option?.label === value // (option) => option?.value === value || option?.label === value
); // );
if (isIndianMobile && existingCustomer?.length === 0) { // if (isIndianMobile && existingCustomer?.length === 0) {
handleAddCustomer(value); // handleAddCustomer(value);
// }
if (onlyNumbers && isIndianMobile) {
handleSearchCustomer(value);
return;
}
if (/[a-zA-Z]/.test(value)) {
debounceSearch(value);
} }
}} }}
/> />
@ -1383,7 +1432,7 @@ const BSCustomerSelect = ({ TopName = null }) => {
const quantity = productQuantities[compositeKey] || 0; const quantity = productQuantities[compositeKey] || 0;
const canIncrease = const canIncrease =
totalConsumedPoints + prod.PointsRequired <= totalConsumedPoints + prod.PointsRequired <=
custLoyaltyPoint && custLoyaltyPoint &&
(prod?.StockAvailable === 'Y' (prod?.StockAvailable === 'Y'
? quantity < prod.BalanceQty ? quantity < prod.BalanceQty
: true); : true);
@ -1477,63 +1526,63 @@ const BSCustomerSelect = ({ TopName = null }) => {
{(filteredLoyaltyFreeProducts?.length > 0 || {(filteredLoyaltyFreeProducts?.length > 0 ||
loyaltyFreeProductsInCart?.length > 0) && ( loyaltyFreeProductsInCart?.length > 0) && (
<Popover <Popover
placement="right" placement="right"
content={ content={
<div style={{ width: 300, maxWidth: 'max-content' }}> <div style={{ width: 300, maxWidth: 'max-content' }}>
<div style={{ marginBottom: 8 }}> <div style={{ marginBottom: 8 }}>
You have free products for loyalty points in cart. You have free products for loyalty points in cart.
<br /> <br />
Do you want to keep them? Do you want to keep them?
</div>
<div
style={{
display: 'flex',
gap: 8,
justifyContent: 'flex-end',
}}
>
<Button
size="small"
type="primary"
onClick={() => {
setClearPopoverVisible(false);
handleClearFreeProducts('yes');
}}
>
Yes
</Button>
<Button
size="small"
danger
onClick={() => {
setClearPopoverVisible(false);
handleClearFreeProducts('no');
}}
>
No
</Button>
</div>
</div> </div>
}
trigger="click"
open={clearPopoverVisible && loyaltyModal}
onOpenChange={(visible) => setClearPopoverVisible(visible)}
>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<div <div
style={{ style={{
display: 'flex', background: '#ff3335',
gap: 8, color: 'white',
justifyContent: 'flex-end',
}} }}
className="loyalty-btn clear-btn"
onClick={handleClearFreeProductsWithConfirm}
> >
<Button Clear Offer
size="small"
type="primary"
onClick={() => {
setClearPopoverVisible(false);
handleClearFreeProducts('yes');
}}
>
Yes
</Button>
<Button
size="small"
danger
onClick={() => {
setClearPopoverVisible(false);
handleClearFreeProducts('no');
}}
>
No
</Button>
</div> </div>
</div> </div>
} </Popover>
trigger="click" )}
open={clearPopoverVisible && loyaltyModal}
onOpenChange={(visible) => setClearPopoverVisible(visible)}
>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<div
style={{
background: '#ff3335',
color: 'white',
}}
className="loyalty-btn clear-btn"
onClick={handleClearFreeProductsWithConfirm}
>
Clear Offer
</div>
</div>
</Popover>
)}
</div> </div>
)} )}
</> </>
@ -1545,7 +1594,7 @@ const BSCustomerSelect = ({ TopName = null }) => {
width={600} width={600}
handleCancel={() => setViewModal(false)} handleCancel={() => setViewModal(false)}
footer={false} footer={false}
// title="Selected Products" // title="Selected Products"
> >
<div style={{ padding: '10px' }}> <div style={{ padding: '10px' }}>
<h3 style={{ marginBottom: '16px' }}>Selected Free Products</h3> <h3 style={{ marginBottom: '16px' }}>Selected Free Products</h3>

View File

@ -433,11 +433,16 @@ const BranchLogin = () => {
{CompBranchData?.map((branch) => ( {CompBranchData?.map((branch) => (
<div <div
key={branch.BrId} key={branch.BrId}
style={{ cursor: 'pointer' }}
className={ className={
branch?.LocationType === 'W' branch?.LocationType === 'W'
? 'GodownLoginCard' ? 'GodownLoginCard'
: 'brachLoginCard' : 'brachLoginCard'
} }
onClick={(e) => {
e.stopPropagation();
onChangeBranch(branch?.BrId);
}}
> >
<div className="branchLoginCardContent"> <div className="branchLoginCardContent">
{branch?.LocationType === 'W' ? ( {branch?.LocationType === 'W' ? (
@ -477,7 +482,7 @@ const BranchLogin = () => {
? 'openGodownBTN' ? 'openGodownBTN'
: 'openBrachBTN' : 'openBrachBTN'
} }
onClick={() => onChangeBranch(branch?.BrId)} // onClick={() => onChangeBranch(branch?.BrId)}
> >
{branch?.LocationType === 'W' {branch?.LocationType === 'W'
? 'Open Warehouse' ? 'Open Warehouse'
@ -562,14 +567,12 @@ const BranchLogin = () => {
{SelectTypeName === 'OTP' {SelectTypeName === 'OTP'
? !FirstTimeOtp ? !FirstTimeOtp
? `send ${SelectTypeName.toLocaleLowerCase()}` ? `send ${SelectTypeName.toLocaleLowerCase()}`
: `resend ${SelectTypeName.toLocaleLowerCase()}${ : `resend ${SelectTypeName.toLocaleLowerCase()}${seconds > 0 ? ` in ${seconds}s` : ''
seconds > 0 ? ` in ${seconds}s` : '' }`
}`
: !FirstTimePin : !FirstTimePin
? `send ${SelectTypeName.toLocaleLowerCase()}` ? `send ${SelectTypeName.toLocaleLowerCase()}`
: `resend ${SelectTypeName.toLocaleLowerCase()}${ : `resend ${SelectTypeName.toLocaleLowerCase()}${seconds > 0 ? ` in ${seconds}s` : ''
seconds > 0 ? ` in ${seconds}s` : '' }`}
}`}
</button> </button>
</div> </div>
</div> </div>

View File

@ -28,6 +28,9 @@ import '../../../Styles/Reports/LedgerReport/LedgerReport.scss';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import { ReportMobilePDFPrint } from '../../paymentpdfPage/ReportMobilePDFPrint.js'; import { ReportMobilePDFPrint } from '../../paymentpdfPage/ReportMobilePDFPrint.js';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import excelExport from '../../../Images/xls-export.png';
import ExcelJS from 'exceljs';
import { saveAs } from 'file-saver';
dayjs.extend(customParseFormat); dayjs.extend(customParseFormat);
@ -403,6 +406,215 @@ const LedgerReport = () => {
} }
}; };
const exportToExcel = async () => {
if (!LedgerData || LedgerData.length === 0) return;
const workbook = new ExcelJS.Workbook();
const worksheet = workbook.addWorksheet("Ledger Report");
worksheet.views = [
{
state: "frozen",
ySplit: 2
}
];
// HEADER ROW 1
worksheet.addRow([
"SI No",
"Type",
"Cus-Id",
"Cus-Name",
"RC.NO",
"Mob.No",
"Address",
"Payment Mode",
"Date",
"Debit",
"Credit",
"Balance in",
""
]);
// HEADER ROW 2
worksheet.addRow([
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"Credit",
"Debit"
]);
// MERGE CELLS
worksheet.mergeCells("A1:A2");
worksheet.mergeCells("B1:B2");
worksheet.mergeCells("C1:C2");
worksheet.mergeCells("D1:D2");
worksheet.mergeCells("E1:E2");
worksheet.mergeCells("F1:F2");
worksheet.mergeCells("G1:G2");
worksheet.mergeCells("H1:H2");
worksheet.mergeCells("I1:I2");
worksheet.mergeCells("J1:J2");
worksheet.mergeCells("K1:K2");
worksheet.mergeCells("L1:M1");
// worksheet.eachRow((row) => {
// row.eachCell((cell) => {
// cell.protection = {
// locked: true
// };
// });
// });
// Lock header rows
[1, 2].forEach((rowNumber) => {
const row = worksheet.getRow(rowNumber);
row.eachCell((cell) => {
cell.protection = { locked: true };
});
});
// HEADER STYLE
const headerRows = [1, 2];
headerRows.forEach((rowNumber) => {
const row = worksheet.getRow(rowNumber);
row.eachCell((cell) => {
cell.font = {
bold: true,
color: { argb: "FFFFFFFF" } // white text
};
cell.alignment = {
vertical: "middle",
horizontal: "center"
};
cell.fill = {
type: "pattern",
pattern: "solid",
fgColor: { argb: "FF2E7D32" } // green header
};
cell.border = {
top: { style: "thin" },
left: { style: "thin" },
bottom: { style: "thin" },
right: { style: "thin" }
};
});
});
// specifically ensure Balance in header center
worksheet.getCell("L1").alignment = { horizontal: "center", vertical: "middle" };
// COLUMN WIDTH
worksheet.columns = [
{ width: 8 },
{ width: 10 },
{ width: 12 },
{ width: 20 },
{ width: 12 },
{ width: 15 },
{ width: 25 },
{ width: 15 },
{ width: 15 },
{ width: 12 },
{ width: 12 },
{ width: 12 },
{ width: 12 }
];
// DATA ROWS
LedgerData.forEach((row, index) => {
const r = worksheet.addRow([
index + 1,
row.TypeName === "OB" ? "OB" : row.TypeName,
row.CustId ? extractLastNumber(row.CustId) : "GEN",
row.CustName || "",
row.ReceiptNo || "",
row.MobileNo || "",
row.Address1 || "",
row.PaymentTypeName || "",
ExtractDateFormate(row.Date) || "",
row.Debit > 0 ? row.Debit : "",
row.Credit > 0 ? row.Credit : "",
row.BalCredit > 0 ? row.BalCredit : "",
row.BalDebit > 0 ? row.BalDebit : ""
]);
// 🔓 Unlock every cell in this row
r.eachCell({ includeEmpty: true }, (cell) => {
cell.protection = { locked: false };
});
// Credit red
if (row.BalCredit > 0) {
r.getCell(12).font = { color: { argb: "FFFF0000" } };
}
// Debit green
if (row.BalDebit > 0) {
r.getCell(13).font = { color: { argb: "FF008000" } };
}
});
// Unlock all data rows
worksheet.eachRow((row, rowNumber) => {
if (rowNumber > 2) {
row.eachCell((cell) => {
cell.protection = { locked: false };
});
}
});
await worksheet.protect("ledger123", {
selectLockedCells: true,
selectUnlockedCells: true,
formatColumns: true, // allow column resize
formatRows: false,
insertColumns: false,
insertRows: false,
deleteColumns: false,
deleteRows: false
});
const buffer = await workbook.xlsx.writeBuffer();
const blob = new Blob([buffer], {
type: "application/vnd.openxmlformats-of ficedocument.spreadsheetml.sheet"
});
const now = new Date();
const day = String(now.getDate()).padStart(2, "0");
const month = String(now.getMonth() + 1).padStart(2, "0");
const year = now.getFullYear();
let hours = now.getHours();
const minutes = String(now.getMinutes()).padStart(2, "0");
const ampm = hours >= 12 ? "PM" : "AM";
hours = hours % 12;
hours = hours ? hours : 12;
hours = String(hours).padStart(2, "0");
const fileName = `Ledger Report_${day}-${month}-${year}_${hours}-${minutes}-${ampm}.xlsx`;
saveAs(blob, fileName);
};
const FirstOrderLedgerDateRaw = dayjs(FirstOrderLedgerDate); const FirstOrderLedgerDateRaw = dayjs(FirstOrderLedgerDate);
const disabledDate = (current) => { const disabledDate = (current) => {
@ -621,13 +833,24 @@ const LedgerReport = () => {
</div> </div>
<div className="ledger-PrintIcon"> <div className="ledger-PrintIcon">
<BiSolidPrinter <BiSolidPrinter
onClick={Print} onClick={LedgerData?.length > 0 ? () => Print() : (() => { })}
className={ className={
LedgerData?.length > 0 LedgerData?.length > 0
? 'ItemWiseReport-printerIcon' ? 'ItemWiseReport-printerIcon'
: 'ItemWiseReport-printerIcon-disabled' : 'ItemWiseReport-printerIcon-disabled'
} }
/> />
<Tooltip title={LedgerData?.length > 0 ? "Export as Excel" : "No data to Export"} placement="top">
<div style={{ width: '35px', height: '35px', display: 'flex', justifyContent: 'center', alignItems: 'center', cursor: LedgerData?.length > 0 ? 'pointer' : 'not-allowed', opacity: LedgerData?.length > 0 ? 1 : 0.5 }}>
<img
width={'95%'}
height={'95%'}
src={excelExport}
alt="Excel Export"
onClick={LedgerData?.length > 0 ? () => exportToExcel() : (() => { })}
/>
</div>
</Tooltip>
</div> </div>
</div> </div>
</div> </div>

View File

@ -88,8 +88,30 @@
// overflow-x: scroll; // overflow-x: scroll;
} }
.ItemWiseReport-printerIcon-disabled {
opacity: 0.5;
cursor: not-allowed;
font-size: 30px;
}
.ItemWiseReport-printerIcon {
font-size: 25px;
cursor: pointer;
}
.ItemWiseReport-printerIcon:hover {
color: #414141;
}
.ItemWiseReport-printerIcon {
font-size: 30px;
}
.ledger-PrintIcon { .ledger-PrintIcon {
font-size: xx-large; font-size: xx-large;
display: flex;
align-items: center;
gap: 0.5rem;
} }
.RadioButton-DMYPicker { .RadioButton-DMYPicker {
@ -120,8 +142,8 @@
width: 72px; width: 72px;
} }
.LedgerTable .ant-table-wrapper .ant-table-thead > tr > th, .LedgerTable .ant-table-wrapper .ant-table-thead>tr>th,
.ant-table-wrapper .ant-table-thead > tr > td { .ant-table-wrapper .ant-table-thead>tr>td {
color: #000000; color: #000000;
font-size: 12px; font-size: 12px;
font-weight: 600; font-weight: 600;
@ -152,7 +174,7 @@
} }
.MasterLedger-Report .ant-table-wrapper .ant-table-cell, .MasterLedger-Report .ant-table-wrapper .ant-table-cell,
.MasterLedger-Report .ant-table-wrapper .ant-table-thead > tr > th { .MasterLedger-Report .ant-table-wrapper .ant-table-thead>tr>th {
padding: 1px 13px; padding: 1px 13px;
width: 100px; width: 100px;
} }
@ -243,7 +265,7 @@
border: 1px solid #909090; border: 1px solid #909090;
font-family: "Poppins", sans-serif; font-family: "Poppins", sans-serif;
> thead { >thead {
position: sticky; position: sticky;
top: -1px; top: -1px;
} }
@ -268,7 +290,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 4px; gap: 4px;
overflow: scroll; overflow: scroll;
padding-bottom: 2rem; padding-bottom: 2rem;
} }
@ -314,7 +336,7 @@
justify-content: flex-end; justify-content: flex-end;
gap: 1rem; gap: 1rem;
> div { >div {
border-radius: 6px; border-radius: 6px;
padding: 5px 10px; padding: 5px 10px;
color: #fff; color: #fff;
@ -322,16 +344,17 @@
cursor: pointer; cursor: pointer;
} }
> div:nth-child(1) { >div:nth-child(1) {
background-color: #28aa3a; background-color: #28aa3a;
} }
> div:nth-child(2) { >div:nth-child(2) {
background-color: #ff0000; background-color: #ff0000;
} }
} }
.custom-table { .custom-table {
Button:disabled, Button:disabled,
Button[disabled] { Button[disabled] {
width: unset !important; width: unset !important;