Merge pull request 'srinath' (#300) from srinath into main
Reviewed-on: Pozomind/pozo-retail-app#300
This commit is contained in:
commit
383106d3ed
|
|
@ -10,6 +10,7 @@ import {
|
||||||
GlobalDineinDefault,
|
GlobalDineinDefault,
|
||||||
GlobalOrderType,
|
GlobalOrderType,
|
||||||
Globalunpaidflow,
|
Globalunpaidflow,
|
||||||
|
PreferenceData,
|
||||||
changeBookingType,
|
changeBookingType,
|
||||||
changeChairLevelServiceDefault,
|
changeChairLevelServiceDefault,
|
||||||
changeDefaultBookingType,
|
changeDefaultBookingType,
|
||||||
|
|
@ -37,16 +38,22 @@ const BSNavBarTable = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const BookingType = useSelector(GlobalBookingType);
|
const BookingType = useSelector(GlobalBookingType);
|
||||||
console.log(BookingType, "BookingType")
|
|
||||||
const OrderType = useSelector(GlobalOrderType);
|
const OrderType = useSelector(GlobalOrderType);
|
||||||
const unpaidFlow = useSelector(Globalunpaidflow);
|
const unpaidFlow = useSelector(Globalunpaidflow);
|
||||||
const DineinDefault = useSelector(GlobalDineinDefault);
|
const DineinDefault = useSelector(GlobalDineinDefault);
|
||||||
const defaultBookingType = useSelector(GlobalDefaultBookingType);
|
const defaultBookingType = useSelector(GlobalDefaultBookingType);
|
||||||
const chairLevelServiceDefault = useSelector(GlobalChairLevelServiceDefault);
|
const chairLevelServiceDefault = useSelector(GlobalChairLevelServiceDefault);
|
||||||
const [PopOpen, setPopOpen] = useState(false);
|
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 () => {
|
const handleDineInNavigate = async () => {
|
||||||
if (chairLevelServiceDefault || defaultBookingType === 'Both') {
|
dispatch(changeDefaultBookingType('Dine In'))
|
||||||
|
// if (chairLevelServiceDefault || defaultBookingType === 'Both') {
|
||||||
|
if (prefaranceDine) {
|
||||||
navigate(`${subDirectory}sales/dine-in`);
|
navigate(`${subDirectory}sales/dine-in`);
|
||||||
}
|
}
|
||||||
//cmd by mohan for both concept
|
//cmd by mohan for both concept
|
||||||
|
|
@ -149,15 +156,19 @@ const BSNavBarTable = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="BSBilling7-icon-flex">
|
<div className="BSBilling7-icon-flex">
|
||||||
<div className='EstimateButton' style={{ padding: '5px' }}>
|
{/* <div className='EstimateButton' style={{ padding: '5px' }}> */}
|
||||||
<TooltipWrapper title={defaultBookingType} isMobile={isMobile}>
|
<div>
|
||||||
{defaultBookingType === 'TakeAway' && <TakeAway />}
|
{/* <TooltipWrapper title={defaultBookingType} isMobile={isMobile}> */}
|
||||||
{defaultBookingType === 'Dine In' && <PozoDineInIcon
|
<TooltipWrapper title={'Dine In'} isMobile={isMobile}>
|
||||||
|
{/* {defaultBookingType === 'TakeAway' && <TakeAway />} */}
|
||||||
|
{/* {defaultBookingType === 'Dine In' && <PozoDineInIcon */}
|
||||||
|
{defaultBookingType && <PozoDineInIcon
|
||||||
style={{
|
style={{
|
||||||
marginRight: '10px',
|
marginRight: '10px', color: BookingType === 'Dine In' ? '#52c41a' : '#1292ee'
|
||||||
}}
|
}}
|
||||||
className={
|
className={
|
||||||
defaultBookingType === 'Dine In'
|
BookingType === 'Dine In'
|
||||||
|
// defaultBookingType === 'Dine In'
|
||||||
? 'BSBillingNav-icon-table-inner pulse-element'
|
? 'BSBillingNav-icon-table-inner pulse-element'
|
||||||
: 'BSBillingNav-icon-table-inner'
|
: 'BSBillingNav-icon-table-inner'
|
||||||
}
|
}
|
||||||
|
|
@ -187,11 +198,11 @@ const BSNavBarTable = () => {
|
||||||
|
|
||||||
</TooltipWrapper>
|
</TooltipWrapper>
|
||||||
|
|
||||||
<Popover open={PopOpen} onOpenChange={(visible) => setPopOpen(visible)} content={content} title="SET AS DEFAULT" trigger="click">
|
{/* <Popover open={PopOpen} onOpenChange={(visible) => setPopOpen(visible)} content={content} title="SET AS DEFAULT" trigger="click">
|
||||||
<button className="Estoptbtn">
|
<button className="Estoptbtn">
|
||||||
<UpOutlined onClick={EnableOptions} />
|
<UpOutlined onClick={EnableOptions} />
|
||||||
</button>
|
</button>
|
||||||
</Popover>
|
</Popover> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
...(allSettingsMap['parking']?.value === 'Y' ? ['parking'] : []),
|
...(allSettingsMap['parking']?.value === 'Y' ? ['parking'] : []),
|
||||||
...(allSettingsMap['offer']?.value === 'Y' ? ['offer'] : []),
|
...(allSettingsMap['offer']?.value === 'Y' ? ['offer'] : []),
|
||||||
],
|
],
|
||||||
|
chairlevel: allSettingsMap['chairlevel']?.value === 'Y',
|
||||||
stockselection: allSettingsMap['stockselection']?.value === 'Y',
|
stockselection: allSettingsMap['stockselection']?.value === 'Y',
|
||||||
weightasquantity: allSettingsMap['weightasquantity']?.value === 'Y',
|
weightasquantity: allSettingsMap['weightasquantity']?.value === 'Y',
|
||||||
expiredselection: allSettingsMap['expiredselection']?.value === 'Y',
|
expiredselection: allSettingsMap['expiredselection']?.value === 'Y',
|
||||||
|
|
@ -369,6 +370,7 @@ const PreferenceList = ({ setting = false }) => {
|
||||||
searchfocus: values.searchfocus,
|
searchfocus: values.searchfocus,
|
||||||
addproductcard: values.addproductcard,
|
addproductcard: values.addproductcard,
|
||||||
stockselection: values.stockselection,
|
stockselection: values.stockselection,
|
||||||
|
chairlevel: values.chairlevel,
|
||||||
weightasquantity: values.weightasquantity,
|
weightasquantity: values.weightasquantity,
|
||||||
expiredselection: values.expiredselection,
|
expiredselection: values.expiredselection,
|
||||||
'sales mode': values?.['salesmode'],
|
'sales mode': values?.['salesmode'],
|
||||||
|
|
@ -893,7 +895,7 @@ const userDropData = async () => {
|
||||||
</Checkbox.Group>
|
</Checkbox.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
|
{(allSettingsMap['dinein'] !== undefined && dinePreference) && renderCheckbox('chairlevel', 'Enable Dine In Chair Level Serve?')}
|
||||||
{renderCheckbox('stockselection', 'Enable stock selection?')}
|
{renderCheckbox('stockselection', 'Enable stock selection?')}
|
||||||
{renderCheckbox('weightasquantity', 'Use Weight as Quantity?')}
|
{renderCheckbox('weightasquantity', 'Use Weight as Quantity?')}
|
||||||
{renderCheckbox('expiredselection', 'Show product expiry date?')}
|
{renderCheckbox('expiredselection', 'Show product expiry date?')}
|
||||||
|
|
|
||||||
|
|
@ -149,87 +149,65 @@ const StockExcel = ({
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (excelData && excelData.length > 0) {
|
if (excelData && excelData.length > 0) {
|
||||||
let ExcelToJsConversion = [];
|
const headers = excelData[0]; // first row is the header array
|
||||||
let slicedData = excelData.slice(1); // Skip header row
|
const slicedData = excelData.slice(1); // data rows
|
||||||
|
|
||||||
slicedData.forEach((item, index) => {
|
const ExcelToJsConversion = slicedData
|
||||||
// Skip empty rows
|
.filter((item) => item && item.some((val) => val !== '' && val != null))
|
||||||
if (!item || Object.values(item).every((val) => !val)) return;
|
.map((item, index) => {
|
||||||
|
const get = (i) => item[i];
|
||||||
|
const isSelf = String(get(1)).trim() === 'Self';
|
||||||
|
const offset = isSelf ? 1 : 0;
|
||||||
|
|
||||||
const rowData = {
|
// Build header-to-index map from actual headers row
|
||||||
key: index,
|
const headerIndexMap = {};
|
||||||
InwardDate: item['0'],
|
headers.forEach((h, i) => {
|
||||||
Supplier: item['1'],
|
if (h) headerIndexMap[String(h).trim()] = i;
|
||||||
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()];
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
const getByHeader = (headerName) =>
|
||||||
|
item[headerIndexMap[headerName]];
|
||||||
|
|
||||||
// Add optional fields based on column presence
|
const rowData = {
|
||||||
let currentColIndex = 23;
|
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
|
return rowData;
|
||||||
const optionalFields = [
|
})
|
||||||
{ key: 'ManufactureDate', header: 'Manufacture Date' },
|
.filter((row) => row?.ProductName);
|
||||||
{ 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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
setDatas(ExcelToJsConversion);
|
setDatas(ExcelToJsConversion);
|
||||||
}
|
}
|
||||||
|
|
@ -322,8 +300,7 @@ const StockExcel = ({
|
||||||
|
|
||||||
// ✅ unchanged logic
|
// ✅ unchanged logic
|
||||||
dispatch(uploadExcel({ file, jsonData: nonEmptyRows }));
|
dispatch(uploadExcel({ file, jsonData: nonEmptyRows }));
|
||||||
setWorksheet1(worksheet1);
|
setWorksheet1(worksheet);
|
||||||
setDatas(formattedData);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
reader.readAsArrayBuffer(file);
|
reader.readAsArrayBuffer(file);
|
||||||
|
|
@ -477,14 +454,14 @@ const StockExcel = ({
|
||||||
pushCol('Amount Per Piece', 'AmountPerPiece', true);
|
pushCol('Amount Per Piece', 'AmountPerPiece', true);
|
||||||
pushCol('Number of Piece Inside', 'NumberofPieceInside', true);
|
pushCol('Number of Piece Inside', 'NumberofPieceInside', true);
|
||||||
|
|
||||||
if (isOptionalFieldAllowed('Manufacture Date'))
|
pushCol('Uom', 'Uom', true);
|
||||||
pushCol('Manufacture Date', 'ManufDate', false);
|
pushCol('Tax (%)', 'Tax', true);
|
||||||
if (isOptionalFieldAllowed('Expire Date'))
|
pushCol('Hsn', 'Hsn', false);
|
||||||
pushCol('Expire Date', 'ExpDate', false);
|
pushCol('IMEI', 'IMEI', false);
|
||||||
if (isOptionalFieldAllowed('Batch No.'))
|
pushCol('Manufacture Date', 'ManufDate', false);
|
||||||
pushCol('Batch No.', 'BatchNo', false);
|
pushCol('Expire Date', 'ExpDate', false);
|
||||||
if (isOptionalFieldAllowed('Model No.'))
|
pushCol('Batch No', 'BatchNo', false);
|
||||||
pushCol('Model No.', 'ModelNo', false);
|
pushCol('Model No', 'ModelNo', false);
|
||||||
if (isOptionalFieldAllowed('Rejected Qty'))
|
if (isOptionalFieldAllowed('Rejected Qty'))
|
||||||
pushCol('Rejected Qty', 'RejectedQty', false);
|
pushCol('Rejected Qty', 'RejectedQty', false);
|
||||||
if (isOptionalFieldAllowed('Free Qty'))
|
if (isOptionalFieldAllowed('Free Qty'))
|
||||||
|
|
@ -603,6 +580,10 @@ const StockExcel = ({
|
||||||
SalesPrice: variant.SellPrice || 0,
|
SalesPrice: variant.SellPrice || 0,
|
||||||
NumberofPieceInside: variant.NoOfPcs || 0,
|
NumberofPieceInside: variant.NoOfPcs || 0,
|
||||||
AmountPerPiece: variant.OnePcsPrice || 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') {
|
if (String(selectedSupplierData?.SuppName).trim() === 'Self') {
|
||||||
|
|
@ -891,6 +872,34 @@ const StockExcel = ({
|
||||||
};
|
};
|
||||||
expCell.protection = { locked: false };
|
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')) {
|
if (colIndex('ReceivedQty') && colIndex('Quantity')) {
|
||||||
const rIdx = colIndex('ReceivedQty');
|
const rIdx = colIndex('ReceivedQty');
|
||||||
const qIdx = colIndex('Quantity');
|
const qIdx = colIndex('Quantity');
|
||||||
|
|
@ -1197,13 +1206,13 @@ const StockExcel = ({
|
||||||
editable: true,
|
editable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Batch No.',
|
title: 'Batch No',
|
||||||
dataIndex: 'BatchNo',
|
dataIndex: 'BatchNo',
|
||||||
key: 'BatchNo',
|
key: 'BatchNo',
|
||||||
editable: true,
|
editable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Model No.',
|
title: 'Model No',
|
||||||
dataIndex: 'ModelNo',
|
dataIndex: 'ModelNo',
|
||||||
key: 'ModelNo',
|
key: 'ModelNo',
|
||||||
editable: true,
|
editable: true,
|
||||||
|
|
@ -1226,6 +1235,30 @@ const StockExcel = ({
|
||||||
key: 'WholesalePrice',
|
key: 'WholesalePrice',
|
||||||
editable: true,
|
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) => {
|
const column = columns?.map((col) => {
|
||||||
|
|
@ -1247,7 +1280,7 @@ const StockExcel = ({
|
||||||
dataIndex: col.dataIndex,
|
dataIndex: col.dataIndex,
|
||||||
title: col.title,
|
title: col.title,
|
||||||
handleSave,
|
handleSave,
|
||||||
onClick: () => onClickHandler(record),
|
onClick: onClickHandler ? () => onClickHandler(record) : undefined,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -113,8 +113,11 @@ const StockList = () => {
|
||||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||||
const [page, setpage] = useState(1);
|
const [page, setpage] = useState(1);
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
const [openExcel, setOpenExcel] = useState(false);
|
||||||
|
|
||||||
const [Exceldatasubmit, setExceldatasubmit] = useState(null);
|
const [Exceldatasubmit, setExceldatasubmit] = useState(null);
|
||||||
|
console.log(Exceldatasubmit,'Exceldatasubmit111');
|
||||||
|
|
||||||
const [Totaltax, setTotaltax] = useState(null);
|
const [Totaltax, setTotaltax] = useState(null);
|
||||||
const [Totalamount, setTotalamount] = useState(null);
|
const [Totalamount, setTotalamount] = useState(null);
|
||||||
const [Taxdatas, setTaxdatas] = useState();
|
const [Taxdatas, setTaxdatas] = useState();
|
||||||
|
|
@ -277,7 +280,6 @@ const StockList = () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const filteredData = debouncedSearchText ? countData || [] : data || [];
|
const filteredData = debouncedSearchText ? countData || [] : data || [];
|
||||||
console.log('1111111111111111', filteredData);
|
|
||||||
async function searchData({ queryKey }) {
|
async function searchData({ queryKey }) {
|
||||||
const [_, SearchText] = queryKey;
|
const [_, SearchText] = queryKey;
|
||||||
|
|
||||||
|
|
@ -848,12 +850,12 @@ const StockList = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
setOpen(false);
|
setOpenExcel(false);
|
||||||
handleResetExcelData();
|
handleResetExcelData();
|
||||||
};
|
};
|
||||||
|
|
||||||
const openModal = () => {
|
const openModal = () => {
|
||||||
setOpen(true);
|
setOpenExcel(true);
|
||||||
// setEditState(false);
|
// setEditState(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1006,71 +1008,97 @@ const StockList = () => {
|
||||||
return acc + amount;
|
return acc + amount;
|
||||||
}, 0);
|
}, 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 {
|
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,
|
SuppName: groupInfo.Supplier,
|
||||||
OwnWithPaid: groupInfo.OwnWithPaid,
|
OwnWithPaid: groupInfo.OwnWithPaid || '',
|
||||||
InvoiceDeliveryChallan: groupInfo.InvoiceDeliveryChallan,
|
InvoiceDeliveryChallan: groupInfo.InvoiceDeliveryChallan || '',
|
||||||
PayType: groupInfo.PaymentType,
|
PaymentType: groupInfo.PaymentMode || groupInfo.PaymentType || '',
|
||||||
PaymentType: groupInfo.PaymentMode || groupInfo.PaymentType,
|
PaymentAmount: PaymentAmount,
|
||||||
PaymentMode: groupInfo.PaymentMode,
|
InvoiceDate: inwardDate,
|
||||||
PaymentAmount: PaymentAmount.toFixed(2),
|
SuppInvoiceNo: groupInfo.SupplierInvoiceNumber || '',
|
||||||
InvoiceDate: groupInfo.InwardDate
|
SuppInvoiceDate: suppInvoiceDate,
|
||||||
? moment(groupInfo.InwardDate, 'YYYY-MM-DD').format(
|
DeliveryChallanNo: groupInfo.DeliveryChallanNo || '',
|
||||||
'YYYY-MM-DDTHH:mm:ss'
|
DeliveryInvoiceDate: deliveryInvoiceDate,
|
||||||
)
|
DueDate: dueDate,
|
||||||
: null,
|
InvoiceAmount: Totalamount,
|
||||||
SuppInvoiceNo: groupInfo.SupplierInvoiceNumber,
|
TaxAmount: Totaltax,
|
||||||
SuppInvoiceDate: groupInfo.SupplierInvoiceDate
|
TotalAmount: Totalamount,
|
||||||
? moment(groupInfo.SupplierInvoiceDate, 'YYYY-MM-DD').format(
|
BillAmount: Billamount,
|
||||||
'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',
|
|
||||||
PurOrderStatus: 'P',
|
PurOrderStatus: 'P',
|
||||||
ProdDetails: products.map((item) => ({
|
LocationType: 'Supplier',
|
||||||
ProdName: item.ProductName,
|
PaymentStatus: 'S',
|
||||||
ProdVariantName: item.VariantName,
|
ProdDetails: products.map((item) => {
|
||||||
Quantity: item.Quantity,
|
const matchedProduct = Productdata?.find(
|
||||||
ReceivedQty: item.ReceivedQty,
|
(p) =>
|
||||||
RejectedQty: item.RejectedQty,
|
p.ProdName === item.ProductName &&
|
||||||
AcceptedQty: item.AcceptedQty,
|
p.ProdVariantName === item.VariantName
|
||||||
FreeQty: item.FreeQty,
|
);
|
||||||
ManufDate: item.ManufactureDate
|
const inwardPrice = parseFloat(item.PurchaseRate) || 0;
|
||||||
? moment(item.ManufactureDate, 'YYYY-MM-DD').format(
|
const acceptedQty = parseFloat(item.AcceptedQty) || 0;
|
||||||
'YYYY-MM-DDTHH:mm:ss'
|
const rejectedQty = parseFloat(item.RejectedQty) || 0;
|
||||||
)
|
const receivedQty = parseFloat(item.ReceivedQty) || 0;
|
||||||
: null,
|
const amount = parseFloat(String(item.Amount || '').replace(/,/g, '')) || 0;
|
||||||
ExpDate: item.ExpireDate
|
const taxPercent = parseFloat(matchedProduct?.TaxPercentage || item.Tax || 0);
|
||||||
? moment(item.ExpireDate, 'YYYY-MM-DD').format(
|
const taxAmt = taxPercent > 0 ? (amount * taxPercent) / (100 + taxPercent) : 0;
|
||||||
'YYYY-MM-DDTHH:mm:ss'
|
const imeiList = item.IMEI
|
||||||
)
|
? String(item.IMEI).split(',').map((imei, idx) => ({
|
||||||
: null,
|
SerialNumber: String(idx + 1),
|
||||||
BatchNo: item.BatchNo,
|
IMEI1: imei.trim(),
|
||||||
ModelNo: item.ModelNo,
|
IMEI2: '',
|
||||||
InwardPrice: item.PurchaseRate,
|
MacId: '',
|
||||||
Amount: item.Amount,
|
}))
|
||||||
MRP: item.MRP,
|
: [];
|
||||||
SellPrice: item.SalesPrice,
|
return {
|
||||||
OnePcsPrice: item.AmountPerPiece,
|
ProdName: item.ProductName,
|
||||||
NoOfPcs: item.NumberofPieceInside,
|
ProdVariantName: item.VariantName || '',
|
||||||
WhSalePrice: item.WholesalePrice,
|
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 = () => {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<DefaultModal
|
<DefaultModal
|
||||||
open={open}
|
open={openExcel}
|
||||||
title="Bulk Upload"
|
title="Bulk Upload"
|
||||||
footer={true}
|
footer={true}
|
||||||
width={excelDataValues?.length > 0 ? 3000 : 600}
|
width={excelDataValues?.length > 0 ? 3000 : 600}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue