Merge pull request 'fixed taxInvoice print and added All list in supplier dropdown product receipt' (#122) from temp/sales-bill-edit-fix into main

Reviewed-on: Pozomind/pozo-retail-app#122
This commit is contained in:
karthikalakshmi 2026-02-10 13:50:16 +05:30
commit b41d6d79f1
5 changed files with 660 additions and 579 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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',
@ -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' }}
>
<div className="inputForm">
<Form.Item
name="SuppId"
rules={[
@ -1379,10 +1382,29 @@ console.log('hi');
<PlusCircleOutlined onClick={addPurSupplier} />
</Tooltip>
</Form.Item>
<Form.Item
name="showAll"
valuePropName="checked"
>
<Tooltip title="Show all branches and warehouses" placement="top">
<span>
<Checkbox
checked={showAllSuppliers}
onChange={(e) => {
const checked = e.target.checked;
setShowAllSuppliers(checked);
getSupplierData(checked ? 'Y' : null);
}}
>
All
</Checkbox>
</span>
</Tooltip>
</Form.Item>
<div className='deliveryaddress'>
{selecSuppDetails !== null &&
(() => {
(<div className='deliveryaddress'>
{(() => {
const fields = [];
if (selecSuppDetails?.SuppName) {
fields.push(
@ -1456,7 +1478,8 @@ console.log('hi');
</div>
);
})()}
</div>
</div>)
}
<div
className="lowStock-button"
onClick={() => setisLowStockModel(true)}

View File

@ -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';
@ -268,6 +268,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 +325,7 @@ const StockForm = ({ formType }) => {
deliveryPerformance();
discountLevel();
qualityofSupp();
getSuplaierApi({});
getSuplaierApi({ Type: null });
if (formType == 'add') {
formRef.current?.setFieldsValue({ SuppInvoiceDate: new Date().toJSON() });
@ -416,9 +417,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) {
@ -3381,6 +3382,8 @@ const StockForm = ({ formType }) => {
</FloatLabel>
</Form.Item>
)}
<div className={`${orderType ? 'div-flex' : ''}`}>
<Form.Item
name="CustSuppId"
rules={[
@ -3430,8 +3433,32 @@ const StockForm = ({ formType }) => {
/>
</Tooltip>
</Form.Item>
{orderType && <Form.Item
name="showAll"
valuePropName="checked"
>
<Tooltip title="Show all branches and warehouses" placement="top">
<span>
<Checkbox
checked={showAllSuppliers}
onChange={(e) => {
const checked = e.target.checked;
setShowAllSuppliers(checked);
setInitialLoad(true);
getSuplaierApi({ Type: checked ? 'Y' : null });
}}
>
All
</Checkbox>
</span>
</Tooltip>
</Form.Item>
}
</div>
{!selectedSupplierName && (
<RadioGrpButton
content={[
{ value: 'own', label: 'Own' },
{ value: 'paid', label: 'With paid' },
@ -3443,6 +3470,7 @@ const StockForm = ({ formType }) => {
/>
)}
<div className="pe-inward-date">
<label className="required">Inward Date</label>

View File

@ -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;
}
}