Commit 47d87bf2 authored by Mohammed Dohadwala's avatar Mohammed Dohadwala

Added validation for effective date and expiry date in sales contract...

Added validation for effective date and expiry date in sales contract amendment, sales quotation and sales quotation amendment.
parent 486b5795
......@@ -464,6 +464,34 @@ public class SalesContractAmendmentIC extends ValidatorEJB{
break;
}
}
} // for loop ends
// Mohammed.D 20-04-2026 addid date validation for effective_date and valid_upto
// ================== DATE VALIDATION ==================
String effFrom = whenNull(getItemString(dom, 1, "eff_from"));
String validUpto = whenNull(getItemString(dom, 1, "valid_upto"));
if(effFrom != null && effFrom.trim().length() > 0 &&
validUpto != null && validUpto.trim().length() > 0)
{
Timestamp effDate = Timestamp.valueOf(
genericUtility.getValidDateString(effFrom,
genericUtility.getApplDateFormat(),
genericUtility.getDBDateFormat()) + " 00:00:00");
Timestamp validDate = Timestamp.valueOf(
genericUtility.getValidDateString(validUpto,
genericUtility.getApplDateFormat(),
genericUtility.getDBDateFormat()) + " 00:00:00");
if(effDate.after(validDate))
{
errString = "VEFFDTVLER";
if("E".equalsIgnoreCase(whenNull(insertError(errString, "eff_from"))))
{
return errString;
}
}
}
break;
case 2:
......@@ -1217,6 +1245,7 @@ public class SalesContractAmendmentIC extends ValidatorEJB{
String rate="";
String convQtyStduom="" ;
String unitRate="";
String errString = "";
java.sql.Date ld_tax_date = null, ld_pl_date = null, ld_pord_date = null, ld_dsp_date = null, ld_eff_from = null, ld_valid_upto = null;
try {
switch(objContext)
......
......@@ -511,6 +511,44 @@ public class SalesQuotationAmdIC extends ValidatorEJB implements ValidatorLocal,
} // end for
// Mohammed.D 20-04-2026 addid date validation for effective_date and valid_upto
// ================== DATE VALIDATION ==================
Timestamp effDate = null;
Timestamp validUpto = null;
String effDateStr = genericUtility.getColumnValue("eff_date", dom);
String validUptoStr = genericUtility.getColumnValue("valid_upto", dom);
if(effDateStr != null && effDateStr.trim().length() > 0)
{
effDate = Timestamp.valueOf(
genericUtility.getValidDateString(
effDateStr,
genericUtility.getApplDateFormat(),
genericUtility.getDBDateFormat()
) + " 00:00:00.0"
);
}
if(validUptoStr != null && validUptoStr.trim().length() > 0)
{
validUpto = Timestamp.valueOf(
genericUtility.getValidDateString(
validUptoStr,
genericUtility.getApplDateFormat(),
genericUtility.getDBDateFormat()
) + " 00:00:00.0"
);
}
if(effDate != null && validUpto != null && effDate.after(validUpto))
{
errCode = "VTINVEFDT";
errList.add(errCode);
errFields.add("eff_date");
errFields.add("valid_upto");
}
} // End of Case 1
break;
......
......@@ -119,6 +119,39 @@ public class SalesQuotationIC extends ValidatorEJB implements ValidatorLocal,Val
parentList = dom.getElementsByTagName("Detail1");
parentNode = parentList.item(0);
childList = parentNode.getChildNodes();
// Mohammed.D 20-04-2026 addid date validation for effective_date and valid_upto
// ================== DATE VALIDATION ==================
String effDateStr = checkNull(genericUtility.getColumnValue("eff_date", dom));
String validUptoStr = checkNull(genericUtility.getColumnValue("valid_upto", dom));
Timestamp effDate = null;
Timestamp validUpto = null;
if(effDateStr.trim().length() > 0) {
effDate = Timestamp.valueOf(
genericUtility.getValidDateString(
effDateStr,
genericUtility.getApplDateFormat(),
genericUtility.getDBDateFormat()
) + " 00:00:00.0"
);
}
if(validUptoStr.trim().length() > 0) {
validUpto = Timestamp.valueOf(
genericUtility.getValidDateString(
validUptoStr,
genericUtility.getApplDateFormat(),
genericUtility.getDBDateFormat()
) + " 00:00:00.0"
);
}
if(effDate != null && validUpto != null && effDate.after(validUpto)) {
errCode = "VTINVEFDT";
errList.add(errCode);
errFields.add("eff_date");
errFields.add("valid_upto");
}
for (ctr = 0; ctr < childList.getLength(); ctr++)
{
childNode = childList.item(ctr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment