From 9aa1330b529212a2ef979a5342a06f46fc782dc7 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Mar 2026 09:48:33 +0530 Subject: [PATCH 1/4] file saver package added --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 5365059..8af1305 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "date-fns": "^4.1.0", "devtools-detect": "^4.0.2", "exceljs": "^4.3.0", + "file-saver": "^2.0.5", "google-maps-react": "^2.0.6", "highcharts": "^11.4.3", "highcharts-react-official": "^3.2.1", From 97842915052fab186513b4935115bcee9e820d05 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Mar 2026 11:55:15 +0530 Subject: [PATCH 2/4] added validation in customer master --- src/Pages/CustomerMaster/CustMasterForm.jsx | 230 +++++++++++--------- 1 file changed, 124 insertions(+), 106 deletions(-) diff --git a/src/Pages/CustomerMaster/CustMasterForm.jsx b/src/Pages/CustomerMaster/CustMasterForm.jsx index 0698166..d86a502 100644 --- a/src/Pages/CustomerMaster/CustMasterForm.jsx +++ b/src/Pages/CustomerMaster/CustMasterForm.jsx @@ -1,4 +1,4 @@ -import { useState, useEffect, useRef } from 'react'; +import { useState, useEffect, useRef, useCallback } from 'react'; import { useDispatch } from 'react-redux'; import { InputField } from '../../Components/Forms/InputField.jsx'; import Buttons from '../../Components/Forms/Buttons.jsx'; @@ -37,6 +37,7 @@ import { MdLocationOn, MdHome } from 'react-icons/md'; import { useSelector } from 'react-redux'; import { ApplicationPreferences } from '../../Features/BrachLogin/BranchLogin.js'; import { IoMdAddCircleOutline } from 'react-icons/io'; +import { isIndianMobile } from '../../utils/calculations.js'; const subDirectory = import.meta.env.BASE_URL; @@ -354,57 +355,41 @@ const CustomerForm = ({ formType }) => { //post data const onFinish = async (values) => { - let postData = values; - console.log(postData, 'postData'); - - // Handle address data - use only the addresses from addressesList - const addedAddresses = addressesList || []; - - // Only include addresses that have Address1 and Zip - const validAddresses = addedAddresses.filter( - (addr) => addr?.Address1 && addr?.Zip - ); - - postData['CustomerAddressDtl'] = validAddresses; - - postData['CreatedBy'] = UserId; - postData['CompId'] = CompId; - postData['BranchId'] = BranchId; - postData['UserId'] = GetUserId; - // postData["OutStandingAmount"] = parseInt(values?.OutStandingAmount); - postData['InitialOutStanding'] = parseInt(values?.OutStandingAmount); - - postData['Document'] = ImageUrl; - postData['CustomerProfile'] = ImageUrl ? ImageUrl : null; - postData['CreditDays'] = - selectedCredit === 'others' ? otherCreditValue : selectedCredit; - let response = {}; - if (formType === 'add') { - // if (SelectedUserCreation === "N") { - postData['AppId'] = AppId; - // } - if (offerType) { - postData['OfferType'] = offerType; - } - if (Maritalstatus == 'N') { - postData['MarriedStatus'] = 'N'; - postData['CustDOB'] = DobDate; - } - if (Maritalstatus == 'Y') { - postData['MarriedStatus'] = 'Y'; - postData['CustDOB'] = DobDate; - postData['SpouseDOB'] = SpouseDobDate; - postData['AnniversaryDate'] = anniversaryDate; + try { + let postData = values; + console.log(postData, 'postData'); + const validMobile = isIndianMobile(postData?.CustMobile); + if (!validMobile) { + setMessageType('warning'); + setMessageData('Please enter a valid Indian mobile number.'); + return; } + // Handle address data - use only the addresses from addressesList + const addedAddresses = addressesList || []; - response = await dispatch(postCust(postData)).unwrap(); - } else if (formType === 'edit') { - if (editstate) { - postData['CustId'] = editstate?.CustId; - postData['AddId'] = editstate?.CustAddId; - postData['AppId'] = editstate?.AppId; - postData['UpdatedBy'] = UserId; - postData['UserId'] = editstate?.UserId; + // Only include addresses that have Address1 and Zip + const validAddresses = addedAddresses.filter( + (addr) => addr?.Address1 && addr?.Zip + ); + + postData['CustomerAddressDtl'] = validAddresses; + + postData['CreatedBy'] = UserId; + postData['CompId'] = CompId; + postData['BranchId'] = BranchId; + postData['UserId'] = GetUserId; + // postData["OutStandingAmount"] = parseInt(values?.OutStandingAmount); + postData['InitialOutStanding'] = parseInt(values?.OutStandingAmount); + + postData['Document'] = ImageUrl; + postData['CustomerProfile'] = ImageUrl ? ImageUrl : null; + postData['CreditDays'] = + selectedCredit === 'others' ? otherCreditValue : selectedCredit; + let response = {}; + if (formType === 'add') { + // if (SelectedUserCreation === "N") { + postData['AppId'] = AppId; + // } if (offerType) { postData['OfferType'] = offerType; } @@ -418,22 +403,48 @@ const CustomerForm = ({ formType }) => { postData['SpouseDOB'] = SpouseDobDate; postData['AnniversaryDate'] = anniversaryDate; } - } - response = await dispatch(putCust(postData)).unwrap(); - } - if (response?.data?.statusCode == 1) { - navigate(`${subDirectory}setting/customer-master/`, { - state: { - Notiffy: { - messageType: 'success', - messageData: response?.data?.response, + response = await dispatch(postCust(postData)).unwrap(); + } else if (formType === 'edit') { + if (editstate) { + postData['CustId'] = editstate?.CustId; + postData['AddId'] = editstate?.CustAddId; + postData['AppId'] = editstate?.AppId; + postData['UpdatedBy'] = UserId; + postData['UserId'] = editstate?.UserId; + if (offerType) { + postData['OfferType'] = offerType; + } + if (Maritalstatus == 'N') { + postData['MarriedStatus'] = 'N'; + postData['CustDOB'] = DobDate; + } + if (Maritalstatus == 'Y') { + postData['MarriedStatus'] = 'Y'; + postData['CustDOB'] = DobDate; + postData['SpouseDOB'] = SpouseDobDate; + postData['AnniversaryDate'] = anniversaryDate; + } + } + response = await dispatch(putCust(postData)).unwrap(); + } + + if (response?.data?.statusCode == 1) { + navigate(`${subDirectory}setting/customer-master/`, { + state: { + Notiffy: { + messageType: 'success', + messageData: response?.data?.response, + }, }, - }, - }); - } else { - setMessageType('error'); - setMessageData(response?.data?.response); + }); + } else { + setMessageType('error'); + setMessageData(response?.data?.response); + } + } catch (error) { + // Validation error will stop submit + console.log("Validation Failed:", error); } }; @@ -841,12 +852,17 @@ const CustomerForm = ({ formType }) => { ); }; + const onComplete = useCallback(() => { + setMessageType(null); + setMessageData(null); + }, []); + return (
- +
@@ -865,10 +881,12 @@ const CustomerForm = ({ formType }) => { rules={[ { required: true, - pattern: /^\d{10}$/, - message: 'Please Enter a Valid Mobile Number', + message: "Please Enter Mobile Number", + }, + { + pattern: /^[6-9]\d{9}$/, + message: "Please enter a valid mobile number", }, - { validator: validatePhoneNumber }, ]} > @@ -888,10 +906,10 @@ const CustomerForm = ({ formType }) => { } inputMode="numeric" onInput={(e) => - (e.target.value = e.target.value.replace( - /[^0-9]/g, - '' - )) + (e.target.value = e.target.value.replace( + /[^0-9]/g, + '' + )) } /> @@ -987,15 +1005,15 @@ const CustomerForm = ({ formType }) => { autocomplete="off" isOnChange={ formType == 'edit' || - formRef.current?.getFieldsValue()?.CustName != '' + formRef.current?.getFieldsValue()?.CustName != '' ? true : false } - // isOnChange={ - // formType == 'edit' || fieldChangeMap['CustName'] - // ? true - // : false - // } + // isOnChange={ + // formType == 'edit' || fieldChangeMap['CustName'] + // ? true + // : false + // } /> { autocomplete="off" isOnChange={ formType == 'edit' || - fieldChangeMap['CustShortName'] + fieldChangeMap['CustShortName'] ? true : false } @@ -1076,9 +1094,9 @@ const CustomerForm = ({ formType }) => {

Upload Profile

- // formType === 'edit' ? editstate?.EmpPhotoLink : e - // } + // getValueFromEvent={(e) => + // formType === 'edit' ? editstate?.EmpPhotoLink : e + // } > { autocomplete="off" isOnChange={ formType == 'edit' || - formRef.current?.getFieldsValue()?.CustEmail + formRef.current?.getFieldsValue()?.CustEmail ? true : false } @@ -1133,7 +1151,7 @@ const CustomerForm = ({ formType }) => { maxLength={15} isOnChange={ formType == 'edit' || - formRef.current?.getFieldsValue()?.CustGSTIN + formRef.current?.getFieldsValue()?.CustGSTIN ? true : false } @@ -1157,7 +1175,7 @@ const CustomerForm = ({ formType }) => { autocapitalize="on" isOnChange={ formType == 'edit' || - formRef.current?.getFieldsValue()?.StateCode + formRef.current?.getFieldsValue()?.StateCode ? true : false } @@ -1173,13 +1191,13 @@ const CustomerForm = ({ formType }) => { style={ offerType == 'P' ? { - opacity: '1', - boxShadow: - 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', - margin: '3px', - padding: '5px', - backgroundColor: '#fff', - } + opacity: '1', + boxShadow: + 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', + margin: '3px', + padding: '5px', + backgroundColor: '#fff', + } : { opacity: '0.6', boxShadow: 'none' } } onClick={() => { @@ -1200,13 +1218,13 @@ const CustomerForm = ({ formType }) => { style={ offerType == 'F' ? { - opacity: '1', - boxShadow: - 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', - margin: '3px', - padding: '5px', - backgroundColor: '#fff', - } + opacity: '1', + boxShadow: + 'rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px', + margin: '3px', + padding: '5px', + backgroundColor: '#fff', + } : { opacity: '0.6', boxShadow: 'none' } } onClick={() => { @@ -1384,7 +1402,7 @@ const CustomerForm = ({ formType }) => { ); }} inputMode="numeric" - // style={{ marginLeft: '10px', width: '120px' }} + // style={{ marginLeft: '10px', width: '120px' }} /> )}
@@ -1404,8 +1422,8 @@ const CustomerForm = ({ formType }) => { autocomplete="off" isOnChange={ formType == 'edit' || - formRef.current?.getFieldsValue() - ?.CreditLimit + formRef.current?.getFieldsValue() + ?.CreditLimit ? true : false } @@ -1932,7 +1950,7 @@ const CustomerForm = ({ formType }) => { { prevlca={ editstate ? { - lat: editstate.Latitude, - lng: editstate.Longitude, - } + lat: editstate.Latitude, + lng: editstate.Longitude, + } : null } /> From e1d73246591ffbdd567c226a907eae68c43ccad8 Mon Sep 17 00:00:00 2001 From: Srinath Date: Fri, 6 Mar 2026 12:22:33 +0530 Subject: [PATCH 3/4] Added Your Order No element in token print --- src/Pages/paymentpdfPage/PaymentPdfBooking.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx b/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx index fe11585..49431c1 100644 --- a/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx +++ b/src/Pages/paymentpdfPage/PaymentPdfBooking.jsx @@ -1733,6 +1733,10 @@ const PaymentPdfBooking = ({ ))} +
+ Your Order No:{' '} + {table2Data?.SalesId && extractLastNumber(table2Data?.SalesId)} +
))} From cfddaef6ad55cd9b94ffb25edaecff75f66616ff Mon Sep 17 00:00:00 2001 From: Tamilselvan Date: Fri, 6 Mar 2026 14:48:57 +0530 Subject: [PATCH 4/4] taxinvoicechangesandeditbill --- .../BSBillingEditQuantity.jsx | 8 +- .../PrintTemplates/A4/TaxInvoice.jsx | 83 ++++++++++++++++--- 2 files changed, 77 insertions(+), 14 deletions(-) diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx index 93cf4e6..e91957c 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx @@ -3180,13 +3180,13 @@ const BSBillingEditQuantity = (props) => { ...( !offerApply && itemDiscountPrice > 0 ? { - DiscountAmt: safeRound(itemDiscountPrice), + DiscountAmt: safeRound(itemDiscountPrice*fixedQty ), DiscountType: itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P', DiscountValue: itemDiscountPercentageSelection === 'Fixed' - ? itemDiscountPrice + ? itemDiscountPrice*fixedQty : ( - (itemDiscountPrice / + (itemDiscountPrice*fixedQty / (newPrice > 0 ? newPrice : editedProduct?.OrderRate)) * 100 ) } @@ -3301,7 +3301,7 @@ const BSBillingEditQuantity = (props) => { const { OfferType = null, OfferPrice = 0 } = product; let totalAmount = qty * rate; - totalAmount = totalAmount - (itemDiscountPrice || 0); + totalAmount = totalAmount - (itemDiscountPrice*qty|| 0); const taxAmount = ( (totalAmount * taxPercentage) / (100 + taxPercentage) diff --git a/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx b/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx index e12d50b..3fe85e2 100644 --- a/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx +++ b/src/Pages/BookingScreen/PrintTemplates/A4/TaxInvoice.jsx @@ -13,6 +13,7 @@ import { GlobalSelectedFooterFontColor, GlobalSelectedNetAmountColor, GlobalSelectedNetAmountFontColor, + GloabalFieldDetails, } from '../../../../Features/ThemeChange/ThemeChange'; import { isMobile } from 'react-device-detect'; import { extractLastNumberOrderId } from '../../../../Services/Others'; @@ -70,6 +71,10 @@ const TaxInvoice = ({ const tableBodyColor = printColors?.find(obj => obj.tableBodyColor)?.tableBodyColor; const footerColor = printColors?.find(obj => obj.footerColor)?.footerColor; const netAmtColor = printColors?.find(obj => obj.netAmtColor)?.netAmtColor; + const FieldDetails = useSelector(GloabalFieldDetails); + console.log(FieldDetails,"FieldDetails") + const Discount = FieldDetails?.['Discount']; + console.log(Discount, "Discount") // Function to convert number to words const numberToWords = (num) => { const a = [ @@ -802,7 +807,8 @@ const TaxInvoice = ({
Rate
+ {Discount &&
+ Disc +
} {/*
per
*/}
Amount @@ -869,7 +884,7 @@ const TaxInvoice = ({ key={index} style={{ display: 'grid', - gridTemplateColumns: '5% 40% 12% 11% 16% 16%', + gridTemplateColumns: Discount ? '5% 40% 12% 11% 8% 8% 16%' : '5% 40% 12% 11% 16% 16%', // borderRight: '1px solid #000', ...(index % 2 === 0 && rowtypeStyle === "even" ? tableBodyStyle @@ -976,6 +991,21 @@ const TaxInvoice = ({ maximumFractionDigits: 2, })}
+ {Discount &&
+ {Number( + + (item.DiscountAmt / item.SalesQty) || 0 + ).toLocaleString('en-IN', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + })} +
} {/*
{item.UomName || 'NOS'}
*/}
+ {Discount &&
}
@@ -1048,7 +1079,7 @@ const TaxInvoice = ({
CGST
+ {Discount &&
}
@@ -1100,7 +1134,7 @@ const TaxInvoice = ({
SGST
+ {Discount &&
}
@@ -1155,7 +1192,7 @@ const TaxInvoice = ({
IGST
+ {Discount &&
}
@@ -1211,7 +1251,7 @@ const TaxInvoice = ({
ROUNDING OFF
+ + {Discount &&
}
@@ -1248,7 +1292,7 @@ const TaxInvoice = ({ key={`empty-${idx}`} style={{ display: 'grid', - gridTemplateColumns: '5% 40% 12% 11% 16% 16%', + gridTemplateColumns: Discount ? '5% 40% 12% 11% 8% 8% 16%' : '5% 40% 12% 11% 16% 16%', // borderRight: '1px solid #000', minHeight: '32px', // Adjust height as needed for your design @@ -1272,6 +1316,15 @@ const TaxInvoice = ({ >  
+ {Discount &&
+   +
}
+ {Discount &&
}
{/*
*/}
No items to display
+ {Discount &&
+ - +
}