diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarTable.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarTable.jsx
index 469f90a..0ac9732 100644
--- a/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarTable.jsx
+++ b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarTable.jsx
@@ -10,6 +10,7 @@ import {
GlobalDineinDefault,
GlobalOrderType,
Globalunpaidflow,
+ PreferenceData,
changeBookingType,
changeChairLevelServiceDefault,
changeDefaultBookingType,
@@ -37,16 +38,22 @@ const BSNavBarTable = () => {
const navigate = useNavigate();
const dispatch = useDispatch();
const BookingType = useSelector(GlobalBookingType);
- console.log(BookingType, "BookingType")
const OrderType = useSelector(GlobalOrderType);
const unpaidFlow = useSelector(Globalunpaidflow);
const DineinDefault = useSelector(GlobalDineinDefault);
const defaultBookingType = useSelector(GlobalDefaultBookingType);
const chairLevelServiceDefault = useSelector(GlobalChairLevelServiceDefault);
const [PopOpen, setPopOpen] = useState(false);
+ const PreferenceDatas = useSelector(PreferenceData);
+ const prefaranceDine = PreferenceDatas?.[0]?.SettingDtlDetails?.find((item) =>
+ item.SettingIdName === 'Chairlevel' && item?.SettingValue === 'Y'
+ );
+ console.log(prefaranceDine, 'erereerer', PreferenceDatas);
const handleDineInNavigate = async () => {
- if (chairLevelServiceDefault || defaultBookingType === 'Both') {
+ dispatch(changeDefaultBookingType('Dine In'))
+ // if (chairLevelServiceDefault || defaultBookingType === 'Both') {
+ if (prefaranceDine) {
navigate(`${subDirectory}sales/dine-in`);
}
//cmd by mohan for both concept
@@ -149,15 +156,19 @@ const BSNavBarTable = () => {
return (
-
-
- {defaultBookingType === 'TakeAway' && }
- {defaultBookingType === 'Dine In' && */}
+
+ {/*
*/}
+
+ {/* {defaultBookingType === 'TakeAway' && } */}
+ {/* {defaultBookingType === 'Dine In' && {
- setPopOpen(visible)} content={content} title="SET AS DEFAULT" trigger="click">
+ {/* setPopOpen(visible)} content={content} title="SET AS DEFAULT" trigger="click">
-
+ */}
);
diff --git a/src/Pages/Preference/PreferenceList.jsx b/src/Pages/Preference/PreferenceList.jsx
index f2bef2e..c5e08cd 100644
--- a/src/Pages/Preference/PreferenceList.jsx
+++ b/src/Pages/Preference/PreferenceList.jsx
@@ -94,6 +94,7 @@ const PreferenceList = ({ setting = false }) => {
...(allSettingsMap['parking']?.value === 'Y' ? ['parking'] : []),
...(allSettingsMap['offer']?.value === 'Y' ? ['offer'] : []),
],
+ chairlevel: allSettingsMap['chairlevel']?.value === 'Y',
stockselection: allSettingsMap['stockselection']?.value === 'Y',
weightasquantity: allSettingsMap['weightasquantity']?.value === 'Y',
expiredselection: allSettingsMap['expiredselection']?.value === 'Y',
@@ -369,6 +370,7 @@ const PreferenceList = ({ setting = false }) => {
searchfocus: values.searchfocus,
addproductcard: values.addproductcard,
stockselection: values.stockselection,
+ chairlevel: values.chairlevel,
weightasquantity: values.weightasquantity,
expiredselection: values.expiredselection,
'sales mode': values?.['salesmode'],
@@ -893,7 +895,7 @@ const userDropData = async () => {
)}
-
+ {(allSettingsMap['dinein'] !== undefined && dinePreference) && renderCheckbox('chairlevel', 'Enable Dine In Chair Level Serve?')}
{renderCheckbox('stockselection', 'Enable stock selection?')}
{renderCheckbox('weightasquantity', 'Use Weight as Quantity?')}
{renderCheckbox('expiredselection', 'Show product expiry date?')}
diff --git a/src/Pages/StockMaster/StockBulkUpload.jsx b/src/Pages/StockMaster/StockBulkUpload.jsx
index c80cea0..cbb9629 100644
--- a/src/Pages/StockMaster/StockBulkUpload.jsx
+++ b/src/Pages/StockMaster/StockBulkUpload.jsx
@@ -149,87 +149,65 @@ const StockExcel = ({
useEffect(() => {
if (excelData && excelData.length > 0) {
- let ExcelToJsConversion = [];
- let slicedData = excelData.slice(1); // Skip header row
+ const headers = excelData[0]; // first row is the header array
+ const slicedData = excelData.slice(1); // data rows
- slicedData.forEach((item, index) => {
- // Skip empty rows
- if (!item || Object.values(item).every((val) => !val)) return;
+ const ExcelToJsConversion = slicedData
+ .filter((item) => item && item.some((val) => val !== '' && val != null))
+ .map((item, index) => {
+ const get = (i) => item[i];
+ const isSelf = String(get(1)).trim() === 'Self';
+ const offset = isSelf ? 1 : 0;
- const rowData = {
- key: index,
- InwardDate: item['0'],
- Supplier: item['1'],
- InvoiceDeliveryChallan: item['3'],
- SupplierInvoiceNumber: item['4'],
- SupplierInvoiceDate: item['5'],
- DeliveryChallanNo: item['6'],
- DeliveryInvoiceDate: item['7'],
- PaymentType: item['8'],
- PaymentMode: item['9'],
- PaymentAmount: item['10'],
- DueDate: item['11'],
- ProductName: item['12'],
- VariantName: item['13'],
- Quantity: item['14'],
- PurchaseRate: item['15'],
- Amount: item['16'],
- ReceivedQty: item['17'],
- AcceptedQty: item['18'],
- MRP: item['19'],
- SalesPrice: item['20'],
- AmountPerPiece: item['21'],
- NumberofPieceInside: item['22'],
- };
-
- // Handle conditional 'Own / With Paid' column
- const supplierValue = item['1'];
- if (String(supplierValue).trim() === 'Self') {
- rowData.OwnWithPaid = item['2'];
- // Shift all subsequent columns by 1
- Object.keys(rowData).forEach((key) => {
- if (
- !['key', 'InwardDate', 'Supplier', 'OwnWithPaid'].includes(key)
- ) {
- const currentIndex = parseInt(Object.keys(rowData).indexOf(key));
- rowData[key] = item[currentIndex.toString()];
- }
+ // Build header-to-index map from actual headers row
+ const headerIndexMap = {};
+ headers.forEach((h, i) => {
+ if (h) headerIndexMap[String(h).trim()] = i;
});
- }
+ const getByHeader = (headerName) =>
+ item[headerIndexMap[headerName]];
- // Add optional fields based on column presence
- let currentColIndex = 23;
+ const rowData = {
+ key: index,
+ InwardDate: get(0),
+ Supplier: get(1),
+ ...(isSelf ? { OwnWithPaid: get(2) } : {}),
+ InvoiceDeliveryChallan: get(2 + offset),
+ SupplierInvoiceNumber: get(3 + offset),
+ SupplierInvoiceDate: get(4 + offset),
+ DeliveryChallanNo: get(5 + offset),
+ DeliveryInvoiceDate: get(6 + offset),
+ PaymentType: get(7 + offset),
+ PaymentMode: get(8 + offset),
+ PaymentAmount: get(9 + offset),
+ DueDate: get(10 + offset),
+ ProductName: get(11 + offset),
+ VariantName: get(12 + offset),
+ Quantity: get(13 + offset),
+ PurchaseRate: get(14 + offset),
+ Amount: get(15 + offset),
+ ReceivedQty: get(16 + offset),
+ AcceptedQty: get(17 + offset),
+ MRP: get(18 + offset),
+ SalesPrice: get(19 + offset),
+ AmountPerPiece: get(20 + offset),
+ NumberofPieceInside: get(21 + offset),
+ Uom: getByHeader('Uom'),
+ Tax: getByHeader('Tax (%)'),
+ Hsn: getByHeader('Hsn'),
+ IMEI: getByHeader('IMEI'),
+ ManufactureDate: getByHeader('Manufacture Date') ?? getByHeader('Manuf.Date'),
+ ExpireDate: getByHeader('Expire Date') ?? getByHeader('Exp.Date'),
+ BatchNo: getByHeader('Batch No') ?? getByHeader('Batch'),
+ ModelNo: getByHeader('Model No') ?? getByHeader('Model'),
+ RejectedQty: getByHeader('Rejected Qty'),
+ FreeQty: getByHeader('Free Qty'),
+ WholesalePrice: getByHeader('Wholesale Price'),
+ };
- // Check for optional fields in order they appear in handleDownload
- const optionalFields = [
- { key: 'ManufactureDate', header: 'Manufacture Date' },
- { key: 'ExpireDate', header: 'Expire Date' },
- { key: 'BatchNo', header: 'Batch No.' },
- { key: 'ModelNo', header: 'Model No.' },
- { key: 'RejectedQty', header: 'Rejected Qty' },
- { key: 'FreeQty', header: 'Free Qty' },
- { key: 'WholesalePrice', header: 'Wholesale Price' },
- ];
-
- // Get headers from first row to determine which optional fields exist
- const headers = excelData[0];
- optionalFields.forEach((field) => {
- if (headers.includes(field.header)) {
- rowData[field.key] = item[currentColIndex.toString()];
- currentColIndex++;
- }
- });
- if (
- rowData?.PurchaseRate &&
- rowData?.Amount &&
- rowData?.MRP &&
- rowData?.SalesPrice &&
- rowData?.ProductName &&
- rowData?.PaymentAmount
- ) {
- ExcelToJsConversion.push(rowData);
- }
- });
+ return rowData;
+ })
+ .filter((row) => row?.ProductName);
setDatas(ExcelToJsConversion);
}
@@ -322,8 +300,7 @@ const StockExcel = ({
// ✅ unchanged logic
dispatch(uploadExcel({ file, jsonData: nonEmptyRows }));
- setWorksheet1(worksheet1);
- setDatas(formattedData);
+ setWorksheet1(worksheet);
};
reader.readAsArrayBuffer(file);
@@ -477,14 +454,14 @@ const StockExcel = ({
pushCol('Amount Per Piece', 'AmountPerPiece', true);
pushCol('Number of Piece Inside', 'NumberofPieceInside', true);
- if (isOptionalFieldAllowed('Manufacture Date'))
- pushCol('Manufacture Date', 'ManufDate', false);
- if (isOptionalFieldAllowed('Expire Date'))
- pushCol('Expire Date', 'ExpDate', false);
- if (isOptionalFieldAllowed('Batch No.'))
- pushCol('Batch No.', 'BatchNo', false);
- if (isOptionalFieldAllowed('Model No.'))
- pushCol('Model No.', 'ModelNo', false);
+ pushCol('Uom', 'Uom', true);
+ pushCol('Tax (%)', 'Tax', true);
+ pushCol('Hsn', 'Hsn', false);
+ pushCol('IMEI', 'IMEI', false);
+ pushCol('Manufacture Date', 'ManufDate', false);
+ pushCol('Expire Date', 'ExpDate', false);
+ pushCol('Batch No', 'BatchNo', false);
+ pushCol('Model No', 'ModelNo', false);
if (isOptionalFieldAllowed('Rejected Qty'))
pushCol('Rejected Qty', 'RejectedQty', false);
if (isOptionalFieldAllowed('Free Qty'))
@@ -603,6 +580,10 @@ const StockExcel = ({
SalesPrice: variant.SellPrice || 0,
NumberofPieceInside: variant.NoOfPcs || 0,
AmountPerPiece: variant.OnePcsPrice || 0,
+ Uom: variant.UomName || product.UomName || '',
+ Tax: variant.TaxPer || product.TaxPer || 0,
+ Hsn: product.HsnCode || '',
+ IMEI: '',
};
if (String(selectedSupplierData?.SuppName).trim() === 'Self') {
@@ -891,6 +872,34 @@ const StockExcel = ({
};
expCell.protection = { locked: false };
}
+ if (colIndex('BatchNo')) {
+ const cell = worksheet.getCell(r, colIndex('BatchNo'));
+ cell.protection = { locked: false };
+ }
+ if (colIndex('ModelNo')) {
+ const cell = worksheet.getCell(r, colIndex('ModelNo'));
+ cell.protection = { locked: false };
+ }
+ if (colIndex('Hsn')) {
+ const cell = worksheet.getCell(r, colIndex('Hsn'));
+ cell.protection = { locked: false };
+ }
+ if (colIndex('Uom')) {
+ const cell = worksheet.getCell(r, colIndex('Uom'));
+ cell.protection = { locked: true };
+ }
+ if (colIndex('Tax')) {
+ const cIdx = colIndex('Tax');
+ const letter = colLetter(cIdx);
+ const taxCell = worksheet.getCell(`${letter}${r}`);
+ taxCell.numFmt = '#,##0.00';
+ taxCell.protection = { locked: false };
+ addNumberValidation(taxCell, true, 0);
+ }
+ if (colIndex('IMEI')) {
+ const cell = worksheet.getCell(r, colIndex('IMEI'));
+ cell.protection = { locked: false };
+ }
if (colIndex('ReceivedQty') && colIndex('Quantity')) {
const rIdx = colIndex('ReceivedQty');
const qIdx = colIndex('Quantity');
@@ -1197,13 +1206,13 @@ const StockExcel = ({
editable: true,
},
{
- title: 'Batch No.',
+ title: 'Batch No',
dataIndex: 'BatchNo',
key: 'BatchNo',
editable: true,
},
{
- title: 'Model No.',
+ title: 'Model No',
dataIndex: 'ModelNo',
key: 'ModelNo',
editable: true,
@@ -1226,6 +1235,30 @@ const StockExcel = ({
key: 'WholesalePrice',
editable: true,
},
+ {
+ title: 'Hsn',
+ dataIndex: 'Hsn',
+ key: 'Hsn',
+ editable: true,
+ },
+ {
+ title: 'Uom',
+ dataIndex: 'Uom',
+ key: 'Uom',
+ editable: true,
+ },
+ {
+ title: 'Tax (%)',
+ dataIndex: 'Tax',
+ key: 'Tax',
+ editable: true,
+ },
+ {
+ title: 'IMEI',
+ dataIndex: 'IMEI',
+ key: 'IMEI',
+ editable: true,
+ },
];
const column = columns?.map((col) => {
@@ -1247,7 +1280,7 @@ const StockExcel = ({
dataIndex: col.dataIndex,
title: col.title,
handleSave,
- onClick: () => onClickHandler(record),
+ onClick: onClickHandler ? () => onClickHandler(record) : undefined,
}),
};
});
diff --git a/src/Pages/StockMaster/StockList.jsx b/src/Pages/StockMaster/StockList.jsx
index a546b47..27c6beb 100644
--- a/src/Pages/StockMaster/StockList.jsx
+++ b/src/Pages/StockMaster/StockList.jsx
@@ -113,8 +113,11 @@ const StockList = () => {
const [addnewAccess, setaddnewAccess] = useState(true);
const [page, setpage] = useState(1);
const [open, setOpen] = useState(false);
+ const [openExcel, setOpenExcel] = useState(false);
const [Exceldatasubmit, setExceldatasubmit] = useState(null);
+ console.log(Exceldatasubmit,'Exceldatasubmit111');
+
const [Totaltax, setTotaltax] = useState(null);
const [Totalamount, setTotalamount] = useState(null);
const [Taxdatas, setTaxdatas] = useState();
@@ -277,7 +280,6 @@ const StockList = () => {
});
const filteredData = debouncedSearchText ? countData || [] : data || [];
- console.log('1111111111111111', filteredData);
async function searchData({ queryKey }) {
const [_, SearchText] = queryKey;
@@ -848,12 +850,12 @@ const StockList = () => {
};
const handleCancel = () => {
- setOpen(false);
+ setOpenExcel(false);
handleResetExcelData();
};
const openModal = () => {
- setOpen(true);
+ setOpenExcel(true);
// setEditState(false);
};
@@ -1006,71 +1008,97 @@ const StockList = () => {
return acc + amount;
}, 0);
+ const inwardDate = groupInfo.InwardDate
+ ? moment(groupInfo.InwardDate, 'YYYY-MM-DD').format('YYYY-MM-DDTHH:mm:ss')
+ : null;
+ const suppInvoiceDate = groupInfo.SupplierInvoiceDate
+ ? moment(groupInfo.SupplierInvoiceDate, 'YYYY-MM-DD').format('YYYY-MM-DDTHH:mm:ss')
+ : null;
+ const deliveryInvoiceDate = groupInfo.DeliveryInvoiceDate
+ ? moment(groupInfo.DeliveryInvoiceDate, 'YYYY-MM-DD').format('YYYY-MM-DDTHH:mm:ss')
+ : null;
+ const dueDate = groupInfo.DueDate
+ ? moment(groupInfo.DueDate, 'YYYY-MM-DD').format('YYYY-MM-DDTHH:mm:ss')
+ : null;
+
return {
- ...commonData, // Assuming commonData is defined elsewhere
+ AppId: parseInt(commonData.AppId),
+ CompId: parseInt(commonData.CompId),
+ BranchId: parseInt(commonData.BranchId),
+ CreatedBy: parseInt(commonData.CreatedBy),
SuppName: groupInfo.Supplier,
- OwnWithPaid: groupInfo.OwnWithPaid,
- InvoiceDeliveryChallan: groupInfo.InvoiceDeliveryChallan,
- PayType: groupInfo.PaymentType,
- PaymentType: groupInfo.PaymentMode || groupInfo.PaymentType,
- PaymentMode: groupInfo.PaymentMode,
- PaymentAmount: PaymentAmount.toFixed(2),
- InvoiceDate: groupInfo.InwardDate
- ? moment(groupInfo.InwardDate, 'YYYY-MM-DD').format(
- 'YYYY-MM-DDTHH:mm:ss'
- )
- : null,
- SuppInvoiceNo: groupInfo.SupplierInvoiceNumber,
- SuppInvoiceDate: groupInfo.SupplierInvoiceDate
- ? moment(groupInfo.SupplierInvoiceDate, 'YYYY-MM-DD').format(
- 'YYYY-MM-DDTHH:mm:ss'
- )
- : null,
- DeliveryChallanNo: groupInfo.DeliveryChallanNo,
- DeliveryInvoiceDate: groupInfo.DeliveryInvoiceDate
- ? moment(groupInfo.DeliveryInvoiceDate, 'YYYY-MM-DD').format(
- 'YYYY-MM-DDTHH:mm:ss'
- )
- : null,
- DueDate: groupInfo.DueDate
- ? moment(groupInfo.DueDate, 'YYYY-MM-DD').format(
- 'YYYY-MM-DDTHH:mm:ss'
- )
- : null,
- InvoiceAmount: Totalamount.toFixed(2),
- TaxAmount: Totaltax.toFixed(2),
- TotalAmount: Totalamount.toFixed(2),
- BillAmount: Billamount.toFixed(2),
- PaymentStatus: 'S',
+ OwnWithPaid: groupInfo.OwnWithPaid || '',
+ InvoiceDeliveryChallan: groupInfo.InvoiceDeliveryChallan || '',
+ PaymentType: groupInfo.PaymentMode || groupInfo.PaymentType || '',
+ PaymentAmount: PaymentAmount,
+ InvoiceDate: inwardDate,
+ SuppInvoiceNo: groupInfo.SupplierInvoiceNumber || '',
+ SuppInvoiceDate: suppInvoiceDate,
+ DeliveryChallanNo: groupInfo.DeliveryChallanNo || '',
+ DeliveryInvoiceDate: deliveryInvoiceDate,
+ DueDate: dueDate,
+ InvoiceAmount: Totalamount,
+ TaxAmount: Totaltax,
+ TotalAmount: Totalamount,
+ BillAmount: Billamount,
PurOrderStatus: 'P',
- ProdDetails: products.map((item) => ({
- ProdName: item.ProductName,
- ProdVariantName: item.VariantName,
- Quantity: item.Quantity,
- ReceivedQty: item.ReceivedQty,
- RejectedQty: item.RejectedQty,
- AcceptedQty: item.AcceptedQty,
- FreeQty: item.FreeQty,
- ManufDate: item.ManufactureDate
- ? moment(item.ManufactureDate, 'YYYY-MM-DD').format(
- 'YYYY-MM-DDTHH:mm:ss'
- )
- : null,
- ExpDate: item.ExpireDate
- ? moment(item.ExpireDate, 'YYYY-MM-DD').format(
- 'YYYY-MM-DDTHH:mm:ss'
- )
- : null,
- BatchNo: item.BatchNo,
- ModelNo: item.ModelNo,
- InwardPrice: item.PurchaseRate,
- Amount: item.Amount,
- MRP: item.MRP,
- SellPrice: item.SalesPrice,
- OnePcsPrice: item.AmountPerPiece,
- NoOfPcs: item.NumberofPieceInside,
- WhSalePrice: item.WholesalePrice,
- })),
+ LocationType: 'Supplier',
+ PaymentStatus: 'S',
+ ProdDetails: products.map((item) => {
+ const matchedProduct = Productdata?.find(
+ (p) =>
+ p.ProdName === item.ProductName &&
+ p.ProdVariantName === item.VariantName
+ );
+ const inwardPrice = parseFloat(item.PurchaseRate) || 0;
+ const acceptedQty = parseFloat(item.AcceptedQty) || 0;
+ const rejectedQty = parseFloat(item.RejectedQty) || 0;
+ const receivedQty = parseFloat(item.ReceivedQty) || 0;
+ const amount = parseFloat(String(item.Amount || '').replace(/,/g, '')) || 0;
+ const taxPercent = parseFloat(matchedProduct?.TaxPercentage || item.Tax || 0);
+ const taxAmt = taxPercent > 0 ? (amount * taxPercent) / (100 + taxPercent) : 0;
+ const imeiList = item.IMEI
+ ? String(item.IMEI).split(',').map((imei, idx) => ({
+ SerialNumber: String(idx + 1),
+ IMEI1: imei.trim(),
+ IMEI2: '',
+ MacId: '',
+ }))
+ : [];
+ return {
+ ProdName: item.ProductName,
+ ProdVariantName: item.VariantName || '',
+ ReceivedQty: receivedQty,
+ AcceptedQty: acceptedQty,
+ RejectedQty: rejectedQty,
+ RejectionReason: '',
+ ManufDate: item.ManufactureDate
+ ? moment(item.ManufactureDate, 'YYYY-MM-DD').format('YYYY-MM-DDTHH:mm:ss')
+ : null,
+ ExpDate: item.ExpireDate
+ ? moment(item.ExpireDate, 'YYYY-MM-DD').format('YYYY-MM-DDTHH:mm:ss')
+ : null,
+ IssuedQty: 0,
+ BalanceQty: acceptedQty,
+ InwardPrice: inwardPrice,
+ MRP: parseFloat(item.MRP) || matchedProduct?.MRP || 0,
+ SellPrice: parseFloat(item.SalesPrice) || matchedProduct?.SellPrice || 0,
+ WhSalePrice: parseFloat(item.WholesalePrice) || 0,
+ OfferPrice: 0,
+ SpecialPrice: 0,
+ TaxId: matchedProduct?.TaxId || '',
+ TaxType: 0,
+ TaxAmt: parseFloat(taxAmt.toFixed(2)),
+ PurDisc: 0,
+ FreeItem: parseFloat(item.FreeQty) || 0,
+ Amount: amount,
+ OnePcsPrice: parseFloat(item.AmountPerPiece) || matchedProduct?.OnePcsPrice || 0,
+ NoOfPcs: parseFloat(item.NumberofPieceInside) || matchedProduct?.NoOfPcs || 0,
+ OnePcsAvailable: matchedProduct?.OnePcsAvailable || 'Y',
+ ModelNumber: item.ModelNo || '',
+ ProductIdentifierDtls: imeiList,
+ };
+ }),
};
});
@@ -1380,7 +1408,7 @@ const StockList = () => {
)}