Commit d9dd765f authored by mjadhav's avatar mjadhav

add validation for refernce date


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98428 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1f39d808
...@@ -101,7 +101,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -101,7 +101,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
String errorType = ""; String errorType = "";
String errString = ""; String errString = "";
String bankCode = ""; String bankCode = "";
String prdCode = "",refNo="",refSer="",lineNo=""; String prdCode = "",refNo="",refSer="",lineNo="",refDate="";
java.util.Date tranDate = null; java.util.Date tranDate = null;
int ctr = 0; int ctr = 0;
int currentFormNo = 0; int currentFormNo = 0;
...@@ -120,7 +120,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -120,7 +120,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
int countCustRef=0,refSerCnt=0; int countCustRef=0,refSerCnt=0;
int childNodeListLength=0; int childNodeListLength=0;
double rcpAmt=0.0,chqAmt=0.0,rcpAmtVal=0.0; double rcpAmt=0.0,chqAmt=0.0,rcpAmtVal=0.0;
boolean isValidcustRef=false; boolean isValidcustRef=false,dateFlag=false;
ArrayList<String> refNoList = new ArrayList<String>(); ArrayList<String> refNoList = new ArrayList<String>();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try try
...@@ -293,6 +293,23 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -293,6 +293,23 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
else if (childNodeName.equalsIgnoreCase("ref_date"))
{
refDate = this.genericUtility.getColumnValue("ref_date", dom);
System.out.println("refDate :"+refDate);
if(refDate != null && refDate.trim().length() > 0)
{
dateFlag= isValidDate(refDate);
System.out.println("dateFlag :"+dateFlag);
if(dateFlag == false)
{
System.out.println("Invalid Refernce Date ");
errCode = "VTINVREFDT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if (childNodeName.equalsIgnoreCase("chq_amt")) else if (childNodeName.equalsIgnoreCase("chq_amt"))
{ {
if(!(isNumeric(this.genericUtility.getColumnValue("chq_amt", dom)))) if(!(isNumeric(this.genericUtility.getColumnValue("chq_amt", dom))))
...@@ -1752,6 +1769,38 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -1752,6 +1769,38 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
return true; return true;
} }
public boolean isValidDate(String date) throws ITMException, Exception
{
E12GenericUtility e12GenericUtility = new E12GenericUtility();
// SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yy");
java.util.Date testDate = null;
Boolean isReult = true;
SimpleDateFormat sdf1 = null;
try
{
sdf1 = new SimpleDateFormat(e12GenericUtility.getApplDateFormat());
System.out.println("DATE FORMAT>>>>>>" + e12GenericUtility.getApplDateFormat());
testDate = sdf1.parse(date);
if (!sdf1.format(testDate).equals(date))
{
isReult = false;
}
} catch (ParseException e)
{
isReult = false;
}
return isReult;
}
} }
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