Commit 478ac9a7 authored by caluka's avatar caluka

Changes done in E-Collection for receipt amount validation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97434 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 077270aa
......@@ -125,23 +125,23 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0)
{
errCode = "VMSITE1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(genericUtility.getColumnValue("eff_date", dom) == null)
{
tranDate = null;
}
else
{
tranDate = dateFormat2.parse(genericUtility.getColumnValue("eff_date",dom));
sql = "select code from period where ? between fr_date and to_date";
......@@ -207,16 +207,17 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
{
cnt = rs.getInt("COUNT");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( cnt == 0 )
{
errCode = "VTCUSTCD1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else
......@@ -239,16 +240,17 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
{
cnt = rs.getInt("COUNT");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( cnt == 0 )
{
errCode = "VMBANKMIS1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else
{
......@@ -282,20 +284,17 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
{
cnt = rs.getInt("COUNT");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( cnt == 0 )
{
errCode = "VTINVRESER";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
System.out.println("duplicate ref ser");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else
{
......@@ -318,6 +317,10 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
{
cnt = rs.getInt("COUNT");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( cnt == 0 )
{
errCode = "VTINVREFNO";
......@@ -331,13 +334,9 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
errCode = "VTDUPREFNO";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else
{
......@@ -367,11 +366,8 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
errCode = "VTRCPAMT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
isInvAmt = getValidDateFromDom(dom2,refSer,refNo,lineNo, conn);
sql = "SELECT (TOT_AMT - ADJ_AMT) AS AMT FROM RECEIVABLES WHERE TRAN_SER = ? AND REF_NO = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,checkNull(genericUtility.getColumnValue("ref_ser",dom)));
......@@ -385,8 +381,8 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
rs = null;
pstmt.close();
pstmt = null;
System.out.println("isInvAmt>>>["+isInvAmt+"]rcpAmt["+rcpAmt+"]");
if(rcpAmt < isInvAmt)
System.out.println("rcpAmtNew>>>["+rcpAmtNew+"]rcpAmt["+rcpAmt+"]");
if(rcpAmt < rcpAmtNew)
{
errCode = "VTINVTLAMT";
errList.add(errCode);
......@@ -570,6 +566,10 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
{
loginSiteDesc = rs.getString( "DESCR" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append( "<tran_date><![CDATA[" ).append( checkNull( sysDate ) ).append( "]]></tran_date>\r\n" );
valueXmlString.append( "<eff_date><![CDATA[" ).append( checkNull( sysDate ) ).append( "]]></eff_date>\r\n" );
valueXmlString.append("<site_code><![CDATA[" ).append( loginSite ).append( "]]></site_code>\r\n");
......@@ -577,10 +577,7 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
valueXmlString.append("<status><![CDATA[" ).append("E").append( "]]></status>\r\n");
valueXmlString.append("<tran_type><![CDATA[" ).append("E").append( "]]></tran_type>\r\n");
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else if( currentColumn.trim().equalsIgnoreCase( "bank_code" ) )
{
......@@ -594,12 +591,13 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
{
bankName = checkNull(rs.getString( "BANK_NAME" ));
}
valueXmlString.append("<bank_name>").append("<![CDATA["+bankName+"]]>").append("</bank_name>\r\n");
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<bank_name>").append("<![CDATA["+bankName+"]]>").append("</bank_name>\r\n");
}else if( currentColumn.trim().equalsIgnoreCase( "cust_code" ) )
{
custCode = checkNull(genericUtility.getColumnValue("cust_code",dom));
......@@ -610,14 +608,15 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
if( rs.next() )
{
custName = checkNull(rs.getString( "CUST_NAME" ));
}
System.out.println("custName["+custName+"]");
valueXmlString.append("<cust_name><![CDATA[").append(custName).append("]]></cust_name>\r\n");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("custName["+custName+"]");
valueXmlString.append("<cust_name><![CDATA[").append(custName).append("]]></cust_name>\r\n");
}else if( currentColumn.trim().equalsIgnoreCase( "site_code" ) )
{
......@@ -631,12 +630,11 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
{
siteCodeDesc = checkNull(rs.getString( "DESCR" ));
}
valueXmlString.append("<descr><![CDATA[").append(siteCodeDesc).append("]]></descr>\r\n");
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<descr><![CDATA[").append(siteCodeDesc).append("]]></descr>\r\n");
}
valueXmlString.append("</Detail1>");
break;
......@@ -661,16 +659,16 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
pstmt.setString(1, refSer);
pstmt.setString(2, refNo);
rs = pstmt.executeQuery();
if( rs.next() )
{
rcpAmt1=rs.getDouble(1);
}
valueXmlString.append("<rcp_amt><![CDATA[" ).append( rcpAmt1 ).append( "]]></rcp_amt>\r\n");
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<rcp_amt><![CDATA[" ).append( rcpAmt1 ).append( "]]></rcp_amt>\r\n");
}
valueXmlString.append("</Detail2>");
......@@ -781,92 +779,7 @@ public class EcollectionIC extends ValidatorEJB implements EcollectionICLocal, E
}
return msgType;
}
private double getValidDateFromDom(Document dom,String refSer, String refNo,String lineNo, Connection conn) throws ITMException
{
System.out.println("---inside getValidDateFromDom--");
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
String lineNoDom = "";
String refSerDom="",refNoDom="",rcpAmtDomStr="";
double rcpAmtDom=0;
double reduceAmt=0;
try
{
parentList = dom.getElementsByTagName("Detail2");
int parentNodeListLength = parentList.getLength();
for (int prntCtr = 0; prntCtr < parentNodeListLength; prntCtr++ )
{
parentNode = parentList.item(prntCtr);
childList = parentNode.getChildNodes();
for (int ctr = 0; ctr < childList.getLength(); ctr++)
{
childNode = childList.item(ctr);
if(childNode != null && childNode.getNodeName().equalsIgnoreCase("attribute"))
{
String updateFlag = "";
updateFlag = childNode.getAttributes().getNamedItem("updateFlag").getNodeValue();
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("line_no") )
{
lineNoDom = childNode.getFirstChild().getNodeValue().trim();
}
if ( childNode != null && childNode.getFirstChild() != null && childNode.getNodeName().equalsIgnoreCase("ref_no") )
{
refNoDom = childNode.getFirstChild().getNodeValue().trim();
}
if ( childNode != null && childNode.getFirstChild() != null && childNode.getNodeName().equalsIgnoreCase("ref_ser") )
{
refSerDom = childNode.getFirstChild().getNodeValue().trim();
}
if ( childNode != null && childNode.getFirstChild() != null && childNode.getNodeName().equalsIgnoreCase("rcp_amt") )
{
rcpAmtDomStr = childNode.getFirstChild().getNodeValue().trim();
if (rcpAmtDomStr != null && rcpAmtDomStr.trim().length() > 0)
{
try
{
rcpAmtDom = Double.parseDouble(rcpAmtDomStr);
} catch (NumberFormatException n)
{
rcpAmtDom = 0;
}
}
}
}
if (refSer.trim().equalsIgnoreCase(refSerDom.trim()) && refNo.trim().equalsIgnoreCase(refNoDom.trim()) )
{
reduceAmt=reduceAmt+rcpAmtDom;
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
try
{
}
catch(Exception e)
{
e.printStackTrace();
}
}
System.out.println("final reduceAmt ["+reduceAmt+"]");
return reduceAmt;
}
private boolean isDulplicateFrmDom(Document dom,String refNo, String lineNo,String refSer) throws ITMException
{
NodeList parentList = null;
......
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