Merge pull request 'Bug Fixing' (#329) from srinath into main

Reviewed-on: Pozomind/pozo-retail-app#329
This commit is contained in:
karthikalakshmi 2026-03-31 17:14:30 +05:30
commit 01fecaebcf
12 changed files with 275 additions and 190 deletions

View File

@ -432,7 +432,7 @@ export const getCustomerForHold = createAsyncThunk(
export const getAllCustomerAndBranch = createAsyncThunk(
'product/getAllCustomerAndBranch',
async ({ CompId, AppId, BranchId }) => {
async ({ CompId, AppId, BranchId,selectedCustomertype }) => {
if (
CompId != null &&
CompId != undefined &&
@ -442,7 +442,7 @@ export const getAllCustomerAndBranch = createAsyncThunk(
AppId != undefined
) {
return await axiosRetailInstanceData.get(
`/Customer/AllCustomerBranchDropdown?compId=${CompId}&branchId=${BranchId}&appId=${AppId}`
`/Customer/AllCustomerBranchDropdown?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&type=${selectedCustomertype}`
);
}
}

View File

@ -435,7 +435,8 @@ const SalesNetAmountModal = ({
color: '#2e7d32',
}}
>
{total-RefundAmt}
{/* {total-RefundAmt} */}
{total}
</td>
</tr>
);

View File

@ -335,6 +335,13 @@ const RetailBookingClosing = (props) => {
{safeRound(PaymentClosingData?.OverAllUpiAmount)}
</span>
</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">
<p> Total Cash In Hand</p>
<div>=</div>

View File

@ -82,7 +82,9 @@ const SalesCountComponent = React.memo(
SelfTakeAwayAmount,
SelfDineInAmount,
PreOrderAmount,
RefundAmt
RefundAmt,
DineInRefundAmount,
TakeAwayRefundAmount
} = GlobalsalesDetailData.length > 0 ? GlobalsalesDetailData[0] : {};
const dispatch = useDispatch();
@ -172,7 +174,7 @@ const SalesCountComponent = React.memo(
{takeAwayPreference && (
<p>
Take Away:{' '}
{TakeAwayOrderCount + SelfTakeAwayOrderCount || 0}
{(TakeAwayOrderCount + SelfTakeAwayOrderCount || 0)}
</p>
)}
<p>Dine In: {DineInOrderCount + SelfDineInOrderCount || 0}</p>
@ -528,6 +530,20 @@ const SalesCountComponent = React.memo(
)}
</div>
</div>
{ TakeAwayRefundAmount != 0 && <div
style={{
display: 'flex',
gap: '1rem',
justifyContent: 'flex-end',
fontFamily: 'Poppins',
}}
>
<div>Refund (-) :</div>
<div>
{safeRound(TakeAwayRefundAmount)}
</div>
</div>}
<div
style={{
flexGrow: 1,
@ -548,11 +564,12 @@ const SalesCountComponent = React.memo(
<div>Total</div>
<div>
{safeRound(
TakeAwayAmount +
SelfTakeAwayAmount +
PreOrderAmount -
OverAllTakeAwayOfferAmount
)}
(TakeAwayAmount ?? 0) +
(SelfTakeAwayAmount ?? 0) +
(PreOrderAmount ?? 0) -
(OverAllTakeAwayOfferAmount ?? 0) -
(TakeAwayRefundAmount ?? 0)
)}
</div>
</div>
</div>
@ -562,10 +579,11 @@ const SalesCountComponent = React.memo(
{isMobile ? 'TA' : 'Take Away'}:{' '}
<span>
{safeRound(
(TakeAwayAmount ||
0 + SelfTakeAwayAmount ||
0 + PreOrderAmount ||
0) - OverAllTakeAwayOfferAmount
((TakeAwayAmount || 0) +
(SelfTakeAwayAmount || 0) +
(PreOrderAmount || 0)) -
(OverAllTakeAwayOfferAmount || 0) -
(TakeAwayRefundAmount || 0)
)}
</span>
</p>
@ -603,6 +621,21 @@ const SalesCountComponent = React.memo(
)}
</div>
</div>
{ DineInRefundAmount != 0 && <div
style={{
display: 'flex',
gap: '1rem',
justifyContent: 'flex-end',
fontFamily: 'Poppins',
}}
>
<div>Refund (-) :</div>
<div>
{safeRound(DineInRefundAmount)}
</div>
</div>}
<div
style={{
flexGrow: 1,
@ -623,10 +656,11 @@ const SalesCountComponent = React.memo(
<div>Total</div>
<div>
{safeRound(
DineInAmount +
SelfDineInAmount -
OverAllDineInOfferAmount
)}
(DineInAmount ?? 0) +
(SelfDineInAmount ?? 0) -
(OverAllDineInOfferAmount ?? 0) -
(DineInRefundAmount ?? 0)
)}
</div>
</div>
</div>
@ -636,9 +670,10 @@ const SalesCountComponent = React.memo(
{isMobile ? 'DI' : 'Dine In'}:{' '}
<span>
{safeRound(
DineInAmount +
SelfDineInAmount -
OverAllDineInOfferAmount
(DineInAmount ?? 0) +
(SelfDineInAmount ?? 0) -
(OverAllDineInOfferAmount ?? 0) -
(DineInRefundAmount ?? 0)
)}
</span>
</p>
@ -663,12 +698,19 @@ const SalesCountComponent = React.memo(
{isMobile ? 'NA' : 'Net Amt'}:{' '}
<span>
{safeRound(
(TakeAwayAmount +
SelfTakeAwayAmount +
PreOrderAmount -
OverAllTakeAwayOfferAmount || 0) +
(DineInAmount + SelfDineInAmount - OverAllDineInOfferAmount)
)}
(
(TakeAwayAmount ?? 0) +
(SelfTakeAwayAmount ?? 0) +
(PreOrderAmount ?? 0) -
(OverAllTakeAwayOfferAmount ?? 0)
) +
(
(DineInAmount ?? 0) +
(SelfDineInAmount ?? 0) -
(OverAllDineInOfferAmount ?? 0)
) -
(RefundAmt ?? 0)
)}
</span>
</p>
{Customisebillno && <CustomisedInvoiceChange />}

View File

@ -777,6 +777,10 @@ const ChangePaymentmode = () => {
dispatch(ChangeSelectedCustDisable(false));
SelectCanPaymode(null);
}
else{
setMessageType('error');
setMessageData(response?.data?.response);
}
} catch (error) {
console.error('Payment mode change failed:', error);
}

View File

@ -13,6 +13,7 @@ import {
Tooltip,
Space,
Segmented,
Checkbox,
} from 'antd';
import { BsUpcScan } from "react-icons/bs";
import {
@ -116,6 +117,7 @@ const DeliveryChellanForm = () => {
const [selectedOrder, setSelectedOrder] = useState();
const [orderTableData, setOrderTableData] = useState([]);
const [emailSending, setEmailSending] = useState(false);
const [selectedCustomertype, setSelectedCustomertype] = useState('N');
const items = [
{
@ -132,9 +134,11 @@ const DeliveryChellanForm = () => {
useEffect(() => {
dispatch(changeBreadCrumb({ items: items }));
getProduct();
fetchdata();
getPrintData();
}, []);
useEffect(() => {
fetchdata();
}, [selectedCustomertype]);
useEffect(() => {
if (UserType === 'Employee') {
@ -261,14 +265,14 @@ const DeliveryChellanForm = () => {
console.log(AllCustomer, "AllCustomerAllCustomer")
const fetchdata = async () => {
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) {
setAllCustomer(resCustomer?.data?.data);
} else {
setAllCustomer([]);
setMessageType("error");
setMessageData(resCustomer?.data?.response);
// setMessageType("error");
// setMessageData(resCustomer?.data?.response);
}
const resOrders = await dispatch(PendingOrdersDC({ CompId, AppId, BranchId })).unwrap();
@ -276,8 +280,8 @@ const DeliveryChellanForm = () => {
setOrdersCustomer(resOrders?.data?.data?.PurchaseOrder);
} else {
setOrdersCustomer([]);
setMessageType("error");
setMessageData(resOrders?.data?.response);
// setMessageType("error");
// setMessageData(resOrders?.data?.response);
}
} catch (err) {
@ -1242,7 +1246,7 @@ const DeliveryChellanForm = () => {
setMessageData('Email failed to send');
setMessageType('error');
}
finally{
finally {
setEmailSending(false);
}
}, 300);
@ -1345,7 +1349,7 @@ const DeliveryChellanForm = () => {
</div>
<div className="DeliveryChellanDetails">
{segmentValue === "N" ? <div>
{segmentValue === "N" ? <div style={{ display: "flex", alignItems: "center", gap: "12px" }}>
<Form.Item
name="CustId"
rules={[
@ -1368,6 +1372,21 @@ const DeliveryChellanForm = () => {
onChangeFunction={handleAdminUserDropDownChange}
/>
</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>
<Form.Item
name="Order"
@ -1722,7 +1741,7 @@ const DeliveryChellanForm = () => {
</div>
}
/> */}
{(iSEmail || emailSending )&& (
{(iSEmail || emailSending) && (
<EmailModel
open={iSEmail}
emailSending={emailSending}

View File

@ -101,6 +101,7 @@ const ProductForm = ({ formType }) => {
const state = location?.state;
const editstate = state?.editstate;
console.log(editstate,'editstate23233232');
const formRef = useRef(null);
const formCategoryRef = useRef(null);

View File

@ -64,7 +64,7 @@ const DateWiseReport = () => {
setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
setting?.SettingValue === 'Y'
);
console.log(MobileA4Print,SettingDataSelector, 'MobileA4PrintMobileA4Print');
console.log(MobileA4Print, SettingDataSelector, 'MobileA4PrintMobileA4Print');
useEffect(() => {
if (dataSource?.length > 0) {
@ -369,7 +369,7 @@ const DateWiseReport = () => {
}, []);
const getPreference = async () => {
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId,UserId: sessionuserid };
const data = { AppId: AppId, CompId: CompId, BranchId: BranchId, UserId: sessionuserid };
const { data: res } = await dispatch(getPreferenceData(data)).unwrap();
const decimalSetting = res?.data?.[0]?.SettingDtlDetails?.find(
(setting) =>
@ -947,6 +947,12 @@ const DateWiseReport = () => {
<td>{datewiseData?.[0]?.TotalExtraChargeAmount}</td>
</tr>
)}
{datewiseData?.[0]?.RefundAmount > 0 && (
<tr>
<td>Refund (-)</td>
<td>{datewiseData?.[0]?.RefundAmount}</td>
</tr>
)}
{datewiseData?.[0]?.PreOrderNetAmount > 0 && (
<tr>
<td>Preorder</td>
@ -982,8 +988,10 @@ const DateWiseReport = () => {
datewiseData?.[0]?.WholeSaleExpenseNetAmount
) || 0
: safeRound(
datewiseData?.[0]?.TotalNetAmount +
(datewiseData?.[0]?.PreOrderNetAmount || 0)
(datewiseData?.[0]?.TotalBillAmount || 0) +
(datewiseData?.[0]?.TaxAmount || 0) +
(datewiseData?.[0]?.PreOrderNetAmount || 0) -
(datewiseData?.[0]?.RefundAmount || 0)
) || 0}
</td>
</tr>

View File

@ -436,6 +436,7 @@ const ItemWiseReport = () => {
BalanceQty:item?.BalanceQty,
Amount: item?.TotalAmt,
StockAvailable:item?.StockAvailable,
RefundAmount: item?.RefundAmount,
}));
const itemData = DateWisTableData;
@ -1210,6 +1211,14 @@ const ItemWiseReport = () => {
</td>
</tr>
)}
{ItemWiseData?.[0]?.RefundAmount > 0 && (
<tr>
<td>Refund (-) </td>
<td>
{safeRound(ItemWiseData?.[0]?.RefundAmount)}
</td>
</tr>
)}
{ItemWiseData?.[0]?.PreOrderNetAmount > 0 && (
<tr>
<td>Preorder</td>
@ -1243,7 +1252,7 @@ const ItemWiseReport = () => {
(ItemWiseData?.[0]?.TotalOfferAmount
? ItemWiseData?.[0]?.TotalOfferAmount
: 0)
) || 0}
) - (ItemWiseData?.[0]?.RefundAmount || 0) || 0}
</th>
</tr>
</tbody>

View File

@ -57,7 +57,6 @@ const SalesRemovallist = () => {
const [Tabledata, setTabledata] = useState();
const [Zero, SetZero] = useState(false);
const [OrderProductdata, setOrderProductdata] = useState([]);
console.log('OrderProductdata', OrderProductdata);
const [OrderDataModel, setOrderDataModal] = useState(false);
const [PaymentModal, setPaymentModal] = useState(false);
const [Paymentdata, setPaymentdata] = useState([]);
@ -711,40 +710,31 @@ const SalesRemovallist = () => {
const handleSave = (row) => {
const newData = [...OrderProductdata];
const index = newData.findIndex((item) => row.ProdId === item.ProdId);
if (index > -1) {
const item = newData.splice(index, 1, { ...row })[0];
setOrderProductdata(item);
// Recalculate offer amounts
const updatedTableData = newData.map((item) => {
if (item.ProdId === row.ProdId) {
const updatedTotalAmt = row.SalesQty * Number(row?.Rate || 0);
return {
...item,
SalesQty: item.SalesQty,
OrderQty: item.SalesQty,
TotalAmt: updatedTotalAmt, // Update the recalculated TotalAmt
const existing = newData[index];
const salesQty = Number(row.SalesQty);
const rate = Number(row?.Rate || 0);
const refundQty = Number(existing.OldSalesQty) - salesQty;
const refundAmount = refundQty * rate;
const updatedRow = {
...existing,
...row,
SalesQty: salesQty,
OrderQty: salesQty,
OrderRate: rate,
TotalAmt: salesQty * rate,
RefundQty: refundQty,
RefundAmount: refundAmount,
};
}
newData.splice(index, 1, updatedRow);
const recalculatedTotalAmt = item.SalesQty * Number(item?.Rate || 0);
return {
...item,
TotalAmt: recalculatedTotalAmt, // Ensure all rows' TotalAmt are updated
};
});
const TotalAmount = updatedTableData.reduce(
const TotalAmount = newData.reduce(
(sum, item) => sum + Number(item?.TotalAmt || 0),
0
);
setTotalAmts(TotalAmount);
setOrderProductdata(updatedTableData);
setOrderProductdata(newData);
}
};
@ -919,19 +909,16 @@ const SalesRemovallist = () => {
);
});
console.log(
SalesQty,
SalesQty.ProductIdentifierDtls.length,
matchingProducts.length,
SalesQty.ProductIdentifierDtls.length >= matchingProducts.length,
'!!!!!!!!!'
const totalRefundAmount = OrderProductdata.reduce(
(sum, prod) => sum + Number(prod?.RefundAmount || 0),
0
);
if (allQtyMatch) {
const postdatas = Proddata.map((item) => ({
const postdatas = Proddata?.map((item) => ({
OrderId: item?.OrderId,
SalesId: item?.SalesId,
OrderQty:item?.SalesId,
OrderQty:item?.OrderQty,
CompId: item?.CompId,
BranchId: item?.BranchId,
OrderType: item?.OrderType,
@ -942,7 +929,7 @@ const SalesRemovallist = () => {
ActiveStatus: item?.ActiveStatus,
UpdatedBy: item?.CreatedBy,
AppId: item?.AppId,
RefundAmount: item?.RefundAmount,
RefundAmount: totalRefundAmount,
AddlInfo: item?.AddlInfo,
BillAmount: item?.BillAmount,
OverallDiscSales: item?.OverallDisc,
@ -956,7 +943,8 @@ const SalesRemovallist = () => {
PaymentStatus: item?.PaymentStatus,
OrderDtlDetails: OrderProductdata.map((prod) => ({
ActiveStatus: prod?.ActiveStatus,
// ActiveStatus: prod?.ActiveStatus,
ActiveStatus: "D",
ProdId: prod?.ProdId,
Type: prod?.Type,
// OrderQty: prod?.OrderQty,
@ -1014,7 +1002,7 @@ const SalesRemovallist = () => {
ActiveStatus: item?.ActiveStatus,
UpdatedBy: item?.CreatedBy,
AppId: item?.AppId,
RefundAmount: item?.RefundAmount,
RefundAmount: totalRefundAmount,
AddlInfo: item?.AddlInfo,
BillAmount: item?.BillAmount,
OverallDiscSales: item?.OverallDisc,
@ -1071,7 +1059,7 @@ const SalesRemovallist = () => {
} else if (isIdentifyDetailsValid) {
// else if(isSalesQtyOldSalesQty){
const postdatas = Proddata.map((item) => ({
const postdatas = Proddata?.map((item) => ({
OrderId: item?.OrderId,
SalesId: item?.SalesId,
CompId: item?.CompId,
@ -1084,7 +1072,7 @@ const SalesRemovallist = () => {
ActiveStatus: item?.ActiveStatus,
UpdatedBy: item?.CreatedBy,
AppId: item?.AppId,
RefundAmount: item?.RefundAmount,
RefundAmount: totalRefundAmount,
AddlInfo: item?.AddlInfo,
BillAmount: item?.BillAmount,
OverallDiscSales: item?.OverallDisc,

View File

@ -18,6 +18,7 @@ const DateWiseReportPdf = ({
}) => {
let PrintDetailsdata = datewiseData?.[0]?.AddressDetails?.[0];
const refundAmount = datewiseData?.[0]?.RefundAmount || 0;
console.log(PrintDetailsdata, 'hhhhhhhhhhhhhhhj');
const [currentTime, setCurrentTime] = useState('');
@ -285,14 +286,16 @@ const DateWiseReportPdf = ({
{TotalCharges > 0 && (
<p className="totaldetails"> Charges: {TotalCharges}</p>
)}
{refundAmount > 0 && (
<p className="totaldetails"> Refund: {refundAmount}</p>
)}
{TotalDiscount > 0 && (
<p className="totaldetails"> Discount(-): {TotalDiscount}</p>
)}
<p className="totaldetails">-------------------------</p>
<p className="totaldetails">
{' '}
Net: {Math.round(TotalNetAmount + (TotalPreOrderAmount || 0))}
Net: {Math.round(TotalBillAmount + TaxAmount + (TotalPreOrderAmount || 0) - (refundAmount))}
</p>
</div>
{/* current Time */}

View File

@ -177,6 +177,9 @@ const ItemWiseReportPdf = ({
{TotalCharges > 0 && (
<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 && (
<p className="totaldetails"> Discount(-): { parseFloat(TotalDiscount).toFixed(2)}</p>
)}
@ -190,7 +193,7 @@ const ItemWiseReportPdf = ({
(TotalTaxAmount || 0) +
(TotalCharges || 0) +
(TotalPreOrderAmount || 0) -
(TotalDiscount || 0)
(TotalDiscount || 0) - (itemData?.[0]?.RefundAmount || 0)
)}
</p>
</div>