diff --git a/src/Features/PurchaseOrder/PurchaseOrder.js b/src/Features/PurchaseOrder/PurchaseOrder.js index b1b0994..7445091 100644 --- a/src/Features/PurchaseOrder/PurchaseOrder.js +++ b/src/Features/PurchaseOrder/PurchaseOrder.js @@ -70,13 +70,15 @@ export const postStockAdjustment = createAsyncThunk( export const getPurchaseSupplierAndWareHouseData = createAsyncThunk( 'PurchaseOrder/getPurchaseSupplierAndWareHouseData', async (ProdData, { rejectWithValue }) => { - const { AppId, CompId, BranchId } = ProdData; + const { AppId, CompId, BranchId, Type } = ProdData; if (AppId && CompId && BranchId) { try { - const response = await axiosRetailInstanceData.get( - `/Supplier/AllSupplierBranchDropdown?appId=${AppId}&compId=${CompId}&branchId=${BranchId}` - ); + let url = `/Supplier/AllSupplierBranchDropdown?appId=${AppId}&compId=${CompId}&branchId=${BranchId}`; + if (Type) { + url += `&Type=${Type}`; + } + const response = await axiosRetailInstanceData.get(url); return response.data; } catch (error) { return rejectWithValue(error.response?.data || error.message); diff --git a/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx b/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx index 820889d..058627f 100644 --- a/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx @@ -282,6 +282,7 @@ const TaxInvoice = ({ paginatedChunks.push(chunk); } } + console.log(paginatedChunks, "paginatedChunks") const lastChunkRows = paginatedChunks.length > 0 @@ -878,7 +879,7 @@ const TaxInvoice = ({ > {Number( table2Data?.OrderType !== 'E' - ? item.Rate - item.ProdTaxAmt + ? item.Rate - (item?.SinglePc === 'Y' ? (item?.TaxAmt / item?.SalesQty) : item.ProdTaxAmt) : item.Rate || 0 ).toLocaleString('en-IN', { minimumFractionDigits: 2, diff --git a/src/Pages/PurchaseOrder/PurchaseOrder.jsx b/src/Pages/PurchaseOrder/PurchaseOrder.jsx index 6f2f9b3..f45fe68 100644 --- a/src/Pages/PurchaseOrder/PurchaseOrder.jsx +++ b/src/Pages/PurchaseOrder/PurchaseOrder.jsx @@ -8,7 +8,7 @@ import { EditFilled, } from '@ant-design/icons'; import { Messages } from '../../Components/Notifications/Messages'; -import { Form, Tooltip, Space, Input, Button, AutoComplete } from 'antd'; +import { Form, Tooltip, Space, Input, Button, AutoComplete, Checkbox } from 'antd'; import { IoWarningOutline } from 'react-icons/io5'; import { getSession, @@ -134,6 +134,7 @@ const PurchaseOrder = () => { const [itemsPerPage] = useState(20); const [searchTerm, setSearchTerm] = useState(''); const [minQty, setMinQty] = useState(''); + const [showAllSuppliers, setShowAllSuppliers] = useState(false); // const filteredData = currentData.filter((item) => { // const matchesSearch = @@ -153,7 +154,7 @@ const PurchaseOrder = () => { { name: 'Purchase Order', - link: `${subDirectory}setting/purchase-order/new`, + link: `${subDirectory}setting/purchase-order`, }, { name: 'New', @@ -223,7 +224,7 @@ const PurchaseOrder = () => { console.error('Error fetching stock details:', err); } }; -console.log('hi'); + console.log('hi'); const debouncedFetchStock = useMemo(() => debounce(ProductStockFun, 600), []); const handleMinQtyChange = (e) => { @@ -301,20 +302,21 @@ console.log('hi'); let SelectSupDetails = Supplierdata?.filter( (item) => item.SuppName?.toLowerCase() === 'self' ); //naresh - + setselecSuppDetails(SelectSupDetails?.[0]); setselecPurSupplierDetails(SelectSupDetails); formRef.current?.setFieldsValue({ SuppId: SupplierId }); setselecPurSupplier(SupplierId); getProductDatas(SupplierId); }; - const getSupplierData = async () => { + const getSupplierData = async (Type = null) => { try { let Supplier = await dispatch( getPurchaseSupplierAndWareHouseData({ CompId, AppId, BranchId, + Type, }) ).unwrap(); if (Supplier?.statusCode == 1) { @@ -1322,6 +1324,7 @@ console.log('hi'); style={{ paddingTop: '0px', rowGap: '0px' }} >
+ + + + + { + const checked = e.target.checked; + setShowAllSuppliers(checked); + getSupplierData(checked ? 'Y' : null); + }} + > + All + + + + -
- {selecSuppDetails !== null && - (() => { + {selecSuppDetails !== null && + (
+ {(() => { const fields = []; if (selecSuppDetails?.SuppName) { fields.push( @@ -1456,7 +1478,8 @@ console.log('hi');
); })()} -
+
) + }
setisLowStockModel(true)} diff --git a/src/Pages/StockMaster/StockForm.jsx b/src/Pages/StockMaster/StockForm.jsx index 882b2a7..b34fde8 100644 --- a/src/Pages/StockMaster/StockForm.jsx +++ b/src/Pages/StockMaster/StockForm.jsx @@ -13,7 +13,7 @@ import { PlusCircleOutlined, SearchOutlined, } from '@ant-design/icons'; -import { Form, Tooltip, Table, Input, AutoComplete, Switch } from 'antd'; +import { Form, Tooltip, Table, Input, AutoComplete, Switch, Checkbox } from 'antd'; import { IoAddCircleSharp } from 'react-icons/io5'; import { InputField } from '../../Components/Forms/InputField.jsx'; import Buttons from '../../Components/Forms/Buttons.jsx'; @@ -223,6 +223,7 @@ const StockForm = ({ formType }) => { const [selectedRowIndex, setSelectedRowIndex] = useState(null); const [selectedRowRecord, setSelectedRowRecord] = useState({}); const [purchaseOrderId, setPurchaseOrderId] = useState(); + console.log(orderType, "orderType") const [selectedProductName, setSelectedProductName] = useState(null); const [scanner, setScanner] = useState(false); @@ -268,6 +269,7 @@ const StockForm = ({ formType }) => { // const [filteredPurchaseData, setFilteredPurchaseData] = useState([]); const [searchValue, setSearchValue] = useState(''); const isSearching = Boolean(searchValue?.trim()); + const [showAllSuppliers, setShowAllSuppliers] = useState(false); const SelInvoiceAmount = useMemo(() => { const total = PurchaseData?.reduce( @@ -324,7 +326,7 @@ const StockForm = ({ formType }) => { deliveryPerformance(); discountLevel(); qualityofSupp(); - getSuplaierApi({}); + getSuplaierApi({ Type: null }); if (formType == 'add') { formRef.current?.setFieldsValue({ SuppInvoiceDate: new Date().toJSON() }); @@ -416,9 +418,9 @@ const StockForm = ({ formType }) => { : setSelectedSupplierName(true); }; - const getSuplaierApi = async ({ dataReturn = false }) => { + const getSuplaierApi = async ({ dataReturn = false, Type = null }) => { const response = await dispatch( - getPurchaseSupplierAndWareHouseData({ CompId, AppId, BranchId }) + getPurchaseSupplierAndWareHouseData({ CompId, AppId, BranchId, Type }) ).unwrap(); if (response?.statusCode === 1) { @@ -1400,47 +1402,47 @@ const StockForm = ({ formType }) => { const localId = record.localId; const values = Delete ? { - [`BalanceQty${localId}`]: undefined, - [`ReceivedQty${localId}`]: undefined, - [`AcceptedQty${localId}`]: undefined, - [`RejectedQty${localId}`]: undefined, - [`Amount${localId}`]: undefined, - [`Freeqty${localId}`]: undefined, - [`InwardPrice${localId}`]: undefined, - [`MRP${localId}`]: undefined, - [`PurcDisc${localId}`]: undefined, - [`SellPrice${localId}`]: undefined, - [`WhSalePrice${localId}`]: undefined, - [`offerSalePrice${localId}`]: undefined, - [`splSalePrice${localId}`]: undefined, - [`NumberofPieceinside${localId}`]: undefined, - [`AmountPerPiece${localId}`]: undefined, - [`PurcDiscType${localId}`]: undefined, - [`ManufDate${localId}`]: undefined, - [`ExpDate${localId}`]: undefined, - [`OnePcsPrice${localId}`]: undefined, - [`NoOfPcs${localId}`]: undefined, - } + [`BalanceQty${localId}`]: undefined, + [`ReceivedQty${localId}`]: undefined, + [`AcceptedQty${localId}`]: undefined, + [`RejectedQty${localId}`]: undefined, + [`Amount${localId}`]: undefined, + [`Freeqty${localId}`]: undefined, + [`InwardPrice${localId}`]: undefined, + [`MRP${localId}`]: undefined, + [`PurcDisc${localId}`]: undefined, + [`SellPrice${localId}`]: undefined, + [`WhSalePrice${localId}`]: undefined, + [`offerSalePrice${localId}`]: undefined, + [`splSalePrice${localId}`]: undefined, + [`NumberofPieceinside${localId}`]: undefined, + [`AmountPerPiece${localId}`]: undefined, + [`PurcDiscType${localId}`]: undefined, + [`ManufDate${localId}`]: undefined, + [`ExpDate${localId}`]: undefined, + [`OnePcsPrice${localId}`]: undefined, + [`NoOfPcs${localId}`]: undefined, + } : { - [`BalanceQty${localId}`]: record.BalanceQty, - [`ReceivedQty${localId}`]: record.ReceivedQty, - [`AcceptedQty${localId}`]: record.AcceptedQty, - [`RejectedQty${localId}`]: record.RejectedQty, - [`Freeqty${localId}`]: record.FreeItem, - [`MRP${localId}`]: record.MRP, - [`ManufDate${localId}`]: record.ManufDate, - [`ExpDate${localId}`]: record.ExpDate, - [`SellPrice${localId}`]: record.SellPrice, - [`WhSalePrice${localId}`]: record.WhSalePrice, - [`PurcDiscType${localId}`]: record.PurcDiscType, - [`Amount${localId}`]: record.Amount, - [`InwardPrice${localId}`]: record.InwardPrice, - [`PurcDisc${localId}`]: record.PurcDisc, - [`offerSalePrice${localId}`]: record.OfferPrice, - [`splSalePrice${localId}`]: record.SpecialPrice, - [`OnePcsPrice${localId}`]: record.OnePcsPrice, - [`NoOfPcs${localId}`]: record.NoOfPcs, - }; + [`BalanceQty${localId}`]: record.BalanceQty, + [`ReceivedQty${localId}`]: record.ReceivedQty, + [`AcceptedQty${localId}`]: record.AcceptedQty, + [`RejectedQty${localId}`]: record.RejectedQty, + [`Freeqty${localId}`]: record.FreeItem, + [`MRP${localId}`]: record.MRP, + [`ManufDate${localId}`]: record.ManufDate, + [`ExpDate${localId}`]: record.ExpDate, + [`SellPrice${localId}`]: record.SellPrice, + [`WhSalePrice${localId}`]: record.WhSalePrice, + [`PurcDiscType${localId}`]: record.PurcDiscType, + [`Amount${localId}`]: record.Amount, + [`InwardPrice${localId}`]: record.InwardPrice, + [`PurcDisc${localId}`]: record.PurcDisc, + [`offerSalePrice${localId}`]: record.OfferPrice, + [`splSalePrice${localId}`]: record.SpecialPrice, + [`OnePcsPrice${localId}`]: record.OnePcsPrice, + [`NoOfPcs${localId}`]: record.NoOfPcs, + }; if (!Delete && applicationRestrictedFields.BatchAndModelDetails) { values[`BatchRef${localId}`] = record.BatchRef; @@ -1657,29 +1659,29 @@ const StockForm = ({ formType }) => { }, ...(selectedAdditionalColumn.includes('Mrp') ? [ - { - title: 'MRP', - dataIndex: 'MRP', - key: 'MRP', - editable: true, - width: 100, - align: 'center', - render: (_, record) => { - return ( - edit(record)} - placeholder="MRP" - value={record?.MRP ?? ''} - maxLength={10} - inputMode="decimal" - onChange={(e) => handleMRPChange(e, record)} - onBlur={(e) => handleMRPBlur(e, record)} - onPressEnter={(e) => handleKeyPress(e, record)} - /> - ); - }, + { + title: 'MRP', + dataIndex: 'MRP', + key: 'MRP', + editable: true, + width: 100, + align: 'center', + render: (_, record) => { + return ( + edit(record)} + placeholder="MRP" + value={record?.MRP ?? ''} + maxLength={10} + inputMode="decimal" + onChange={(e) => handleMRPChange(e, record)} + onBlur={(e) => handleMRPBlur(e, record)} + onPressEnter={(e) => handleKeyPress(e, record)} + /> + ); }, - ] + }, + ] : []), { title: ( @@ -1711,388 +1713,388 @@ const StockForm = ({ formType }) => { ...(selectedAdditionalColumn.includes('Amount Per Piece') ? [ - { - title: 'Amount per piece', - dataIndex: 'OnePcsPrice', - key: 'OnePcsPrice', - width: 70, - editable: true, - render: (_, record, index) => { - return ( - edit(record)} - onFocus={(e) => e.stopPropagation()} - disabled={record?.OnePcsAvailable === 'N'} - placeholder="OnePcsPrice" - value={record?.OnePcsPrice ?? ''} - maxLength={10} - inputMode="decimal" - onChange={(e) => handleOnePcsChange(e, record)} - onBlur={(e) => handleOnePcsBlur(e, record)} - onPressEnter={() => handleKeyPress(e, record)} - onInput={(e) => { - let v = e.target.value.replace(/[^0-9.]/g, ''); - if (v.startsWith('.')) v = '0' + v; - const parts = v.split('.'); - e.target.value = - parts.length > 2 - ? `${parts[0]}.${parts.slice(1).join('')}` - : v; - }} - /> - ); - }, + { + title: 'Amount per piece', + dataIndex: 'OnePcsPrice', + key: 'OnePcsPrice', + width: 70, + editable: true, + render: (_, record, index) => { + return ( + edit(record)} + onFocus={(e) => e.stopPropagation()} + disabled={record?.OnePcsAvailable === 'N'} + placeholder="OnePcsPrice" + value={record?.OnePcsPrice ?? ''} + maxLength={10} + inputMode="decimal" + onChange={(e) => handleOnePcsChange(e, record)} + onBlur={(e) => handleOnePcsBlur(e, record)} + onPressEnter={() => handleKeyPress(e, record)} + onInput={(e) => { + let v = e.target.value.replace(/[^0-9.]/g, ''); + if (v.startsWith('.')) v = '0' + v; + const parts = v.split('.'); + e.target.value = + parts.length > 2 + ? `${parts[0]}.${parts.slice(1).join('')}` + : v; + }} + /> + ); }, - ] + }, + ] : []), ...(selectedAdditionalColumn.includes('Amount Per Piece') ? [ - { - title: 'Number of piece', - dataIndex: 'NoOfPcs', - key: 'NoOfPcs', - width: 70, - editable: true, - render: (_, record, index) => { - return ( - edit(record)} - onFocus={(e) => e.stopPropagation()} - disabled={record?.OnePcsAvailable === 'N'} - placeholder="NoOfPcs" - value={record.NoOfPcs ?? ''} - maxLength={5} - inputMode="numeric" - onChange={(e) => handleNoOfPcsChange(e, record)} - onBlur={(e) => handleNoOfPcsBlur(e, record)} - onPressEnter={() => handleKeyPress(e, record)} - onInput={(e) => { - // remove invalid characters & leading zeros - let val = e.target.value.replace(/[^0-9]/g, ''); - val = val.replace(/^0+(?=\d)/, ''); // removes leading zeros but keeps single 0 - e.target.value = val; - }} - /> - ); - }, + { + title: 'Number of piece', + dataIndex: 'NoOfPcs', + key: 'NoOfPcs', + width: 70, + editable: true, + render: (_, record, index) => { + return ( + edit(record)} + onFocus={(e) => e.stopPropagation()} + disabled={record?.OnePcsAvailable === 'N'} + placeholder="NoOfPcs" + value={record.NoOfPcs ?? ''} + maxLength={5} + inputMode="numeric" + onChange={(e) => handleNoOfPcsChange(e, record)} + onBlur={(e) => handleNoOfPcsBlur(e, record)} + onPressEnter={() => handleKeyPress(e, record)} + onInput={(e) => { + // remove invalid characters & leading zeros + let val = e.target.value.replace(/[^0-9]/g, ''); + val = val.replace(/^0+(?=\d)/, ''); // removes leading zeros but keeps single 0 + e.target.value = val; + }} + /> + ); }, - ] + }, + ] : []), ...(selectedAdditionalColumn.includes('Wholesale Price') ? [ - { - title: 'Wholesale price', - dataIndex: 'WhSalePrice', - key: 'WhSalePrice', - width: 70, - editable: true, - render: (_, record) => { - return ( - edit(record)} - onFocus={(e) => e.stopPropagation()} - placeholder="WhSalePrice" - value={record.WhSalePrice ?? ''} - inputMode="decimal" - maxLength={10} - onChange={(e) => handleWhSalePriceChange(e, record)} - onBlur={(e) => handleWhSalePriceBlur(e, record)} - onPressEnter={() => handleKeyPress(record)} - onInput={(e) => { - let val = e.target.value.replace(/[^0-9.]/g, ''); // remove invalid chars - if (val.startsWith('.')) val = '0' + val; // leading dot fix - const parts = val.split('.'); - if (parts.length > 2) - val = `${parts[0]}.${parts.slice(1).join('')}`; // max one dot - val = val.replace(/^0+(?=\d)/, ''); // remove leading zeros - e.target.value = val; - }} - /> - ); - }, + { + title: 'Wholesale price', + dataIndex: 'WhSalePrice', + key: 'WhSalePrice', + width: 70, + editable: true, + render: (_, record) => { + return ( + edit(record)} + onFocus={(e) => e.stopPropagation()} + placeholder="WhSalePrice" + value={record.WhSalePrice ?? ''} + inputMode="decimal" + maxLength={10} + onChange={(e) => handleWhSalePriceChange(e, record)} + onBlur={(e) => handleWhSalePriceBlur(e, record)} + onPressEnter={() => handleKeyPress(record)} + onInput={(e) => { + let val = e.target.value.replace(/[^0-9.]/g, ''); // remove invalid chars + if (val.startsWith('.')) val = '0' + val; // leading dot fix + const parts = val.split('.'); + if (parts.length > 2) + val = `${parts[0]}.${parts.slice(1).join('')}`; // max one dot + val = val.replace(/^0+(?=\d)/, ''); // remove leading zeros + e.target.value = val; + }} + /> + ); }, - ] + }, + ] : []), ...(selectedAdditionalColumn.includes('Manufacture Date') ? [ - { - title: 'Manuf.Date', - dataIndex: 'ManufDate', - key: 'ManufDate', - editable: true, - render: (text, record, index) => { - return ( - { - // Format date to your preferred format - const formattedDate = dateString - ? moment(dateString, ['DD-MM-YYYY']).format( - 'YYYY-MM-DDTHH:mm:ss' - ) - : undefined; + { + title: 'Manuf.Date', + dataIndex: 'ManufDate', + key: 'ManufDate', + editable: true, + render: (text, record, index) => { + return ( + { + // Format date to your preferred format + const formattedDate = dateString + ? moment(dateString, ['DD-MM-YYYY']).format( + 'YYYY-MM-DDTHH:mm:ss' + ) + : undefined; - // Update the row data immutably - const newData = PurchaseData.map((item) => - item.localId === record.localId - ? { ...item, ManufDate: formattedDate } - : item - ); - setPurchaseData(newData); - }} - /> - ); - }, + // Update the row data immutably + const newData = PurchaseData.map((item) => + item.localId === record.localId + ? { ...item, ManufDate: formattedDate } + : item + ); + setPurchaseData(newData); + }} + /> + ); }, - ] + }, + ] : []), ...(selectedAdditionalColumn.includes('Expiry Date') ? [ - { - title: 'Exp.Date', - dataIndex: 'ExpDate', - key: 'ExpDate', - editable: true, - render: (text, record, index) => { - return ( - - handleExpDateChange(dateString, record) - } - /> - ); - }, + { + title: 'Exp.Date', + dataIndex: 'ExpDate', + key: 'ExpDate', + editable: true, + render: (text, record, index) => { + return ( + + handleExpDateChange(dateString, record) + } + /> + ); }, - ] + }, + ] : []), ...(selectedAdditionalColumn.includes('Hsn') ? [ - { - title: 'Hsn', - dataIndex: 'Hsn', - key: 'Hsn', - editable: true, - // width: 130, - render: (text, record, index) => { - return ( - edit(record)} - onFocus={(e) => e.stopPropagation()} - onPressEnter={() => handleKeyPress(record)} - onChange={(e) => { - const value = e.target.value; - setPurchaseData((prev) => - prev.map((item) => - item.localId === record.localId - ? { ...item, PurchaseHSNCode: value } - : item - ) - ); - }} - /> - ); - }, + { + title: 'Hsn', + dataIndex: 'Hsn', + key: 'Hsn', + editable: true, + // width: 130, + render: (text, record, index) => { + return ( + edit(record)} + onFocus={(e) => e.stopPropagation()} + onPressEnter={() => handleKeyPress(record)} + onChange={(e) => { + const value = e.target.value; + setPurchaseData((prev) => + prev.map((item) => + item.localId === record.localId + ? { ...item, PurchaseHSNCode: value } + : item + ) + ); + }} + /> + ); }, - ] + }, + ] : []), ...(selectedAdditionalColumn.includes('Model No') ? [ - { - title: 'Model', - dataIndex: 'Model', - key: 'Model', - editable: true, - render: (text, record, index) => { - return ( - edit(record)} - onFocus={(e) => e.stopPropagation()} - onPressEnter={() => handleKeyPress(record)} - onChange={(e) => { - const value = e.target.value; - setPurchaseData((prev) => - prev.map((item) => - item.localId === record.localId - ? { ...item, ModelNumber: value } - : item - ) - ); - }} - /> - ); - }, + { + title: 'Model', + dataIndex: 'Model', + key: 'Model', + editable: true, + render: (text, record, index) => { + return ( + edit(record)} + onFocus={(e) => e.stopPropagation()} + onPressEnter={() => handleKeyPress(record)} + onChange={(e) => { + const value = e.target.value; + setPurchaseData((prev) => + prev.map((item) => + item.localId === record.localId + ? { ...item, ModelNumber: value } + : item + ) + ); + }} + /> + ); }, - ] + }, + ] : []), ...(selectedAdditionalColumn.includes('Batch No') ? [ - { - title: 'Batch', - dataIndex: 'Batch', - key: 'Batch', - editable: true, - render: (text, record, index) => { - return ( - edit(record)} - onFocus={(e) => e.stopPropagation()} - onPressEnter={() => handleKeyPress(record, index)} - onChange={(e) => { - const value = e.target.value; - setPurchaseData((prev) => - prev.map((item) => - item.localId === record.localId - ? { ...item, BatchRef: value } - : item - ) - ); - }} - /> - ); - }, + { + title: 'Batch', + dataIndex: 'Batch', + key: 'Batch', + editable: true, + render: (text, record, index) => { + return ( + edit(record)} + onFocus={(e) => e.stopPropagation()} + onPressEnter={() => handleKeyPress(record, index)} + onChange={(e) => { + const value = e.target.value; + setPurchaseData((prev) => + prev.map((item) => + item.localId === record.localId + ? { ...item, BatchRef: value } + : item + ) + ); + }} + /> + ); }, - ] + }, + ] : []), ...(selectedAdditionalColumn.includes('Rejected Qty') ? [ - { - title: 'Rejected Qty', - dataIndex: 'RejectedQty', - key: 'RejectedQty', - editable: true, - render: (text, record, index) => { - return ( - edit(record)} - onFocus={(e) => e.stopPropagation()} - onPressEnter={() => handleKeyPress(record, index)} - onChange={(e) => { - let inputValue = e.target.value.replace(/[^0-9.]/g, ''); // allow only numbers - if (inputValue.startsWith('0') && inputValue.length > 1) { - inputValue = inputValue.replace(/^0+/, ''); // remove leading zeros - } + { + title: 'Rejected Qty', + dataIndex: 'RejectedQty', + key: 'RejectedQty', + editable: true, + render: (text, record, index) => { + return ( + edit(record)} + onFocus={(e) => e.stopPropagation()} + onPressEnter={() => handleKeyPress(record, index)} + onChange={(e) => { + let inputValue = e.target.value.replace(/[^0-9.]/g, ''); // allow only numbers + if (inputValue.startsWith('0') && inputValue.length > 1) { + inputValue = inputValue.replace(/^0+/, ''); // remove leading zeros + } - const rejectedQty = parseFloat(inputValue) || 0; - const receivedQty = parseFloat(record.ReceivedQty) || 0; + const rejectedQty = parseFloat(inputValue) || 0; + const receivedQty = parseFloat(record.ReceivedQty) || 0; - // validation - if (rejectedQty >= receivedQty) { - setMessageType('error'); - setMessageData( - 'Rejected Qty cannot be greater than or equal to Received Qty' - ); - return; - } - - const acceptedQty = receivedQty - rejectedQty; - const price = parseFloat(record.InwardPrice) || 0; - const amount = acceptedQty * price; - - setPurchaseData((prev) => - prev.map((item) => - item.localId === record.localId - ? { - ...item, - RejectedQty: rejectedQty, - AcceptedQty: acceptedQty, - Amount: amount, - } - : item - ) + // validation + if (rejectedQty >= receivedQty) { + setMessageType('error'); + setMessageData( + 'Rejected Qty cannot be greater than or equal to Received Qty' ); - }} - /> - ); - }, + return; + } + + const acceptedQty = receivedQty - rejectedQty; + const price = parseFloat(record.InwardPrice) || 0; + const amount = acceptedQty * price; + + setPurchaseData((prev) => + prev.map((item) => + item.localId === record.localId + ? { + ...item, + RejectedQty: rejectedQty, + AcceptedQty: acceptedQty, + Amount: amount, + } + : item + ) + ); + }} + /> + ); }, - ] + }, + ] : []), ...(selectedAdditionalColumn.includes('Free Qty') ? [ - { - title: 'Free Qty', - dataIndex: 'Freeqty', - key: 'Freeqty', - editable: true, - render: (text, record) => { - return ( - edit(record)} - onFocus={(e) => e.stopPropagation()} - onPressEnter={() => handleKeyPress(record)} - onChange={(e) => { - let value = e.target.value.replace(/[^0-9]/g, ''); // only digits - if (value.startsWith('0') && value.length > 1) { - value = value.replace(/^0+/, ''); // remove leading zeros - } + { + title: 'Free Qty', + dataIndex: 'Freeqty', + key: 'Freeqty', + editable: true, + render: (text, record) => { + return ( + edit(record)} + onFocus={(e) => e.stopPropagation()} + onPressEnter={() => handleKeyPress(record)} + onChange={(e) => { + let value = e.target.value.replace(/[^0-9]/g, ''); // only digits + if (value.startsWith('0') && value.length > 1) { + value = value.replace(/^0+/, ''); // remove leading zeros + } - updateRowValue(record.localId, 'Freeqty', value); - }} - /> - ); - }, + updateRowValue(record.localId, 'Freeqty', value); + }} + /> + ); }, - ] + }, + ] : []), ...(selectedAdditionalColumn.includes('IMEI') ? [ - { - title: 'IMEI', - dataIndex: 'AdditionalInfo', - key: 'AdditionalInfo', - width: 120, - align: 'center', - render: (text, record, index) => { - const receivedQty = parseFloat(record?.ReceivedQty) || 0; - const isClickable = receivedQty > 0; + { + title: 'IMEI', + dataIndex: 'AdditionalInfo', + key: 'AdditionalInfo', + width: 120, + align: 'center', + render: (text, record, index) => { + const receivedQty = parseFloat(record?.ReceivedQty) || 0; + const isClickable = receivedQty > 0; - return ( - { - if (!isClickable) { - setMessageType('error'); - setMessageData('Please Enter Qty'); - return; - } - setSelectedRowIndex(index); - handleModelDataOpen(record); - }} - className="shape-preview" - /> - ); - }, + return ( + { + if (!isClickable) { + setMessageType('error'); + setMessageData('Please Enter Qty'); + return; + } + setSelectedRowIndex(index); + handleModelDataOpen(record); + }} + className="shape-preview" + /> + ); }, - ] + }, + ] : []), { title: 'Action', @@ -2169,18 +2171,18 @@ const StockForm = ({ formType }) => { prev.map((item) => item.localId === localId ? { - ...item, - BalanceQty: qty, - ReceivedQty: qty, - AcceptedQty: qty, - RejectedQty: 0, - PurcDisc: 0, - Amount: - isNaN(item.InwardPrice) || isNaN(qty) - ? 0 - : item.InwardPrice * qty, - ProductIdentifierDtls: [], - } + ...item, + BalanceQty: qty, + ReceivedQty: qty, + AcceptedQty: qty, + RejectedQty: 0, + PurcDisc: 0, + Amount: + isNaN(item.InwardPrice) || isNaN(qty) + ? 0 + : item.InwardPrice * qty, + ProductIdentifierDtls: [], + } : item ) ); @@ -2217,10 +2219,10 @@ const StockForm = ({ formType }) => { prev.map((item) => item.localId === record.localId ? { - ...item, - MRP: value, - SellPrice: value, - } + ...item, + MRP: value, + SellPrice: value, + } : item ) ); @@ -2234,10 +2236,10 @@ const StockForm = ({ formType }) => { prev.map((item) => item.localId === record.localId ? { - ...item, - MRP: normalized, - SellPrice: normalized, - } + ...item, + MRP: normalized, + SellPrice: normalized, + } : item ) ); @@ -3370,19 +3372,21 @@ const StockForm = ({ formType }) => { )} - - + + index === self.findIndex( @@ -3396,31 +3400,55 @@ const StockForm = ({ formType }) => { ? `${option.SuppName} (${option.Type}) [${option.SuppId}]` : `${option.SuppName} (${option.Type})`, })) - : [] - } - label={ - - } - className="field-DropDown" - onChangeFunction={handleSupplierDropDownChange} - valueData={selectedSupplierData} - disabled={ - editstate?.SuppId - ? true - : !orderType + : [] + } + label={ + + } + className="field-DropDown" + onChangeFunction={handleSupplierDropDownChange} + valueData={selectedSupplierData} + disabled={ + editstate?.SuppId ? true - : false - } - /> - - - - + + + + + {orderType && + + + { + const checked = e.target.checked; + setShowAllSuppliers(checked); + setInitialLoad(true); + getSuplaierApi({ Type: checked ? 'Y' : null }); + }} + > + All + + + + + } +
+ {!selectedSupplierName && ( { /> )} +
@@ -3601,88 +3630,88 @@ const StockForm = ({ formType }) => { item.ConfigId === SelectedPurchaseType && item.ConfigName === 'Cash' ) && ( - <> - - ({ - value: mode.ModeId, - label: mode.ModeName, - }))} - label={ - - } - className="field-DropDown" - onChangeFunction={handlePaymentModeChange} - valueData={selectedPaymentMode} - /> - - { - if ( - value === undefined || - value === null || - value === '' - ) { - return Promise.resolve(); - } - if (Number(value) === 0) { - return Promise.reject( - 'Payment Amount cannot be 0' - ); - } - if ( - isNaN(value) || - Number(value) < 0 - ) { - return Promise.reject( - 'Payment Amount cannot be less than 0' - ); - } - return Promise.resolve(); + <> + - - Payment Amount - - } - inputMode="decimal" - disable={!payAmountDisable} - isOnChange={paymentAmount ? true : false} - min={0} - type="number" - value={paymentAmount} - onChange={(e) => { - formRef?.current?.setFieldsValue({ - PaymentAmount: e?.target?.value, - }); - setPaymentAmount(e?.target?.value); - }} - /> - - - )} + ]} + > + ({ + value: mode.ModeId, + label: mode.ModeName, + }))} + label={ + + } + className="field-DropDown" + onChangeFunction={handlePaymentModeChange} + valueData={selectedPaymentMode} + /> + + { + if ( + value === undefined || + value === null || + value === '' + ) { + return Promise.resolve(); + } + if (Number(value) === 0) { + return Promise.reject( + 'Payment Amount cannot be 0' + ); + } + if ( + isNaN(value) || + Number(value) < 0 + ) { + return Promise.reject( + 'Payment Amount cannot be less than 0' + ); + } + return Promise.resolve(); + }, + }, + ]} + > + + Payment Amount + + } + inputMode="decimal" + disable={!payAmountDisable} + isOnChange={paymentAmount ? true : false} + min={0} + type="number" + value={paymentAmount} + onChange={(e) => { + formRef?.current?.setFieldsValue({ + PaymentAmount: e?.target?.value, + }); + setPaymentAmount(e?.target?.value); + }} + /> + + + )}
@@ -3716,7 +3745,7 @@ const StockForm = ({ formType }) => { (p) => p.ProdId === prodId && (p.ProdVariantName || 'Variant1') === - variantName + variantName ); const nameMatch = option.label ?.toLowerCase() @@ -3729,9 +3758,9 @@ const StockForm = ({ formType }) => { options={ !scanner ? productData?.map((option) => ({ - value: `${option.ProdId}_${option.ProdVariantName}`, - label: `${option.ProdName} (${option.Size} ${option.UomName})${option?.BrandName ? ` - ${option?.BrandName}` : ''} - ${option.ProdVariantName}`, - })) + value: `${option.ProdId}_${option.ProdVariantName}`, + label: `${option.ProdName} (${option.Size} ${option.UomName})${option?.BrandName ? ` - ${option?.BrandName}` : ''} - ${option.ProdVariantName}`, + })) : [] } // onSelect={async (value, option) => { @@ -4035,7 +4064,7 @@ const StockForm = ({ formType }) => { autoComplete="off" label="GST No" autocapitalize="on" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} />
@@ -4057,10 +4086,10 @@ const StockForm = ({ formType }) => { // isOnChange={formType == 'edit' ? true : false} inputMode="numeric" onInput={(e) => - (e.target.value = e.target.value?.replace( - /[^0-9]/g, - '' - )) + (e.target.value = e.target.value?.replace( + /[^0-9]/g, + '' + )) } /> @@ -4072,7 +4101,7 @@ const StockForm = ({ formType }) => { MailId} autocomplete="off" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> @@ -4099,7 +4128,7 @@ const StockForm = ({ formType }) => { Point of Contact} autocomplete="off" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> @@ -4121,7 +4150,7 @@ const StockForm = ({ formType }) => { label={} autocomplete="off" maxLength="10" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> @@ -4132,7 +4161,7 @@ const StockForm = ({ formType }) => { POC MailId} autocomplete="off" - // isOnChange={formType == 'edit' ? true : false} + // isOnChange={formType == 'edit' ? true : false} /> diff --git a/src/Styles/Stock/StockMaster.scss b/src/Styles/Stock/StockMaster.scss index 28b0852..6c7b0a5 100644 --- a/src/Styles/Stock/StockMaster.scss +++ b/src/Styles/Stock/StockMaster.scss @@ -87,7 +87,7 @@ width: 180px !important; } - > div:nth-child(2) { + >div:nth-child(2) { p { display: none !important; } @@ -145,7 +145,7 @@ max-width: 130px !important; } - > td:nth-child(3) { + >td:nth-child(3) { .ant-input { width: max-content !important; max-width: 70px !important; @@ -153,7 +153,7 @@ } } - > td:nth-child(5) { + >td:nth-child(5) { .ant-input { width: max-content !important; max-width: 100px !important; @@ -324,12 +324,12 @@ } .purchase-status { - > div:nth-child(1) { + >div:nth-child(1) { display: flex; align-items: center; gap: 10px; - > p { + >p { padding-bottom: 0 !important; } } @@ -447,7 +447,7 @@ .invoice-date { .ant-form-item-control-input-content { - > label { + >label { font-family: 'Poppins'; font-weight: 500; } @@ -473,7 +473,7 @@ gap: 1rem; margin-bottom: 10px; - > button { + >button { font-family: 'Poppins'; background-color: #ef4444; color: #fff; @@ -481,8 +481,8 @@ align-items: center; .ant-btn-icon { - > span { - > svg { + >span { + >svg { width: 13px; height: 13px; } @@ -833,9 +833,36 @@ } @media (max-width: 500px) { + .tdProductrecipt, .proReceiptTD { font-size: 12px !important; } - + + .div-flex{ + padding-bottom: 18px !important; + } + } + + +.div-flex { + display: flex; + align-items: center; + gap: 10px; + background-color: rgb(218, 218, 218); + border-radius: 4px; + padding: 4px 4px 8px 4px; + + .ant-form-item { + margin-bottom: 0 !important; + } +} + +@media (max-width: 400px) { + .div-flex { + flex-direction: column; + align-items: flex-start; + padding-bottom: 8px !important; + } +} \ No newline at end of file