Bug Fixing
This commit is contained in:
parent
12fe504bb0
commit
8d07176b38
|
|
@ -432,7 +432,7 @@ export const getCustomerForHold = createAsyncThunk(
|
||||||
|
|
||||||
export const getAllCustomerAndBranch = createAsyncThunk(
|
export const getAllCustomerAndBranch = createAsyncThunk(
|
||||||
'product/getAllCustomerAndBranch',
|
'product/getAllCustomerAndBranch',
|
||||||
async ({ CompId, AppId, BranchId }) => {
|
async ({ CompId, AppId, BranchId,selectedCustomertype }) => {
|
||||||
if (
|
if (
|
||||||
CompId != null &&
|
CompId != null &&
|
||||||
CompId != undefined &&
|
CompId != undefined &&
|
||||||
|
|
@ -442,7 +442,7 @@ export const getAllCustomerAndBranch = createAsyncThunk(
|
||||||
AppId != undefined
|
AppId != undefined
|
||||||
) {
|
) {
|
||||||
return await axiosRetailInstanceData.get(
|
return await axiosRetailInstanceData.get(
|
||||||
`/Customer/AllCustomerBranchDropdown?compId=${CompId}&branchId=${BranchId}&appId=${AppId}`
|
`/Customer/AllCustomerBranchDropdown?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&type=${selectedCustomertype}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -435,7 +435,8 @@ const SalesNetAmountModal = ({
|
||||||
color: '#2e7d32',
|
color: '#2e7d32',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{total-RefundAmt}
|
{/* {total-RefundAmt} */}
|
||||||
|
{total}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -335,6 +335,13 @@ const RetailBookingClosing = (props) => {
|
||||||
{safeRound(PaymentClosingData?.OverAllUpiAmount)}
|
{safeRound(PaymentClosingData?.OverAllUpiAmount)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
{PaymentClosingData?.OverAllRefundAmount > 0 && (<div className="ClosepayBTN">
|
||||||
|
<p>Refund Amount</p>
|
||||||
|
<div>=</div>
|
||||||
|
<span style={{ color: '#28AA3A', cursor: 'pointer' }}>
|
||||||
|
{safeRound(PaymentClosingData?.OverAllRefundAmount)}
|
||||||
|
</span>
|
||||||
|
</div>)}
|
||||||
<div className="ClosepayBTN">
|
<div className="ClosepayBTN">
|
||||||
<p> Total Cash In Hand</p>
|
<p> Total Cash In Hand</p>
|
||||||
<div>=</div>
|
<div>=</div>
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,9 @@ const SalesCountComponent = React.memo(
|
||||||
SelfTakeAwayAmount,
|
SelfTakeAwayAmount,
|
||||||
SelfDineInAmount,
|
SelfDineInAmount,
|
||||||
PreOrderAmount,
|
PreOrderAmount,
|
||||||
RefundAmt
|
RefundAmt,
|
||||||
|
DineInRefundAmount,
|
||||||
|
TakeAwayRefundAmount
|
||||||
} = GlobalsalesDetailData.length > 0 ? GlobalsalesDetailData[0] : {};
|
} = GlobalsalesDetailData.length > 0 ? GlobalsalesDetailData[0] : {};
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
@ -172,7 +174,7 @@ const SalesCountComponent = React.memo(
|
||||||
{takeAwayPreference && (
|
{takeAwayPreference && (
|
||||||
<p>
|
<p>
|
||||||
Take Away:{' '}
|
Take Away:{' '}
|
||||||
{TakeAwayOrderCount + SelfTakeAwayOrderCount || 0}
|
{(TakeAwayOrderCount + SelfTakeAwayOrderCount || 0)}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
<p>Dine In: {DineInOrderCount + SelfDineInOrderCount || 0}</p>
|
<p>Dine In: {DineInOrderCount + SelfDineInOrderCount || 0}</p>
|
||||||
|
|
@ -528,6 +530,20 @@ const SalesCountComponent = React.memo(
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{ TakeAwayRefundAmount != 0 && <div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
gap: '1rem',
|
||||||
|
justifyContent: 'flex-end',
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div>Refund (-) :</div>
|
||||||
|
<div>
|
||||||
|
{safeRound(TakeAwayRefundAmount)}
|
||||||
|
</div>
|
||||||
|
</div>}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
|
|
@ -548,10 +564,11 @@ const SalesCountComponent = React.memo(
|
||||||
<div>Total</div>
|
<div>Total</div>
|
||||||
<div>
|
<div>
|
||||||
{safeRound(
|
{safeRound(
|
||||||
TakeAwayAmount +
|
(TakeAwayAmount ?? 0) +
|
||||||
SelfTakeAwayAmount +
|
(SelfTakeAwayAmount ?? 0) +
|
||||||
PreOrderAmount -
|
(PreOrderAmount ?? 0) -
|
||||||
OverAllTakeAwayOfferAmount
|
(OverAllTakeAwayOfferAmount ?? 0) -
|
||||||
|
(TakeAwayRefundAmount ?? 0)
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -562,10 +579,11 @@ const SalesCountComponent = React.memo(
|
||||||
{isMobile ? 'TA' : 'Take Away'}:{' '}
|
{isMobile ? 'TA' : 'Take Away'}:{' '}
|
||||||
<span>
|
<span>
|
||||||
{safeRound(
|
{safeRound(
|
||||||
(TakeAwayAmount ||
|
((TakeAwayAmount || 0) +
|
||||||
0 + SelfTakeAwayAmount ||
|
(SelfTakeAwayAmount || 0) +
|
||||||
0 + PreOrderAmount ||
|
(PreOrderAmount || 0)) -
|
||||||
0) - OverAllTakeAwayOfferAmount
|
(OverAllTakeAwayOfferAmount || 0) -
|
||||||
|
(TakeAwayRefundAmount || 0)
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -603,6 +621,21 @@ const SalesCountComponent = React.memo(
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{ DineInRefundAmount != 0 && <div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
gap: '1rem',
|
||||||
|
justifyContent: 'flex-end',
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div>Refund (-) :</div>
|
||||||
|
<div>
|
||||||
|
{safeRound(DineInRefundAmount)}
|
||||||
|
</div>
|
||||||
|
</div>}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
|
|
@ -623,9 +656,10 @@ const SalesCountComponent = React.memo(
|
||||||
<div>Total</div>
|
<div>Total</div>
|
||||||
<div>
|
<div>
|
||||||
{safeRound(
|
{safeRound(
|
||||||
DineInAmount +
|
(DineInAmount ?? 0) +
|
||||||
SelfDineInAmount -
|
(SelfDineInAmount ?? 0) -
|
||||||
OverAllDineInOfferAmount
|
(OverAllDineInOfferAmount ?? 0) -
|
||||||
|
(DineInRefundAmount ?? 0)
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -636,9 +670,10 @@ const SalesCountComponent = React.memo(
|
||||||
{isMobile ? 'DI' : 'Dine In'}:{' '}
|
{isMobile ? 'DI' : 'Dine In'}:{' '}
|
||||||
<span>
|
<span>
|
||||||
{safeRound(
|
{safeRound(
|
||||||
DineInAmount +
|
(DineInAmount ?? 0) +
|
||||||
SelfDineInAmount -
|
(SelfDineInAmount ?? 0) -
|
||||||
OverAllDineInOfferAmount
|
(OverAllDineInOfferAmount ?? 0) -
|
||||||
|
(DineInRefundAmount ?? 0)
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -663,11 +698,18 @@ const SalesCountComponent = React.memo(
|
||||||
{isMobile ? 'NA' : 'Net Amt'}:{' '}
|
{isMobile ? 'NA' : 'Net Amt'}:{' '}
|
||||||
<span>
|
<span>
|
||||||
{safeRound(
|
{safeRound(
|
||||||
(TakeAwayAmount +
|
(
|
||||||
SelfTakeAwayAmount +
|
(TakeAwayAmount ?? 0) +
|
||||||
PreOrderAmount -
|
(SelfTakeAwayAmount ?? 0) +
|
||||||
OverAllTakeAwayOfferAmount || 0) +
|
(PreOrderAmount ?? 0) -
|
||||||
(DineInAmount + SelfDineInAmount - OverAllDineInOfferAmount)
|
(OverAllTakeAwayOfferAmount ?? 0)
|
||||||
|
) +
|
||||||
|
(
|
||||||
|
(DineInAmount ?? 0) +
|
||||||
|
(SelfDineInAmount ?? 0) -
|
||||||
|
(OverAllDineInOfferAmount ?? 0)
|
||||||
|
) -
|
||||||
|
(RefundAmt ?? 0)
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
||||||
|
|
@ -777,6 +777,10 @@ const ChangePaymentmode = () => {
|
||||||
dispatch(ChangeSelectedCustDisable(false));
|
dispatch(ChangeSelectedCustDisable(false));
|
||||||
SelectCanPaymode(null);
|
SelectCanPaymode(null);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
setMessageType('error');
|
||||||
|
setMessageData(response?.data?.response);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Payment mode change failed:', error);
|
console.error('Payment mode change failed:', error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Space,
|
Space,
|
||||||
Segmented,
|
Segmented,
|
||||||
|
Checkbox,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import { BsUpcScan } from "react-icons/bs";
|
import { BsUpcScan } from "react-icons/bs";
|
||||||
import {
|
import {
|
||||||
|
|
@ -116,6 +117,7 @@ const DeliveryChellanForm = () => {
|
||||||
const [selectedOrder, setSelectedOrder] = useState();
|
const [selectedOrder, setSelectedOrder] = useState();
|
||||||
const [orderTableData, setOrderTableData] = useState([]);
|
const [orderTableData, setOrderTableData] = useState([]);
|
||||||
const [emailSending, setEmailSending] = useState(false);
|
const [emailSending, setEmailSending] = useState(false);
|
||||||
|
const [selectedCustomertype, setSelectedCustomertype] = useState('N');
|
||||||
|
|
||||||
const items = [
|
const items = [
|
||||||
{
|
{
|
||||||
|
|
@ -132,9 +134,11 @@ const DeliveryChellanForm = () => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(changeBreadCrumb({ items: items }));
|
dispatch(changeBreadCrumb({ items: items }));
|
||||||
getProduct();
|
getProduct();
|
||||||
fetchdata();
|
|
||||||
getPrintData();
|
getPrintData();
|
||||||
}, []);
|
}, []);
|
||||||
|
useEffect(() => {
|
||||||
|
fetchdata();
|
||||||
|
}, [selectedCustomertype]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (UserType === 'Employee') {
|
if (UserType === 'Employee') {
|
||||||
|
|
@ -261,14 +265,14 @@ const DeliveryChellanForm = () => {
|
||||||
console.log(AllCustomer, "AllCustomerAllCustomer")
|
console.log(AllCustomer, "AllCustomerAllCustomer")
|
||||||
const fetchdata = async () => {
|
const fetchdata = async () => {
|
||||||
try {
|
try {
|
||||||
const resCustomer = await dispatch(getAllCustomerAndBranch({ CompId, AppId, BranchId })).unwrap();
|
const resCustomer = await dispatch(getAllCustomerAndBranch({ CompId, AppId, BranchId, selectedCustomertype })).unwrap();
|
||||||
if (resCustomer?.data?.statusCode === 1) {
|
if (resCustomer?.data?.statusCode === 1) {
|
||||||
setAllCustomer(resCustomer?.data?.data);
|
setAllCustomer(resCustomer?.data?.data);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setAllCustomer([]);
|
setAllCustomer([]);
|
||||||
setMessageType("error");
|
// setMessageType("error");
|
||||||
setMessageData(resCustomer?.data?.response);
|
// setMessageData(resCustomer?.data?.response);
|
||||||
}
|
}
|
||||||
|
|
||||||
const resOrders = await dispatch(PendingOrdersDC({ CompId, AppId, BranchId })).unwrap();
|
const resOrders = await dispatch(PendingOrdersDC({ CompId, AppId, BranchId })).unwrap();
|
||||||
|
|
@ -276,8 +280,8 @@ const DeliveryChellanForm = () => {
|
||||||
setOrdersCustomer(resOrders?.data?.data?.PurchaseOrder);
|
setOrdersCustomer(resOrders?.data?.data?.PurchaseOrder);
|
||||||
} else {
|
} else {
|
||||||
setOrdersCustomer([]);
|
setOrdersCustomer([]);
|
||||||
setMessageType("error");
|
// setMessageType("error");
|
||||||
setMessageData(resOrders?.data?.response);
|
// setMessageData(resOrders?.data?.response);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
@ -1345,7 +1349,7 @@ const DeliveryChellanForm = () => {
|
||||||
</div>
|
</div>
|
||||||
<div className="DeliveryChellanDetails">
|
<div className="DeliveryChellanDetails">
|
||||||
|
|
||||||
{segmentValue === "N" ? <div>
|
{segmentValue === "N" ? <div style={{ display: "flex", alignItems: "center", gap: "12px" }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="CustId"
|
name="CustId"
|
||||||
rules={[
|
rules={[
|
||||||
|
|
@ -1368,6 +1372,21 @@ const DeliveryChellanForm = () => {
|
||||||
onChangeFunction={handleAdminUserDropDownChange}
|
onChangeFunction={handleAdminUserDropDownChange}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
{/* <Form.Item> */}
|
||||||
|
<Tooltip
|
||||||
|
title="Check to view all branch customers. Uncheck to view only your branch customers.">
|
||||||
|
<Checkbox
|
||||||
|
checked={selectedCustomertype === 'Y'}
|
||||||
|
onChange={(e) => {
|
||||||
|
setSelectedCustomertype(e.target.checked ? 'Y' : 'N');
|
||||||
|
}}
|
||||||
|
> {selectedCustomertype === 'Y'
|
||||||
|
? 'All Branch'
|
||||||
|
: 'My Branch'}
|
||||||
|
</Checkbox>
|
||||||
|
</Tooltip>
|
||||||
|
{/* </Form.Item> */}
|
||||||
</div> : <div>
|
</div> : <div>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="Order"
|
name="Order"
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,7 @@ const ProductForm = ({ formType }) => {
|
||||||
|
|
||||||
const state = location?.state;
|
const state = location?.state;
|
||||||
const editstate = state?.editstate;
|
const editstate = state?.editstate;
|
||||||
|
console.log(editstate,'editstate23233232');
|
||||||
|
|
||||||
const formRef = useRef(null);
|
const formRef = useRef(null);
|
||||||
const formCategoryRef = useRef(null);
|
const formCategoryRef = useRef(null);
|
||||||
|
|
|
||||||
|
|
@ -947,6 +947,12 @@ const DateWiseReport = () => {
|
||||||
<td>{datewiseData?.[0]?.TotalExtraChargeAmount}</td>
|
<td>{datewiseData?.[0]?.TotalExtraChargeAmount}</td>
|
||||||
</tr>
|
</tr>
|
||||||
)}
|
)}
|
||||||
|
{datewiseData?.[0]?.RefundAmount > 0 && (
|
||||||
|
<tr>
|
||||||
|
<td>Refund (-)</td>
|
||||||
|
<td>{datewiseData?.[0]?.RefundAmount}</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
{datewiseData?.[0]?.PreOrderNetAmount > 0 && (
|
{datewiseData?.[0]?.PreOrderNetAmount > 0 && (
|
||||||
<tr>
|
<tr>
|
||||||
<td>Preorder</td>
|
<td>Preorder</td>
|
||||||
|
|
@ -982,8 +988,10 @@ const DateWiseReport = () => {
|
||||||
datewiseData?.[0]?.WholeSaleExpenseNetAmount
|
datewiseData?.[0]?.WholeSaleExpenseNetAmount
|
||||||
) || 0
|
) || 0
|
||||||
: safeRound(
|
: safeRound(
|
||||||
datewiseData?.[0]?.TotalNetAmount +
|
(datewiseData?.[0]?.TotalBillAmount || 0) +
|
||||||
(datewiseData?.[0]?.PreOrderNetAmount || 0)
|
(datewiseData?.[0]?.TaxAmount || 0) +
|
||||||
|
(datewiseData?.[0]?.PreOrderNetAmount || 0) -
|
||||||
|
(datewiseData?.[0]?.RefundAmount || 0)
|
||||||
) || 0}
|
) || 0}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
|
|
@ -436,6 +436,7 @@ const ItemWiseReport = () => {
|
||||||
BalanceQty:item?.BalanceQty,
|
BalanceQty:item?.BalanceQty,
|
||||||
Amount: item?.TotalAmt,
|
Amount: item?.TotalAmt,
|
||||||
StockAvailable:item?.StockAvailable,
|
StockAvailable:item?.StockAvailable,
|
||||||
|
RefundAmount: item?.RefundAmount,
|
||||||
}));
|
}));
|
||||||
const itemData = DateWisTableData;
|
const itemData = DateWisTableData;
|
||||||
|
|
||||||
|
|
@ -1210,6 +1211,14 @@ const ItemWiseReport = () => {
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
)}
|
)}
|
||||||
|
{ItemWiseData?.[0]?.RefundAmount > 0 && (
|
||||||
|
<tr>
|
||||||
|
<td>Refund (-) </td>
|
||||||
|
<td>
|
||||||
|
{safeRound(ItemWiseData?.[0]?.RefundAmount)}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
{ItemWiseData?.[0]?.PreOrderNetAmount > 0 && (
|
{ItemWiseData?.[0]?.PreOrderNetAmount > 0 && (
|
||||||
<tr>
|
<tr>
|
||||||
<td>Preorder</td>
|
<td>Preorder</td>
|
||||||
|
|
@ -1243,7 +1252,7 @@ const ItemWiseReport = () => {
|
||||||
(ItemWiseData?.[0]?.TotalOfferAmount
|
(ItemWiseData?.[0]?.TotalOfferAmount
|
||||||
? ItemWiseData?.[0]?.TotalOfferAmount
|
? ItemWiseData?.[0]?.TotalOfferAmount
|
||||||
: 0)
|
: 0)
|
||||||
) || 0}
|
) - (ItemWiseData?.[0]?.RefundAmount || 0) || 0}
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ const SalesRemovallist = () => {
|
||||||
const [Tabledata, setTabledata] = useState();
|
const [Tabledata, setTabledata] = useState();
|
||||||
const [Zero, SetZero] = useState(false);
|
const [Zero, SetZero] = useState(false);
|
||||||
const [OrderProductdata, setOrderProductdata] = useState([]);
|
const [OrderProductdata, setOrderProductdata] = useState([]);
|
||||||
console.log('OrderProductdata', OrderProductdata);
|
|
||||||
const [OrderDataModel, setOrderDataModal] = useState(false);
|
const [OrderDataModel, setOrderDataModal] = useState(false);
|
||||||
const [PaymentModal, setPaymentModal] = useState(false);
|
const [PaymentModal, setPaymentModal] = useState(false);
|
||||||
const [Paymentdata, setPaymentdata] = useState([]);
|
const [Paymentdata, setPaymentdata] = useState([]);
|
||||||
|
|
@ -711,40 +710,31 @@ const SalesRemovallist = () => {
|
||||||
|
|
||||||
const handleSave = (row) => {
|
const handleSave = (row) => {
|
||||||
const newData = [...OrderProductdata];
|
const newData = [...OrderProductdata];
|
||||||
|
|
||||||
const index = newData.findIndex((item) => row.ProdId === item.ProdId);
|
const index = newData.findIndex((item) => row.ProdId === item.ProdId);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
const item = newData.splice(index, 1, { ...row })[0];
|
const existing = newData[index];
|
||||||
|
const salesQty = Number(row.SalesQty);
|
||||||
setOrderProductdata(item);
|
const rate = Number(row?.Rate || 0);
|
||||||
|
const refundQty = Number(existing.OldSalesQty) - salesQty;
|
||||||
// Recalculate offer amounts
|
const refundAmount = refundQty * rate;
|
||||||
const updatedTableData = newData.map((item) => {
|
const updatedRow = {
|
||||||
if (item.ProdId === row.ProdId) {
|
...existing,
|
||||||
const updatedTotalAmt = row.SalesQty * Number(row?.Rate || 0);
|
...row,
|
||||||
|
SalesQty: salesQty,
|
||||||
return {
|
OrderQty: salesQty,
|
||||||
...item,
|
OrderRate: rate,
|
||||||
SalesQty: item.SalesQty,
|
TotalAmt: salesQty * rate,
|
||||||
OrderQty: item.SalesQty,
|
RefundQty: refundQty,
|
||||||
TotalAmt: updatedTotalAmt, // Update the recalculated TotalAmt
|
RefundAmount: refundAmount,
|
||||||
};
|
};
|
||||||
}
|
newData.splice(index, 1, updatedRow);
|
||||||
|
|
||||||
const recalculatedTotalAmt = item.SalesQty * Number(item?.Rate || 0);
|
const TotalAmount = newData.reduce(
|
||||||
|
|
||||||
return {
|
|
||||||
...item,
|
|
||||||
TotalAmt: recalculatedTotalAmt, // Ensure all rows' TotalAmt are updated
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const TotalAmount = updatedTableData.reduce(
|
|
||||||
(sum, item) => sum + Number(item?.TotalAmt || 0),
|
(sum, item) => sum + Number(item?.TotalAmt || 0),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
setTotalAmts(TotalAmount);
|
setTotalAmts(TotalAmount);
|
||||||
setOrderProductdata(updatedTableData);
|
setOrderProductdata(newData);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -919,19 +909,16 @@ const SalesRemovallist = () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(
|
const totalRefundAmount = OrderProductdata.reduce(
|
||||||
SalesQty,
|
(sum, prod) => sum + Number(prod?.RefundAmount || 0),
|
||||||
SalesQty.ProductIdentifierDtls.length,
|
0
|
||||||
matchingProducts.length,
|
|
||||||
SalesQty.ProductIdentifierDtls.length >= matchingProducts.length,
|
|
||||||
'!!!!!!!!!'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (allQtyMatch) {
|
if (allQtyMatch) {
|
||||||
const postdatas = Proddata.map((item) => ({
|
const postdatas = Proddata?.map((item) => ({
|
||||||
OrderId: item?.OrderId,
|
OrderId: item?.OrderId,
|
||||||
SalesId: item?.SalesId,
|
SalesId: item?.SalesId,
|
||||||
OrderQty:item?.SalesId,
|
OrderQty:item?.OrderQty,
|
||||||
CompId: item?.CompId,
|
CompId: item?.CompId,
|
||||||
BranchId: item?.BranchId,
|
BranchId: item?.BranchId,
|
||||||
OrderType: item?.OrderType,
|
OrderType: item?.OrderType,
|
||||||
|
|
@ -942,7 +929,7 @@ const SalesRemovallist = () => {
|
||||||
ActiveStatus: item?.ActiveStatus,
|
ActiveStatus: item?.ActiveStatus,
|
||||||
UpdatedBy: item?.CreatedBy,
|
UpdatedBy: item?.CreatedBy,
|
||||||
AppId: item?.AppId,
|
AppId: item?.AppId,
|
||||||
RefundAmount: item?.RefundAmount,
|
RefundAmount: totalRefundAmount,
|
||||||
AddlInfo: item?.AddlInfo,
|
AddlInfo: item?.AddlInfo,
|
||||||
BillAmount: item?.BillAmount,
|
BillAmount: item?.BillAmount,
|
||||||
OverallDiscSales: item?.OverallDisc,
|
OverallDiscSales: item?.OverallDisc,
|
||||||
|
|
@ -956,7 +943,8 @@ const SalesRemovallist = () => {
|
||||||
PaymentStatus: item?.PaymentStatus,
|
PaymentStatus: item?.PaymentStatus,
|
||||||
|
|
||||||
OrderDtlDetails: OrderProductdata.map((prod) => ({
|
OrderDtlDetails: OrderProductdata.map((prod) => ({
|
||||||
ActiveStatus: prod?.ActiveStatus,
|
// ActiveStatus: prod?.ActiveStatus,
|
||||||
|
ActiveStatus: "D",
|
||||||
ProdId: prod?.ProdId,
|
ProdId: prod?.ProdId,
|
||||||
Type: prod?.Type,
|
Type: prod?.Type,
|
||||||
// OrderQty: prod?.OrderQty,
|
// OrderQty: prod?.OrderQty,
|
||||||
|
|
@ -1014,7 +1002,7 @@ const SalesRemovallist = () => {
|
||||||
ActiveStatus: item?.ActiveStatus,
|
ActiveStatus: item?.ActiveStatus,
|
||||||
UpdatedBy: item?.CreatedBy,
|
UpdatedBy: item?.CreatedBy,
|
||||||
AppId: item?.AppId,
|
AppId: item?.AppId,
|
||||||
RefundAmount: item?.RefundAmount,
|
RefundAmount: totalRefundAmount,
|
||||||
AddlInfo: item?.AddlInfo,
|
AddlInfo: item?.AddlInfo,
|
||||||
BillAmount: item?.BillAmount,
|
BillAmount: item?.BillAmount,
|
||||||
OverallDiscSales: item?.OverallDisc,
|
OverallDiscSales: item?.OverallDisc,
|
||||||
|
|
@ -1071,7 +1059,7 @@ const SalesRemovallist = () => {
|
||||||
} else if (isIdentifyDetailsValid) {
|
} else if (isIdentifyDetailsValid) {
|
||||||
// else if(isSalesQtyOldSalesQty){
|
// else if(isSalesQtyOldSalesQty){
|
||||||
|
|
||||||
const postdatas = Proddata.map((item) => ({
|
const postdatas = Proddata?.map((item) => ({
|
||||||
OrderId: item?.OrderId,
|
OrderId: item?.OrderId,
|
||||||
SalesId: item?.SalesId,
|
SalesId: item?.SalesId,
|
||||||
CompId: item?.CompId,
|
CompId: item?.CompId,
|
||||||
|
|
@ -1084,7 +1072,7 @@ const SalesRemovallist = () => {
|
||||||
ActiveStatus: item?.ActiveStatus,
|
ActiveStatus: item?.ActiveStatus,
|
||||||
UpdatedBy: item?.CreatedBy,
|
UpdatedBy: item?.CreatedBy,
|
||||||
AppId: item?.AppId,
|
AppId: item?.AppId,
|
||||||
RefundAmount: item?.RefundAmount,
|
RefundAmount: totalRefundAmount,
|
||||||
AddlInfo: item?.AddlInfo,
|
AddlInfo: item?.AddlInfo,
|
||||||
BillAmount: item?.BillAmount,
|
BillAmount: item?.BillAmount,
|
||||||
OverallDiscSales: item?.OverallDisc,
|
OverallDiscSales: item?.OverallDisc,
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ const DateWiseReportPdf = ({
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
let PrintDetailsdata = datewiseData?.[0]?.AddressDetails?.[0];
|
let PrintDetailsdata = datewiseData?.[0]?.AddressDetails?.[0];
|
||||||
|
const refundAmount = datewiseData?.[0]?.RefundAmount || 0;
|
||||||
console.log(PrintDetailsdata, 'hhhhhhhhhhhhhhhj');
|
console.log(PrintDetailsdata, 'hhhhhhhhhhhhhhhj');
|
||||||
const [currentTime, setCurrentTime] = useState('');
|
const [currentTime, setCurrentTime] = useState('');
|
||||||
|
|
||||||
|
|
@ -285,14 +286,16 @@ const DateWiseReportPdf = ({
|
||||||
{TotalCharges > 0 && (
|
{TotalCharges > 0 && (
|
||||||
<p className="totaldetails"> Charges: {TotalCharges}</p>
|
<p className="totaldetails"> Charges: {TotalCharges}</p>
|
||||||
)}
|
)}
|
||||||
|
{refundAmount > 0 && (
|
||||||
|
<p className="totaldetails"> Refund: {refundAmount}</p>
|
||||||
|
)}
|
||||||
{TotalDiscount > 0 && (
|
{TotalDiscount > 0 && (
|
||||||
<p className="totaldetails"> Discount(-): {TotalDiscount}</p>
|
<p className="totaldetails"> Discount(-): {TotalDiscount}</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<p className="totaldetails">-------------------------</p>
|
<p className="totaldetails">-------------------------</p>
|
||||||
<p className="totaldetails">
|
<p className="totaldetails">
|
||||||
{' '}
|
{' '}
|
||||||
Net: {Math.round(TotalNetAmount + (TotalPreOrderAmount || 0))}
|
Net: {Math.round(TotalBillAmount + TaxAmount + (TotalPreOrderAmount || 0) - (refundAmount))}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{/* current Time */}
|
{/* current Time */}
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,9 @@ const ItemWiseReportPdf = ({
|
||||||
{TotalCharges > 0 && (
|
{TotalCharges > 0 && (
|
||||||
<p className="totaldetails"> Charges: {parseFloat(TotalCharges).toFixed(2)}</p>
|
<p className="totaldetails"> Charges: {parseFloat(TotalCharges).toFixed(2)}</p>
|
||||||
)}
|
)}
|
||||||
|
{itemData?.[0]?.RefundAmount > 0 && (
|
||||||
|
<p className="totaldetails"> Refund: {parseFloat(itemData?.[0]?.RefundAmount).toFixed(2)}</p>
|
||||||
|
)}
|
||||||
{TotalDiscount > 0 && (
|
{TotalDiscount > 0 && (
|
||||||
<p className="totaldetails"> Discount(-): { parseFloat(TotalDiscount).toFixed(2)}</p>
|
<p className="totaldetails"> Discount(-): { parseFloat(TotalDiscount).toFixed(2)}</p>
|
||||||
)}
|
)}
|
||||||
|
|
@ -190,7 +193,7 @@ const ItemWiseReportPdf = ({
|
||||||
(TotalTaxAmount || 0) +
|
(TotalTaxAmount || 0) +
|
||||||
(TotalCharges || 0) +
|
(TotalCharges || 0) +
|
||||||
(TotalPreOrderAmount || 0) -
|
(TotalPreOrderAmount || 0) -
|
||||||
(TotalDiscount || 0)
|
(TotalDiscount || 0) - (itemData?.[0]?.RefundAmount || 0)
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue