Commit eb243791 authored by caluka's avatar caluka

Total Receipt amount validation added in header and detail


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@101390 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a74a9406
......@@ -69,7 +69,7 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
String userId = "";
String sql = "";
String errorType = "";
String custCode="",bankCode="",lineNo="";
String custCode="",bankCode="",lineNo="",chqAmtStr="";
int cnt = 0;
int ctr=0;
int childNodeListLength;
......@@ -88,7 +88,7 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
String siteCode="",rcpAmtStr="",refSer="",refNo="",prdCode="";
java.util.Date tranDate = null;
double rcpAmt=0,rcpAmtNew=0,rcpAmtStatus=0.0;
double isInvAmt=0;
double isInvAmt=0.0,chqAmt=0.0;
SimpleDateFormat dateFormat2 = null;
try
{ dateFormat2 = new SimpleDateFormat(genericUtility.getApplDateFormat());
......@@ -258,6 +258,25 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}else if (childNodeName.equalsIgnoreCase("chq_amt"))
{
chqAmtStr = this.genericUtility.getColumnValue("chq_amt", dom);
if(chqAmtStr != null && chqAmtStr.trim().length() > 0)
{
chqAmt= Double.parseDouble(chqAmtStr);
if(chqAmt <= 0)
{
errCode = "VTRCPAMT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}else
{
errCode = "VTRCPAMTNL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}// end for
break; // case 1 end
......@@ -352,23 +371,24 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
lineNo = genericUtility.getColumnValue("line_no",dom);
custCode = this.genericUtility.getColumnValue("cust_code", dom1);
siteCode = this.genericUtility.getColumnValue("site_code", dom1);
if (rcpAmtStr != null && rcpAmtStr.trim().length() > 0)
chqAmtStr = this.genericUtility.getColumnValue("chq_amt", dom1);
if (chqAmtStr != null && chqAmtStr.trim().length() > 0)
{
try
{
rcpAmtNew = Double.parseDouble(rcpAmtStr);
chqAmt= Double.parseDouble(chqAmtStr);
} catch (NumberFormatException n)
{
rcpAmtNew = 0;
chqAmt = 0;
}
}
System.out.println("rcpAmtNew["+rcpAmtNew+"]");
if(rcpAmtNew <= 0)
System.out.println("chqAmt>>>>>>["+chqAmt+"]");
/*if(rcpAmtNew <= 0)
{
errCode = "VTRCPAMT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}*/
sql = "SELECT (TOT_AMT - ADJ_AMT) AS AMT FROM RECEIVABLES WHERE TRAN_SER = ? AND REF_NO = ? AND cust_code = ? and site_code= ? " ;
pstmt = conn.prepareStatement(sql);
......@@ -413,6 +433,13 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
if (ischqAmtGreater(dom2,chqAmt,lineNo))
{
errCode = "VTINVCQAMT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
} // end for
break; // case 2 end
......@@ -490,9 +517,7 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
return errString;
}
//end of validation
// method for item change
// method for item change
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
Document dom = null;
......@@ -960,5 +985,88 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
System.out.println("isDulplicate>>>>>> ["+isDulplicate+"]");
return isDulplicate;
}
private boolean ischqAmtGreater(Document dom, double chqAmt, String lineNo)
{
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
String lineNoDom = "",rcpAmtSt="";
boolean ischqAmtGreater = false;
double chqAmtMeth=0.0,chqAmtSum=0.0;
String refNoDom= "",refSerDom="";
System.out.println("---inside ischqAmtGreater--");
try
{
parentList = dom.getElementsByTagName("Detail2");
int parentNodeListLength = parentList.getLength();
for (int prntCtr = parentNodeListLength; prntCtr > 0; prntCtr-- )
{
parentNode = parentList.item(prntCtr-1);
childList = parentNode.getChildNodes();
for (int ctr = 0; ctr < childList.getLength(); ctr++)
{
childNode = childList.item(ctr);
System.out.println("childNode>>>"+childNode);
if(childNode != null && childNode.getNodeName().equalsIgnoreCase("attribute"))
{
String updateFlag = "";
updateFlag = childNode.getAttributes().getNamedItem("updateFlag").getNodeValue();
System.out.println("updateFlag>>>"+updateFlag);
if (updateFlag.equalsIgnoreCase("D"))
{
System.out.println("Break from here as the record is deleted");
break;
}
}
if ( childNode != null && childNode.getFirstChild() != null &&
childNode.getNodeName().equalsIgnoreCase("rcp_amt") )
{
rcpAmtSt = childNode.getFirstChild().getNodeValue().trim();
if (rcpAmtSt != null && rcpAmtSt.trim().length() > 0)
{
try
{
chqAmtMeth= Double.parseDouble(rcpAmtSt);
} catch (NumberFormatException n)
{
chqAmtMeth = 0;
}
}
}
}
chqAmtSum=chqAmtSum+chqAmtMeth;
}//for loop
System.out.println("chqAmtSum>>>["+chqAmtSum+"]chqAmt>>>>["+chqAmt+"]");
if (chqAmt < chqAmtSum)
{
ischqAmtGreater = true;
}
}catch(Exception e)
{
e.printStackTrace();
}
finally
{
try
{
}
catch(Exception e)
{
e.printStackTrace();
}
}
System.out.println("ischqAmtGreater>>>>>> ["+ischqAmtGreater+"]");
return ischqAmtGreater;
}
//end of validation
}
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