diff --git a/src/Features/BookingScreen/BookingData/BookingData.js b/src/Features/BookingScreen/BookingData/BookingData.js index 3706e29..6ba669b 100644 --- a/src/Features/BookingScreen/BookingData/BookingData.js +++ b/src/Features/BookingScreen/BookingData/BookingData.js @@ -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}` ); } } diff --git a/src/Pages/BookingScreen/Components/UtillComponents/SalesDetailsNetAmountModal.jsx b/src/Pages/BookingScreen/Components/UtillComponents/SalesDetailsNetAmountModal.jsx index 44b02da..c162061 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/SalesDetailsNetAmountModal.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/SalesDetailsNetAmountModal.jsx @@ -435,7 +435,8 @@ const SalesNetAmountModal = ({ color: '#2e7d32', }} > - {total-RefundAmt} + {/* {total-RefundAmt} */} + {total} ); diff --git a/src/Pages/BookingScreen/Template/RetailBookingClose.jsx b/src/Pages/BookingScreen/Template/RetailBookingClose.jsx index f709de7..2cac1a7 100644 --- a/src/Pages/BookingScreen/Template/RetailBookingClose.jsx +++ b/src/Pages/BookingScreen/Template/RetailBookingClose.jsx @@ -335,6 +335,13 @@ const RetailBookingClosing = (props) => { {safeRound(PaymentClosingData?.OverAllUpiAmount)} + {PaymentClosingData?.OverAllRefundAmount > 0 && (
+

Refund Amount

+
=
+ + {safeRound(PaymentClosingData?.OverAllRefundAmount)} + +
)}

Total Cash In Hand

=
diff --git a/src/Pages/BookingScreen/Template/SalesCountComponent.jsx b/src/Pages/BookingScreen/Template/SalesCountComponent.jsx index 48984a6..8deda8c 100644 --- a/src/Pages/BookingScreen/Template/SalesCountComponent.jsx +++ b/src/Pages/BookingScreen/Template/SalesCountComponent.jsx @@ -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 && (

Take Away:{' '} - {TakeAwayOrderCount + SelfTakeAwayOrderCount || 0} + {(TakeAwayOrderCount + SelfTakeAwayOrderCount || 0)}

)}

Dine In: {DineInOrderCount + SelfDineInOrderCount || 0}

@@ -528,6 +530,20 @@ const SalesCountComponent = React.memo( )}
+ { TakeAwayRefundAmount != 0 &&
+
Refund (-) :
+
+ {safeRound(TakeAwayRefundAmount)} +
+
} +
Total
{safeRound( - TakeAwayAmount + - SelfTakeAwayAmount + - PreOrderAmount - - OverAllTakeAwayOfferAmount - )} + (TakeAwayAmount ?? 0) + + (SelfTakeAwayAmount ?? 0) + + (PreOrderAmount ?? 0) - + (OverAllTakeAwayOfferAmount ?? 0) - + (TakeAwayRefundAmount ?? 0) +)}
@@ -562,11 +579,12 @@ const SalesCountComponent = React.memo( {isMobile ? 'TA' : 'Take Away'}:{' '} {safeRound( - (TakeAwayAmount || - 0 + SelfTakeAwayAmount || - 0 + PreOrderAmount || - 0) - OverAllTakeAwayOfferAmount - )} + ((TakeAwayAmount || 0) + + (SelfTakeAwayAmount || 0) + + (PreOrderAmount || 0)) - + (OverAllTakeAwayOfferAmount || 0) - + (TakeAwayRefundAmount || 0) + )}

@@ -603,6 +621,21 @@ const SalesCountComponent = React.memo( )} + + { DineInRefundAmount != 0 &&
+
Refund (-) :
+
+ {safeRound(DineInRefundAmount)} +
+
} +
Total
{safeRound( - DineInAmount + - SelfDineInAmount - - OverAllDineInOfferAmount - )} + (DineInAmount ?? 0) + + (SelfDineInAmount ?? 0) - + (OverAllDineInOfferAmount ?? 0) - + (DineInRefundAmount ?? 0) +)}
@@ -636,9 +670,10 @@ const SalesCountComponent = React.memo( {isMobile ? 'DI' : 'Dine In'}:{' '} {safeRound( - DineInAmount + - SelfDineInAmount - - OverAllDineInOfferAmount + (DineInAmount ?? 0) + + (SelfDineInAmount ?? 0) - + (OverAllDineInOfferAmount ?? 0) - + (DineInRefundAmount ?? 0) )}

@@ -663,12 +698,19 @@ const SalesCountComponent = React.memo( {isMobile ? 'NA' : 'Net Amt'}:{' '} {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) +)}

{Customisebillno && } diff --git a/src/Pages/CancelReschedule/ChangePaymentmode.jsx b/src/Pages/CancelReschedule/ChangePaymentmode.jsx index 57a9c38..839d253 100644 --- a/src/Pages/CancelReschedule/ChangePaymentmode.jsx +++ b/src/Pages/CancelReschedule/ChangePaymentmode.jsx @@ -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); } diff --git a/src/Pages/DeliveryChallan/Deliverychallan.jsx b/src/Pages/DeliveryChallan/Deliverychallan.jsx index cfed990..7e436e0 100644 --- a/src/Pages/DeliveryChallan/Deliverychallan.jsx +++ b/src/Pages/DeliveryChallan/Deliverychallan.jsx @@ -13,6 +13,7 @@ import { Tooltip, Space, Segmented, + Checkbox, } from 'antd'; import { BsUpcScan } from "react-icons/bs"; import { @@ -62,7 +63,7 @@ import { getPrintSelectionComponentData } from '../../Features/ThemeChange/Theme import { DCPDFMobilePrint } from './DCPDFMobilePrint.js'; import { isMobile } from 'react-device-detect'; import EmailModel from '../BookingScreen/Components/UtillComponents/EmailModel.jsx'; - + const DeliveryChellanForm = () => { const { SadminuserAccess } = useAuth(); @@ -115,7 +116,8 @@ const DeliveryChellanForm = () => { const [segmentValue, setSegmentValue] = useState("N") const [selectedOrder, setSelectedOrder] = useState(); const [orderTableData, setOrderTableData] = useState([]); - const [emailSending, setEmailSending] = useState(false); + 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) { @@ -1157,7 +1161,7 @@ const DeliveryChellanForm = () => { }; const handlePrint = async () => { - setIsSubmitted(false); + setIsSubmitted(false); const DCstyle = await DCPrintStyleFunction( DCPrintTemplateStyle == undefined ? 'Style 13' : DCPrintTemplateStyle); const stylesMap = { @@ -1188,8 +1192,8 @@ const DeliveryChellanForm = () => { if (isMobile) { DCPDFMobilePrint({ PrintTempData: DCPrintTemplateDtl, - UserId: UserId, - dispatch + UserId: UserId, + dispatch }) } else { @@ -1219,7 +1223,7 @@ const DeliveryChellanForm = () => { // setPrintData(record); if (orderData?.CustMail) { - setEmailSending(true); + setEmailSending(true); setTimeout(async () => { try { const blob = await pdfDiv('DC-Default-Print', PurchaseOrderStyle); @@ -1242,15 +1246,15 @@ const DeliveryChellanForm = () => { setMessageData('Email failed to send'); setMessageType('error'); } - finally{ - setEmailSending(false); + finally { + setEmailSending(false); } }, 300); } else { setPendingOrderDetails(ProductDetails); setPendingRecord(record); setiSEmail(true); - setIsSubmitted(false); + setIsSubmitted(false); } }; @@ -1303,7 +1307,7 @@ const DeliveryChellanForm = () => { style={{ display: 'flex', justifyContent: 'space-between', - }}> + }}>
{
- {segmentValue === "N" ?
+ {segmentValue === "N" ?
{ onChangeFunction={handleAdminUserDropDownChange} /> + + {/* */} + + { + setSelectedCustomertype(e.target.checked ? 'Y' : 'N'); + }} + > {selectedCustomertype === 'Y' + ? 'All Branch' + : 'My Branch'} + + + {/* */}
:
{
} /> */} - {(iSEmail || emailSending )&& ( - setiSEmail(false)} - form={form} - handleSendEmailWithEnteredEmail={handleSendEmailWithEnteredEmail} - />)} + {(iSEmail || emailSending) && ( + setiSEmail(false)} + form={form} + handleSendEmailWithEnteredEmail={handleSendEmailWithEnteredEmail} + />)} {PrintingData?.length > 0 &&
{ const state = location?.state; const editstate = state?.editstate; +console.log(editstate,'editstate23233232'); const formRef = useRef(null); const formCategoryRef = useRef(null); diff --git a/src/Pages/Reports/DateWiseReport/DateWiseReport.jsx b/src/Pages/Reports/DateWiseReport/DateWiseReport.jsx index a3fa7fa..49076b8 100644 --- a/src/Pages/Reports/DateWiseReport/DateWiseReport.jsx +++ b/src/Pages/Reports/DateWiseReport/DateWiseReport.jsx @@ -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) { @@ -143,22 +143,22 @@ const DateWiseReport = () => { const Billamountspace = Math.max( 0, 6 - - String( - (AppType - ? datewiseData?.[0]?.WholeSaleExpenseNetAmount - : datewiseData?.[0]?.TotalBillAmount - )?.toFixed(2) - ).length + String( + (AppType + ? datewiseData?.[0]?.WholeSaleExpenseNetAmount + : datewiseData?.[0]?.TotalBillAmount + )?.toFixed(2) + ).length ); const Taxamountspace = Math.max( 0, 6 - - String( - (AppType - ? datewiseData?.[0]?.WholeSaleExpenseTaxAmount - : datewiseData?.[0]?.TaxAmount - )?.toFixed(2) - ).length + String( + (AppType + ? datewiseData?.[0]?.WholeSaleExpenseTaxAmount + : datewiseData?.[0]?.TaxAmount + )?.toFixed(2) + ).length ); const Chargesamountspace = Math.max( 0, @@ -171,22 +171,22 @@ const DateWiseReport = () => { const Discountamountspace = Math.max( 0, 6 - - String( - (AppType - ? datewiseData?.[0]?.WholeSaleExpenseTotalOverallDisc - : datewiseData?.[0]?.TotalOfferAmount - )?.toFixed(2) - ).length + String( + (AppType + ? datewiseData?.[0]?.WholeSaleExpenseTotalOverallDisc + : datewiseData?.[0]?.TotalOfferAmount + )?.toFixed(2) + ).length ); const Netamountspace = Math.max( 0, 6 - - String( - (AppType - ? datewiseData?.[0]?.WholeSaleExpenseNetAmount - : datewiseData?.[0]?.TotalNetAmount - )?.toFixed(2) - ).length + String( + (AppType + ? datewiseData?.[0]?.WholeSaleExpenseNetAmount + : datewiseData?.[0]?.TotalNetAmount + )?.toFixed(2) + ).length ); var data = datewiseData && datewiseData[0] ? datewiseData[0] : {}; var receiptTextdata = @@ -209,8 +209,8 @@ const DateWiseReport = () => { parseFloat( !AppType ? (data?.TotalBillAmount || 0) - - (data?.TotalExtraChargeAmount || 0) + - (data?.TotalOfferAmount || 0) + (data?.TotalExtraChargeAmount || 0) + + (data?.TotalOfferAmount || 0) : data?.WholeSaleExpenseNetAmount || 0 ).toFixed(2) + ' '.repeat(Billamountspace) + @@ -265,7 +265,7 @@ const DateWiseReport = () => { AppType ? datewiseData?.[0]?.WholeSaleExpenseNetAmount || 0 : datewiseData?.[0]?.TotalNetAmount + - (datewiseData?.[0]?.PreOrderNetAmount || 0) || 0 + (datewiseData?.[0]?.PreOrderNetAmount || 0) || 0 ) ).toFixed(2) + ' '.repeat(Netamountspace) + @@ -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) => @@ -552,33 +552,33 @@ const DateWiseReport = () => { // printStyle: style, // }); // } else { - var textEncoded = encodeURI(receiptText); - var TypeCheck = 'PrintReceipt'; - var scheme = 'pozoprinter'; - var packageName = 'com.example.pozoprinter'; + var textEncoded = encodeURI(receiptText); + var TypeCheck = 'PrintReceipt'; + var scheme = 'pozoprinter'; + var packageName = 'com.example.pozoprinter'; - window.location.href = - scheme + - '://' + - textEncoded + - '#Intent;scheme=' + - scheme + - ';package=' + - packageName + - 'ImgS' + - LogoImage + - 'ImgE' + - TypeCheck + - 'TokenS' + - TokenData + - 'TokenE' + - 'EstimateS' + - '' + - 'EstimateE' + - 'HasFooterTextS' + - FooterPrint + - 'HasFooterTextE' + - ';end;'; + window.location.href = + scheme + + '://' + + textEncoded + + '#Intent;scheme=' + + scheme + + ';package=' + + packageName + + 'ImgS' + + LogoImage + + 'ImgE' + + TypeCheck + + 'TokenS' + + TokenData + + 'TokenE' + + 'EstimateS' + + '' + + 'EstimateE' + + 'HasFooterTextS' + + FooterPrint + + 'HasFooterTextE' + + ';end;'; // } } else { await printDiv('RePrint', style); @@ -724,7 +724,7 @@ const DateWiseReport = () => { onChangeFunction={(e) => UserDropDownChange(e)} isOnchanges={selectedUserData ? true : false} valueData={selectedUserData} - // defaultValue={LastSelectConfig} + // defaultValue={LastSelectConfig} /> )} @@ -921,32 +921,38 @@ const DateWiseReport = () => { {!AppType ? (datewiseData?.[0]?.TotalBillAmount || 0) - - (datewiseData?.[0]?.TotalExtraChargeAmount || 0) + - (datewiseData?.[0]?.TotalOfferAmount || 0) + (datewiseData?.[0]?.TotalExtraChargeAmount || 0) + + (datewiseData?.[0]?.TotalOfferAmount || 0) : datewiseData?.[0]?.WholeSaleExpenseNetAmount} {!AppType ? datewiseData?.[0]?.TaxAmount > 0 && ( - - Tax - {datewiseData?.[0]?.TaxAmount} - - ) + + Tax + {datewiseData?.[0]?.TaxAmount} + + ) : datewiseData?.[0]?.WholeSaleExpenseTaxAmount > 0 && ( - - Tax - - {datewiseData?.[0]?.WholeSaleExpenseTaxAmount} - - - )} + + Tax + + {datewiseData?.[0]?.WholeSaleExpenseTaxAmount} + + + )} {datewiseData?.[0]?.TotalExtraChargeAmount > 0 && ( Charges {datewiseData?.[0]?.TotalExtraChargeAmount} )} + {datewiseData?.[0]?.RefundAmount > 0 && ( + + Refund (-) + {datewiseData?.[0]?.RefundAmount} + + )} {datewiseData?.[0]?.PreOrderNetAmount > 0 && ( Preorder @@ -955,23 +961,23 @@ const DateWiseReport = () => { )} {AppType ? datewiseData?.[0]?.WholeSaleExpenseTotalOverallDisc > - 0 && ( - - Discount(-) - - { - datewiseData?.[0] - ?.WholeSaleExpenseTotalOverallDisc - } - - - ) + 0 && ( + + Discount(-) + + { + datewiseData?.[0] + ?.WholeSaleExpenseTotalOverallDisc + } + + + ) : datewiseData?.[0]?.TotalOfferAmount > 0 && ( - - Discount(-) - {datewiseData?.[0]?.TotalOfferAmount} - - )} + + Discount(-) + {datewiseData?.[0]?.TotalOfferAmount} + + )}

@@ -979,12 +985,14 @@ const DateWiseReport = () => { {AppType ? safeRound( - datewiseData?.[0]?.WholeSaleExpenseNetAmount - ) || 0 + datewiseData?.[0]?.WholeSaleExpenseNetAmount + ) || 0 : safeRound( - datewiseData?.[0]?.TotalNetAmount + - (datewiseData?.[0]?.PreOrderNetAmount || 0) - ) || 0} + (datewiseData?.[0]?.TotalBillAmount || 0) + + (datewiseData?.[0]?.TaxAmount || 0) + + (datewiseData?.[0]?.PreOrderNetAmount || 0) - + (datewiseData?.[0]?.RefundAmount || 0) + ) || 0} @@ -999,7 +1007,7 @@ const DateWiseReport = () => { {TotalCashInHand[0]?.PaymentMethod === 'Cash' && TotalCashInHand[0]?.NetAmount < - parseInt(denominationData?.OverAllTotal) && + parseInt(denominationData?.OverAllTotal) && parseInt(denominationData?.OverAllTotal) > 0 && (
{ BalanceQty:item?.BalanceQty, Amount: item?.TotalAmt, StockAvailable:item?.StockAvailable, + RefundAmount: item?.RefundAmount, })); const itemData = DateWisTableData; @@ -1210,6 +1211,14 @@ const ItemWiseReport = () => { )} + {ItemWiseData?.[0]?.RefundAmount > 0 && ( + + Refund (-) + + {safeRound(ItemWiseData?.[0]?.RefundAmount)} + + + )} {ItemWiseData?.[0]?.PreOrderNetAmount > 0 && ( Preorder @@ -1243,7 +1252,7 @@ const ItemWiseReport = () => { (ItemWiseData?.[0]?.TotalOfferAmount ? ItemWiseData?.[0]?.TotalOfferAmount : 0) - ) || 0} + ) - (ItemWiseData?.[0]?.RefundAmount || 0) || 0} diff --git a/src/Pages/SalesRemoval/SalesBillCancelList.jsx b/src/Pages/SalesRemoval/SalesBillCancelList.jsx index 0490639..ab4e7ac 100644 --- a/src/Pages/SalesRemoval/SalesBillCancelList.jsx +++ b/src/Pages/SalesRemoval/SalesBillCancelList.jsx @@ -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]; + 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); - 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 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, diff --git a/src/Pages/paymentpdfPage/DateWiseReportPdf.jsx b/src/Pages/paymentpdfPage/DateWiseReportPdf.jsx index 10c87fd..c883436 100644 --- a/src/Pages/paymentpdfPage/DateWiseReportPdf.jsx +++ b/src/Pages/paymentpdfPage/DateWiseReportPdf.jsx @@ -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 && (

Charges: {TotalCharges}

)} + {refundAmount > 0 && ( +

Refund: {refundAmount}

+ )} {TotalDiscount > 0 && (

Discount(-): {TotalDiscount}

)} -

-------------------------

{' '} - Net: {Math.round(TotalNetAmount + (TotalPreOrderAmount || 0))} + Net: {Math.round(TotalBillAmount + TaxAmount + (TotalPreOrderAmount || 0) - (refundAmount))}

{/* current Time */} diff --git a/src/Pages/paymentpdfPage/ItemwiseReportPdf.jsx b/src/Pages/paymentpdfPage/ItemwiseReportPdf.jsx index 7abe73c..717c0aa 100644 --- a/src/Pages/paymentpdfPage/ItemwiseReportPdf.jsx +++ b/src/Pages/paymentpdfPage/ItemwiseReportPdf.jsx @@ -177,6 +177,9 @@ const ItemWiseReportPdf = ({ {TotalCharges > 0 && (

Charges: {parseFloat(TotalCharges).toFixed(2)}

)} + {itemData?.[0]?.RefundAmount > 0 && ( +

Refund: {parseFloat(itemData?.[0]?.RefundAmount).toFixed(2)}

+ )} {TotalDiscount > 0 && (

Discount(-): { parseFloat(TotalDiscount).toFixed(2)}

)} @@ -190,7 +193,7 @@ const ItemWiseReportPdf = ({ (TotalTaxAmount || 0) + (TotalCharges || 0) + (TotalPreOrderAmount || 0) - - (TotalDiscount || 0) + (TotalDiscount || 0) - (itemData?.[0]?.RefundAmount || 0) )}