Commit 0b16cf13 authored by gahmad's avatar gahmad

changes for domestic receipt


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99416 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 25c24630
...@@ -4,22 +4,30 @@ ...@@ -4,22 +4,30 @@
*/ */
package ibase.webitm.ejb.fin; package ibase.webitm.ejb.fin;
import ibase.system.config.*; import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.dis.DistCommon; import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.*; import java.sql.Connection;
import java.text.*; import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import org.w3c.dom.*; import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@javax.ejb.Stateless @javax.ejb.Stateless
public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, GenReceiptICRemote//implements SessionBean public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, GenReceiptICRemote//implements SessionBean
...@@ -39,6 +47,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -39,6 +47,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
FinCommon finCommon = new FinCommon(); FinCommon finCommon = new FinCommon();
ValidatorEJB validator = null; ValidatorEJB validator = null;
String allXmlDataStr1=""; String allXmlDataStr1="";
String currXmlDataStr1="",hdrXmlDataStr1="";
E12GenericUtility e12GenericUtility = new E12GenericUtility(); E12GenericUtility e12GenericUtility = new E12GenericUtility();
...@@ -55,20 +64,23 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -55,20 +64,23 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
try try
{ {
allXmlDataStr1=allXmlDataStr; allXmlDataStr1=allXmlDataStr;
currXmlDataStr1=currXmlDataStr;
hdrXmlDataStr1=hdrXmlDataStr;
if(currXmlDataStr != null && currXmlDataStr.trim().length()!= 0) if(currXmlDataStr != null && currXmlDataStr.trim().length()!= 0)
{ {
//System.out.println ( "currXmlDataStr: " + currXmlDataStr); //System.out.println ( "currXmlDataStr: " + currXmlDataStr);
currDom = genericUtility.parseString(currXmlDataStr); currDom = genericUtility.parseString(currXmlDataStr);
System.out.println("currXmlDataStr:"+currXmlDataStr);
} }
if(hdrXmlDataStr != null && hdrXmlDataStr.trim().length()!= 0) if(hdrXmlDataStr != null && hdrXmlDataStr.trim().length()!= 0)
{ {
hdrDom = genericUtility.parseString(hdrXmlDataStr); hdrDom = genericUtility.parseString(hdrXmlDataStr);
//System.out.println("hdrXmlDataStr:"+hdrXmlDataStr); System.out.println("hdrXmlDataStr:"+hdrXmlDataStr);
} }
if(allXmlDataStr != null && allXmlDataStr.trim().length()!= 0) if(allXmlDataStr != null && allXmlDataStr.trim().length()!= 0)
{ {
allDom = genericUtility.parseString(allXmlDataStr); allDom = genericUtility.parseString(allXmlDataStr);
//System.out.println("allXmlDataStr:"+allXmlDataStr); System.out.println("allXmlDataStr:"+allXmlDataStr);
} }
errString = wfValData( currDom, hdrDom,allDom,objContext, editFlag, xtraParams ); errString = wfValData( currDom, hdrDom,allDom,objContext, editFlag, xtraParams );
System.out.println ( "ErrString: " + errString); System.out.println ( "ErrString: " + errString);
...@@ -101,6 +113,9 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -101,6 +113,9 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
String errorType = ""; String errorType = "";
String errString = ""; String errString = "";
String bankCode = ""; String bankCode = "";
String siteCodeQuery = "";
String siteSpecificBank = "";
String currCode = "";
String prdCode = "",refNo="",refSer="",lineNo="",refDate=""; String prdCode = "",refNo="",refSer="",lineNo="",refDate="";
java.util.Date tranDate = null; java.util.Date tranDate = null;
int ctr = 0; int ctr = 0;
...@@ -123,6 +138,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -123,6 +138,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
boolean isValidcustRef=false,dateFlag=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>");
String tranDateStr = "",statFin = "";Timestamp tranDateTs = null;
try try
{ {
System.out.println("validation called!!!!"); System.out.println("validation called!!!!");
...@@ -147,6 +163,8 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -147,6 +163,8 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
System.out.println("CHILDNODE === "+childNodeName);
if (childNodeName.equalsIgnoreCase("site_code")) if (childNodeName.equalsIgnoreCase("site_code"))
{ {
siteCode = this.genericUtility.getColumnValue("site_code", dom); siteCode = this.genericUtility.getColumnValue("site_code", dom);
...@@ -214,7 +232,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -214,7 +232,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
errCode = nfCheckPeriod("FIN",tranDate,siteCode); errCode = this.nfCheckPeriod("FIN",tranDate,siteCode);
if(errCode != null && errCode.trim().length() > 0) if(errCode != null && errCode.trim().length() > 0)
{ {
errList.add(errCode); errList.add(errCode);
...@@ -230,6 +248,93 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -230,6 +248,93 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
else if(childNodeName.equalsIgnoreCase("tran_date"))
{
System.out.println("Entering tran date ===="+ctr);
tranDateStr = genericUtility.getColumnValue("tran_date",dom);
siteCode = genericUtility.getColumnValue("site_code", dom);
tranDateTs = Timestamp.valueOf(genericUtility.getValidDateString(tranDateStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+ " 00:00:00.0");
siteCode = genericUtility.getColumnValue("site_code", dom);
sql = "Select code from period where ? between fr_date and to_date ";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, tranDateTs);
rs = pstmt.executeQuery();
if (rs.next())
{
prdCode = rs.getString("code");
System.out.println("Period Code>>>>>>"+prdCode);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (prdCode != null && prdCode.trim().length() > 0)
{
sql = "Select count(1) from period_stat where prd_code = ? "
+ " AND site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, prdCode.trim());
pstmt.setString(2, siteCode.trim());
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
System.out.println("Count for prdCode>>>>>>>>>>"+cnt);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt > 0)
{
sql = "Select stat_fin from period_stat where prd_code = ? and site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, prdCode.trim());
pstmt.setString(2, siteCode.trim());
rs = pstmt.executeQuery();
if (rs.next())
{
statFin = rs.getString("stat_fin");
System.out.println("Status Fin>>>>>>>"+statFin);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//if(statFin != null && statFin.equalsIgnoreCase("N"))
if(statFin != null && "N".equalsIgnoreCase(statFin))
{
errCode = "VTPRDFIN";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else
{
errCode = "VMSTATSND";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else
{
errCode = "VMPRDNTDF";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if (childNodeName.equalsIgnoreCase("cust_code")) else if (childNodeName.equalsIgnoreCase("cust_code"))
{ {
custCode = this.genericUtility.getColumnValue("cust_code", dom); custCode = this.genericUtility.getColumnValue("cust_code", dom);
...@@ -262,9 +367,11 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -262,9 +367,11 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
else if (childNodeName.equalsIgnoreCase("bank_code")) /* else if (childNodeName.equalsIgnoreCase("bank_code"))
{ {
bankCode = this.genericUtility.getColumnValue("bank_code", dom); bankCode = this.genericUtility.getColumnValue("bank_code", dom);
System.out.println("bankCode == "+bankCode);
if(bankCode != null && bankCode.trim().length() > 0) if(bankCode != null && bankCode.trim().length() > 0)
{ {
sql = "SELECT COUNT(*) AS COUNT FROM BANK WHERE BANK_CODE = ? " ; sql = "SELECT COUNT(*) AS COUNT FROM BANK WHERE BANK_CODE = ? " ;
...@@ -276,6 +383,27 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -276,6 +383,27 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
cnt = rs.getInt("COUNT"); cnt = rs.getInt("COUNT");
} }
if( cnt == 0 ) if( cnt == 0 )
{
System.out.println("COUNT IS ZERO SHOULD THROW ERROR");
errCode = "VMBANKMIS1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
siteCode = genericUtility.getColumnValue("site_code", dom);
sql = "select site_code from bank where bank_code = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,bankCode);
rs = pstmt.executeQuery();
if( rs.next())
{
siteCodeQuery = rs.getString("site_code");
}
if( siteCodeQuery.equals(siteCode) )
{ {
errCode = "VMBANKMIS1"; errCode = "VMBANKMIS1";
errList.add(errCode); errList.add(errCode);
...@@ -285,6 +413,10 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -285,6 +413,10 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
else else
{ {
...@@ -292,6 +424,56 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -292,6 +424,56 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}*/
else if (childNodeName.equalsIgnoreCase("bank_code"))
{
bankCode = this.genericUtility.getColumnValue("bank_code", dom);
if(bankCode != null && bankCode.trim().length() > 0)
{
sql = "select count(*) from bank where bank_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, bankCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
if (cnt == 0)
{
errCode = "VMBANK1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
// added by akhilesh on 01/aug/13 as discuss with manoj sharma
siteSpecificBank = finCommon.getFinparams("999999", "SITE_SPECIFIC_BANK", conn);
if(siteSpecificBank != null && "Y".equalsIgnoreCase(siteSpecificBank))
{
siteCode = this.genericUtility.getColumnValue("site_code", dom);
errCode = this.isBankCode(siteCode, bankCode, "FIN");
//errCode = validateBankCode(bankCode, siteCode, conn);
if(errCode != null && errCode.trim().length() > 0)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
// ended by akhilesh on 01/aug/13 as discuss with manoj
}
else
{
errCode = "VMBCNCD1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} }
else if (childNodeName.equalsIgnoreCase("ref_date")) else if (childNodeName.equalsIgnoreCase("ref_date"))
{ {
...@@ -337,6 +519,41 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -337,6 +519,41 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
} }
else if (childNodeName.equalsIgnoreCase("curr_code"))
{
currCode = this.genericUtility.getColumnValue("curr_code", dom);
if(currCode != null && currCode.trim().length() > 0)
{
sql = "select count(*) from currency where curr_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
if (cnt == 0)
{
errCode = "VMCUR1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else
{
errCode = "VMCURRCD1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
} }
//valueXmlString.append("</Detail1>"); //valueXmlString.append("</Detail1>");
break; break;
...@@ -470,6 +687,17 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -470,6 +687,17 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
/**************************/
/*if(isAmountExceed(domAll,conn))
{
System.out.println("Amount Exceed checking...");
errCode = "VTAMTEXEED";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}*/
} }
else if(childNodeName.equalsIgnoreCase("rcp_amt")) else if(childNodeName.equalsIgnoreCase("rcp_amt"))
...@@ -517,7 +745,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -517,7 +745,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
//added checkAmtvalidation by mahendra on dated 03-09-2015 //added checkAmtvalidation by mahendra on dated 03-09-2015
if(checkAmtvalidation(dom1)) if(checkAmtvalidation(dom2))
{ {
errCode = "VTCHQATINV"; errCode = "VTCHQATINV";
errList.add(errCode); errList.add(errCode);
...@@ -525,6 +753,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -525,6 +753,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
} }
System.out.println("ref_ser :"+genericUtility.getColumnValue("ref_ser",domAll)); System.out.println("ref_ser :"+genericUtility.getColumnValue("ref_ser",domAll));
System.out.println("ref_no :"+genericUtility.getColumnValue("ref_no",domAll)); System.out.println("ref_no :"+genericUtility.getColumnValue("ref_no",domAll));
System.out.println("custCode :"+genericUtility.getColumnValue("cust_code", dom1)); System.out.println("custCode :"+genericUtility.getColumnValue("cust_code", dom1));
...@@ -662,6 +891,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -662,6 +891,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
try try
{ {
System.out.println("ALL DOM "+allXmlDataStr);
if (currXmlDataStr != null && currXmlDataStr.trim().length()!=0) if (currXmlDataStr != null && currXmlDataStr.trim().length()!=0)
{ {
currDom = genericUtility.parseString(currXmlDataStr); currDom = genericUtility.parseString(currXmlDataStr);
...@@ -723,7 +953,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -723,7 +953,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
SimpleDateFormat dateFormat2 = null; SimpleDateFormat dateFormat2 = null;
double exchangeRate= 0.0; double exchangeRate= 0.0;
String currencyCode=""; String currencyCode="";
double stdExRt = 0 ;
Connection connObject = null; Connection connObject = null;
PreparedStatement pstmt = null,pstmt1 = null; PreparedStatement pstmt = null,pstmt1 = null;
...@@ -739,7 +969,11 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -739,7 +969,11 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
boolean isFound=false; boolean isFound=false;
String balAmtReqd=""; String balAmtReqd="";
String logCode = "";
int parentNodeListLength=0; int parentNodeListLength=0;
/**added by vishakha*/
int userLevel = 0;
double cummBal = 0.0;
try try
{ {
dateFormat2=new SimpleDateFormat(genericUtility.getApplDateFormat()); dateFormat2=new SimpleDateFormat(genericUtility.getApplDateFormat());
...@@ -776,6 +1010,8 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -776,6 +1010,8 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
{ {
System.out.println("Enter in itm default"); System.out.println("Enter in itm default");
loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSite"); loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSite");
logCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
System.out.println("LOGIN CODE == "+logCode);
sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = ?"; sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = ?";
pstmt = connObject.prepareStatement(sql); pstmt = connObject.prepareStatement(sql);
...@@ -790,6 +1026,36 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -790,6 +1026,36 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
/**************vishakha******************/
sql = "select usr_lev from users where code = ?";
pstmt = connObject.prepareStatement(sql);
pstmt.setString(1, logCode);
rSet = pstmt.executeQuery();
if( rSet.next() )
{
userLevel = rSet.getInt( "usr_lev" );
System.out.println("User level ***"+userLevel);
}
rSet.close(); // added By akhilesh on 10/01/13 to close the statement
rSet = null;
pstmt.close();
pstmt = null;
if(userLevel == 1 || userLevel == 0 )//for user level 1 and 0 pophelp available
{
System.out.println("If User level is one****");
valueXmlString.append("<user_level>").append( userLevel ).append("</user_level>\r\n");
valueXmlString.append("<user_id>").append( logCode ).append("</user_id>\r\n");
//valueXmlString.append( userLevel ).append( "</editFlag>\r\n</Header>\r\n" );
}
/*******************************/
sql = "select bank_code from site where site_code= ? "; sql = "select bank_code from site where site_code= ? ";
...@@ -963,6 +1229,52 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -963,6 +1229,52 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
pstmt = null; pstmt = null;
} }
else if (currentColumn.trim().equalsIgnoreCase("curr_code"))
{
String currCode = "";
String CurrCode = "";
String siteCode = "";
double mexchrate = 0.0D;
currCode = genericUtility.getColumnValue("curr_code", currDom);
siteCode = genericUtility.getColumnValue("site_code", currDom);
tranDate = dateFormat2.parse(getColumnValue("tran_date", currDom));
// 21/09/13 manoharan caqll common function
//mexchrate = takeExchRate(currCode, "", siteCode, tranDate, "S", conn);
mexchrate = finCommon.getDailyExchRateSellBuy(currCode,"",siteCode, genericUtility.getColumnValue("tran_date", currDom), "S", connObject);
siteCodeValue = checkNull(genericUtility.getColumnValue("site_code",currDom));
valueXmlString.append("<exch_rate>").append("<![CDATA[" + mexchrate + "]]>").append("</exch_rate>");
sql = "SELECT CURR_CODE FROM FINENT WHERE FIN_ENTITY IN (SELECT FIN_ENTITY FROM SITE WHERE SITE_CODE = ?) ";
pstmt = connObject.prepareStatement(sql);
pstmt.setString(1, siteCodeValue);
rSet = pstmt.executeQuery();
if (rSet.next())
{
CurrCode = rSet.getString(1);
}
rSet.close();
rSet = null;
pstmt.close();
pstmt = null;
if (currCode.trim().equals(CurrCode.trim()))
{
valueXmlString.append("<exch_rate protect = \"1\">").append("<![CDATA[" + mexchrate + "]]>").append("</exch_rate>");
}
else
{
valueXmlString.append("<exch_rate protect = \"0\">").append("<![CDATA[" + mexchrate + "]]>").append("</exch_rate>");
}
}
valueXmlString.append( "</Detail1>\r\n" ); valueXmlString.append( "</Detail1>\r\n" );
} }
break; break;
...@@ -1068,45 +1380,8 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -1068,45 +1380,8 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
} }
} }
else if ( currentColumn.trim().equalsIgnoreCase( "rcp_amt" ) && ( "A".equalsIgnoreCase( updateFlag ) ) )
{
custDocAmt = Double.parseDouble(genericUtility.getColumnValue("rcp_amt",currDom)==null?"0":genericUtility.getColumnValue("rcp_amt",currDom));
valueXmlString.append("<cust_doc_amt><![CDATA[").append(round(custDocAmt, 3)).append("]]></cust_doc_amt>\r\n");
}
else if ( currentColumn.trim().equalsIgnoreCase( "fin_chg" ) && ( "A".equalsIgnoreCase( updateFlag ) ) )
{
discAppr = Double.parseDouble(genericUtility.getColumnValue("fin_chg",currDom)==null?"0":genericUtility.getColumnValue("fin_chg",currDom));
valueXmlString.append("<disc_appr><![CDATA[").append(round(discAppr, 3)).append("]]></disc_appr>\r\n");
}
else if ( currentColumn.trim().equalsIgnoreCase( "rcp_amt" ) && ( "E".equalsIgnoreCase( updateFlag ) ) )
{
custDocAmt = Double.parseDouble(genericUtility.getColumnValue("cust_doc_amt",currDom)==null?"0":genericUtility.getColumnValue("cust_doc_amt",currDom));
rcpAmt = Double.parseDouble(genericUtility.getColumnValue("rcp_amt",currDom)==null?"0":genericUtility.getColumnValue("rcp_amt",currDom));
discAppr = Double.parseDouble(genericUtility.getColumnValue("disc_appr",currDom)==null?"0":genericUtility.getColumnValue("disc_appr",currDom));
finChg = custDocAmt + discAppr -rcpAmt ;
System.out.println("@@@@@3 :finChg["+finChg+"] = custDocAmt["+custDocAmt+"] + discAppr["+discAppr+" - rcpAmt["+rcpAmt+"]");
valueXmlString.append("<fin_chg><![CDATA[").append(round(finChg, 3)).append("]]></fin_chg>\r\n");
}
else if ( currentColumn.trim().equalsIgnoreCase( "fin_chg" ) && ( "E".equalsIgnoreCase( updateFlag ) ) )
{
discAppr = Double.parseDouble(genericUtility.getColumnValue("disc_appr",currDom)==null?"0":genericUtility.getColumnValue("disc_appr",currDom));
finChg = Double.parseDouble(genericUtility.getColumnValue("fin_chg",currDom)==null?"0":genericUtility.getColumnValue("fin_chg",currDom));
custDocAmt = Double.parseDouble(genericUtility.getColumnValue("cust_doc_amt",currDom)==null?"0":genericUtility.getColumnValue("cust_doc_amt",currDom));
rcpAmt = custDocAmt + discAppr - finChg;
System.out.println("@@@@@4 :rcpAmt["+rcpAmt+"] = custDocAmt["+custDocAmt+"] + discAppr["+discAppr+" - finChg["+finChg+"]");
valueXmlString.append("<rcp_amt><![CDATA[").append(round(rcpAmt, 3)).append("]]></rcp_amt>\r\n");
} else if(currentColumn.trim().equalsIgnoreCase( "rcp_amt" )&& ( "A".equalsIgnoreCase( updateFlag )))/////////have to do changes here
else if(currentColumn.trim().equalsIgnoreCase( "bal_amt_reqd" ))
{
System.out.println("Setting Cumulative Balance Amount to xml");
balAmtReqd=checkNull(genericUtility.getColumnValue("bal_amt_reqd",currDom));
if("Y".equalsIgnoreCase(balAmtReqd))
{ {
chequeAmt = Double.parseDouble(genericUtility.getColumnValue("chq_amt",hdrDom)== null? "0":genericUtility.getColumnValue("chq_amt",hdrDom)); chequeAmt = Double.parseDouble(genericUtility.getColumnValue("chq_amt",hdrDom)== null? "0":genericUtility.getColumnValue("chq_amt",hdrDom));
...@@ -1140,11 +1415,11 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -1140,11 +1415,11 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
//rcpAmt = Double.parseDouble(genericUtility.getColumnValue("rcp_amt", allDom, "2")== null?"0":genericUtility.getColumnValue("rcp_amt", allDom, "2")); //rcpAmt = Double.parseDouble(genericUtility.getColumnValue("rcp_amt", allDom, "2")== null?"0":genericUtility.getColumnValue("rcp_amt", allDom, "2"));
//discAmt = Double.parseDouble(genericUtility.getColumnValue("fin_chg", allDom, "2")== null?"0":genericUtility.getColumnValue("fin_chg", allDom, "2")); //discAmt = Double.parseDouble(genericUtility.getColumnValue("fin_chg", allDom, "2")== null?"0":genericUtility.getColumnValue("fin_chg", allDom, "2"));
rcpAmt = Double.parseDouble(genericUtility.getColumnValueFromNode("rcp_amt",allDom.getElementsByTagName("Detail2").item(ctr))== null?"0":genericUtility.getColumnValueFromNode("rcp_amt",allDom.getElementsByTagName("Detail2").item(ctr))); rcpAmt = Double.parseDouble(genericUtility.getColumnValueFromNode("rcp_amt",allDom.getElementsByTagName("Detail2").item(ctr))== null?"0":genericUtility.getColumnValueFromNode("rcp_amt",allDom.getElementsByTagName("Detail2").item(ctr)));
discAmt = Double.parseDouble(genericUtility.getColumnValueFromNode("fin_chg",allDom.getElementsByTagName("Detail2").item(ctr)) == null?"0":genericUtility.getColumnValueFromNode("fin_chg",allDom.getElementsByTagName("Detail2").item(ctr))); //discAmt = Double.parseDouble(genericUtility.getColumnValueFromNode("fin_chg",allDom.getElementsByTagName("Detail2").item(ctr)) == null?"0":genericUtility.getColumnValueFromNode("fin_chg",allDom.getElementsByTagName("Detail2").item(ctr)));
if(!("D".equalsIgnoreCase(updateFlag1))) if(!("D".equalsIgnoreCase(updateFlag1)))
{ {
chequeAmt = chequeAmt - (rcpAmt + discAmt); chequeAmt = chequeAmt - (rcpAmt);
} }
System.out.println("@@@@ cheq amt="+chequeAmt+" rcp amt="+rcpAmt+" disc amt="+discAmt+" updateFlag1="+updateFlag1); System.out.println("@@@@ cheq amt="+chequeAmt+" rcp amt="+rcpAmt+" disc amt="+discAmt+" updateFlag1="+updateFlag1);
...@@ -1153,13 +1428,105 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -1153,13 +1428,105 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
//commAmt = chequeAmt - (rcpAmt - discAmt); //commAmt = chequeAmt - (rcpAmt - discAmt);
System.out.println("comm amt="+commAmt); System.out.println("comm amt="+commAmt);
System.out.println("in decimeal="+round(commAmt, 3)); System.out.println("in decimeal="+round(commAmt, 3));
custDocAmt = Double.parseDouble(genericUtility.getColumnValue("rcp_amt",currDom)==null?"0":genericUtility.getColumnValue("rcp_amt",currDom));
valueXmlString.append("<comm_bal_amt><![CDATA[").append(round(commAmt, 3)).append("]]></comm_bal_amt>\r\n"); valueXmlString.append("<cust_doc_amt><![CDATA[").append(round(custDocAmt, 3)).append("]]></cust_doc_amt>\r\n");
} valueXmlString.append("<cumm_bal><![CDATA[").append(round(commAmt, 3)).append("]]></cumm_bal>\r\n");
} }
// added by cpatil on 21/12/12 end /*else if ( currentColumn.trim().equalsIgnoreCase( "rcp_amt" ) && ( "A".equalsIgnoreCase( updateFlag ) ) )
{
custDocAmt = Double.parseDouble(genericUtility.getColumnValue("rcp_amt",currDom)==null?"0":genericUtility.getColumnValue("rcp_amt",currDom));
valueXmlString.append("<cust_doc_amt><![CDATA[").append(round(custDocAmt, 3)).append("]]></cust_doc_amt>\r\n");
/* cummBal = cummulativeAmt(allDom);
System.out.println("Cumulative Balance Amount === "+cummBal);
valueXmlString.append("<cumm_bal>").append( cummBal ).append("</cumm_bal>\r\n");
}*/
else if ( currentColumn.trim().equalsIgnoreCase( "fin_chg" ) && ( "A".equalsIgnoreCase( updateFlag ) ) )
{
discAppr = Double.parseDouble(genericUtility.getColumnValue("fin_chg",currDom)==null?"0":genericUtility.getColumnValue("fin_chg",currDom));
valueXmlString.append("<disc_appr><![CDATA[").append(round(discAppr, 3)).append("]]></disc_appr>\r\n");
}
else if ( currentColumn.trim().equalsIgnoreCase( "rcp_amt" ) && ( "E".equalsIgnoreCase( updateFlag ) ) )
{
custDocAmt = Double.parseDouble(genericUtility.getColumnValue("cust_doc_amt",currDom)==null?"0":genericUtility.getColumnValue("cust_doc_amt",currDom));
rcpAmt = Double.parseDouble(genericUtility.getColumnValue("rcp_amt",currDom)==null?"0":genericUtility.getColumnValue("rcp_amt",currDom));
discAppr = Double.parseDouble(genericUtility.getColumnValue("disc_appr",currDom)==null?"0":genericUtility.getColumnValue("disc_appr",currDom));
finChg = custDocAmt + discAppr -rcpAmt ;
System.out.println("@@@@@3 :finChg["+finChg+"] = custDocAmt["+custDocAmt+"] + discAppr["+discAppr+" - rcpAmt["+rcpAmt+"]");
valueXmlString.append("<fin_chg><![CDATA[").append(round(finChg, 3)).append("]]></fin_chg>\r\n");
}
else if ( currentColumn.trim().equalsIgnoreCase( "fin_chg" ) && ( "E".equalsIgnoreCase( updateFlag ) ) )
{
discAppr = Double.parseDouble(genericUtility.getColumnValue("disc_appr",currDom)==null?"0":genericUtility.getColumnValue("disc_appr",currDom));
finChg = Double.parseDouble(genericUtility.getColumnValue("fin_chg",currDom)==null?"0":genericUtility.getColumnValue("fin_chg",currDom));
custDocAmt = Double.parseDouble(genericUtility.getColumnValue("cust_doc_amt",currDom)==null?"0":genericUtility.getColumnValue("cust_doc_amt",currDom));
rcpAmt = custDocAmt + discAppr - finChg;
System.out.println("@@@@@4 :rcpAmt["+rcpAmt+"] = custDocAmt["+custDocAmt+"] + discAppr["+discAppr+" - finChg["+finChg+"]");
valueXmlString.append("<rcp_amt><![CDATA[").append(round(rcpAmt, 3)).append("]]></rcp_amt>\r\n");
}
/*else if(currentColumn.trim().equalsIgnoreCase( "bal_amt_reqd" ))
{
System.out.println("Setting Cumulative Balance Amount to xml");
balAmtReqd=checkNull(genericUtility.getColumnValue("bal_amt_reqd",currDom));
if("Y".equalsIgnoreCase(balAmtReqd))
{
chequeAmt = Double.parseDouble(genericUtility.getColumnValue("chq_amt",hdrDom)== null? "0":genericUtility.getColumnValue("chq_amt",hdrDom));
System.out.println("cheq amt="+chequeAmt);
parentNodeList = allDom.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength();
//Commented by Manoj dtd 08/02/2013 not to calculate comm bal amt
for(int ctr = 0; ctr < parentNodeListLength ; ctr++ )
{
System.out.println("TEST LENGTH="+parentNodeListLength);
parentNode = parentNodeList.item(ctr);
//
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for(ctr2 = 0; ctr2 < childNodeListLength; ctr2++)
{
childNode = childNodeList.item(ctr2);
if( childNode != null )
{
childNodeName = childNode.getNodeName();
if ("attribute".equalsIgnoreCase(childNodeName))
{
updateFlag1 = childNode.getAttributes().getNamedItem("updateFlag").getNodeValue()== null ? "":childNode.getAttributes().getNamedItem("updateFlag").getNodeValue();
break;
}
}
}
//
//rcpAmt = Double.parseDouble(genericUtility.getColumnValue("rcp_amt", allDom, "2")== null?"0":genericUtility.getColumnValue("rcp_amt", allDom, "2"));
//discAmt = Double.parseDouble(genericUtility.getColumnValue("fin_chg", allDom, "2")== null?"0":genericUtility.getColumnValue("fin_chg", allDom, "2"));
rcpAmt = Double.parseDouble(genericUtility.getColumnValueFromNode("rcp_amt",allDom.getElementsByTagName("Detail2").item(ctr))== null?"0":genericUtility.getColumnValueFromNode("rcp_amt",allDom.getElementsByTagName("Detail2").item(ctr)));
discAmt = Double.parseDouble(genericUtility.getColumnValueFromNode("fin_chg",allDom.getElementsByTagName("Detail2").item(ctr)) == null?"0":genericUtility.getColumnValueFromNode("fin_chg",allDom.getElementsByTagName("Detail2").item(ctr)));
if(!("D".equalsIgnoreCase(updateFlag1)))
{
chequeAmt = chequeAmt - (rcpAmt + discAmt);
}
System.out.println("@@@@ cheq amt="+chequeAmt+" rcp amt="+rcpAmt+" disc amt="+discAmt+" updateFlag1="+updateFlag1);
}
commAmt = chequeAmt;
//commAmt = chequeAmt - (rcpAmt - discAmt);
System.out.println("comm amt="+commAmt);
System.out.println("in decimeal="+round(commAmt, 3));
valueXmlString.append("<comm_bal_amt><![CDATA[").append(round(commAmt, 3)).append("]]></comm_bal_amt>\r\n");
}
}*/
// added by cpatil on 21/12/12 end
valueXmlString.append( "</Detail2>\r\n" ); valueXmlString.append( "</Detail2>\r\n" );
System.out.println("valueXmlString---"+valueXmlString); System.out.println("valueXmlString---"+valueXmlString);
} }
...@@ -1306,6 +1673,41 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -1306,6 +1673,41 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
} }
return updateStatus; return updateStatus;
} }
/*---------Added by vishkha on dated 10-12-2015---------------*/
private String getCurrentStatusFlag(Node currDetail)
{
NodeList currDetailList = null;
String status = "",nodeName = "";
int currDetailListLength = 0;
currDetailList = currDetail.getChildNodes();
currDetailListLength = currDetailList.getLength();
for (int i=0;i< currDetailListLength;i++)
{
nodeName = currDetailList.item(i).getNodeName();
if (nodeName.equalsIgnoreCase("Attribute"))
{
status =currDetailList.item(i).getAttributes().getNamedItem("status").getNodeValue();
break;
}
}
return status;
}
/*---------------------------------------------------------------------------*/
private int calcDiff(java.util.Date a,java.util.Date b) private int calcDiff(java.util.Date a,java.util.Date b)
{ {
int tempDifference = 0; int tempDifference = 0;
...@@ -1558,17 +1960,21 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -1558,17 +1960,21 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
String refNo1=""; String refNo1="";
Document domTest = null; Document domTest = null;
int detailsLen=0; int detailsLen=0;
String ref3="",lineNo1="",updateFlag=""; String ref3="",lineNo1="",updateFlag="",status="",statusUpdatedFlag="";
try try
{ {
System.out.println("===========isDulplicateFrmDom=!!!==============="); System.out.println("========isDulplicateFrmDom check 3 times======");
ArrayList<String> refList = new ArrayList<String>(); ArrayList<String> refList = new ArrayList<String>();
System.out.println("@@@@@@@@@@@@@@@@"+allXmlDataStr1); System.out.println("allXmlDataStr1 :"+allXmlDataStr1);
domTest = parseString(allXmlDataStr1); domTest = parseString(allXmlDataStr1);
detailsLen=domTest.getElementsByTagName("Detail2").getLength(); detailsLen=domTest.getElementsByTagName("Detail2").getLength();
System.out.println("detailsLen "+detailsLen); System.out.println("detailsLen "+detailsLen);
for(int i=0 ; i<detailsLen ; i++) for(int i=0 ; i<detailsLen ; i++)
{ {
...@@ -1578,24 +1984,37 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -1578,24 +1984,37 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
System.out.println("lineNo1 :"+lineNo1); System.out.println("lineNo1 :"+lineNo1);
updateFlag = getCurrentUpdateFlag(domTest.getElementsByTagName("Detail2").item(i)); updateFlag = getCurrentUpdateFlag(domTest.getElementsByTagName("Detail2").item(i));
System.out.println("updateFlag :"+updateFlag+" i :"+i); System.out.println("updateFlag :"+updateFlag+" i :"+i);
status=getCurrentStatusFlag(domTest.getElementsByTagName("Detail2").item(i));
System.out.println("status :"+status);
System.out.println(ref3.length()); System.out.println(ref3.length());
System.out.println("check statusUpdatedFlag :"+statusUpdatedFlag);
if("D".equalsIgnoreCase(updateFlag)) if("D".equalsIgnoreCase(updateFlag))
{ {
System.out.println("remove ref id from delete flag :"+ref3.trim());
refList.remove(ref3.trim()); refList.remove(ref3.trim());
} }
else else
{ {
System.out.println("insert ref id :"+ref3.trim());
refList.add(ref3.trim()); refList.add(ref3.trim());
} }
} }
for (String value : refList) { for (String value : refList) {
System.out.println("Value = " + value); System.out.println("Value = " + value);
} }
boolean flag = checkDuplicate(refList); boolean flag = checkDuplicate(refList);
System.out.println("testing flag :"+flag);
if(flag) if(flag)
{ {
isDulplicate=false; isDulplicate=false;
...@@ -1616,6 +2035,113 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -1616,6 +2035,113 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
} }
/****************vishakha 10/12/2015*************/
/* public boolean isDulplicateFrmDom() throws ITMException
{
boolean isDulplicate=false;
String refNoDom="";
Node childNode = null;
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
String refNo1="";
Document domTest = null;
int detailsLen=0;
String ref3="",lineNo1="",updateFlag="",status="",statusUpdatedFlag="";
HashSet<String> reflistHashset = new HashSet<String>();
HashSet<String> dupreflistHashset = new HashSet<String>();
try
{
System.out.println("========isDulplicateFrmDom check 4 times======");
ArrayList<String> refList = new ArrayList<String>();
System.out.println("allXmlDataStr1 :"+allXmlDataStr1);
domTest = parseString(allXmlDataStr1);
detailsLen=domTest.getElementsByTagName("Detail2").getLength();
System.out.println("detailsLen "+detailsLen);
for(int i=0 ; i<detailsLen ; i++)
{
ref3=e12GenericUtility.getColumnValueFromNode("ref_no", domTest.getElementsByTagName("Detail2").item(i));
System.out.println("ref3 :"+ref3 + " i "+i);
lineNo1=e12GenericUtility.getColumnValueFromNode("line_no", domTest.getElementsByTagName("Detail2").item(i));
System.out.println("lineNo1 :"+lineNo1);
updateFlag = getCurrentUpdateFlag(domTest.getElementsByTagName("Detail2").item(i));
System.out.println("updateFlag :"+updateFlag+" i :"+i);
status=getCurrentStatusFlag(domTest.getElementsByTagName("Detail2").item(i));
System.out.println("status :"+status);
System.out.println(ref3.length());
System.out.println("check statusUpdatedFlag :"+statusUpdatedFlag);
if("D".equalsIgnoreCase(updateFlag))
{
System.out.println("remove ref id from delete flag :"+ref3.trim());
//refList.remove(ref3.trim());
}
else
{
System.out.println("insert ref id :"+ref3.trim());
//refList.add(ref3.trim());
if(!(reflistHashset.add(ref3.trim())))
{
dupreflistHashset.add(ref3.trim());
}
}
}
for (String value : refList) {
System.out.println("Value = " + value);
}
for (String value : reflisths) {
System.out.println("Value = " + value);
}
List<String> list = new ArrayList<String>(reflisths);
System.out.println(list.toString());
//boolean flag = checkDuplicate(refList);
//System.out.println("testing flag :"+flag);
if(flag)
{
isDulplicate=false;
}
else
{
isDulplicate=true;
}
//System.out.println("flag !!"+isDulplicate);
}
catch(Exception e)
{
e.printStackTrace();
isDulplicate=false;
}
System.out.println("isDulplicate :"+isDulplicate);
return isDulplicate;
}*/
/*******************/
//checkAccValidation //checkAccValidation
...@@ -1716,7 +2242,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -1716,7 +2242,7 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
public boolean checkAmtvalidation(Document dom1) throws ITMException public boolean checkAmtvalidation(Document dom) throws ITMException
{ {
boolean flag=false; boolean flag=false;
NodeList parentList = null; NodeList parentList = null;
...@@ -1730,16 +2256,19 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -1730,16 +2256,19 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
try try
{ {
System.out.println("========checkAmtvalidation========"); System.out.println("========checkAmtvalidation========");
domTest = parseString(allXmlDataStr1); //domTest = parseString(allXmlDataStr1);
detailsLen=domTest.getElementsByTagName("Detail2").getLength();
detailsLen=dom.getElementsByTagName("Detail2").getLength();
System.out.println("detailsLen "+detailsLen); System.out.println("detailsLen "+detailsLen);
chqAmt=Double.parseDouble(this.genericUtility.getColumnValue("chq_amt", dom1)); chqAmt=Double.parseDouble(this.genericUtility.getColumnValue("chq_amt", dom));
System.out.println("chqAmt :"+chqAmt); System.out.println("chqAmt :"+chqAmt);
for(int i=0 ; i<detailsLen ; i++) for(int i=0 ; i<detailsLen ; i++)
{ {
updateFlag = getCurrentUpdateFlag(domTest.getElementsByTagName("Detail2").item(i)); updateFlag = getCurrentUpdateFlag(dom.getElementsByTagName("Detail2").item(i));
System.out.println("updateFlag :"+updateFlag+" i :"+i); System.out.println("updateFlag :"+updateFlag+" i :"+i);
rcpAmt= Double.parseDouble(e12GenericUtility.getColumnValueFromNode("rcp_amt", domTest.getElementsByTagName("Detail2").item(i))); rcpAmt= Double.parseDouble(e12GenericUtility.getColumnValueFromNode("rcp_amt", dom.getElementsByTagName("Detail2").item(i)));
System.out.println("rcpAmt :"+rcpAmt); System.out.println("rcpAmt :"+rcpAmt);
if("D".equalsIgnoreCase(updateFlag)) if("D".equalsIgnoreCase(updateFlag))
{ {
...@@ -1830,7 +2359,162 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -1830,7 +2359,162 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
} }
/*************added by vishakha on 08/12/15 for cumulative amount calculation**********/
/*public double cummulativeAmt(Document dom1) throws ITMException
{
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Document domTest = null;
int detailsLen=0;
double rcpAmt=0.0,chqAmt=0.0,totRcpAmt=0.0;
String updateFlag="";
double cummBal = 0.0;
try
{
System.out.println("========cumm balance========");
domTest = parseString(allXmlDataStr1);
detailsLen=domTest.getElementsByTagName("Detail2").getLength();
System.out.println("detailsLen "+detailsLen);
chqAmt=Double.parseDouble(this.genericUtility.getColumnValue("chq_amt", dom1));
System.out.println("chqAmt :"+chqAmt);
for(int i=0 ; i<detailsLen ; i++)
{
updateFlag = getCurrentUpdateFlag(domTest.getElementsByTagName("Detail2").item(i));
System.out.println("updateFlag :"+updateFlag+" i :"+i);
rcpAmt= Double.parseDouble(e12GenericUtility.getColumnValueFromNode("rcp_amt", domTest.getElementsByTagName("Detail2").item(i)));
System.out.println("rcpAmt :"+rcpAmt);
if("D".equalsIgnoreCase(updateFlag))
{
totRcpAmt=totRcpAmt-rcpAmt;
}
else
{
totRcpAmt = totRcpAmt + rcpAmt;
}
}
System.out.println("totRcpAmt :"+totRcpAmt);
cummBal = chqAmt - totRcpAmt;
System.out.println("Cumulative balance : "+cummBal);
}
catch(Exception e)
{
e.printStackTrace();
}
return cummBal;
}*/
public boolean isAmountExceed(Document dom1,Connection conn) throws ITMException
{
boolean flag=false;
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Document domTest = null;
int detailsLen=0;
double rcpAmtVal=0.0,rcpAmtDet=0.0,totRcpAmt=0.0;
String updateFlag="",siteCode = "";
PreparedStatement pstmt = null ,pstmt1 = null;
ResultSet rs = null ,rs1 = null;
String sql = "";
try
{
System.out.println("=======Amount Exceed========");
domTest = parseString(allXmlDataStr1);
detailsLen=domTest.getElementsByTagName("Detail2").getLength();
System.out.println("detailsLen "+detailsLen);
siteCode = checkNull(genericUtility.getColumnValue("site_code",dom1));
System.out.println("siteCode$$$$$$$$"+siteCode);
for(int i=0 ; i<detailsLen ; i++)
{
sql = "SELECT (TOT_AMT - ADJ_AMT) AS AMT FROM RECEIVABLES WHERE REF_NO = ? and site_code=? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,checkNull(genericUtility.getColumnValue("ref_no",dom1)));
pstmt.setString(2,checkNull(genericUtility.getColumnValue("site_code",dom1)));
rs = pstmt.executeQuery();
if( rs.next())
{
rcpAmtVal=rs.getDouble(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("rcpAmtVal :"+rcpAmtVal);
// and tran_id <> ?
String tranID = "";
tranID = checkNull(genericUtility.getColumnValue("tran_id",dom1));
if(tranID.trim().length() == 0)
{
tranID = "X";
}
sql = "select sum(rcp_amt) as rcpAmt from rcpdet_form where ref_no = ? and tran_id in(select tran_id from receipt_form where confirmed='N') and tran_id <> ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,checkNull(genericUtility.getColumnValue("ref_no",dom1)));
pstmt.setString(2,tranID);
rs = pstmt.executeQuery();
if( rs.next())
{
rcpAmtDet=rs.getDouble(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("rcpAmtVal :"+rcpAmtVal);
System.out.println("rcpAmtDet 1 time :"+rcpAmtDet);
Double rcpAmtFromDom = 0.0;
rcpAmtFromDom = Double.parseDouble(checkNull(genericUtility.getColumnValue("rcp_amt",dom1))); //reading current dom value
rcpAmtDet = rcpAmtDet + rcpAmtFromDom;
System.out.println("rcpAmtDet 2 time after adding current amount :"+rcpAmtDet);
if(rcpAmtDet > rcpAmtVal)
{
flag=true;//amount exceeds than total amount in receivables
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
return flag;
}
/*****************/
} }
......
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