Commit ad931270 authored by vkadam's avatar vkadam

Implement Log generation for XML.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100185 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c07c299c
package ibase.webitm.ejb.fin; package ibase.webitm.ejb.fin;
import ibase.system.config.AppConnectParm; import ibase.system.config.AppConnectParm;
import ibase.utility.EMail; import ibase.utility.CommonConstants;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.MasterStatefulLocal; import ibase.utility.EMail;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.dis.DistCommon; import ibase.webitm.ejb.MasterStatefulLocal;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException; import ibase.webitm.ejb.dis.DistCommon;
import java.rmi.RemoteException; import ibase.webitm.utility.GenericUtility;
import java.sql.Connection; import ibase.webitm.utility.ITMException;
import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.io.File;
import java.sql.SQLException; import java.io.FileOutputStream;
import java.sql.Timestamp; import java.io.IOException;
import java.text.SimpleDateFormat; import java.rmi.RemoteException;
import java.util.Calendar; import java.sql.Connection;
import java.sql.PreparedStatement;
import javax.naming.InitialContext; import java.sql.ResultSet;
import javax.xml.rpc.ParameterMode; import java.sql.SQLException;
import org.apache.axis.client.Call; import java.sql.Timestamp;
import org.apache.axis.client.Service; import java.text.SimpleDateFormat;
import org.apache.axis.encoding.XMLType; import java.util.Calendar;
import org.w3c.dom.Document;
import ibase.webitm.ejb.fin.adv.ReceiptAdvConf; import javax.naming.InitialContext;
import javax.xml.rpc.ParameterMode;
@javax.ejb.Stateless
public class ReceiptAutoConfPOS extends ValidatorEJB implements ReceiptAutoConfPOSLocal, ReceiptAutoConfPOSRemote { import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
FinCommon finCommon = new FinCommon(); import org.apache.axis.encoding.XMLType;
DistCommon distCommon = new DistCommon(); import org.w3c.dom.Document;
public String postSave() throws RemoteException, ITMException { import ibase.webitm.ejb.fin.adv.ReceiptAdvConf;
return "";
} @javax.ejb.Stateless
public class ReceiptAutoConfPOS extends ValidatorEJB implements ReceiptAutoConfPOSLocal, ReceiptAutoConfPOSRemote {
public String postSave(String domString, String editFlag,String xtraParams, Connection conn) throws RemoteException,ITMException
{ FinCommon finCommon = new FinCommon();
String retString = postSave(domString, editFlag, xtraParams, true, conn); DistCommon distCommon = new DistCommon();
GenericUtility genericUtility = GenericUtility.getInstance(); FileOutputStream fos1 = null;
Document dom = genericUtility.parseString(domString); E12GenericUtility genericUtility=new E12GenericUtility();
PreparedStatement pstmt = null; Calendar calendar = Calendar.getInstance();
ResultSet rs= null;
String tranId = ""; public String postSave() throws RemoteException, ITMException {
StringBuffer commInfo = new StringBuffer(); return "";
String sql="",userType="",custCode="",tranType="",rcpMode="",bankCode="",refNo="",confDate=""; }
String siteCode="",emailAddr="";
String refDate="",remarks="",dlvMode="",dlvRef="",netAmt="",currCode="",exchRate="",empCodeAprv="",descr="",custName=""; public String postSave(String domString, String editFlag,String xtraParams, Connection conn) throws RemoteException,ITMException
String formatCode="RECPT_MAIL"; {
Timestamp tranDate=null; java.util.Date startDate = new java.util.Date(System.currentTimeMillis());
String startDateStr="";
if (retString.trim().length() == 0) System.out.println("Intializing Log $$$$$..."+ intializingLog("Rcp_Aut_Cnf_Pos_log"));
{
System.out.println("@V@ Post save return string :-[" + retString+ "]"); String retString="";
tranId = GenericUtility.getInstance().getColumnValue("tran_id", dom); try
ReceiptAdvConf obj = new ReceiptAdvConf(); {
retString = obj.confirm(tranId, xtraParams, "", conn); SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getApplDateFormat());
System.out.println("@V@ Confirm return string :- [" + retString+ "]"); startDate = new java.util.Date(System.currentTimeMillis());
if (retString.contains("VTCICONF3")) calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis()));
{ startDateStr = sdf1.format(startDate)+" "+calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE)+":"+calendar.get(Calendar.SECOND);
//Added by Pankaj to send auto-mail to concern employee on 20/NOV/2015 fos1.write(("Receipt auto Confirm start at :- [" + startDateStr +"]\r\n\n").getBytes());
try
{ fos1.write(("Dom String :- [" + domString +"]\r\n\n").getBytes());
sql="SELECT TRAN_DATE,SITE_CODE,CUST_CODE,TRAN_TYPE,RCP_MODE,BANK_CODE,REF_NO,REF_DATE,REMARKS,DLV_MODE," +
"DLV_REF,NET_AMT,CURR_CODE,EXCH_RATE,EMP_CODE__APRV,CONF_DATE FROM RECEIPT WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql); retString = postSave(domString, editFlag, xtraParams, true, conn);
pstmt.setString(1, tranId); fos1.write(("After POST SAVE Return String:- [" + retString +"]\r\n\n").getBytes());
rs = pstmt.executeQuery(); } catch (IOException e2)
if(rs.next()) {
{ // TODO Auto-generated catch block
tranDate = (rs.getTimestamp("TRAN_DATE")); e2.printStackTrace();
siteCode = checkNull(rs.getString("SITE_CODE")); } catch (Exception e2)
custCode = checkNull(rs.getString("CUST_CODE")); {
tranType = checkNull(rs.getString("TRAN_TYPE")); // TODO Auto-generated catch block
rcpMode = checkNull(rs.getString("RCP_MODE")); e2.printStackTrace();
bankCode = checkNull(rs.getString("BANK_CODE")); }
refNo = checkNull(rs.getString("REF_NO"));
refDate = checkNull(rs.getString("REF_DATE")); GenericUtility genericUtility = GenericUtility.getInstance();
remarks = checkNull(rs.getString("REMARKS")); Document dom = genericUtility.parseString(domString);
dlvMode = checkNull(rs.getString("DLV_MODE")); PreparedStatement pstmt = null;
dlvRef = checkNull(rs.getString("DLV_REF")); ResultSet rs= null;
netAmt = checkNull(rs.getString("NET_AMT")); String tranId = "";
currCode = checkNull(rs.getString("CURR_CODE")); StringBuffer commInfo = new StringBuffer();
exchRate = checkNull(rs.getString("EXCH_RATE")); String sql="",userType="",custCode="",tranType="",rcpMode="",bankCode="",refNo="",confDate="";
empCodeAprv = checkNull(rs.getString("EMP_CODE__APRV")); String siteCode="",emailAddr="";
confDate = checkNull(rs.getString("CONF_DATE")); String refDate="",remarks="",dlvMode="",dlvRef="",netAmt="",currCode="",exchRate="",empCodeAprv="",descr="",custName="";
System.out.println("refDate before>>>>"+refDate); String formatCode="RECPT_MAIL";
System.out.println("tranDate>>>>"+tranDate); Timestamp tranDate=null;
refDate = genericUtility.getValidDateString(refDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat()); String errString="";
confDate = genericUtility.getValidDateString(confDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat());
} if (retString.trim().length() == 0)
rs.close(); {
rs = null; System.out.println("@V@ Post save return string :-[" + retString+ "]");
pstmt.close(); tranId = GenericUtility.getInstance().getColumnValue("tran_id", dom);
pstmt = null; ReceiptAdvConf obj = new ReceiptAdvConf();
retString = obj.confirm(tranId, xtraParams, "", conn);
sql = "select cust_name from customer where cust_code= ? "; System.out.println("@V@ Confirm return string :- [" + retString+ "]");
pstmt = conn.prepareStatement(sql); try
pstmt.setString(1, custCode); {
rs = pstmt.executeQuery(); fos1.write(("After CONFIRM Return String:- [" + retString +"]\r\n\n").getBytes());
if(rs.next()) } catch (IOException e1)
{ {
custName = checkNull(rs.getString("cust_name")); // TODO Auto-generated catch block
} e1.printStackTrace();
rs.close(); }
rs = null;
pstmt.close(); if (retString.contains("VTCICONF3"))
pstmt = null; {
//Added by Pankaj to send auto-mail to concern employee on 20/NOV/2015
sql = "select email_addr from site where site_code= ? "; try
pstmt = conn.prepareStatement(sql); {
pstmt.setString(1, siteCode); sql="SELECT TRAN_DATE,SITE_CODE,CUST_CODE,TRAN_TYPE,RCP_MODE,BANK_CODE,REF_NO,REF_DATE,REMARKS,DLV_MODE," +
rs = pstmt.executeQuery(); "DLV_REF,NET_AMT,CURR_CODE,EXCH_RATE,EMP_CODE__APRV,CONF_DATE FROM RECEIPT WHERE TRAN_ID = ?";
if(rs.next()) pstmt = conn.prepareStatement(sql);
{ pstmt.setString(1, tranId);
emailAddr = checkNull(rs.getString("email_addr")); rs = pstmt.executeQuery();
System.out.println("email_addr>>> "+emailAddr); if(rs.next())
} {
rs.close(); tranDate = (rs.getTimestamp("TRAN_DATE"));
rs = null; siteCode = checkNull(rs.getString("SITE_CODE"));
pstmt.close(); custCode = checkNull(rs.getString("CUST_CODE"));
pstmt = null; tranType = checkNull(rs.getString("TRAN_TYPE"));
rcpMode = checkNull(rs.getString("RCP_MODE"));
sql="SELECT descr FROM gencodes WHERE MOD_NAME = 'X' AND FLD_NAME = 'EMAIL_ID_AML' " + bankCode = checkNull(rs.getString("BANK_CODE"));
"and sh_descr in(select registr_5 from customer c,receipt r " + refNo = checkNull(rs.getString("REF_NO"));
"where c.cust_code=r.cust_code and r.tran_id= ?) "; refDate = checkNull(rs.getString("REF_DATE"));
pstmt = conn.prepareStatement(sql); remarks = checkNull(rs.getString("REMARKS"));
pstmt.setString(1, tranId); dlvMode = checkNull(rs.getString("DLV_MODE"));
rs = pstmt.executeQuery(); dlvRef = checkNull(rs.getString("DLV_REF"));
if(rs.next()) netAmt = checkNull(rs.getString("NET_AMT"));
{ currCode = checkNull(rs.getString("CURR_CODE"));
descr = checkNull(rs.getString("descr")); exchRate = checkNull(rs.getString("EXCH_RATE"));
System.out.println(" descr ::"+descr); empCodeAprv = checkNull(rs.getString("EMP_CODE__APRV"));
} confDate = checkNull(rs.getString("CONF_DATE"));
rs.close(); System.out.println("refDate before>>>>"+refDate);
rs = null; System.out.println("tranDate>>>>"+tranDate);
pstmt.close(); refDate = genericUtility.getValidDateString(refDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat());
pstmt = null; confDate = genericUtility.getValidDateString(confDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat());
}
commInfo.append("<ROOT>"); rs.close();
commInfo.append("<MAIL><EMAIL_TYPE>page</EMAIL_TYPE><ENTITY_CODE>BASE</ENTITY_CODE>"); rs = null;
commInfo.append("<ENTITY_TYPE>"+userType+"</ENTITY_TYPE>"); pstmt.close();
commInfo.append("<TO_ADD>"+descr+","+emailAddr+"</TO_ADD>"); pstmt = null;
commInfo.append("<BCC_ADD></BCC_ADD>");
commInfo.append("<FORMAT_CODE>"+formatCode+"</FORMAT_CODE>"); sql = "select cust_name from customer where cust_code= ? ";
commInfo.append("<ATTACHMENT><BODY></BODY><LOCATION></LOCATION></ATTACHMENT>"); pstmt = conn.prepareStatement(sql);
commInfo.append("</MAIL>"); pstmt.setString(1, custCode);
commInfo.append("<XML_DATA><ROOT><Detail1><TRAN_ID>"+tranId+"</TRAN_ID><TRAN_DATE>"+tranDate+"</TRAN_DATE>" + rs = pstmt.executeQuery();
"<CUST_CODE>"+custCode+"</CUST_CODE><CUST_NAME>"+custName+"</CUST_NAME><TRAN_TYPE>"+tranType+"</TRAN_TYPE><RCP_MODE>"+rcpMode+"</RCP_MODE>" + if(rs.next())
"<BANK_CODE>"+bankCode+"</BANK_CODE><REF_NO>"+refNo+"</REF_NO><REF_DATE>"+refDate+"</REF_DATE>" + {
"<REMARKS>"+remarks+"</REMARKS><CONF_DATE>"+confDate+"</CONF_DATE><DLV_MODE>"+dlvMode+"</DLV_MODE><DLV_REF>"+dlvRef+"</DLV_REF>" + custName = checkNull(rs.getString("cust_name"));
"<NET_AMT>"+netAmt+"</NET_AMT><CURR_CODE>"+currCode+"</CURR_CODE><EXCH_RATE>"+exchRate+"</EXCH_RATE>" + }
"<emp_code>"+empCodeAprv+"</emp_code>"); rs.close();
// commInfo.append("<cc_to>"+travelCodeEmail+","+nsmCodeEmail+"</cc_to>"); rs = null;
commInfo.append("</Detail1></ROOT></XML_DATA>"); pstmt.close();
commInfo.append("</ROOT>"); pstmt = null;
EMail email = new EMail();
email.sendMail(commInfo.toString(), "ITM"); sql = "select email_addr from site where site_code= ? ";
pstmt = conn.prepareStatement(sql);
retString = "submited"; pstmt.setString(1, siteCode);
System.out.println(" information submited::"); rs = pstmt.executeQuery();
} if(rs.next())
catch( Exception e ) {
{ emailAddr = checkNull(rs.getString("email_addr"));
e.printStackTrace(); System.out.println("email_addr>>> "+emailAddr);
System.out.println("Exception ::"+ e.getMessage()); }
throw new ITMException(e); rs.close();
} rs = null;
} pstmt.close();
// End by Pankaj R on 20/NOV/15 pstmt = null;
}
return retString; sql="SELECT descr FROM gencodes WHERE MOD_NAME = 'X' AND FLD_NAME = 'EMAIL_ID_AML' " +
} "and sh_descr in(select registr_5 from customer c,receipt r " +
"where c.cust_code=r.cust_code and r.tran_id= ?) ";
public String postSave(String domString, String editFlag, pstmt = conn.prepareStatement(sql);
String xtraParams, boolean autoConfirm, Connection conn) pstmt.setString(1, tranId);
throws RemoteException, ITMException { rs = pstmt.executeQuery();
if(rs.next())
System.out.println("In ReceiptAdvPostSave ... "); {
descr = checkNull(rs.getString("descr"));
PreparedStatement pstmt = null; System.out.println(" descr ::"+descr);
Document dom = null; }
ResultSet rs = null; rs.close();
boolean isError = false; rs = null;
pstmt.close();
String tranIdRcp = ""; pstmt = null;
String tranId = "", lineNo = "";
String errString = ""; commInfo.append("<ROOT>");
String xmlString = null; commInfo.append("<MAIL><EMAIL_TYPE>page</EMAIL_TYPE><ENTITY_CODE>BASE</ENTITY_CODE>");
String sql = null; commInfo.append("<ENTITY_TYPE>"+userType+"</ENTITY_TYPE>");
String sqlC = null; commInfo.append("<TO_ADD>"+descr+","+emailAddr+"</TO_ADD>");
StringBuffer xmlBuff = new StringBuffer(); commInfo.append("<BCC_ADD></BCC_ADD>");
// PreparedStatement pstmt=null; commInfo.append("<FORMAT_CODE>"+formatCode+"</FORMAT_CODE>");
String bankCode = null; commInfo.append("<ATTACHMENT><BODY></BODY><LOCATION></LOCATION></ATTACHMENT>");
String finEntity = null; commInfo.append("</MAIL>");
String currCode = null; commInfo.append("<XML_DATA><ROOT><Detail1><TRAN_ID>"+tranId+"</TRAN_ID><TRAN_DATE>"+tranDate+"</TRAN_DATE>" +
double exchRate = 0; "<CUST_CODE>"+custCode+"</CUST_CODE><CUST_NAME>"+custName+"</CUST_NAME><TRAN_TYPE>"+tranType+"</TRAN_TYPE><RCP_MODE>"+rcpMode+"</RCP_MODE>" +
double chqAmt = 0, chqAmtActual = 0, netAmt = 0, diffAmtExchTotal = 0, netAmtBc = 0; "<BANK_CODE>"+bankCode+"</BANK_CODE><REF_NO>"+refNo+"</REF_NO><REF_DATE>"+refDate+"</REF_DATE>" +
String tranDate = null; "<REMARKS>"+remarks+"</REMARKS><CONF_DATE>"+confDate+"</CONF_DATE><DLV_MODE>"+dlvMode+"</DLV_MODE><DLV_REF>"+dlvRef+"</DLV_REF>" +
String custCode = null; "<NET_AMT>"+netAmt+"</NET_AMT><CURR_CODE>"+currCode+"</CURR_CODE><EXCH_RATE>"+exchRate+"</EXCH_RATE>" +
String siteCode = null; "<emp_code>"+empCodeAprv+"</emp_code>");
String acctCodeBal = null; // commInfo.append("<cc_to>"+travelCodeEmail+","+nsmCodeEmail+"</cc_to>");
String acctCodeAr = null; commInfo.append("</Detail1></ROOT></XML_DATA>");
String cctrCodeBal = null; commInfo.append("</ROOT>");
String cctrCodeAr = null; EMail email = new EMail();
String acctCodeAdv = null; email.sendMail(commInfo.toString(), "ITM");
String cctrCodeAdv = null;
String refNo = null; //retString = "submited";
String itemSer = null; System.out.println(" information submited::");
String varValue = ""; }
String loginEmpCode = ""; catch( Exception e )
String cctrFin = ""; {
String cctrFinS = ""; errString=e.toString();
String acctFin = ""; e.printStackTrace();
String acctFinS = "";
String bdFluctuationCf = ""; System.out.println("Exception ::"+ e.getMessage());
String sql1 = ""; throw new ITMException(e);
String errorString = ""; }
}
double rcpAmt = 0, finChg = 0, diffAmtExchDet = 0, diffAmtExchAdv = 0, diffAmtExchEpc = 0, newAdvAmt = 0; else
double billAmtDet = 0, advAmtHdr = 0, adjAmtAdv = 0, bdAmt = 0, advAmtRact = 0, othAmt = 0.0, exchRateHdr = 0.0, taxAmt = 0, amount = 0.0, othAmttemp = 0.0; {
int cnt = 0; errString="Loading Failed";
try { }
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); // End by Pankaj R on 20/NOV/15
GenericUtility genericUtility = GenericUtility.getInstance(); }
dom = genericUtility.parseString(domString); else
{
tranId = GenericUtility.getInstance() errString=retString;
.getColumnValue("tran_id", dom); }
currCode = GenericUtility.getInstance().getColumnValue("curr_code", try
dom); {
fos1.write(("ERROR String return:- [" + errString +"]\r\n\n\n").getBytes());
sql = "select adv_amt, exch_rate,chq_amt,curr_Code from receipt WHERE tran_id = ? "; } catch (IOException e)
pstmt = conn.prepareStatement(sql); {
pstmt.setString(1, tranId); // TODO Auto-generated catch block
rs = pstmt.executeQuery(); e.printStackTrace();
if (rs.next()) { }
advAmtHdr = rs.getDouble(1); return errString;
exchRateHdr = rs.getDouble(2); }
chqAmtActual = rs.getDouble(3);
currCode = rs.getString(4); public String postSave(String domString, String editFlag,
} String xtraParams, boolean autoConfirm, Connection conn)
rs.close(); throws RemoteException, ITMException {
rs = null;
pstmt.close(); System.out.println("In ReceiptAdvPostSave ... ");
pstmt = null;
PreparedStatement pstmt = null;
bdFluctuationCf = checkNull(finCommon.getFinparams("999999", Document dom = null;
"BD_FLUCTUATION_CF", conn));// added by sagar on 21/08/14.. ResultSet rs = null;
System.out.println(">>>>>>>>>>>>>>Finparam varValue:" + varValue); boolean isError = false;
if (bdFluctuationCf == null
|| bdFluctuationCf.trim().equalsIgnoreCase("NULLFOUND")) { String tranIdRcp = "";
bdFluctuationCf = "N"; String tranId = "", lineNo = "";
} String errString = "";
if ("N".equals(bdFluctuationCf.trim())) // Condition added by sagar String xmlString = null;
// on 21/08/14.. String sql = null;
{ String sqlC = null;
sql = "UPDATE rcpdet set exch_rate = ? " StringBuffer xmlBuff = new StringBuffer();
+ " WHERE tran_id = ? " // PreparedStatement pstmt=null;
+ " and (curr_code = ? or exch_rate is null) "; String bankCode = null;
pstmt = conn.prepareStatement(sql); String finEntity = null;
pstmt.setDouble(1, exchRateHdr); String currCode = null;
pstmt.setString(2, tranId); double exchRate = 0;
pstmt.setString(3, currCode); double chqAmt = 0, chqAmtActual = 0, netAmt = 0, diffAmtExchTotal = 0, netAmtBc = 0;
cnt = pstmt.executeUpdate(); String tranDate = null;
pstmt.close(); String custCode = null;
pstmt = null; String siteCode = null;
String acctCodeBal = null;
sql = "UPDATE rcpdet set diff_amt__exch = (rcp_amt * EXCH_RATE__RCV) - (rcp_amt * exch_rate) " String acctCodeAr = null;
+ " WHERE tran_id = ? " String cctrCodeBal = null;
+ " and (curr_code = ? or exch_rate is null) "; String cctrCodeAr = null;
pstmt = conn.prepareStatement(sql); String acctCodeAdv = null;
pstmt.setString(1, tranId); String cctrCodeAdv = null;
pstmt.setString(2, currCode); String refNo = null;
cnt = pstmt.executeUpdate(); String itemSer = null;
pstmt.close(); String varValue = "";
pstmt = null; String loginEmpCode = "";
} String cctrFin = "";
String cctrFinS = "";
sql = "select sum(diff_amt__exch), sum(tax_amt) from rcpdet WHERE tran_id = ? "; String acctFin = "";
pstmt = conn.prepareStatement(sql); String acctFinS = "";
pstmt.setString(1, tranId); String bdFluctuationCf = "";
rs = pstmt.executeQuery(); String sql1 = "";
if (rs.next()) { String errorString = "";
diffAmtExchDet = rs.getDouble(1);
taxAmt = rs.getDouble(2); double rcpAmt = 0, finChg = 0, diffAmtExchDet = 0, diffAmtExchAdv = 0, diffAmtExchEpc = 0, newAdvAmt = 0;
} double billAmtDet = 0, advAmtHdr = 0, adjAmtAdv = 0, bdAmt = 0, advAmtRact = 0, othAmt = 0.0, exchRateHdr = 0.0, taxAmt = 0, amount = 0.0, othAmttemp = 0.0;
rs.close(); int cnt = 0;
rs = null; try {
sql = "select sum(diff_amt__exch) from rcpadv WHERE tran_id = ? "; ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
pstmt = conn.prepareStatement(sql); GenericUtility genericUtility = GenericUtility.getInstance();
pstmt.setString(1, tranId); dom = genericUtility.parseString(domString);
rs = pstmt.executeQuery();
if (rs.next()) { tranId = GenericUtility.getInstance()
diffAmtExchAdv = rs.getDouble(1); .getColumnValue("tran_id", dom);
} currCode = GenericUtility.getInstance().getColumnValue("curr_code",
rs.close(); dom);
rs = null;
sql = "select sum(diff_amt__exch) from rcpepc_adj WHERE tran_id = ? "; sql = "select adv_amt, exch_rate,chq_amt,curr_Code from receipt WHERE tran_id = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next()) {
diffAmtExchEpc = rs.getDouble(1); advAmtHdr = rs.getDouble(1);
} exchRateHdr = rs.getDouble(2);
rs.close(); chqAmtActual = rs.getDouble(3);
rs = null; currCode = rs.getString(4);
}
sql1 = "select sum(amount * exch_rate ) oth_amt from rcpacct WHERE tran_id = ? AND eff_bank <> 'N'"; rs.close();
pstmt = conn.prepareStatement(sql1); rs = null;
pstmt.close();
pstmt.setString(1, tranId); pstmt = null;
rs = pstmt.executeQuery();
if (rs.next()) { bdFluctuationCf = checkNull(finCommon.getFinparams("999999",
othAmttemp = rs.getDouble(1); "BD_FLUCTUATION_CF", conn));// added by sagar on 21/08/14..
System.out.println(">>>>>>>>>>>>>>Finparam varValue:" + varValue);
} if (bdFluctuationCf == null
rs.close(); || bdFluctuationCf.trim().equalsIgnoreCase("NULLFOUND")) {
rs = null; bdFluctuationCf = "N";
pstmt.close(); }
pstmt = null; if ("N".equals(bdFluctuationCf.trim())) // Condition added by sagar
System.out.println("Other Amount Temp before division>>>>" // on 21/08/14..
+ othAmttemp); {
if (othAmttemp != 0) { sql = "UPDATE rcpdet set exch_rate = ? "
+ " WHERE tran_id = ? "
othAmt = (othAmttemp / exchRateHdr); + " and (curr_code = ? or exch_rate is null) ";
} pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, exchRateHdr);
System.out.println("ExchangeRate hdr after division>>>>>" pstmt.setString(2, tranId);
+ exchRateHdr); pstmt.setString(3, currCode);
System.out.println("Other Amount after division>>>>>" + othAmt); cnt = pstmt.executeUpdate();
pstmt.close();
sql = "UPDATE receipt SET oth_amt = ?, tax_amt = ? WHERE tran_id = ? "; pstmt = null;
pstmt = conn.prepareStatement(sql);
sql = "UPDATE rcpdet set diff_amt__exch = (rcp_amt * EXCH_RATE__RCV) - (rcp_amt * exch_rate) "
pstmt.setDouble(1, othAmt); + " WHERE tran_id = ? "
pstmt.setDouble(2, taxAmt); + " and (curr_code = ? or exch_rate is null) ";
pstmt.setString(3, tranId); pstmt = conn.prepareStatement(sql);
cnt = pstmt.executeUpdate(); pstmt.setString(1, tranId);
pstmt.close(); pstmt.setString(2, currCode);
pstmt = null; cnt = pstmt.executeUpdate();
pstmt.close();
System.out.println("Other Amount on update11111111>>>>>" + othAmt); pstmt = null;
}
sql = "select sum(adj_amt) from rcpadv WHERE tran_id = ? ";
pstmt = conn.prepareStatement(sql); sql = "select sum(diff_amt__exch), sum(tax_amt) from rcpdet WHERE tran_id = ? ";
pstmt.setString(1, tranId); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); pstmt.setString(1, tranId);
if (rs.next()) { rs = pstmt.executeQuery();
adjAmtAdv = rs.getDouble(1); if (rs.next()) {
} diffAmtExchDet = rs.getDouble(1);
rs.close(); taxAmt = rs.getDouble(2);
rs = null; }
pstmt.close(); rs.close();
pstmt = null; rs = null;
sql = "select sum(diff_amt__exch) from rcpadv WHERE tran_id = ? ";
if ("N".equals(bdFluctuationCf.trim())) // Condition added by Manoj pstmt = conn.prepareStatement(sql);
// on 22/08/14.. pstmt.setString(1, tranId);
{ rs = pstmt.executeQuery();
sql = "select sum(d.rcp_amt * d.exch_rate / h.exch_rate), sum(case when r.bill_disc = 'Y' then d.BILL_DISC_AMT + d. FIN_CHG else 0 end ) " if (rs.next()) {
+ " from receipt h, rcpdet d, receivables r " diffAmtExchAdv = rs.getDouble(1);
+ " WHERE h.tran_id = d.tran_id " }
+ " and r.tran_ser = d.ref_ser " rs.close();
+ " and r.ref_no = d.ref_no " rs = null;
+ " and r.line_no__ref = d.line_no__ref " sql = "select sum(diff_amt__exch) from rcpepc_adj WHERE tran_id = ? ";
+ " and h.tran_id = ? "; pstmt = conn.prepareStatement(sql);
} else { pstmt.setString(1, tranId);
sql = "select sum(d.rcp_amt * d.exch_rate__rcv / h.exch_rate), sum(case when r.bill_disc = 'Y' then d.BILL_DISC_AMT + d. FIN_CHG else 0 end ) " rs = pstmt.executeQuery();
+ " from receipt h, rcpdet d, receivables r " if (rs.next()) {
+ " WHERE h.tran_id = d.tran_id " diffAmtExchEpc = rs.getDouble(1);
+ " and r.tran_ser = d.ref_ser " }
+ " and r.ref_no = d.ref_no " rs.close();
+ " and r.line_no__ref = d.line_no__ref " rs = null;
+ " and h.tran_id = ? ";
} sql1 = "select sum(amount * exch_rate ) oth_amt from rcpacct WHERE tran_id = ? AND eff_bank <> 'N'";
pstmt = conn.prepareStatement(sql1);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next()) {
billAmtDet = rs.getDouble(1); othAmttemp = rs.getDouble(1);
bdAmt = rs.getDouble(2);
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
billAmtDet = roundVal(billAmtDet, 3); System.out.println("Other Amount Temp before division>>>>"
// chqAmt = billAmtDet + bdAmt + adjAmtAdv; // 21/01/14 bd amount + othAmttemp);
// removed from bill_amt if (othAmttemp != 0) {
chqAmt = billAmtDet;// + adjAmtAdv;
// 25/02/14 manoharan if all details are dropped t6he bill_amt othAmt = (othAmttemp / exchRateHdr);
// should be 0 }
// if (chqAmt != 0)
// { System.out.println("ExchangeRate hdr after division>>>>>"
sql = "UPDATE receipt SET bill_amt = ?, ADVADJ_AMT = ? WHERE tran_id = ? "; + exchRateHdr);
pstmt = conn.prepareStatement(sql); System.out.println("Other Amount after division>>>>>" + othAmt);
pstmt.setDouble(1, chqAmt);
pstmt.setDouble(2, adjAmtAdv); sql = "UPDATE receipt SET oth_amt = ?, tax_amt = ? WHERE tran_id = ? ";
pstmt.setString(3, tranId); pstmt = conn.prepareStatement(sql);
cnt = pstmt.executeUpdate();
pstmt.close(); pstmt.setDouble(1, othAmt);
pstmt = null; pstmt.setDouble(2, taxAmt);
// } pstmt.setString(3, tranId);
System.out.println("05/07/14 bill_amt [" + chqAmt cnt = pstmt.executeUpdate();
+ "] billAmtDet [" + billAmtDet + "] advadj_amt [" pstmt.close();
+ adjAmtAdv + "] oth_amt [" + othAmt + "] taxAmt [" pstmt = null;
+ taxAmt + "] diffAmtExchDet [" + diffAmtExchDet
+ "] diffAmtExchAdv [" + diffAmtExchAdv System.out.println("Other Amount on update11111111>>>>>" + othAmt);
+ "] diffAmtExchEpc [" + diffAmtExchEpc + "]");
// 21/03/14 manoharan update advance sql = "select sum(adj_amt) from rcpadv WHERE tran_id = ? ";
if (chqAmtActual != 0) { pstmt = conn.prepareStatement(sql);
// 29/05/14 manoharan pstmt.setString(1, tranId);
// 30/06/14 manoharan not to deduct dbamt rs = pstmt.executeQuery();
// sql="select chq_amt - ((case when bill_amt is null then 0 else bill_amt end)+ (case when advadj_amt is null then 0 else advadj_amt end) - ? + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) from receipt WHERE tran_id = ? " if (rs.next()) {
// ; adjAmtAdv = rs.getDouble(1);
sql = "select chq_amt - ((case when bill_amt is null then 0 else bill_amt end) + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) from receipt WHERE tran_id = ? "; }
pstmt = conn.prepareStatement(sql); rs.close();
rs = null;
// pstmt.setDouble(1,bdAmt ); pstmt.close();
pstmt.setString(1, tranId); pstmt = null;
rs = pstmt.executeQuery();
if (rs.next()) { if ("N".equals(bdFluctuationCf.trim())) // Condition added by Manoj
newAdvAmt = rs.getDouble(1); // on 22/08/14..
} {
rs.close(); sql = "select sum(d.rcp_amt * d.exch_rate / h.exch_rate), sum(case when r.bill_disc = 'Y' then d.BILL_DISC_AMT + d. FIN_CHG else 0 end ) "
rs = null; + " from receipt h, rcpdet d, receivables r "
pstmt.close(); + " WHERE h.tran_id = d.tran_id "
pstmt = null; + " and r.tran_ser = d.ref_ser "
System.out.println("newAdvAmt: " + newAdvAmt); + " and r.ref_no = d.ref_no "
if (newAdvAmt < 0) { + " and r.line_no__ref = d.line_no__ref "
+ " and h.tran_id = ? ";
errorString = itmDBAccessEJB.getErrorString("", "VTNEGADV", } else {
"", "", conn); sql = "select sum(d.rcp_amt * d.exch_rate__rcv / h.exch_rate), sum(case when r.bill_disc = 'Y' then d.BILL_DISC_AMT + d. FIN_CHG else 0 end ) "
System.out.println("errorString :" + errorString); + " from receipt h, rcpdet d, receivables r "
// throw new + " WHERE h.tran_id = d.tran_id "
// Exception("Advance amount calculated is becoming negative [" + " and r.tran_ser = d.ref_ser "
// + newAdvAmt + "]" ); + " and r.ref_no = d.ref_no "
} + " and r.line_no__ref = d.line_no__ref "
// end 29/05/14 manoharan + " and h.tran_id = ? ";
}
// 30/06/14 manoharan not to deduct dbamt
// sql="UPDATE receipt SET adv_amt = chq_amt - ((case when bill_amt is null then 0 else bill_amt end)+ (case when advadj_amt is null then 0 else advadj_amt end) - ? + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) WHERE tran_id = ? " pstmt = conn.prepareStatement(sql);
// ; pstmt.setString(1, tranId);
sql = "UPDATE receipt SET adv_amt = chq_amt - ((case when bill_amt is null then 0 else bill_amt end) + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) WHERE tran_id = ? "; rs = pstmt.executeQuery();
pstmt = conn.prepareStatement(sql); if (rs.next()) {
billAmtDet = rs.getDouble(1);
// pstmt.setDouble(1,bdAmt ); bdAmt = rs.getDouble(2);
pstmt.setString(1, tranId); }
cnt = pstmt.executeUpdate(); rs.close();
pstmt.close(); rs = null;
pstmt = null; pstmt.close();
pstmt = null;
if (cnt > 0) { billAmtDet = roundVal(billAmtDet, 3);
System.out.println("update successfully [" + cnt + "]"); // chqAmt = billAmtDet + bdAmt + adjAmtAdv; // 21/01/14 bd amount
} // removed from bill_amt
} chqAmt = billAmtDet;// + adjAmtAdv;
// 25/02/14 manoharan if all details are dropped t6he bill_amt
// - (case when bill_disc_amt is null then 0 else bill_disc_amt end) // should be 0
// removed on 21/01/14 // if (chqAmt != 0)
// change done by kunal on 01/feb/14 minus bill_disc_amt // {
sql = "UPDATE receipt SET bill_amt = ?, ADVADJ_AMT = ? WHERE tran_id = ? ";
diffAmtExchTotal = diffAmtExchDet + diffAmtExchAdv + diffAmtExchEpc; pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, chqAmt);
sql = "select ((case when adv_amt is null then 0 else adv_amt end)+ (case when bill_amt is null then 0 else bill_amt end)+ (case when advadj_amt is null then 0 else advadj_amt end) + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) net_amt from receipt WHERE tran_id = ? "; pstmt.setDouble(2, adjAmtAdv);
pstmt = conn.prepareStatement(sql); pstmt.setString(3, tranId);
cnt = pstmt.executeUpdate();
// pstmt.setDouble(1,bdAmt ); pstmt.close();
pstmt.setString(1, tranId); pstmt = null;
rs = pstmt.executeQuery(); // }
if (rs.next()) { System.out.println("05/07/14 bill_amt [" + chqAmt
netAmt = rs.getDouble(1); + "] billAmtDet [" + billAmtDet + "] advadj_amt ["
} + adjAmtAdv + "] oth_amt [" + othAmt + "] taxAmt ["
rs.close(); + taxAmt + "] diffAmtExchDet [" + diffAmtExchDet
rs = null; + "] diffAmtExchAdv [" + diffAmtExchAdv
pstmt.close(); + "] diffAmtExchEpc [" + diffAmtExchEpc + "]");
pstmt = null; // 21/03/14 manoharan update advance
netAmt = netAmt - bdAmt; if (chqAmtActual != 0) {
netAmtBc = netAmt * exchRateHdr; // 29/05/14 manoharan
// 30/06/14 manoharan not to deduct dbamt
/* // sql="select chq_amt - ((case when bill_amt is null then 0 else bill_amt end)+ (case when advadj_amt is null then 0 else advadj_amt end) - ? + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) from receipt WHERE tran_id = ? "
* sql="UPDATE receipt SET DIFF_AMT__EXCH = ? + ? + ?, net_amt = ((case when adv_amt is null then 0 else adv_amt end)+ (case when bill_amt is null then 0 else bill_amt end)+ (case when advadj_amt is null then 0 else advadj_amt end) - ? + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) , " // ;
* + sql = "select chq_amt - ((case when bill_amt is null then 0 else bill_amt end) + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) from receipt WHERE tran_id = ? ";
* " net_amt__bc = ((case when adv_amt is null then 0 else adv_amt end)+ (case when bill_amt is null then 0 else bill_amt end)+ (case when advadj_amt is null then 0 else advadj_amt end) - ? + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) * exch_rate, " pstmt = conn.prepareStatement(sql);
* +" bill_disc_amt = ? WHERE tran_id = ? " ; pstmt =
* conn.prepareStatement(sql); // pstmt.setDouble(1,bdAmt );
* pstmt.setString(1, tranId);
* pstmt.setDouble(1,diffAmtExchDet ); rs = pstmt.executeQuery();
* pstmt.setDouble(2,diffAmtExchAdv ); if (rs.next()) {
* pstmt.setDouble(3,diffAmtExchEpc ); pstmt.setDouble(4,bdAmt newAdvAmt = rs.getDouble(1);
* );//added by kunal on 03/feb/14 pstmt.setDouble(5,bdAmt ); }
* //added by kunal on 03/feb/14 pstmt.setDouble(6,bdAmt ); rs.close();
* pstmt.setString(7,tranId ); cnt = pstmt.executeUpdate(); rs = null;
* pstmt.close(); pstmt = null; pstmt.close();
*/ pstmt = null;
sql = "UPDATE receipt SET DIFF_AMT__EXCH = ? , net_amt = ? , net_amt__bc = ?, bill_disc_amt = ? WHERE tran_id = ? "; System.out.println("newAdvAmt: " + newAdvAmt);
pstmt = conn.prepareStatement(sql); if (newAdvAmt < 0) {
pstmt.setDouble(1, diffAmtExchTotal); errorString = itmDBAccessEJB.getErrorString("", "VTNEGADV",
pstmt.setDouble(2, netAmt); "", "", conn);
pstmt.setDouble(3, netAmtBc); System.out.println("errorString :" + errorString);
pstmt.setDouble(4, bdAmt); // throw new
pstmt.setString(5, tranId); // Exception("Advance amount calculated is becoming negative ["
cnt = pstmt.executeUpdate(); // + newAdvAmt + "]" );
pstmt.close(); }
pstmt = null; // end 29/05/14 manoharan
if (cnt > 0) { // 30/06/14 manoharan not to deduct dbamt
System.out.println("update successfully [" + cnt + "]"); // sql="UPDATE receipt SET adv_amt = chq_amt - ((case when bill_amt is null then 0 else bill_amt end)+ (case when advadj_amt is null then 0 else advadj_amt end) - ? + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) WHERE tran_id = ? "
} // ;
sql = "UPDATE receipt SET adv_amt = chq_amt - ((case when bill_amt is null then 0 else bill_amt end) + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) WHERE tran_id = ? ";
if (cnt > 0) { pstmt = conn.prepareStatement(sql);
System.out.println("update successfully [" + cnt + "]");
} // pstmt.setDouble(1,bdAmt );
} catch (Exception e) { pstmt.setString(1, tranId);
try { cnt = pstmt.executeUpdate();
conn.rollback(); pstmt.close();
} catch (SQLException e1) { pstmt = null;
// TODO Auto-generated catch block
e1.printStackTrace(); if (cnt > 0) {
} System.out.println("update successfully [" + cnt + "]");
isError = true; }
System.out.println("Exception :DcdetPostSaveEJB : :==>\n" }
+ e.getMessage());
e.printStackTrace(); // - (case when bill_disc_amt is null then 0 else bill_disc_amt end)
throw new ITMException(e); // removed on 21/01/14
} finally { // change done by kunal on 01/feb/14 minus bill_disc_amt
try {
System.out.println("isError [" + isError + "]"); diffAmtExchTotal = diffAmtExchDet + diffAmtExchAdv + diffAmtExchEpc;
if (conn != null) {
sql = "select ((case when adv_amt is null then 0 else adv_amt end)+ (case when bill_amt is null then 0 else bill_amt end)+ (case when advadj_amt is null then 0 else advadj_amt end) + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) net_amt from receipt WHERE tran_id = ? ";
/* pstmt = conn.prepareStatement(sql);
* if( isError ) { conn.rollback(); } else { conn.commit();
* } // pstmt.setDouble(1,bdAmt );
*/ pstmt.setString(1, tranId);
} rs = pstmt.executeQuery();
if (pstmt != null) { if (rs.next()) {
pstmt.close(); netAmt = rs.getDouble(1);
pstmt = null; }
} rs.close();
rs = null;
} catch (Exception e) { pstmt.close();
System.out.println("Exception :SavexPreSaveEJB : :==>\n" pstmt = null;
+ e.getMessage()); netAmt = netAmt - bdAmt;
try { netAmtBc = netAmt * exchRateHdr;
System.out.println("Before rollback");
conn.rollback(); /*
} * sql="UPDATE receipt SET DIFF_AMT__EXCH = ? + ? + ?, net_amt = ((case when adv_amt is null then 0 else adv_amt end)+ (case when bill_amt is null then 0 else bill_amt end)+ (case when advadj_amt is null then 0 else advadj_amt end) - ? + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) , "
* +
catch (SQLException sqle) { * " net_amt__bc = ((case when adv_amt is null then 0 else adv_amt end)+ (case when bill_amt is null then 0 else bill_amt end)+ (case when advadj_amt is null then 0 else advadj_amt end) - ? + (case when oth_amt is null then 0 else oth_amt end) + (case when fin_chg is null then 0 else fin_chg end) + tax_amt) * exch_rate, "
System.out.println(sqle); * +" bill_disc_amt = ? WHERE tran_id = ? " ; pstmt =
} * conn.prepareStatement(sql);
throw new ITMException(e); *
} * pstmt.setDouble(1,diffAmtExchDet );
} * pstmt.setDouble(2,diffAmtExchAdv );
System.out.println("Out DcdetPostSaveEJB ... "); * pstmt.setDouble(3,diffAmtExchEpc ); pstmt.setDouble(4,bdAmt
return errorString; * );//added by kunal on 03/feb/14 pstmt.setDouble(5,bdAmt );
} * //added by kunal on 03/feb/14 pstmt.setDouble(6,bdAmt );
* pstmt.setString(7,tranId ); cnt = pstmt.executeUpdate();
private java.math.BigDecimal round(int scale, double round) { * pstmt.close(); pstmt = null;
return new java.math.BigDecimal(round).setScale(scale, */
java.math.BigDecimal.ROUND_UP); sql = "UPDATE receipt SET DIFF_AMT__EXCH = ? , net_amt = ? , net_amt__bc = ?, bill_disc_amt = ? WHERE tran_id = ? ";
} pstmt = conn.prepareStatement(sql);
private double roundVal(double round, int scale) { pstmt.setDouble(1, diffAmtExchTotal);
return Math.round(round * Math.pow(10, scale)) / Math.pow(10, scale); pstmt.setDouble(2, netAmt);
} pstmt.setDouble(3, netAmtBc);
pstmt.setDouble(4, bdAmt);
private String checkNull(String input) { pstmt.setString(5, tranId);
if (input == null) { cnt = pstmt.executeUpdate();
input = ""; pstmt.close();
} pstmt = null;
return input;
} if (cnt > 0) {
System.out.println("update successfully [" + cnt + "]");
}
if (cnt > 0) {
System.out.println("update successfully [" + cnt + "]");
}
} catch (Exception e) {
errorString=e.toString();
try {
conn.rollback();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
isError = true;
System.out.println("Exception :DcdetPostSaveEJB : :==>\n"
+ e.getMessage());
e.printStackTrace();
throw new ITMException(e);
} finally {
try {
System.out.println("isError [" + isError + "]");
if (conn != null) {
/*
* if( isError ) { conn.rollback(); } else { conn.commit();
* }
*/
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
} catch (Exception e) {
System.out.println("Exception :SavexPreSaveEJB : :==>\n"
+ e.getMessage());
try {
System.out.println("Before rollback");
conn.rollback();
}
catch (SQLException sqle) {
System.out.println(sqle);
}
throw new ITMException(e);
}
}
System.out.println("Out DcdetPostSaveEJB ... ");
return errorString;
}
/**
* Initialise and generate log file
* @param fileName
* @return String
*/
private String intializingLog(String fileName)
{
String log="intializingLog_Failed";
// String strToWrite = "";
String currTime = null;
java.util.Date startDate = new java.util.Date(System.currentTimeMillis());
String startDateStr="";
// String folderName="RcpAutCnf";
try{
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat());
try
{
currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString();
currTime = currTime.replaceAll("-","");
calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis()));
fileName = fileName+currTime+calendar.get(Calendar.HOUR)+""+calendar.get(Calendar.MINUTE)+".log";
// folderName=folderName+calendar.get(Calendar.YEAR)+""+calendar.get(Calendar.MONTH)+calendar.get(Calendar.DATE);
fos1 = new FileOutputStream(CommonConstants.JBOSSHOME + File.separator +"EDI"+File.separator+fileName);
}
catch(Exception e)
{
System.out.println("Exception []::"+e.getMessage());
e.printStackTrace();
}
startDate = new java.util.Date(System.currentTimeMillis());
calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis()));
startDateStr = sdf1.format(startDate)+" "+calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE)+":"+calendar.get(Calendar.SECOND);
fos1.write(("Fetching Records Started At " + startDateStr +"\r\n").getBytes());
}
catch(Exception e)
{
System.out.println("Exception []::"+e.getMessage());
e.printStackTrace();
}
log ="intializingLog_Successesfull";
return log;
}
private java.math.BigDecimal round(int scale, double round) {
return new java.math.BigDecimal(round).setScale(scale,
java.math.BigDecimal.ROUND_UP);
}
private double roundVal(double round, int scale) {
return Math.round(round * Math.pow(10, scale)) / Math.pow(10, scale);
}
private String checkNull(String input) {
if (input == null) {
input = "";
}
return input;
}
} }
\ No newline at end of file
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