Commit c4d3f6b6 authored by sjagtap's avatar sjagtap

Sun pharama business component use for multitancancy server

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@187651 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 466d98d8
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>webitm-fin-advSupp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
package ibase.webitm.ejb.fin.advfield;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.utility.GenericUtility;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import org.json.JSONObject;
public class AdvVouchCommon extends ActionHandlerEJB {
Connection conn = null;
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs;
public AdvVouchCommon(){
try {
ConnDriver connDriver = new ConnDriver();
//Comment By sanket J as request by Manoj sir on [21/06/2018]
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
} catch (Exception e) {
// TODO: handle exception
}
}
public Double getPrvOs(String sundry_code,String sundry_type)
{
System.out.println("Inside getPrvOs::::: sundry_code"+sundry_code+"sundry_type::"+sundry_type);
String retString="";
double prvAmt=0;
JSONObject json=null;
try
{
String sql="SELECT FN_PRV_OS(?,?) FROM DUAL";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sundry_type);
pstmt.setString(2, sundry_code);
rs=pstmt.executeQuery();
while(rs.next())
{
prvAmt=rs.getDouble(1);
}
System.out.println("prvAmt:::::"+prvAmt);
}
catch(Exception e)
{
e.printStackTrace();
}
return prvAmt;
}
public String getAttachList(String tranId,String refSer)
{
StringBuffer valueXmlString = new StringBuffer();
try{
int domID=0;
valueXmlString = new StringBuffer( "<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<editFlag>" );
valueXmlString.append( "A" ).append( "</editFlag>\r\n</Header>\r\n" );
String sql="SELECT DOC_CONTENTS.DOC_ID,DOC_NAME,DOC_TYPE,CHG_DATE,CHG_USER,ADD_DATE,ADD_USER,USER_ID__CHKOUT " +
"FROM DOC_CONTENTS, DOC_TRANSACTION_LINK WHERE DOC_TRANSACTION_LINK.DOC_ID = DOC_CONTENTS.DOC_ID AND REF_SER = ? " +
"AND REF_ID = ? ORDER BY DOC_CONTENTS.DOC_ID";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refSer);
pstmt.setString(2, tranId);
rs=pstmt.executeQuery();
while(rs.next())
{
domID++;
valueXmlString.append("<Detail1 domID='"+ domID +"' selected=\"N\">\r\n" );
valueXmlString.append("<tran_id><![CDATA[").append(rs.getString("DOC_ID")).append("]]></tran_id>\r\n");
valueXmlString.append("<name><![CDATA[").append(rs.getString("DOC_NAME")).append("]]></name>\r\n");
valueXmlString.append("<type><![CDATA[").append(rs.getString("DOC_TYPE")).append("]]></type>\r\n");
valueXmlString.append("<chg_date><![CDATA[").append(TimestampStringToDate(rs.getString("CHG_DATE"))).append("]]></chg_date>\r\n");
valueXmlString.append("<chg_user><![CDATA[").append(rs.getString("CHG_USER")).append("]]></chg_user>\r\n");
valueXmlString.append("<add_date><![CDATA[").append(TimestampStringToDate(rs.getString("ADD_DATE"))).append("]]></add_date>\r\n");
valueXmlString.append("<add_user><![CDATA[").append(rs.getString("ADD_USER")).append("]]></add_user>\r\n");
valueXmlString.append("<chk_out><![CDATA[").append(rs.getString("USER_ID__CHKOUT")).append("]]></chk_out>\r\n");
valueXmlString.append("</Detail1>\r\n");
}
valueXmlString.append( "</Root>\r\n" );
pstmtrsNull(pstmt, rs);
}catch (Exception e) {
System.out.println("Exception : "+e);
}
return valueXmlString.toString();
}
public String openAttach(String docId)
{
String filePath ="";
try {
sql = "SELECT DOC_OBJECT,DOC_NAME FROM DOC_CONTENTS WHERE DOC_ID =?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, docId.trim());
rs=pstmt.executeQuery();
while(rs.next())
{
String url = CommonConstants.JBOSSHOME+File.separator+"server"+File.separator+"default"+File.separator+"deploy"+File.separator+
"ibase.ear"+File.separator+"ibase.war"+File.separator+"temp"+File.separator;
System.out.println("File path : "+url);
if(!new File(url).exists())
{
new File(url).mkdir();
}
url = url + rs.getString("DOC_NAME");
filePath = url ;
System.out.println("File path : "+url);
File image = new File(filePath);
FileOutputStream fos = new FileOutputStream(image);
byte[] buffer = new byte[256];
InputStream is = rs.getBinaryStream("DOC_OBJECT");
while (is.read(buffer) > 0) {
fos.write(buffer);
}
fos.close();
}
pstmtrsNull(pstmt, rs);
if(filePath.trim().length() != 0)
{
File file = new File(filePath);
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + file);
}
} catch (Exception e) {
System.out.println("In create file : "+e);
}
return filePath;
}
public String TimestampStringToDate(String inputString)
{
inputString = checkNull(inputString);
//System.out.println("inputString ------- "+inputString+" lENGHT : "+inputString.trim().length());
String temp="";
try{
if(inputString.trim().length() > 0){
GenericUtility genericUtility = GenericUtility.getInstance();
DateFormat formatter;
formatter = new SimpleDateFormat(genericUtility.getDBDateFormat());
java.util.Date upto_date_temp = (java.util.Date)formatter.parse(inputString.trim());
java.sql.Date convertedDate = new java.sql.Date(upto_date_temp.getTime());
//System.out.println("Converted "+convertedDate);
SimpleDateFormat format = new SimpleDateFormat(genericUtility.getApplDateFormat());
temp=format.format(convertedDate);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return temp;
}
public String checkNull(String input) {
if (input == null) {
input = "";
} else {
input = input.trim();
}
return input;
}
public void pstmtrsNull(PreparedStatement pstmt,ResultSet rs)
{
try {
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
} catch (Exception e) {
// TODO: handle exception
}
}
}
package ibase.webitm.ejb.fin.advfield;
import ibase.utility.E12GenericUtility;
//import ibase.webitm.ejb.sys_UTL.CreateXmlMiscVouch;
import ibase.webitm.ejb.sys_UTL.CreateXmlObject;
import ibase.utility.*;
import ibase.webitm.ejb.*;
import ibase.utility.UserInfoBean;
import ibase.ejb.CommonDBAccessRemote;
import ibase.system.config.*;
import java.rmi.RemoteException;
import java.text.*;
import java.util.*;
import java.lang.*;
import java.sql.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.*;
import javax.naming.InitialContext;
import java.io.*;
import java.io.File;
import javax.ejb.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import org.xml.sax.InputSource;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerConfigurationException;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.sys_UTL.*;//added by bipin on 22/03/2010 [reason: To allow error & warning]
@javax.ejb.Stateless
public class AdvanceVoucherConfirm extends ActionHandlerEJB implements AdvanceVoucherConfirmRemote,AdvanceVoucherConfirmLocal
{
CommonFunctions commonFunctions = commonFunctions = new CommonFunctions();//added by bipin on 22/03/2010 [reason: To allow error & warning]
public String confirm() throws RemoteException,ITMException
{
return "";
}
public String confirm(String tranId,String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String result = "";
try
{
System.out.println("Confirm Advance Voucher...");
result =confirmCashVoucher(tranId, xtraParams);
}
catch(Exception e)
{
System.out.println("Exception ::"+e.getMessage());
throw new ITMException(e);
}
return result;
}
private String confirmCashVoucher(String tranId, String xtraParams)throws RemoteException,Exception,ITMException
{
Connection conn = null;
Statement stmt = null;
Statement stmt1=null;
ResultSet rs1=null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
String sql1 = "";
int change = 0 ;
String confirm = "";
String format = "";
String retString = "";
String userId = "BASE";
String empCodeAprv ="";
String confirmed ="";
String status ="";
String emploginCode = "";
String empLogin = "";
int count = 0 ;
int line =0;
String yes ="Y";
String selected ="";
double amount =0;
int netAmount = 0;
BufferedWriter bw = null;
FileWriter fw = null;
String errorString = "";
// code for creating HashMap
E12GenericUtility e12GenericUtilityObj = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
StringBuffer errStringXml = new StringBuffer();
//ITMDBAccess itmDBAccess = null;
ConnDriver connDriver = new ConnDriver();
try
{
format= e12GenericUtilityObj.getApplDateFormat();
}
catch(Exception e)
{
System.out.println("Exception :[generateXML]While Getting Date Format"+e.getMessage());
}
java.util.Date DateX = new java.util.Date();
java.text.SimpleDateFormat dtf= new SimpleDateFormat(format);
// GET LOGIN EMP CODE
try
{
java.text.SimpleDateFormat dt= new java.text.SimpleDateFormat("dd-MM-yy");
String xmlTag = "<?xml version="+'"'+"1.0"+'"'+"?>";
int randInt = new Random().nextInt();
String LOG_FILEPATH = null;
CommonConstants.setIBASEHOME();
LOG_FILEPATH = CommonConstants.JBOSSHOME + File.separator + "applnlog" + File.separator + "Cash_MiscVouch_"+dt.format(new java.util.Date())+"_"+randInt+".xml";
fw=new FileWriter(LOG_FILEPATH,true);
bw=new BufferedWriter(fw);
bw.write(xmlTag);
bw.newLine();
bw.write("<CASH_VOUCHER>");
bw.newLine();
bw.flush();
//UserInfoBean userInfo = new UserInfoBean();
emploginCode = e12GenericUtilityObj.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
empLogin = e12GenericUtilityObj.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
System.out.println("empLogin--advanceVocuherConfirm---["+empLogin+"]");
//Comment as changes required by manoj Sir on 21/06/2018
//conn = connDriver.getConnectDB("DriverITM");
AppConnectParm appConnect = new AppConnectParm();
InitialContext ctx = new InitialContext(appConnect.getProperty());
CommonDBAccessRemote dbAccessRemote = (CommonDBAccessRemote)ctx.lookup("ibase/CommonDBAccessEJB/remote");
UserInfoBean userInfo = dbAccessRemote.createUserInfo(empLogin);
System.out.println("userinfo in advanceVocuherConfirm--["+userInfo+"]");
setUserInfo(userInfo);
//conn = getConnection( userInfo.getTransDB() , userInfo) ;
conn = getConnection();
conn.setAutoCommit(false);
System.out.println("commonFunctions : ["+commonFunctions+"]");
errStringXml.append("<?xml version=\"1.0\"?>\r\n<Root><Errors>\r\n");
//end - bipin on 22/03/2010
stmt = conn.createStatement();
System.out.println(" CONFIRMED FROM tranId IS :"+tranId+"***emploginCode"+emploginCode+"***");
System.out.println("*********CONFIRMED CASHVOUCHER*********");
sql = "SELECT TRAN_ID,CONFIRMED,STATUS,NET_AMT FROM CASH_VOUCHER WHERE TRAN_ID='"+tranId+"'";
System.out.println("sql:::::::"+sql);
rs = stmt.executeQuery(sql);
if (rs.next())
{
tranId = rs.getString("TRAN_ID");
confirm = rs.getString("CONFIRMED");
status = rs.getString("STATUS");
netAmount = rs.getInt("NET_AMT");//pradeep 15/12/2008
}
//=========pradeeep ==15/12/2008
/* if (netAmount > 20000)
{
return itmDBAccessEJB.getErrorString("net_amt", "VNAMT1", userId);
}
else
{*/
if (confirm.equalsIgnoreCase("Y"))
{
//return itmDBAccessEJB.getErrorString("","VTALCONF","","",conn);//commented by bipin on 22/03/2010
retString=itmDBAccessEJB.getErrorString("","VTALCONF","","",conn);//added by bipin on 22/03/2010 [reason: To allow error & warning]
if (commonFunctions.errorType(conn, retString,errStringXml,emploginCode).equalsIgnoreCase("E")) //added by bipin on 22/03/2010 [reason: To allow error & warning]
return retString;
}
if( !status.equalsIgnoreCase("S"))
{
retString = itmDBAccessEJB.getErrorString("confirmed", "VTINVSTATU",userId,"",conn);
if (commonFunctions.errorType(conn, retString,errStringXml,emploginCode).equalsIgnoreCase("E")) //added by bipin on 22/03/2010 [reason: To allow error & warning]
return retString;
}
else//added by bipin on 11/03/2010
{
//start - bipin on 11/03/2010 [reason:Transaction should be confirmed if voucher created or not created ]
String empCode = e12GenericUtilityObj.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
int updateCashVoucher=updateCashVoucher(tranId,empCode,conn);
System.out.println("updateCashVoucher : ["+updateCashVoucher+"]");
conn.commit();
//end - bipin on 11/03/2010
retString = createHashmapForMiscVoucher(tranId,xtraParams,userId,bw,conn);
}
errorString = retString;
//}//pradeep 15/12/2008
System.out.println("transaction is commiting");
// conn.commit();
bw.write("</CREATE_MISC>");
bw.write("</CASH_VOUCHER>");
bw.close();
fw.close();
}// END OF try
catch(SQLException sqx)
{
System.out.println("Exception :: [CashVoucherConfirmEJB ] SQLEXCEPTION"+sqx.getMessage() );
// return itmDBAccessEJB.getErrorString("","VTADHOC1","","",conn);
}
catch(Exception e)
{
System.out.println("Exception :: [CashVoucherConfirmEJB] EXCEPTION"+e.getMessage());
// return itmDBAccessEJB.getErrorString("","VTADHOC1","","",conn);
}
finally
{
try
{
if(conn!=null)
{
stmt.close();
stmt = null;
conn.close();
conn = null;
}
}
catch(Exception e)
{
System.out.println("Exception inside finally" + e.getMessage());
conn.rollback();
return itmDBAccessEJB.getErrorString("","VTADHOC1","","",conn);
}
}// END OF finally
//return itmDBAccessEJB.getErrorString("","VTMCONF2 ","","",conn);
//start - bipin on 22/03/2010 [reason: To allow error & warning]
errStringXml.append("</Errors></Root>\r\n");
if(errStringXml.toString().indexOf("</error>") != -1)
{
errorString= errStringXml.toString();
}
System.out.println("### FINAL errStringXml###\n=="+errStringXml);
//end - bipin on 22/03/2010
return errorString;
} // END OF confirmCashVoucher METHOD
//======================== New Misc. Voucher created in ==========================
public String createHashmapForMiscVoucher(String tranID, String xtraParams, String userId, BufferedWriter bw,Connection conn) throws ITMException ,Exception
{
Node parentNode = null;
Node childNode = null;
String childNodeName = "";
String exprNo = "";
String errString = "";
Document detailDom = null;
Document headerDom = null;
Statement stmt1=null;
ResultSet rs1=null;
int change=0;
//PreparedStatement pstmt = null;
//ResultSet rs = null;
StringBuffer xmlString = new StringBuffer();
Statement stmt = null;
Statement stmt2 = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
ResultSet rs2 = null;
String scCust = "";
String sql = "";
String sql1 = "";
String format = "";
String retString = "";
String AMOUNT = "";
String TRAN_DATE = "";
String taxEnv = "";
String siteCode = "";
String TRAN_TYPE = "";
String sponType ="";
java.sql.Date currDate = null;
HashMap parentHashMap = new HashMap();
HashMap headerMap = new HashMap();
HashMap detMap = null;
String key = "";
String emploginCode = "";
String loginSite="";
String columnValue ="";
String lineNo = "";
String trequest ="";
String confirm="";
String statusValue="";
String site_code="";
String process_for="";
String pay_to="";
String pay_code="";
String amount="";
String sundryCodePay = "";
String payMode ="";
int i = 0;
int j = 1;
int count =0;
int tempTotalAmount =0;
int totalAmt = 0;
int sponAmount = 0;
int tempCount = 0;
int amountAdv = 0;
int servicesCount =0;
int parentNodeListLength;
int childNodeListLength;
int crterm = 0;
// BufferedWriter bw =null;//pradeep 9/7/2009
// FileWriter fw = null;//pradeep 9/7/2009
System.out.println("\n\n\n\n\n\n\n\n\n\nConfirmed Method in CashVoucher.");
CreateXmlObject cxmv = new CreateXmlObject();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
ibase.utility.E12GenericUtility e12Obj = new ibase.utility.E12GenericUtility();
//userId = E12GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"userId");
emploginCode = e12Obj.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
loginSite =e12Obj.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
System.out.println("Generic Utility method is got");
String returnValue = "";//haneesh 31/10/09
Calendar cal = null;//Haneesh 02/11/09
String currDateX = "";
try
{
cal = new GregorianCalendar(Locale.UK);//Haneesh 02/11/09
format= e12Obj.getApplDateFormat();
java.util.Date DateX = new java.util.Date();
java.text.SimpleDateFormat dtf= new SimpleDateFormat(format);
//System.out.println("Connecting to Database");//commented by bipin on 11/03/2010
//ConnDriver connDriver = new ConnDriver();//commented by bipin on 11/03/2010
//conn = connDriver.getConnectDB("DriverITM");//commented by bipin on 11/03/2010
conn.setAutoCommit(false);
//stmt = conn.createStatement();//commented by bipin on 11/03/2010
System.out.println("Connecting found");
bw.newLine();
bw.write("<CREATE_MISC>");
userId = e12Obj.getValueFromXTRA_PARAMS(xtraParams,"userId");
emploginCode = e12Obj.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
loginSite =e12Obj.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
System.out.println("start misc voucher");
/***********************values not defined*********/
//headerMap.put("cctr_code__ap","");//commented by bipin on 08/03/2010
//headerMap.put("acct_code__adv","");//commented by bipin on 08/03/2010
//headerMap.put("cctr_code__adv","");//commented by bipin on 08/03/2010
headerMap.put("net_amt","0.00");
headerMap.put("net_amt__bc","0.00");
headerMap.put("entry_batch_no","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("anal_code","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("acct_code__cf","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("cctr_code__cf","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("site_descr","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("accounts_descr","");//bipin on 16/02/2010[reason:removed 1 space]
//start - bipin on 19/02/2010 [reason: According to Sumit Sir on 18/02/2010]
//headerMap.put("remarks","");
//end - bipin on 19/02/2010
/**
*
* Commented the following code On - 10-Feb-2014 start..
* */
//headerMap.put("chq_name","");//bipin on 16/02/2010[reason:removed 1 space]
/**
*
* Commented the following code On - 10-Feb-2014 End..
* */
headerMap.put("pay_acct_descr","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("mvouch_gen_tran_id","");//bipin on 16/02/2010[reason:removed 1 space]
//headerMap.put("tour_id"," ");//commented by bipin on 16/02/2010[reason:to resolve foreign key contraint error]
headerMap.put("tour_id","");//added by bipin on 16/02/2010
headerMap.put("tran_id__gen","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("stan_descr","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("sundry_name","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("stan_descr_pay","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("sundry_name_pay","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("advance","Y");
headerMap.put("cctr_descr__ap","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("cctr_descr__pay","");//bipin on 16/02/2010[reason:removed 1 space]
//headerMap.put("taxed_adj_amt"," ");//commented by bipin on 16/02/2010[reason:to resolve java.lang.Exception]
headerMap.put("taxed_adj_amt","0");//added by bipin on 16/02/2010
headerMap.put("adv_adjusted","0.00");
headerMap.put("advance_amt","0");//bipin on 16/02/2010[reason:removed 1 space and added '0']
//start - bipin on 16/02/2010
// Manoj Sarode comment the following code & change the variable name on 17-Jul-2013 Start
/* String acctCodeAp = getValueFromFinparam("999999","DEFT_CV_ACCT_CODE_AP",conn);
String acctCodeCf = getValueFromFinparam("999999","DEFT_CV_ACCT_CODE_CF",conn);
String cctrCodeCf = getValueFromFinparam("999999","DEFT_CV_CCTR_CODE_CF",conn);
*/
String acctCodeAp = getValueFromFinparam("999999","ADV_ACCT_AP_FIELD",conn);
String acctCode = getValueFromFinparam("999999","ADV_ACCT_CODE_FIELD",conn);
String acctCodeCf = getValueFromFinparam("999999","DEFT_CV_ACCT_CODE_CF",conn);
String cctrCodeCf = getValueFromFinparam("999999","DEFT_CV_CCTR_CODE_CF",conn);
// Manoj Sarode comment the following code & change the variable name on 17-Jul-2013 End
System.out.println("acctCodeAp : ["+acctCodeAp+"]");
System.out.println("acctCodeCf : ["+acctCodeCf+"]");
System.out.println("cctrCodeCf : ["+cctrCodeCf+"]");
//end - bipin on 16/02/2010
/************************************************/
headerMap.put("tran_id","");
headerMap.put("order_ref",tranID);
System.out.println("tranIDDDDDDD"+tranID);
System.out.println("Order Reffffffff"+headerMap.get("order_ref"));
//headerMap.put("vouch_type","O");//committed by bipin on 08/03/2010
headerMap.put("tran_date",dtf.format(DateX));
//Arvind 21/08/07 --Begin
headerMap.put("tran_type","CVH");
headerMap.put("sundry_type","E");
//Arvind 21/08/07 --End
headerMap.put("rnd_off","R");
headerMap.put("rnd_to","1");
headerMap.put("rnd_amt","0.00");
String CR_TERM = getValueFromFinparam("999999","CR_PRD_ZERO",conn);
crterm = Integer.parseInt(CR_TERM);
System.out.println("CR_TERM:: "+crterm);
stmt = conn.createStatement();
stmt2 = conn.createStatement();
//Haneesh 02/11/09 begin
cal.add(Calendar.DAY_OF_MONTH,crterm);
currDateX = dtf.format(DateX).toString();
headerMap.put("eff_date", currDateX);
cal.add(Calendar.DAY_OF_MONTH,crterm);
currDateX = dtf.format(DateX).toString();
headerMap.put("due_date", currDateX);
//Haneesh 02/11/09 end
/*
//Haneesh 02/11/09 commented
rs2 = stmt2.executeQuery("SELECT SYSDATE +"+crterm+" FROM DUAL");
if(rs2.next())
{
System.out.println("EFF_DATE:"+rs2.getDate(1).toString());
sql = "SELECT TO_CHAR(TO_DATE('"+rs2.getDate(1).toString()+"','yyyy/mm/dd'),'dd/mm/yy') FROM DUAL";
rs = stmt.executeQuery(sql);
if(rs.next())
headerMap.put("eff_date",rs.getString(1).toString());
currDate = rs2.getDate(1);
sql = "SELECT TO_DATE('"+rs2.getDate(1)+"','yyyy-mm-dd')+"+crterm+" FROM DUAL";
//sql = "select to_char(to_date('2007-07-26','yyyy-mm-dd')+1,'dd/mm/yy') from dual";
System.out.println("SQL:"+sql);
rs = stmt.executeQuery(sql);
if(rs.next())
{
System.out.println("Due date::"+rs.getDate(1));
String sql2 = "SELECT TO_CHAR(TO_DATE('"+rs.getDate(1).toString()+"','yyyy/mm/dd'),'dd/mm/yy') FROM DUAL";
System.out.println("sql2 "+sql2);
rs2 = stmt2.executeQuery(sql2);
System.out.println("Due date ");
if(rs2.next())
headerMap.put("due_date",rs2.getString(1));
}
}
*/
try{
System.out.println("-->>>>>>>>> beforeeeeeeeee"+tranID );
sql = "SELECT * FROM cash_voucher WHERE TRAN_ID = '"+tranID+"' for update nowait";
System.out.println("sql -->>>>>>>>>" + sql);
String bankCode = "";
String remarks="";
String empCode = "";
rs = stmt.executeQuery(sql);
if(rs.next())
{
//start - bipin on 19/02/2010 [reason: According to Sumit Sir on 18/02/2010]
//SimpleDateFormat sdf= new SimpleDateFormat("dd/MM/yy");
E12GenericUtility genericUtility = new E12GenericUtility();
SimpleDateFormat sdf= new SimpleDateFormat(genericUtility.getApplDateFormat());
java.util.Date trDate=new java.util.Date();
trDate=rs.getDate("tran_date");
remarks = rs.getString("remarks");
empCode = rs.getString("emp_code");
String tranDate=sdf.format(trDate);
double billAmt=rs.getDouble("tot_amt");
System.out.println("tranID : ["+tranID+"]");
System.out.println("tranDate : ["+tranDate+"]");
System.out.println("billAmt : ["+billAmt+"]");
headerMap.put("bill_date",tranDate);
headerMap.put("supp_bill_amt",billAmt+"");
// Manoj Sarode put the bill amount value in Header map on 17-Jul-2013 Start
headerMap.put("bill_amt",billAmt+"");
// Manoj Sarode put the bill amount value in Header map on 17-Jul-2013 Stop
String advAcctCode = getAdvAcctCode(tranID, conn);
String tranType=rs.getString("tran_type");
tranType = (tranType == null)?"":tranType.trim();
String vouchType="",billNo="";
/*if(tranType.equalsIgnoreCase("C"))
{
vouchType="O";
advAcctCode="";
billNo=tranID+"/CASH";
}
else*/
if(tranType.equalsIgnoreCase("A"))
{
vouchType="A";
advAcctCode=advAcctCode.trim();
billNo=tranID+"/ADVANCE";
}
System.out.println("vouchType : ["+vouchType+"]");
System.out.println("advAcctCode : ["+advAcctCode+"]");
System.out.println("billNo : ["+billNo+"]");
headerMap.put("bill_no",billNo);
headerMap.put("vouch_type",vouchType);
headerMap.put("acct_code__adv",advAcctCode);
headerMap.put("cctr_code__adv"," ");
//end - bipin on 08/03/2010
System.out.println("Emp Code:::::"+rs.getString("emp_code"));
//------PRADEEP--BEGIN--07/12/07
headerMap.put("sundry_code__pay",rs.getString("emp_code")==null?"":rs.getString("emp_code"));
//Arvind 21/08/07 --Begin
headerMap.put("sundry_code",rs.getString("emp_code")==null?"":rs.getString("emp_code"));
//Arvind 20/08/07----- End
//Arvind 20/08/07 --Begin
headerMap.put("site_code",rs.getString("site_code")==null?"":rs.getString("site_code"));
headerMap.put("fin_entity",rs.getString("site_code")==null?"":getValueFromRefTable( "SITE","SITE_CODE",rs.getString("site_code"),"FIN_ENTITY",conn));
headerMap.put("curr_code",rs.getString("curr_code")==null?"":rs.getString("curr_code"));
headerMap.put("proj_code",rs.getString("proj_code")==null?"":rs.getString("proj_code"));
headerMap.put("tax_class",rs.getString("tax_class")==null?"":rs.getString("tax_class"));
headerMap.put("tax_chap",rs.getString("tax_chap")==null?"":rs.getString("tax_chap"));
headerMap.put("tax_env",rs.getString("tax_env")==null?"":rs.getString("tax_env"));
//Arvind 20/08/07 --End
headerMap.put("tax_date",dtf.format(new java.sql.Date(new java.util.Date().getTime())).toString());
/**
* Following code is commented. Now the bank code & pay mode will come from employee master i.e Employee.Bank_code &
* Employee.Pay_mode of requesteremployee.
* If Employee.Bank_code is null then Site.bank_code and if Employee.Pay_mode is null then set as 'Q'.
* on 01-Mar-2014 Start.....
* */
// bankCode = rs.getString("site_code")==null?"":getValueFromRefTable( "SITE","SITE_CODE",rs.getString("site_code"),"CASH_CODE",conn);
bankCode = getValueFromRefTable( "EMPLOYEE","EMP_CODE",empCode,"BANK_CODE",conn);
payMode = getValueFromRefTable( "EMPLOYEE","EMP_CODE",empCode,"PAY_MODE",conn);
if(bankCode == null || bankCode.trim().length() == 0 )
{
bankCode = getValueFromRefTable( "SITE","SITE_CODE",rs.getString("site_code"),"BANK_CODE",conn);
headerMap.put("bank_code",bankCode);
}
else
{
headerMap.put("bank_code",bankCode);
}
if(payMode == null || payMode.trim().length() == 0 )
{
headerMap.put("pay_mode","Q");
}
else
{
headerMap.put("pay_mode",payMode);
}
/**
* Following code is commented. Now the bank code & pay mode will come from employee master i.e Employee.Bank_code &
* Employee.Pay_mode of requesteremployee.
* If Employee.Bank_code is null then Site.bank_code and if Employee.Pay_mode is null then set as 'Q'.
* on 01-Mar-2014 End.....
* */
headerMap.put("diff_amt__exch","0.00");
//start - bipin on 16/02/2010 [reason: commented by bipin on 16/02/2010]
/*headerMap.put("acct_code__cf",(bankCode == null)?"3013":getValueFromRefTable( "BANK","BANK_CODE",bankCode,"ACCT_CODE__CF_AP",conn));
System.out.println("Bank Code:"+getValueFromRefTable( "BANK","BANK_CODE",bankCode,"ACCT_CODE__CF_AP",conn));
headerMap.put("cctr_code__cf",(bankCode == null)?"H101":getValueFromRefTable( "BANK","BANK_CODE",bankCode,"CCTR_CODE__CF_AP",conn));
*/
headerMap.put("acct_code__cf",(bankCode == null)?acctCodeCf:getValueFromRefTable( "BANK","BANK_CODE",bankCode,"ACCT_CODE__CF_AP",conn));
System.out.println("Bank Code:"+getValueFromRefTable( "BANK","BANK_CODE",bankCode,"ACCT_CODE__CF_AP",conn));
headerMap.put("cctr_code__cf",(bankCode == null)?cctrCodeCf:getValueFromRefTable( "BANK","BANK_CODE",bankCode,"CCTR_CODE__CF_AP",conn));
//end - bipin on 16/02/2010
//Arvind 20/08/07----begin
headerMap.put("dept_code",rs.getString("dept_code")==null?"":rs.getString("dept_code"));
System.out.println("lassssssssssst");
//Arvind 20/08/07----End
//Haneesh 31/10/09 begin
returnValue = getValueFromRefTable( "SITE","SITE_CODE",rs.getString("site_code"),"DESCR",conn);
headerMap.put("site_descr",returnValue);
returnValue = getValueFromRefTable( "EMPLOYEE","EMP_CODE",empCode,"NVL(EMP_FNAME,'')||' '||NVL(EMP_MNAME,'')||' '||NVL(EMP_LNAME,'') AS EMP_NAME",conn);
headerMap.put("sundry_name",returnValue);
//Haneesh 31/10/09 end
/*
//Haneesh 31/10/09 begin
//---------------------pradeep--begin--22/11/07
sql1= "SELECT DESCR FROM SITE WHERE SITE_CODE='"+rs.getString("site_code")+"' ";
System.out.println("sql1***********"+sql1);
rs2=stmt.executeQuery(sql1);
if (rs2.next())
{
headerMap.put("site_descr",rs2.getString("descr"));
}
//---------------------pradeep--end--22/11/07
//----------PRADEEP---BEGIN--08/11/07
sql1= "SELECT NVL(EMP_FNAME,'')||' '||NVL(EMP_MNAME,'')||' '||NVL(EMP_LNAME,'') EMP_NAME FROM EMPLOYEE WHERE EMP_CODE='"+empCode+"' ";
//sql1= "SELECT 'A' EMP_NAME FROM DUAL ";
System.out.println("sql1***********@@@@@@@"+sql1);
rs2=stmt.executeQuery(sql1);
System.out.println("222222222");
if (rs2.next())
{
headerMap.put("sundry_name",rs2.getString("EMP_NAME"));
}
//----------PRADEEP---END--08/11/07
//Haneesh 31/10/09 end
*/
}
/**
*
* Changed By Manoj Sarode on 06-Feb-2014.
* Existing hardcoded remarks will be change with remarks entered in Advance voucher Module (Header screen's - Remarks).
*
* */
headerMap.put("remarks",remarks);
/**
* - As discussed with Hemant Sir & Sumit S - Add the Employee Short Name as CHQ_NAME in Header Map.
* Changed by Manoj Sarode on 11-Feb-2014 Start.
* */
returnValue = getValueFromRefTable( "EMPLOYEE","EMP_CODE",empCode," SHORT_NAME ",conn);
headerMap.put("chq_name",returnValue);
/**
* - As discussed with Hemant Sir & Sumit S - Add the Employee Short Name as CHQ_NAME in Header Map.
* Changed by Manoj Sarode on 11-Feb-2014 Start.
* */
}//end of Try
catch(SQLException sq)
{
System.out.println("Exception in Sql:::"+sq.getMessage());
sq.printStackTrace();
bw.newLine();
bw.write("<SQLException>");
bw.write("ORA-00054: resource busy and acquire with NOWAIT specified");
bw.write("</SQLException>");
bw.flush();
conn.rollback();
/*String sq1 = sq.getMessage();
int n= sq1.indexOf("ORA-00054:");
System.out.println("n=========>"+n);
if(n >= 0)
{*/
return retString = itmDBAccessEJB.getErrorString("","VTNOWAT","","",conn);
//throw new ITMException(new SQLException(retString) );
// }
}
headerMap.put("confirmed","N");
headerMap.put("conf_date",dtf.format(new java.sql.Date(new java.util.Date().getTime())));
headerMap.put("emp_code__aprv","");
headerMap.put("sundry_type__pay","E");
headerMap.put("cr_term",CR_TERM);
//start - bipin on 16/02/2010 [reason: commented by bipin on 16/02/2010]
/*headerMap.put("acct_code__pay","0633");
headerMap.put("cctr_code__pay"," ");
headerMap.put("acct_code__ap","0633");
headerMap.put("cctr_code__ap"," ");*/
headerMap.put("acct_code__pay",acctCodeAp);
headerMap.put("acct_code__ap",acctCodeAp);
sql1 = "SELECT * FROM CASH_VOUCHER_DET WHERE TRAN_ID ='"+tranID+"' ";
System.out.println("sql1 For Line no--> ["+sql1+"]");
stmt1 = conn.createStatement();
rs = stmt1.executeQuery(sql1);
String lineNumber="";
while(rs.next())
{
lineNumber=rs.getString("LINE_NO");
}
sql1 = "SELECT * FROM CASH_VOUCHER_DET WHERE TRAN_ID ='"+tranID+"' and LINE_No='"+lineNumber+"' ";
System.out.println("sql1 --> ["+sql1+"]");
stmt1 = conn.createStatement();
rs1 = stmt1.executeQuery(sql1);
if(rs1.next())
{
headerMap.put("cctr_code__ap",rs1.getString("cctr_code")==null?" ":rs1.getString("cctr_code"));
headerMap.put("cctr_code__pay",rs1.getString("cctr_code")==null?" ":rs1.getString("cctr_code"));
}
//end - bipin on 16/02/2010
headerMap.put("auto_pay","Y");
headerMap.put("adv_amt","0.0");
headerMap.put("exch_rate","1");
headerMap.put("tot_amt","0.0");
headerMap.put("tax_amt","0.0");
headerMap.put("tran_mode","A");
//start - bipin on 19/02/2010[reason: According to Sumit & Navin sir on 18/02/2010]
/*rs = stmt.executeQuery("SELECT count(*) AS count FROM CASH_VOUCHER_DET WHERE TRAN_ID = '"+tranID+"'");
if(rs.next())
{
int cnt = rs.getInt("count");
System.out.println("cntttttttttt"+cnt);
if(cnt == 1)
{
//Arvind 20/08/07 --Begin
rs2 = stmt2.executeQuery("SELECT bill_no, bill_date, bill_amt FROM CASH_VOUCHER_DET WHERE TRAN_ID = '"+tranID+"'");
if(rs2.next())
{
System.out.println("kkkkkkkkkkkkk"); headerMap.put("bill_no",rs2.getString("bill_no")==null?"":rs2.getString("bill_no"));
//Anil added 04/10/2009:begin
//headerMap.put("bill_date",(rs2.getDate("bill_date")==null)?currDate.toString():rs2.getDate("bill_date").toString());
// above coding has issue due to format. so changed by anil.
//if bill_date is null then set the current date otherwise set from cash_voucher_det To set the bill date in misc voucher header
java.util.Date currDateA = null;
java.util.Date BillDateA = null;
String billDateCurr="";
String billDateDB="";
currDateA = new java.util.Date(dtf.parse(dtf.format(new java.util.Date())).getTime());
if (rs2.getDate("bill_date")!=null)
{
BillDateA=rs2.getDate("bill_date");
billDateDB=dtf.format(BillDateA);
}
else
{
billDateCurr=dtf.format(currDateA);
}
headerMap.put("bill_date",(rs2.getDate("bill_date")==null)?billDateCurr:billDateDB);
//anil added 04/10/2009:end
headerMap.put("supp_bill_amt",rs2.getDouble("bill_amt")+"");
//Arvind 20/08/07 --End
}
}
}
*/
//end - bipin on 19/02/2010
headerMap.put("SITE_CODE_LOGIN",loginSite); //for login site code not for xml data
headerMap.put("USER_ID",userId);
parentHashMap.put("MISC_VOUCHER",headerMap);
parentHashMap.put("Detail1",headerMap);
detMap = getMapForAdvDet(tranID,conn,headerMap);
System.out.println("detMap====>"+detMap);
System.out.println("Detail XML[getMapForAdvDet] found::"+detMap);
parentHashMap.put("MISC_VOUCHDET",detMap);
// Manoj Sarode Commented the following Detail3 Block as never used in Advance Voucher on 10/Jul/2013 Start
parentHashMap.put("Detail3",detMap);
System.out.println("parentHashMap::"+parentHashMap);
// Manoj Sarode Commented the following Detail3 Block as never used in Advance Voucher on 10/Jul/2013 End
//start - bipin on 18/02/2010 [reason:to confirm misc voucher through the workflow when workflow will start of 'misc_voucher_advfld' object only]
//retString = cxmv.generateXML("misc_voucher",parentHashMap, xtraParams, conn);
// Changes by Manoj Sarode - obj name to misc_voucher_advfld For Advance Voucher Request on 16-Sept-2013 Start
retString = cxmv.generateXML("misc_voucher_advfld",parentHashMap, xtraParams, conn);
// Changes by Manoj Sarode - obj name to misc_voucher_advfld For Advance Voucher Request on 16-Sept-2013 End
//end - bipin on 18/02/2010
bw.write("<FROM_JAGSERVER>");
bw.write(retString);
bw.write("</FROM_JAGSERVER>");
System.out.println("retString::::::############"+retString);
//Arvind 22/08/07--- begin
System.out.println("Created XML[CashVoucherConfirm]::"+retString);
int leng=retString.trim().length();
System.out.println("leng::"+leng);//Success
int indexofchar= retString.indexOf("CONFIRMED") ;
System.out.println("-----Before Updating in MISC Voucher indexofchar.........."+indexofchar);
if(indexofchar < 0)
{
System.out.println("---Inside Confirmation Block..11........");
bw.write("<CONFIRMATION>");
bw.newLine();
int indexString = retString.indexOf("Connection refused") ;
if(indexString >0)
{
conn.rollback();
retString = itmDBAccessEJB.getErrorString("","VTCON ","","",conn);
}
bw.write("The transaction can not be confirmed for the TranId"+tranID);
bw.write("</CONFIRMATION>");
bw.flush();
bw.newLine();
System.out.println("---Inside Confirmation Block..22........");
// bw.write("</CREATE_MISC>");
// conn.rollback();
// return itmDBAccessEJB.getErrorString("Confirmed","VTMCANC1","","",conn);
// System.out.println("retString(Error in Misc Voucher) ::"+retString);
// throw new ITMException(new Exception(retString) );
}else
//if (confirm.equalsIgnoreCase("CONFIRMED"))
{
System.out.println("--ELSE Inside Confirmation Block..11........");
bw.write("<CONFIRMATION>");
bw.newLine();
System.out.println("R E T U R N S T R I N G"+retString);
int indexChar = retString.indexOf("@") ;
System.out.println("Index of Char @"+indexChar);
String miscTranId=retString.substring(indexChar+1,20);
// bw.write("</CREATE_MISC>");
System.out.println("--ELSE Inside Confirmation Block..miscTranId........"+miscTranId);
stmt1 = conn.createStatement();
try
{
//Arvind --22/08/07----Begin-------------
/* String tranIdMvouch="";
String sql2="select tran_id from misc_voucher where order_ref='"+tranID+"'";
System.out.println("sql2"+sql2);
rs1=stmt1.executeQuery(sql2);
if(rs1.next())
{
tranIdMvouch= rs1.getString(1);
System.out.println("sql's tranIdMvouch::::::::::::::: "+tranIdMvouch);
}*/
//Arvind --22/08/07----end-------------
//start - commented by bipin on 11/03/2010 [reason:Transaction should be confirmed if voucher created or not created ]
/*
sql1= "UPDATE CASH_VOUCHER SET CONFIRMED =?,CONF_DATE = ?,EMP_CODE__APRV = ?,TRAN_ID__MVOUCH=? WHERE TRAN_ID =? ";
System.out.println("sql is::::::::::::::: "+sql1);
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1,"Y");
pstmt.setDate(2,new java.sql.Date(new java.util.Date().getTime()));
pstmt.setString(3,emploginCode);
pstmt.setString(4,miscTranId);
System.out.println("sql's tranIdMvouch::::::::::::::: "+miscTranId);
pstmt.setString(5,tranID);
System.out.println("sql's tranID::::::::::::::: "+tranID);
change = pstmt.executeUpdate();
System.out.println("CASH VOUCHER HAS CONFIRMED ********"+change );
bw.write("The cash voucher("+tranID+")Confirmed Successfully");
bw.write("</CONFIRMATION>");
bw.flush();
bw.newLine();
retString = itmDBAccessEJB.getErrorString("","VTMCONF2 ","","",conn);
conn.commit();
*/
//start - bipin on 11/03/2010
sql1= "UPDATE CASH_VOUCHER SET TRAN_ID__MVOUCH=? WHERE TRAN_ID =? ";
System.out.println("sql is::::::::::::::: "+sql1);
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1,miscTranId);
System.out.println("sql's tranIdMvouch::::::::::::::: "+miscTranId);
pstmt.setString(2,tranID);
System.out.println("sql's tranID::::::::::::::: "+tranID);
int updateCashVoucher = pstmt.executeUpdate();
System.out.println("updateCashVoucher : ["+updateCashVoucher+"]");
//start - bipin on 15/10/2010
// We need to update chg_user of Misc Voucher from SYSTEM to CashVoucher's emp_code__aprv
//int updateMiscVoucher=updateChgUserMiscVoucher(miscTranId, "voucher_advfield", "A-VOU", tranID, conn);
//16-01-2015 above line commented by santosh set chg_user same as chg_ser from cash_voucher as discuss with Dylan
int updateMiscVoucher=updateChgUserMiscVouh(miscTranId, tranID, conn);
System.out.println("updateMiscVoucher :0:Not Found , 1:Update SuccessFully : ["+updateMiscVoucher+"]");
//end - bipin on 15/10/2010
conn.commit();
retString = itmDBAccessEJB.getErrorString("","VTMCONF2 ","","",conn);
//end - bipin on 11/03/2010
}
catch(Exception e)
{
conn.rollback();
System.out.println("Exception:::::[CashVoucherConfirmEJB]While UPDATE CASH_VOUCHER"+e.getMessage());
return itmDBAccessEJB.getErrorString("","VTADHOC1","","",conn);
}
System.out.println("Misc Voucher Created Successfuly"+retString);
return retString;
}
//Arvind 22/08/07--- End
System.out.println("-----Before Updating in MISC Voucher indexofchar 11.........."+indexofchar);
}
catch(Exception e)
{
System.out.println("Exception :[CashVoucherConfirm's createHashmapForMiscVoucher method]:::::: "+e);
e.printStackTrace();
}
finally
{
try
{
//if (conn != null) {conn.close();conn = null;}//commented by bipin on 11/03/2010
if(pstmt != null) {pstmt.close(); pstmt = null;}
if(stmt != null) {stmt.close(); stmt = null;}
if(stmt1 != null){stmt1.close();stmt1 = null;}
if(stmt2 != null){stmt2.close();stmt2 = null;}
}
catch(Exception e)
{
System.out.println("Exception in closing");
}
}
System.out.println("retString is from Cash voucher:::" + retString);
return retString;
} // END OF createHashmapForMiscVoucher() Method
//======================================= 25/05/07 ================================================
private String getValueFromFinparam(String prdCode,String varName,Connection conn)throws ITMException
{
String returnValue="";
String sql="";
ResultSet rs = null;
Statement stmt = null;
try
{
stmt = conn.createStatement();
sql="SELECT VAR_VALUE FROM FINPARM WHERE PRD_CODE ='"+prdCode+"' AND VAR_NAME ='"+varName+"'";
System.out.println("sql of fin praram" + sql);
rs =stmt.executeQuery(sql);
if(rs.next())
{
returnValue =rs.getString(1);
}
else
{
returnValue = "NULLFOUND";
}
if (stmt != null)
stmt.close();
}
catch(Exception e)
{
throw new ITMException(e);
}
System.out.println("before returnValue in [CreateXML MiscVoucher ] [finparam]" +returnValue );
return(returnValue);
}
//======================= 25/05/07 ================================
private String getValueFromRefTable(String tableName,String fieldName,String fieldValue,String reqdField,Connection conn)
{
Statement stmt = null;
ResultSet rs = null;
String returnValue ="";
try
{
if (fieldValue ==null )
fieldValue ="";
stmt = conn.createStatement();
String sql = "SELECT "+reqdField+" FROM "+tableName+" WHERE "+fieldName+" = '"+fieldValue+"'" ;
System.out.println("*****getValueFromRefTable******* DESCR QUERY IS "+sql);
rs = stmt.executeQuery(sql);
if (rs.next())
{
returnValue = rs.getString(1);
System.out.println("************* VALUE IN "+tableName+" *IS*******"+returnValue );
}
rs.close();
stmt.close();
}catch(Exception e)
{
System.out.println("Inside getValueFromRefTable Exception *******"+e.getMessage());
}
if (returnValue == null)
returnValue="";
return returnValue;
}
//====================== 25/05/07 ==================================
private String getValueFromGencodesTable(String modName,Connection conn)
{
Statement stmt = null;
ResultSet rs = null;
String returnValue ="";
try
{
stmt = conn.createStatement();
String sql = "SELECT FLD_VALUE FROM GENCODES WHERE MOD_NAME='"+modName+"' and FLD_NAME = 'TRAN_TYPE' ";
System.out.println("*****getValueFromRefTable******* DESCR QUERY IS "+sql);
rs = stmt.executeQuery(sql);
if (rs.next())
{
returnValue = rs.getString(1);
System.out.println("************* VALUE IN STRG_EVENT IS*******"+returnValue );
}
rs.close();
stmt.close();
}catch(Exception e)
{
System.out.println("Inside getValueFromRefTable Exception *******"+e.getMessage());
}
if (returnValue == null)
returnValue="";
return returnValue;
}
//===========================================================================================
private HashMap getMapForAdvDet(String tranID,Connection conn,HashMap headerMap)
{
Statement stmt=null;
ResultSet rss=null;
String lineNo="";
String sql = "";
int count = 0;
String returnValue = "";
HashMap detMap = new HashMap();
HashMap errMap=new HashMap();
try
{
//Haneesh 02/11/09 begin
E12GenericUtility e12Obj = new E12GenericUtility();
String format= e12Obj.getApplDateFormat();
java.text.SimpleDateFormat dtf= new SimpleDateFormat(format);
//Haneesh 02/11/09 end
Statement stmt1,stmt2=null;
ResultSet rs1,rs2=null;
ResultSet rs=null;
String sql1=null;
String columnName = "";
int x = 0;
//HashMap detMapChild = null;
String sundryType="";
stmt = conn.createStatement();
//ArrayList lineNoList = new ArrayList();
StringBuffer sqlBufferDet = new StringBuffer();
sql1 = " SELECT LINE_NO FROM CASH_VOUCHER_DET WHERE TRAN_ID = '"+tranID+"'";
System.out.println("sql for count no --> ["+sql1+"]");
rs = stmt.executeQuery(sql1);
//lineNoList.add(0,"0");
int counter = 1;
int lineCount = 1;//Haneesh 02/11/09 added
while (rs.next())
{
/*
//Haneesh 02/11/09 commented
//count = rs.getInt("COUNT");
lineNoList.add(counter,rs.getString("LINE_NO"));
counter++;
//System.out.println("count "+count);
//System.out.println("lineNo "+rs.getString("LINE_NO"));
}
rs.close();
rs = null;
System.out.println("Count --> "+lineNoList.size());
System.out.println("lineNoList --> "+lineNoList);
for (int lineCount = 0; lineCount < lineNoList.size() ; lineCount++)
{
//System.out.println("lineNoList::"+lineNoList.get(lineCount));
System.out.println("lineNoList::"+lineNoList.get(lineCount));
if (lineCount == 0)
{
continue;
}
//sql1 = "SELECT * FROM CASH_VOUCHER_DET WHERE TRAN_ID ='"+tranID+"' and LINE_No="+lineNoList.get(lineCount)+" ";
*/
sql1 = "SELECT * FROM CASH_VOUCHER_DET WHERE TRAN_ID ='"+tranID+"' and LINE_No="+rs.getString("LINE_NO")+" ";//Haneesh 02/11/09 added
System.out.println("sql1 --> "+x+" ["+sql1+"]");
stmt1 = conn.createStatement();
rs1 = stmt1.executeQuery(sql1);
if(rs1.next())
{
HashMap detMapChild = new HashMap();
System.out.println("lineCount-->"+lineCount);
// Arvind -- 21/08/07 --begin
detMapChild.put("tran_id","");
detMapChild.put("ref_id",tranID);
System.out.println("ref id..."+detMapChild.get("ref_id"));
//detMapChild.put("line_no",rs1.getString("line_no")==null?"":rs1.getString("line_no"));
//detMapChild.put("line_no",lineNoList.get(lineCount)); //haneesh 02/11/09 commented
detMapChild.put("line_no",rs.getString("LINE_NO")); //Haneesh 02/11/09 added
detMapChild.put("line_no__ref",rs1.getString("line_no")==null?"":rs1.getString("line_no"));
System.out.println("line no ref..."+detMapChild.get("line_no__ref"));
detMapChild.put("acct_code",rs1.getString("acct_code")==null?"":rs1.getString("acct_code"));
detMapChild.put("cctr_code",rs1.getString("cctr_code")==null?"":rs1.getString("cctr_code"));
// Arvind 21\08\07----------
// for time being setting bill_amt to amount fields.
detMapChild.put("amount",rs1.getString("bill_amt")==null?"":rs1.getString("bill_amt"));
detMapChild.put("rate",rs1.getString("bill_amt")==null?"":rs1.getString("bill_amt"));
System.out.println("rate========>"+detMapChild.get("rate")); detMapChild.put("anal_code",rs1.getString("anal_code")==null?"":rs1.getString("anal_code"));
//Haneesh 31/10/09 begin
returnValue = getValueFromRefTable( "ACCOUNTS","ACCT_CODE", rs1.getString("acct_code"), "DESCR",conn);
detMapChild.put("accounts_descr", returnValue);
returnValue = getValueFromRefTable( "COSTCTR","CCTR_CODE", rs1.getString("cctr_code"), "DESCR",conn);
detMapChild.put("costctr_descr", returnValue);
returnValue = getValueFromRefTable( "ANALYSIS","ANAL_CODE", rs1.getString("anal_code"), "DESCR",conn);
detMapChild.put("analysis_descr", returnValue);
//Haneesh 31/10/09 end
/*
//Haneesh 31/10/09 begin
//------------pradeep--begin--22/11/07----------
sql= "SELECT DESCR FROM ACCOUNTS WHERE ACCT_CODE='"+rs1.getString("acct_code")+"' ";
System.out.println("sql**********************************"+sql);
rs=stmt.executeQuery(sql);
if (rs.next())
{
detMapChild.put("accounts_descr",rs.getString("descr")==null?"":rs.getString("descr"));
}
sql= "SELECT DESCR FROM COSTCTR WHERE CCTR_CODE='"+rs1.getString("cctr_code")+"' ";
System.out.println("sql1*************************"+sql);
rs=stmt.executeQuery(sql);
if (rs.next())
{
detMapChild.put("costctr_descr",rs.getString("descr")==null?"":rs.getString("descr"));
}
sql= "SELECT DESCR FROM ANALYSIS WHERE ANAL_CODE='"+rs1.getString("anal_code")+"' ";
System.out.println("sql1*********************"+sql);
rs=stmt.executeQuery(sql);
if (rs.next())
{
detMapChild.put("analysis_descr",rs.getString("descr")==null?"":rs.getString("descr"));
}
//--------------pradeep--end--22/11/07
///Haneesh 31/10/09 End
*/
detMapChild.put("bill_amt",rs1.getString("bill_amt")==null?"":rs1.getString("bill_amt"));
detMapChild.put("tax_class",rs1.getString("tax_class")==null?"":rs1.getString("tax_class"));
detMapChild.put("tax_chap",rs1.getString("tax_chap")==null?"":rs1.getString("tax_chap"));
detMapChild.put("tax_env", rs1.getString("tax_env")==null?"":rs1.getString("tax_env"));
System.out.println("REMARKS*****************"+rs1.getString("remarks"));
//start - bipin on 17/02/2010 [reason: While creating misc voucher, length of remarks should be 60 char, beacause datatype of remarks column in misc_vouchdet table is 'varchar2(60)' and datatype of remarks column in cash_voucher_det table is 'varchar2(120)' ]
//detMapChild.put("remarks",rs1.getString("remarks")==null?"":rs1.getString("remarks"));
String remarks=rs1.getString("remarks")==null?"":rs1.getString("remarks");
System.out.println("remarks.length() : ["+remarks.length()+"]");
remarks=(remarks.length()>60)?remarks.substring(0,60):remarks;
System.out.println("remarks : ["+remarks+"]");
detMapChild.put("remarks",remarks);
//end - bipin on 17/02/2010
detMapChild.put("tax_amt", rs1.getString("tax_amt")==null?"0":rs1.getString("tax_amt"));
System.out.println("TAX amount*****************"+rs1.getString("tax_amt"));
detMapChild.put("sundry_type__for",rs1.getString("sundry_type")==null?"":rs1.getString("sundry_type"));
detMapChild.put("sundry_code__for",rs1.getString("sundry_code")==null?"":rs1.getString("sundry_code"));
detMapChild.put("bill_no",rs1.getString("bill_no")==null?"":rs1.getString("bill_no"));
if(rs1.getString("apply_tax").equals("Y"))
{
detMapChild.put("apply_tax","Y");
}
else
{
detMapChild.put("apply_tax","N");
}
// }
// detMapChild.put("bill_date","");
if (rs1.getString("bill_date") != null)
{
detMapChild.put("bill_date", dtf.format(rs1.getDate("bill_date")).toString());
//Haneesh 02/11/09 commented
/*
try
{
//String sql2 = "SELECT TO_CHAR(TO_DATE('"+rs1.getDate("bill_date").toString()+"','yyyy/mm/dd'),'dd/mm/yy') FROM CASH_VOUCHER_DET WHERE TRAN_ID='"+tranID+"' and LINE_NO='"+lineNoList.get(lineCount)+"'";//Haneesh 02/11/09 commented
String sql2 = "SELECT TO_CHAR(TO_DATE('"+rs1.getDate("bill_date").toString()+"','yyyy/mm/dd'),'dd/mm/yy') FROM CASH_VOUCHER_DET WHERE TRAN_ID='"+tranID+"' and LINE_NO='"+rs.getString("LINE_NO")+"'";//Haneesh 02/11/09 added
System.out.println("sql2 "+sql2);
stmt2=conn.createStatement();
rs2 = stmt2.executeQuery(sql2);
if(rs2.next())
{
detMapChild.put("bill_date",rs2.getString(1));
}
}
catch (Exception e)
{
System.out.println("Exception to get bill date : "+e.getMessage());
}
*/
}
else
detMapChild.put("bill_date", "");
System.out.println("continue misc voucher....");
detMapChild.put("acct_code__dr","");
detMapChild.put("cctr_code__dr","");
detMapChild.put("acct_code__cr","");
detMapChild.put("cctr_code__cr","");
detMapChild.put("prcp_id","");
detMapChild.put(" line_no__rcp", "");
detMapChild.put("item_code","");
detMapChild.put("item_descr", "");
detMapChild.put("sundry_name", "");
detMapChild.put("sudcity", "");
detMapChild.put("budget_amt_anal", "");
detMapChild.put("budget_amt_cctr", "");
detMapChild.put("consumed_amt_anal", "");
detMapChild.put("consumed_amt_cctr", "");
detMapChild.put("department_descr", "");
detMapChild.put("quantity","1");
detMapChild.put("rate__clg","0");
detMapChild.put("taxed_adj_amt", "0.0");
detMapChild.put("dept_code",(headerMap.get("dept_code")==null)?"":headerMap.get("dept_code"));
detMapChild.put("pkNames", "tran_id:line_no:");
//System.out.println("putting line no : ["+lineNoList.get(lineCount)+"] and line index : ["+lineCount+"]");
//rs.getString("LINE_NO")
//System.out.println("\nLine : "+lineNoList.get(lineCount)+"\n"+detMapChild);
System.out.println("\nLine : "+lineCount+"\n"+detMapChild);//Haneesh 02/11/09
detMap.put(String.valueOf(lineCount),detMapChild);
}
lineCount++;//Haneesh 02/11/09 added
}
}//EOF TRY
catch(Exception e)
{
System.out.println("\n\n\n\n\n\n\nError in Cash Voucher Detail.(Can't return Detail Map)"+e);
e.getMessage();
e.printStackTrace();
}
finally
{
try
{
if (stmt != null)
{
stmt.close();
stmt = null;
}
}
catch ( Exception e )
{
System.out.println("Exception inside finally " +e.getMessage());
}
}
return detMap;
}
//start - bipin on 08/03/2010
private String getAdvAcctCode(String tranId, Connection conn)throws Exception
{
Statement stmt = null;
ResultSet rs = null;
String advAcctCode="";
try
{
stmt = conn.createStatement();
String sql = "SELECT distinct acct_code FROM CASH_VOUCHER_DET WHERE TRAN_ID ='"+tranId+"'";
System.out.println("sql::"+sql);
rs = stmt.executeQuery(sql);
if (rs.next())
{
advAcctCode = rs.getString(1);
}
else
{
advAcctCode="";
}
System.out.println("advAcctCode ["+advAcctCode+"]");
}
catch(Exception e)
{
System.out.println("Inside getAdvAcctCode Exception *******"+e.getMessage());
}
finally
{
if(rs != null){rs.close();rs=null;}
if(stmt != null){stmt.close();stmt=null;}
System.out.println("Inside getAdvAcctCode finally *******");
}
return advAcctCode;
}
private int updateCashVoucher(String tranID,String emploginCode,Connection conn) throws Exception
{
PreparedStatement pstmt=null;
int confirmCashVoucher=0;
try
{
String sql1= "UPDATE CASH_VOUCHER SET CONFIRMED =?, CONF_DATE = ?,EMP_CODE__APRV = ? WHERE TRAN_ID =? ";
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1,"Y");
pstmt.setDate(2,new java.sql.Date(new java.util.Date().getTime()));
pstmt.setString(3,emploginCode);
pstmt.setString(4,tranID);
System.out.println("Sql to confirm cash voucher"+sql1);
confirmCashVoucher = pstmt.executeUpdate();
System.out.println("confirmCashVoucher : ["+confirmCashVoucher+"]");
}
catch(Exception e)
{
System.out.println("Exception in updateCashVoucher :"+e.getMessage());
}
finally
{
if(pstmt != null){pstmt.close();pstmt=null;}
System.out.println("finally in updateCashVoucher :");
}
return confirmCashVoucher;
}
//end - bipin on 08/03/2010
//start - bipin on 15/10/2010
private int updateChgUserMiscVoucher(String miscTranId, String objName, String refSer, String refId, Connection conn) throws Exception
{
PreparedStatement pstmt=null;
ResultSet rs=null;
int updMiscVouch=0;
String signUserCode="";
System.out.println("----- Updating in MISC Voucher ..........");
try
{
String sql="select DDF_GET_WFAPRV_USERCODE(?, ?, ?) from dual";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,objName);
pstmt.setString(2,refSer);
pstmt.setString(3,refId);
System.out.println("sql : ["+sql+"]");
rs=pstmt.executeQuery();
if(rs.next())
{
signUserCode=rs.getString(1);
}
signUserCode=(signUserCode == null)?"":signUserCode.trim();
System.out.println("signUserCode : ["+signUserCode+"]");
pstmt=null;
String sql1= "UPDATE misc_voucher SET CHG_USER =? WHERE TRAN_ID =? ";
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1,signUserCode);
pstmt.setString(2,miscTranId);
System.out.println("Sql to update misc_voucher"+sql1);
updMiscVouch = pstmt.executeUpdate();
System.out.println("updMiscVouch : ["+updMiscVouch+"]");
}
catch(Exception e)
{
System.out.println("Exception in updateChgUserMiscVoucher :"+e.getMessage());
}
finally
{
if(rs != null){rs.close();rs=null;}
if(pstmt != null){pstmt.close();pstmt=null;}
System.out.println("finally in updateChgUserMiscVoucher :");
}
return updMiscVouch;
}
//end - bipin on 15/10/2010
//Start 16-01-2015 added by santosh to set chg_user same as chg_ser from cash_voucher as discuss with Dylan
private int updateChgUserMiscVouh(String miscTranId, String tranId, Connection conn) throws Exception
{
PreparedStatement pstmt=null;
ResultSet rs=null;
int updMiscVouch=0;
String signUserCode="";
System.out.println("----- Updating in MISC Voucher ..........");
try
{
String sql="SELECT CHG_USER FROM CASH_VOUCHER where tran_id =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
System.out.println("sql : ["+sql+"]");
rs=pstmt.executeQuery();
if(rs.next())
{
signUserCode=rs.getString(1);
}
signUserCode=(signUserCode == null)?"":signUserCode.trim();
System.out.println("signUserCode : ["+signUserCode+"]");
pstmt=null;
String sql1= "UPDATE misc_voucher SET CHG_USER =? WHERE TRAN_ID =? ";
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1,signUserCode);
pstmt.setString(2,miscTranId);
System.out.println("Sql to update misc_voucher"+sql1);
updMiscVouch = pstmt.executeUpdate();
System.out.println("updMiscVouch : ["+updMiscVouch+"]");
}
catch(Exception e)
{
System.out.println("Exception in updateChgUserMiscVoucher :"+e.getMessage());
}
finally
{
if(rs != null){rs.close();rs=null;}
if(pstmt != null){pstmt.close();pstmt=null;}
System.out.println("finally in updateChgUserMiscVoucher :");
}
return updMiscVouch;
}
//End 16-01-2015 added by santosh to set chg_user same as chg_ser from cash_voucher as discuss with Dylan
}//end of class
//-----------------------14/08/2007
package ibase.webitm.ejb.fin.advfield;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.*;
import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.*;
import java.io.*;//added by bipin on 22/02/2010
@javax.ejb.Local
public interface AdvanceVoucherConfirmLocal extends ActionHandlerLocal
{
public String confirm() throws RemoteException,ITMException;
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String createHashmapForMiscVoucher(String tranID, String xtraParams, String userId, BufferedWriter bw,Connection conn) throws ITMException ,Exception;//added by bipin on 22/02/2010
}
\ No newline at end of file
package ibase.webitm.ejb.fin.advfield;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.*;
import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.*;
import java.io.*;//added by bipin on 22/02/2010
@javax.ejb.Remote
public interface AdvanceVoucherConfirmRemote extends ActionHandlerRemote
{
public String confirm() throws RemoteException,ITMException;
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String createHashmapForMiscVoucher(String tranID, String xtraParams, String userId, BufferedWriter bw,Connection conn) throws ITMException ,Exception;//added by bipin on 22/02/2010
}
\ No newline at end of file
package ibase.webitm.ejb.fin.advfield;
import ibase.ejb.CommonDBAccessRemote;
import ibase.system.config.AppConnectParm;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.sys_UTL.SignInUpdateWFStatus;
import ibase.utility.E12GenericUtility;
import ibase.utility.UserInfoBean;
import ibase.webitm.utility.ITMException;
import java.io.PrintStream;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@Stateless
public class AdvanceVoucherFieldSubmit extends ActionHandlerEJB
implements AdvanceVoucherFieldSubmitLocal, AdvanceVoucherFieldSubmitRemote
{
public String confirm()
throws RemoteException, ITMException
{
return "";
}
public String confirm(String paramString1, String paramString2, String paramString3) throws RemoteException, ITMException
{
String str = "";
try
{
System.out.println("Advance Confirm Process...");
str = submitCashVoucher(paramString1, paramString2);
System.out.println("result..." + str);
}
catch (Exception localException)
{
System.out.println("Exception ::" + localException.getMessage());
throw new ITMException(localException);
}
return str;
}
private String submitCashVoucher(String paramString1, String paramString2) throws RemoteException, ITMException {
Connection localConnection = null;
Statement localStatement = null;
PreparedStatement localPreparedStatement = null;
ResultSet localResultSet = null;
String str1 = "";
String str2 = "";
String str3 = "";
String str4 = "";
String str5 = "";
String str6 = "BASE";
double d1 = 0.0D;
String str7 = "";
String str8 = "";
Double localDouble = Double.valueOf(0.0D);
UserInfoBean userInfo = null;
double d2 = 0.0D;
String str9 = "";
String str10 = "";
E12GenericUtility localE12GenericUtility = new E12GenericUtility();
ITMDBAccessEJB localITMDBAccessEJB = new ITMDBAccessEJB();
String loginCode = "";
ConnDriver localConnDriver = new ConnDriver();
try
{
str5 = localE12GenericUtility.getApplDateFormat();
}
catch (Exception localException1)
{
System.out.println("Exception :[generateXML]While Getting Date Format" + localException1.getMessage());
}
Date localDate = new Date();
SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat(str5);
java.sql.Timestamp currdate = new java.sql.Timestamp( System.currentTimeMillis() );
try
{
//Comment By sanket J as request by Manoj sir on [21/06/2018]
//localConnection = localConnDriver.getConnectDB("DriverITM");
loginCode = localE12GenericUtility.getValueFromXTRA_PARAMS(paramString2, "loginCode");
System.out.println("loginCode in advanceVoucherFieldSubmit" + loginCode);
AppConnectParm appConnect = new AppConnectParm();
InitialContext ctx = new InitialContext(appConnect.getProperty());
CommonDBAccessRemote dbAccessRemote = (CommonDBAccessRemote) ctx.lookup("ibase/CommonDBAccessEJB/remote");
userInfo = dbAccessRemote.createUserInfo(loginCode);
System.out.println("userInfo in advanceVoucherFieldSubmit[" + userInfo +"]");
setUserInfo(userInfo);
localConnection = getConnection();
System.out.println("localConnection in advanceVoucherFieldSubmit[" + localConnection +"]");
localStatement = localConnection.createStatement();
str1 = "SELECT CONFIRMED,NET_AMT,STATUS,NET_AMT__CONV FROM CASH_VOUCHER WHERE TRAN_ID='" + paramString1 + "'";
System.out.println("sql:::::::" + str1);
localResultSet = localStatement.executeQuery(str1);
if (localResultSet.next())
{
str2 = localResultSet.getString("CONFIRMED");
System.out.println("confirm==>" + str2);
str4 = localResultSet.getString("STATUS");
System.out.println("status==>" + str4);
d2 = localResultSet.getDouble("NET_AMT");
System.out.println("netAmount==>" + d2);
localDouble = Double.valueOf(localResultSet.getDouble("NET_AMT__CONV"));
System.out.println("convNetAmount:::" + localDouble);
}
String str11;
if (str2.equalsIgnoreCase("Y"))
{
str11 = localITMDBAccessEJB.getErrorString("", "VTALCONF", "", "", localConnection);
return str11;
}
if (str4.equalsIgnoreCase("S"))
{
str3 = localITMDBAccessEJB.getErrorString("submited", "VTINWRFLOW", str6, "", localConnection);
str11 = str3;
return str11;
}
/* if (d2 > 20000.0D)
{
str11 = localITMDBAccessEJB.getErrorString("", "VNAMT1", "", "", localConnection);
return str11;
}*/
int i = getCount("CASH_VOUCHER_DET", "TRAN_ID", paramString1, localConnection);
String errString="";
if (i == 0) {
errString = localITMDBAccessEJB.getErrorString("", "VTRLNM1", "", "", localConnection);
return errString;
}
/* str1 = "SELECT SUM(AMOUNT)AS AMOUNT FROM CASH_VOUCHER_CONV WHERE TRAN_ID='" + paramString1 + "'";
localResultSet = localStatement.executeQuery(str1);
if (localResultSet.next())
{
d1 = localResultSet.getDouble("AMOUNT");
System.out.println("amount::" + d1);
}
if (localDouble.doubleValue() > 0.0D)
{
if (d1 != localDouble.doubleValue())
{
localObject1 = localITMDBAccessEJB.getErrorString("", "VTAMOUNT4", "", "", localConnection);
return localObject1;
}
}
if ((localDouble.doubleValue() == 0.0D) && (d1 > 0.0D))
{
localObject1 = localITMDBAccessEJB.getErrorString("", "VMACTCONV", "", "", localConnection);
return localObject1;
}*/
Object localObject1 = new SignInUpdateWFStatus();
//Changes done by sanket J on 22/JUN/2018 for changes required for multilanceny server for getconnection
//str9 = ((SignInUpdateWFStatus)localObject1).updateWFStatus(paramString1, "voucher_advfield", paramString2, str2 );
str9 = ((SignInUpdateWFStatus)localObject1).updateWFStatus(paramString1, "voucher_advfield", paramString2, str2 , localConnection);
System.out.println("result========>" + str9);
System.out.println("status......[" + str4 + "]");
Document localDocument = localE12GenericUtility.parseString(str9);
Node localNode = localDocument.getElementsByTagName("error").item(0);
NamedNodeMap localNamedNodeMap = localNode.getAttributes();
String str12 = localNamedNodeMap.getNamedItem("id").getNodeValue();
if (!str12.trim().equalsIgnoreCase("VTSUBMIT"))
{
if (str9.trim().length() != 0)
{
localConnection.rollback();
String str13 = str9;
return str13;
}
}
else
{
str8 = ((SignInUpdateWFStatus)localObject1).getValueFromXTRA_PARAMS(paramString2, "chgTerm");
System.out.println("chgTerm......[" + str8 + "]");
str7 = ((SignInUpdateWFStatus)localObject1).getValueFromXTRA_PARAMS(paramString2, "loginCode");
System.out.println("chgUser......[" + str7 + "]");
System.out.println("chgDate......[" + currdate+ "]");
/*
* Changes by Manoj Sarode on 10-Oct-2013 Start
* Update the change date when the transaction is submitted using Submit button
* */
str1 = "UPDATE CASH_VOUCHER SET CHG_USER= ?,CHG_TERM= ?, CHG_DATE =? WHERE TRAN_ID='" + paramString1 + "'";
System.out.println("sql......[" + str1 + "]");
localPreparedStatement = localConnection.prepareStatement(str1);
localPreparedStatement.setString(1, str7);
localPreparedStatement.setString(2, str8);
localPreparedStatement.setTimestamp(3, currdate);
int j = localPreparedStatement.executeUpdate();
localPreparedStatement.close();
localPreparedStatement = null;
/*
* Changes by Manoj Sarode on 10-Oct-2013 End
* Update the change date when the transaction is submitted using Submit button
* */
}
localConnection.commit();
}
catch (Exception localSQLException2)
{
System.out.println("Exception:: [AdvanceVoucherFieldSubmit ]EXCEPTION" + localSQLException2.getMessage());
localSQLException2.printStackTrace();
}
finally
{
try
{
if (localConnection != null)
{
localStatement.close();
localConnection.close();
localConnection = null;
}
}
catch (SQLException localSQLException10)
{
System.out.println("Exception inside finally" + localSQLException10.getMessage());
return localITMDBAccessEJB.getErrorString("", "VTADHOC1", "", "", localConnection);
}
}
return (String)str9;
}
int getCount(String paramString1, String paramString2, String paramString3, Connection paramConnection)
{
Statement localStatement = null;
ResultSet localResultSet = null;
int i = 0;
try
{
if (paramString3 == null)
paramString3 = "";
localStatement = paramConnection.createStatement();
String str = "SELECT COUNT(*) AS COUNT FROM " + paramString1 + " WHERE " + paramString2 + " = '" + paramString3 + "'";
System.out.println("sql::" + str);
localResultSet = localStatement.executeQuery(str);
if (localResultSet.next())
{
System.out.println("inside getCount");
i = localResultSet.getInt("COUNT");
System.out.println("************* COUNT IN " + paramString1 + " ********" + i);
}
localResultSet.close();
localStatement.close();
System.out.println("************* COUNT out 33 " + paramString1 + " ********" + i);
}
catch (Exception localException)
{
System.out.println("Inside getCount Exception *******" + localException.getMessage());
localException.printStackTrace();
}
return i;
}
/* private String getValueFromFinparam(String paramString1, String paramString2, Connection paramConnection) throws ITMException {
String str1 = "";
String str2 = "";
ResultSet localResultSet = null;
Statement localStatement = null;
try
{
localStatement = paramConnection.createStatement();
str2 = "SELECT VAR_VALUE FROM FINPARM WHERE PRD_CODE ='" + paramString1 + "' AND VAR_NAME ='" + paramString2 + "'";
System.out.println("sql of fin praram" + str2);
localResultSet = localStatement.executeQuery(str2);
if (localResultSet.next())
{
str1 = localResultSet.getString(1);
}
else
{
str1 = "NULLFOUND";
}
if (localStatement != null)
localStatement.close();
}
catch (Exception localException)
{
throw new ITMException(localException);
}
return str1;
}*/
}
\ No newline at end of file
package ibase.webitm.ejb.fin.advfield;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Local;
@Local
public interface AdvanceVoucherFieldSubmitLocal extends ActionHandlerLocal {
public String confirm() throws RemoteException, ITMException;
public String confirm(String paramString1, String paramString2, String paramString3)
throws RemoteException, ITMException;
}
package ibase.webitm.ejb.fin.advfield;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Remote;
@Remote
public interface AdvanceVoucherFieldSubmitRemote extends ActionHandlerRemote{
public String confirm() throws RemoteException, ITMException;
public String confirm(String paramString1, String paramString2, String paramString3)
throws RemoteException, ITMException;
}
package ibase.webitm.ejb.fin.advfield;
import ibase.webitm.utility.*;
import ibase.utility.E12GenericUtility;
//import ibase.webitm.ejb.sys_UTL.CreateXmlMiscVouch;
import ibase.webitm.ejb.sys_UTL.CreateXmlObject;
import ibase.utility.*;
import ibase.webitm.ejb.*;
import ibase.system.config.*;
import java.rmi.RemoteException;
import java.text.*;
import java.util.*;
import java.lang.*;
import java.sql.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.*;
import javax.naming.InitialContext;
import java.io.*;
import javax.ejb.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import org.xml.sax.InputSource;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerConfigurationException;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.sys_UTL.*;//added by bipin on 22/03/2010 [reason: To allow error & warning]
@javax.ejb.Stateless
public class AdvanceVoucherSuppConfirm extends ActionHandlerEJB implements AdvanceVoucherSuppConfirmLocal,AdvanceVoucherSuppConfirmRemote
{
CommonFunctions commonFunctions = commonFunctions = new CommonFunctions();//added by bipin on 22/03/2010 [reason: To allow error & warning]
public String confirm() throws RemoteException,ITMException
{
return "";
}
public String confirm(String tranId,String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String result = "";
try
{
System.out.println("Confirm Advance Voucher...");
result =confirmCashVoucher(tranId, xtraParams);
}
catch(Exception e)
{
System.out.println("Exception ::"+e.getMessage());
throw new ITMException(e);
}
return result;
}
private String confirmCashVoucher(String tranId, String xtraParams)throws RemoteException,Exception,ITMException
{
Connection conn = null;
Statement stmt = null;
Statement stmt1=null;
ResultSet rs1=null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
String sql1 = "";
int change = 0 ;
String confirm = "";
String format = "";
String retString = "";
String userId = "BASE";
String empCodeAprv ="";
String confirmed ="";
String status ="";
String emploginCode = "";
int count = 0 ;
int line =0;
String yes ="Y";
String selected ="";
double amount =0;
int netAmount = 0;
BufferedWriter bw = null;
FileWriter fw = null;
String errorString = "";
// code for creating HashMap
E12GenericUtility e12GenericUtilityObj = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
StringBuffer errStringXml = new StringBuffer();
//ITMDBAccess itmDBAccess = null;
ConnDriver connDriver = new ConnDriver();
try
{
format= e12GenericUtilityObj.getApplDateFormat();
}
catch(Exception e)
{
System.out.println("Exception :[generateXML]While Getting Date Format"+e.getMessage());
}
java.util.Date DateX = new java.util.Date();
java.text.SimpleDateFormat dtf= new SimpleDateFormat(format);
// GET LOGIN EMP CODE
try
{
java.text.SimpleDateFormat dt= new java.text.SimpleDateFormat("dd-MM-yy");
String xmlTag = "<?xml version="+'"'+"1.0"+'"'+"?>";
int randInt = new Random().nextInt();
String LOG_FILEPATH = null;
CommonConstants.setIBASEHOME();
LOG_FILEPATH = CommonConstants.JBOSSHOME + File.separator + "applnlog" + File.separator + "Cash_MiscVouch_"+dt.format(new java.util.Date())+"_"+randInt+".xml";
fw=new FileWriter(LOG_FILEPATH,true);
bw=new BufferedWriter(fw);
bw.write(xmlTag);
bw.newLine();
bw.write("<CASH_VOUCHER>");
bw.newLine();
bw.flush();
emploginCode = e12GenericUtilityObj.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
//Comment By sanket J as request by Manoj sir on [21/06/2018]
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
conn.setAutoCommit(false);
System.out.println("commonFunctions : ["+commonFunctions+"]");
errStringXml.append("<?xml version=\"1.0\"?>\r\n<Root><Errors>\r\n");
//end - bipin on 22/03/2010
stmt = conn.createStatement();
System.out.println(" CONFIRMED FROM tranId IS :"+tranId+"***emploginCode"+emploginCode+"***");
System.out.println("*********CONFIRMED CASHVOUCHER*********");
sql = "SELECT TRAN_ID,CONFIRMED,STATUS,NET_AMT FROM CASH_VOUCHER WHERE TRAN_ID='"+tranId+"'";
System.out.println("sql:::::::"+sql);
rs = stmt.executeQuery(sql);
if (rs.next())
{
tranId = rs.getString("TRAN_ID");
confirm = rs.getString("CONFIRMED");
status = rs.getString("STATUS");
netAmount = rs.getInt("NET_AMT");//pradeep 15/12/2008
}
//=========pradeeep ==15/12/2008
/* if (netAmount > 20000)
{
return itmDBAccessEJB.getErrorString("net_amt", "VNAMT1", userId);
}
else
{*/
if (confirm.equalsIgnoreCase("Y"))
{
//return itmDBAccessEJB.getErrorString("","VTALCONF","","",conn);//commented by bipin on 22/03/2010
retString=itmDBAccessEJB.getErrorString("","VTALCONF","","",conn);//added by bipin on 22/03/2010 [reason: To allow error & warning]
if (commonFunctions.errorType(conn, retString,errStringXml,emploginCode).equalsIgnoreCase("E")) //added by bipin on 22/03/2010 [reason: To allow error & warning]
return retString;
}
if( !status.equalsIgnoreCase("S"))
{
retString = itmDBAccessEJB.getErrorString("confirmed", "VTINVSTATU",userId,"",conn);
if (commonFunctions.errorType(conn, retString,errStringXml,emploginCode).equalsIgnoreCase("E")) //added by bipin on 22/03/2010 [reason: To allow error & warning]
return retString;
}
else//added by bipin on 11/03/2010
{
//start - bipin on 11/03/2010 [reason:Transaction should be confirmed if voucher created or not created ]
String empCode = e12GenericUtilityObj.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
int updateCashVoucher=updateCashVoucher(tranId,empCode,conn);
System.out.println("updateCashVoucher : ["+updateCashVoucher+"]");
conn.commit();
//end - bipin on 11/03/2010
retString = createHashmapForMiscVoucher(tranId,xtraParams,userId,bw,conn);
}
errorString = retString;
//}//pradeep 15/12/2008
System.out.println("transaction is commiting");
// conn.commit();
bw.write("</CREATE_MISC>");
bw.write("</CASH_VOUCHER>");
bw.close();
fw.close();
}// END OF try
catch(SQLException sqx)
{
System.out.println("Exception :: [CashVoucherConfirmEJB ] SQLEXCEPTION"+sqx.getMessage() );
// return itmDBAccessEJB.getErrorString("","VTADHOC1","","",conn);
}
catch(Exception e)
{
System.out.println("Exception :: [CashVoucherConfirmEJB] EXCEPTION"+e.getMessage());
// return itmDBAccessEJB.getErrorString("","VTADHOC1","","",conn);
}
finally
{
try
{
if(conn!=null)
{
stmt.close();
stmt = null;
conn.close();
conn = null;
}
}
catch(Exception e)
{
System.out.println("Exception inside finally" + e.getMessage());
conn.rollback();
return itmDBAccessEJB.getErrorString("","VTADHOC1","","",conn);
}
}// END OF finally
//return itmDBAccessEJB.getErrorString("","VTMCONF2 ","","",conn);
//start - bipin on 22/03/2010 [reason: To allow error & warning]
errStringXml.append("</Errors></Root>\r\n");
if(errStringXml.toString().indexOf("</error>") != -1)
{
errorString= errStringXml.toString();
}
System.out.println("### FINAL errStringXml###\n=="+errStringXml);
//end - bipin on 22/03/2010
return errorString;
} // END OF confirmCashVoucher METHOD
//======================== New Misc. Voucher created in ==========================
public String createHashmapForMiscVoucher(String tranID, String xtraParams, String userId, BufferedWriter bw,Connection conn) throws ITMException ,Exception
{
Node parentNode = null;
Node childNode = null;
String childNodeName = "";
String exprNo = "";
String errString = "";
Document detailDom = null;
Document headerDom = null;
Statement stmt1=null;
ResultSet rs1=null;
int change=0;
//PreparedStatement pstmt = null;
//ResultSet rs = null;
StringBuffer xmlString = new StringBuffer();
Statement stmt = null;
Statement stmt2 = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
ResultSet rs2 = null;
String scCust = "";
String sql = "";
String sql1 = "";
String format = "";
String retString = "";
String AMOUNT = "";
String TRAN_DATE = "";
String taxEnv = "";
String siteCode = "";
String TRAN_TYPE = "";
String sponType ="";
java.sql.Date currDate = null;
HashMap parentHashMap = new HashMap();
HashMap headerMap = new HashMap();
HashMap detMap = null;
String key = "";
String emploginCode = "";
String loginSite="";
String columnValue ="";
String lineNo = "";
String trequest ="";
String confirm="";
String statusValue="";
String site_code="";
String process_for="";
String pay_to="";
String pay_code="";
String amount="";
String sundryCodePay = "";
String payMode ="";
int i = 0;
int j = 1;
int count =0;
int tempTotalAmount =0;
int totalAmt = 0;
int sponAmount = 0;
int tempCount = 0;
int amountAdv = 0;
int servicesCount =0;
int parentNodeListLength;
int childNodeListLength;
int crterm = 0;
// BufferedWriter bw =null;//pradeep 9/7/2009
// FileWriter fw = null;//pradeep 9/7/2009
System.out.println("\n\n\n\n\n\n\n\n\n\nConfirmed Method in CashVoucher.");
CreateXmlObject cxmv = new CreateXmlObject();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
ibase.utility.E12GenericUtility e12GenericUtilityObj = new ibase.utility.E12GenericUtility();
//userId = E12GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"userId");
emploginCode = e12GenericUtilityObj.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
loginSite =e12GenericUtilityObj.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
System.out.println("Generic Utility method is got");
String returnValue = "";//haneesh 31/10/09
Calendar cal = null;//Haneesh 02/11/09
String currDateX = "";
try
{
cal = new GregorianCalendar(Locale.UK);//Haneesh 02/11/09
format= e12GenericUtilityObj.getApplDateFormat();
java.util.Date DateX = new java.util.Date();
java.text.SimpleDateFormat dtf= new SimpleDateFormat(format);
//System.out.println("Connecting to Database");//commented by bipin on 11/03/2010
//ConnDriver connDriver = new ConnDriver();//commented by bipin on 11/03/2010
//conn = connDriver.getConnectDB("DriverITM");//commented by bipin on 11/03/2010
conn.setAutoCommit(false);
//stmt = conn.createStatement();//commented by bipin on 11/03/2010
System.out.println("Connecting found");
bw.newLine();
bw.write("<CREATE_MISC>");
userId = e12GenericUtilityObj.getValueFromXTRA_PARAMS(xtraParams,"userId");
emploginCode = e12GenericUtilityObj.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
loginSite =e12GenericUtilityObj.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
System.out.println("start misc voucher");
stmt = conn.createStatement();
stmt2 = conn.createStatement();
/***********************values not defined*********/
//headerMap.put("cctr_code__ap","");//commented by bipin on 08/03/2010
//headerMap.put("acct_code__adv","");//commented by bipin on 08/03/2010
//headerMap.put("cctr_code__adv","");//commented by bipin on 08/03/2010
headerMap.put("net_amt","0.00");
headerMap.put("net_amt__bc","0.00");
headerMap.put("entry_batch_no","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("anal_code","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("acct_code__cf","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("cctr_code__cf","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("site_descr","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("accounts_descr","");//bipin on 16/02/2010[reason:removed 1 space]
//start - bipin on 19/02/2010 [reason: According to Sumit Sir on 18/02/2010]
//headerMap.put("remarks","");
//end - bipin on 19/02/2010
/**
*
* Commented the following code On - 10-Feb-2014 start..
* */
//headerMap.put("chq_name","");//bipin on 16/02/2010[reason:removed 1 space]
/**
*
* Commented the following code On - 10-Feb-2014 End..
* */
headerMap.put("pay_acct_descr","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("mvouch_gen_tran_id","");//bipin on 16/02/2010[reason:removed 1 space]
//headerMap.put("tour_id"," ");//commented by bipin on 16/02/2010[reason:to resolve foreign key contraint error]
headerMap.put("tour_id","");//added by bipin on 16/02/2010
headerMap.put("tran_id__gen","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("stan_descr","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("sundry_name","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("stan_descr_pay","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("sundry_name_pay","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("advance","Y");
headerMap.put("cctr_descr__ap","");//bipin on 16/02/2010[reason:removed 1 space]
headerMap.put("cctr_descr__pay","");//bipin on 16/02/2010[reason:removed 1 space]
//headerMap.put("taxed_adj_amt"," ");//commented by bipin on 16/02/2010[reason:to resolve java.lang.Exception]
headerMap.put("taxed_adj_amt","0");//added by bipin on 16/02/2010
headerMap.put("adv_adjusted","0.00");
headerMap.put("advance_amt","0");//bipin on 16/02/2010[reason:removed 1 space and added '0']
//start - bipin on 16/02/2010
String sundryType = "";
String sundryCode = "";
String acctCodeAp = "";
String acctCode = "";
String acctCodeCf = "";
String cctrCodeCf = "";
String cctrCode ="";
String detSql = "SELECT * FROM CASH_VOUCHER_DET WHERE TRAN_ID = '"+tranID+"' for update nowait ";
rs = stmt2.executeQuery(detSql);
if(rs.next())
{
sundryType = rs.getString("SUNDRY_TYPE");
sundryCode = rs.getString("SUNDRY_CODE");
cctrCode = rs.getString("CCTR_CODE");
}
if(rs!=null)
{
rs.close();
rs = null;
}
if(sundryType.equals("S"))
{
acctCodeAp = getValueFromFinparam("999999","ADV_ACCT_AP_SUPP",conn);
acctCode = getValueFromFinparam("999999","ADV_ACCT_CODE_SUPP",conn);
acctCodeCf = getValueFromFinparam("999999","DEFT_CV_ACCT_CODE_CF",conn);
cctrCodeCf = getValueFromFinparam("999999","DEFT_CV_CCTR_CODE_CF",conn);
}
else
{
acctCodeAp = getValueFromFinparam("999999","ADV_ACCT_AP_CUST",conn);
acctCode = getValueFromFinparam("999999","ADV_ACCT_CODE_CUST",conn);
acctCodeCf = getValueFromFinparam("999999","DEFT_CV_ACCT_CODE_CF",conn);
cctrCodeCf = getValueFromFinparam("999999","DEFT_CV_CCTR_CODE_CF",conn);
}
System.out.println("acctCodeAp : ["+acctCodeAp+"]");
System.out.println("acctCodeCf : ["+acctCodeCf+"]");
System.out.println("cctrCodeCf : ["+cctrCodeCf+"]");
//end - bipin on 16/02/2010
/************************************************/
headerMap.put("tran_id","");
headerMap.put("order_ref",tranID);
System.out.println("tranIDDDDDDD"+tranID);
System.out.println("Order Reffffffff"+headerMap.get("order_ref"));
//headerMap.put("vouch_type","O");//committed by bipin on 08/03/2010
headerMap.put("tran_date",dtf.format(DateX));
//Arvind 21/08/07 --Begin
headerMap.put("tran_type","CVH");
headerMap.put("sundry_type",sundryType);
//Arvind 21/08/07 --End
headerMap.put("rnd_off","R");
headerMap.put("rnd_to","1");
headerMap.put("rnd_amt","0.00");
String CR_TERM = getValueFromFinparam("999999","CR_PRD_ZERO",conn);
crterm = Integer.parseInt(CR_TERM);
System.out.println("CR_TERM:: "+crterm);
//Haneesh 02/11/09 begin
cal.add(Calendar.DAY_OF_MONTH,crterm);
currDateX = dtf.format(DateX).toString();
headerMap.put("eff_date", currDateX);
cal.add(Calendar.DAY_OF_MONTH,crterm);
currDateX = dtf.format(DateX).toString();
headerMap.put("due_date", currDateX);
//Haneesh 02/11/09 end
try{
System.out.println("-->>>>>>>>> beforeeeeeeeee"+tranID );
sql = "SELECT * FROM cash_voucher WHERE TRAN_ID = '"+tranID+"' for update nowait";
System.out.println("sql -->>>>>>>>>" + sql);
String bankCode = "";
String remarks="";
String empCode = "";
rs = stmt.executeQuery(sql);
if(rs.next())
{
//start - bipin on 19/02/2010 [reason: According to Sumit Sir on 18/02/2010]
// SimpleDateFormat sdf= new SimpleDateFormat("dd/MM/yy");
E12GenericUtility genericUtility = new E12GenericUtility();
SimpleDateFormat sdf= new SimpleDateFormat(genericUtility.getApplDateFormat());
java.util.Date trDate=new java.util.Date();
trDate=rs.getDate("tran_date");
remarks = rs.getString("remarks");
empCode = rs.getString("emp_code");
String tranDate=sdf.format(trDate);
double billAmt=rs.getDouble("tot_amt");
headerMap.put("bill_date",tranDate);
headerMap.put("supp_bill_amt",billAmt+"");
// Manoj Sarode put the bill amount value in Header map on 17-Jul-2013 Start
headerMap.put("bill_amt",billAmt+"");
// Manoj Sarode put the bill amount value in Header map on 17-Jul-2013 Stop
String advAcctCode = getAdvAcctCode(tranID, conn);
String tranType=rs.getString("tran_type");
tranType = (tranType == null)?"":tranType.trim();
String vouchType="",billNo="";
/*if(tranType.equalsIgnoreCase("C"))
{
vouchType="O";
advAcctCode="";
billNo=tranID+"/CASH";
}
else*/
if(tranType.equalsIgnoreCase("A"))
{
vouchType="A";
advAcctCode=advAcctCode.trim();
billNo=tranID+"/ADVANCE";
}
System.out.println("vouchType : ["+vouchType+"]");
System.out.println("advAcctCode : ["+advAcctCode+"]");
System.out.println("billNo : ["+billNo+"]");
headerMap.put("bill_no",billNo);
headerMap.put("vouch_type",vouchType);
headerMap.put("acct_code__adv",advAcctCode);
headerMap.put("cctr_code__adv",cctrCode);
//end - bipin on 08/03/2010
System.out.println("Emp Code:::::"+rs.getString("emp_code"));
//------PRADEEP--BEGIN--07/12/07
headerMap.put("sundry_code__pay",sundryCode);
//Arvind 21/08/07 --Begin
headerMap.put("sundry_code",sundryCode);
//Arvind 20/08/07----- End
//Arvind 20/08/07 --Begin
headerMap.put("site_code",rs.getString("site_code")==null?"":rs.getString("site_code"));
headerMap.put("fin_entity",rs.getString("site_code")==null?"":getValueFromRefTable( "SITE","SITE_CODE",rs.getString("site_code"),"FIN_ENTITY",conn));
headerMap.put("curr_code",rs.getString("curr_code")==null?"":rs.getString("curr_code"));
headerMap.put("proj_code",rs.getString("proj_code")==null?"":rs.getString("proj_code"));
headerMap.put("tax_class",rs.getString("tax_class")==null?"":rs.getString("tax_class"));
headerMap.put("tax_chap",rs.getString("tax_chap")==null?"":rs.getString("tax_chap"));
headerMap.put("tax_env",rs.getString("tax_env")==null?"":rs.getString("tax_env"));
//Arvind 20/08/07 --End
headerMap.put("tax_date",dtf.format(new java.sql.Date(new java.util.Date().getTime())).toString());
/**
* Following code is commented. Now the bank code & pay mode will come from employee master i.e Employee.Bank_code &
* Employee.Pay_mode of requesteremployee.
* If Employee.Bank_code is null then Site.bank_code and if Employee.Pay_mode is null then set as 'Q'.
* on 01-Mar-2014 Start.....
* */
// bankCode = rs.getString("site_code")==null?"":getValueFromRefTable( "SITE","SITE_CODE",rs.getString("site_code"),"CASH_CODE",conn);
//bankCode = getValueFromRefTable( "EMPLOYEE","EMP_CODE",empCode,"BANK_CODE",conn);
//23-12-2014 Santosh Divekar Commented and added below line that bank code should from site master .Mail from Dylan on same date
bankCode = getValueFromRefTable( "SITE","SITE_CODE",rs.getString("site_code"),"BANK_CODE",conn);
//payMode = getValueFromRefTable( "EMPLOYEE","EMP_CODE",empCode,"PAY_MODE",conn);
//23-12-2014 Santosh Divekar Commented and added below line that pay mode should from supplier master .Mail from Dylan on same date
payMode = getValueFromRefTable( "SUPPLIER","SUPP_CODE",sundryCode,"PAY_MODE",conn);
if(bankCode == null || bankCode.trim().length() == 0 )
{
headerMap.put("bank_code",bankCode);
}
else
{
headerMap.put("bank_code",bankCode);
}
if(payMode == null || payMode.trim().length() == 0 )
{
headerMap.put("pay_mode","Q");
}
else
{
headerMap.put("pay_mode",payMode);
}
/**
* Following code is commented. Now the bank code & pay mode will come from employee master i.e Employee.Bank_code &
* Employee.Pay_mode of requesteremployee.
* If Employee.Bank_code is null then Site.bank_code and if Employee.Pay_mode is null then set as 'Q'.
* on 01-Mar-2014 End.....
* */
headerMap.put("diff_amt__exch","0.00");
//start - bipin on 16/02/2010 [reason: commented by bipin on 16/02/2010]
/*headerMap.put("acct_code__cf",(bankCode == null)?"3013":getValueFromRefTable( "BANK","BANK_CODE",bankCode,"ACCT_CODE__CF_AP",conn));
System.out.println("Bank Code:"+getValueFromRefTable( "BANK","BANK_CODE",bankCode,"ACCT_CODE__CF_AP",conn));
headerMap.put("cctr_code__cf",(bankCode == null)?"H101":getValueFromRefTable( "BANK","BANK_CODE",bankCode,"CCTR_CODE__CF_AP",conn));
*/
headerMap.put("acct_code__cf",(bankCode == null)?acctCodeCf:getValueFromRefTable( "BANK","BANK_CODE",bankCode,"ACCT_CODE__CF_AP",conn));
System.out.println("Bank Code:"+getValueFromRefTable( "BANK","BANK_CODE",bankCode,"ACCT_CODE__CF_AP",conn));
headerMap.put("cctr_code__cf",(bankCode == null)?cctrCodeCf:getValueFromRefTable( "BANK","BANK_CODE",bankCode,"CCTR_CODE__CF_AP",conn));
//end - bipin on 16/02/2010
//Arvind 20/08/07----begin
headerMap.put("dept_code",rs.getString("dept_code")==null?"":rs.getString("dept_code"));
System.out.println("lassssssssssst");
//Arvind 20/08/07----End
//Haneesh 31/10/09 begin
returnValue = getValueFromRefTable( "SITE","SITE_CODE",rs.getString("site_code"),"DESCR",conn);
headerMap.put("site_descr",returnValue);
if(sundryType.equals("S"))
{
returnValue = getValueFromRefTable( "SUPPLIER","SUPP_CODE",sundryCode," NVL(SUPP_NAME) AS SUPP_NAME ",conn);
}
else
{
returnValue = getValueFromRefTable( "STRG_CUSTOMER","SC_CODE",sundryCode," NVL(FIRST_NAME,'')||' '||NVL(MIDDLE_MNAME,'')||' '||NVL(LAST_LNAME,'') AS STR_CUST_NAME ",conn);
}
headerMap.put("sundry_name",returnValue);
//Haneesh 31/10/09 end
/*
//Haneesh 31/10/09 begin
//---------------------pradeep--begin--22/11/07
sql1= "SELECT DESCR FROM SITE WHERE SITE_CODE='"+rs.getString("site_code")+"' ";
System.out.println("sql1***********"+sql1);
rs2=stmt.executeQuery(sql1);
if (rs2.next())
{
headerMap.put("site_descr",rs2.getString("descr"));
}
//---------------------pradeep--end--22/11/07
//----------PRADEEP---BEGIN--08/11/07
sql1= "SELECT NVL(EMP_FNAME,'')||' '||NVL(EMP_MNAME,'')||' '||NVL(EMP_LNAME,'') EMP_NAME FROM EMPLOYEE WHERE EMP_CODE='"+empCode+"' ";
//sql1= "SELECT 'A' EMP_NAME FROM DUAL ";
System.out.println("sql1***********@@@@@@@"+sql1);
rs2=stmt.executeQuery(sql1);
System.out.println("222222222");
if (rs2.next())
{
headerMap.put("sundry_name",rs2.getString("EMP_NAME"));
}
//----------PRADEEP---END--08/11/07
//Haneesh 31/10/09 end
*/
}
/**
*
* Changed By Manoj Sarode on 06-Feb-2014.
* Existing hardcoded remarks will be change with remarks entered in Advance voucher Module (Header screen's - Remarks).
*
* */
headerMap.put("remarks",remarks);
/**
* - As discussed with Hemant Sir & Sumit S - Add the Employee Short Name as CHQ_NAME in Header Map.
* Changed by Manoj Sarode on 11-Feb-2014 Start.
* */
if(sundryType.equals("S"))
{
returnValue = getValueFromRefTable( "SUPPLIER","SUPP_CODE",sundryCode," CHQ_NAME ",conn);
}
else
{
returnValue = getValueFromRefTable( "STRG_CUSTOMER","SC_CODE",sundryCode," CHQ_NAME ",conn);
}
headerMap.put("chq_name",returnValue);
/**
* - As discussed with Hemant Sir & Sumit S - Add the Employee Short Name as CHQ_NAME in Header Map.
* Changed by Manoj Sarode on 11-Feb-2014 Start.
* */
}//end of Try
catch(SQLException sq)
{
System.out.println("Exception in Sql:::"+sq.getMessage());
sq.printStackTrace();
bw.newLine();
bw.write("<SQLException>");
bw.write("ORA-00054: resource busy and acquire with NOWAIT specified");
bw.write("</SQLException>");
bw.flush();
conn.rollback();
/*String sq1 = sq.getMessage();
int n= sq1.indexOf("ORA-00054:");
System.out.println("n=========>"+n);
if(n >= 0)
{*/
return retString = itmDBAccessEJB.getErrorString("","VTNOWAT","","",conn);
//throw new ITMException(new SQLException(retString) );
// }
}
headerMap.put("confirmed","N");
headerMap.put("conf_date",dtf.format(new java.sql.Date(new java.util.Date().getTime())));
headerMap.put("emp_code__aprv","");
headerMap.put("sundry_type__pay",sundryType);
headerMap.put("cr_term",CR_TERM);
//start - bipin on 16/02/2010 [reason: commented by bipin on 16/02/2010]
/*headerMap.put("acct_code__pay","0633");
headerMap.put("cctr_code__pay"," ");
headerMap.put("acct_code__ap","0633");
headerMap.put("cctr_code__ap"," ");*/
headerMap.put("acct_code__pay",acctCodeAp);
headerMap.put("acct_code__ap",acctCodeAp);
sql1 = "SELECT * FROM CASH_VOUCHER_DET WHERE TRAN_ID ='"+tranID+"' ";
System.out.println("sql1 For Line no--> ["+sql1+"]");
stmt1 = conn.createStatement();
rs = stmt1.executeQuery(sql1);
String lineNumber="";
while(rs.next())
{
lineNumber=rs.getString("LINE_NO");
}
if(rs!=null)
{
rs.close();
rs= null;
}
sql1 = "SELECT * FROM CASH_VOUCHER_DET WHERE TRAN_ID ='"+tranID+"' and LINE_No='"+lineNumber+"' ";
System.out.println("sql1 --> ["+sql1+"]");
stmt1 = conn.createStatement();
rs1 = stmt1.executeQuery(sql1);
if(rs1.next())
{
headerMap.put("cctr_code__ap",rs1.getString("cctr_code")==null?" ":rs1.getString("cctr_code"));
headerMap.put("cctr_code__pay",rs1.getString("cctr_code")==null?" ":rs1.getString("cctr_code"));
}
if(rs1!=null)
{
rs1.close();
rs1= null;
}
//end - bipin on 16/02/2010
headerMap.put("auto_pay","Y");
headerMap.put("adv_amt","0.0");
headerMap.put("exch_rate","1");
headerMap.put("tot_amt","0.0");
headerMap.put("tax_amt","0.0");
headerMap.put("tran_mode","A");
//start - bipin on 19/02/2010[reason: According to Sumit & Navin sir on 18/02/2010]
/*rs = stmt.executeQuery("SELECT count(*) AS count FROM CASH_VOUCHER_DET WHERE TRAN_ID = '"+tranID+"'");
if(rs.next())
{
int cnt = rs.getInt("count");
System.out.println("cntttttttttt"+cnt);
if(cnt == 1)
{
//Arvind 20/08/07 --Begin
rs2 = stmt2.executeQuery("SELECT bill_no, bill_date, bill_amt FROM CASH_VOUCHER_DET WHERE TRAN_ID = '"+tranID+"'");
if(rs2.next())
{
System.out.println("kkkkkkkkkkkkk"); headerMap.put("bill_no",rs2.getString("bill_no")==null?"":rs2.getString("bill_no"));
//Anil added 04/10/2009:begin
//headerMap.put("bill_date",(rs2.getDate("bill_date")==null)?currDate.toString():rs2.getDate("bill_date").toString());
// above coding has issue due to format. so changed by anil.
//if bill_date is null then set the current date otherwise set from cash_voucher_det To set the bill date in misc voucher header
java.util.Date currDateA = null;
java.util.Date BillDateA = null;
String billDateCurr="";
String billDateDB="";
currDateA = new java.util.Date(dtf.parse(dtf.format(new java.util.Date())).getTime());
if (rs2.getDate("bill_date")!=null)
{
BillDateA=rs2.getDate("bill_date");
billDateDB=dtf.format(BillDateA);
}
else
{
billDateCurr=dtf.format(currDateA);
}
headerMap.put("bill_date",(rs2.getDate("bill_date")==null)?billDateCurr:billDateDB);
//anil added 04/10/2009:end
headerMap.put("supp_bill_amt",rs2.getDouble("bill_amt")+"");
//Arvind 20/08/07 --End
}
}
}
*/
//end - bipin on 19/02/2010
headerMap.put("SITE_CODE_LOGIN",loginSite); //for login site code not for xml data
headerMap.put("USER_ID",userId);
parentHashMap.put("MISC_VOUCHER",headerMap);
parentHashMap.put("Detail1",headerMap);
detMap = getMapForAdvDet(tranID,conn,headerMap);
System.out.println("detMap====>"+detMap);
System.out.println("Detail XML[getMapForAdvDet] found::"+detMap);
parentHashMap.put("MISC_VOUCHDET",detMap);
// Manoj Sarode Commented the following Detail3 Block as never used in Advance Voucher on 10/Jul/2013 Start
parentHashMap.put("Detail3",detMap);
System.out.println("parentHashMap::"+parentHashMap);
// Manoj Sarode Commented the following Detail3 Block as never used in Advance Voucher on 10/Jul/2013 End
//start - bipin on 18/02/2010 [reason:to confirm misc voucher through the workflow when workflow will start of 'misc_voucher_advfld' object only]
//retString = cxmv.generateXML("misc_voucher",parentHashMap, xtraParams, conn);
// Changes by Manoj Sarode - obj name to misc_voucher_advfld For Advance Voucher Request on 16-Sept-2013 Start
retString = cxmv.generateXML("misc_voucher_advfld",parentHashMap, xtraParams, conn);
// Changes by Manoj Sarode - obj name to misc_voucher_advfld For Advance Voucher Request on 16-Sept-2013 End
//end - bipin on 18/02/2010
bw.write("<FROM_JAGSERVER>");
bw.write(retString);
bw.write("</FROM_JAGSERVER>");
System.out.println("retString::::::############"+retString);
//Arvind 22/08/07--- begin
System.out.println("Created XML[CashVoucherConfirm]::"+retString);
int leng=retString.trim().length();
System.out.println("leng::"+leng);//Success
int indexofchar= retString.indexOf("CONFIRMED") ;
System.out.println("-----Before Updating in MISC Voucher indexofchar.........."+indexofchar);
if(indexofchar < 0)
{
System.out.println("---Inside Confirmation Block..11........");
bw.write("<CONFIRMATION>");
bw.newLine();
int indexString = retString.indexOf("Connection refused") ;
if(indexString >0)
{
conn.rollback();
retString = itmDBAccessEJB.getErrorString("","VTCON ","","",conn);
}
bw.write("The transaction can not be confirmed for the TranId"+tranID);
bw.write("</CONFIRMATION>");
bw.flush();
bw.newLine();
System.out.println("---Inside Confirmation Block..22........");
// bw.write("</CREATE_MISC>");
// conn.rollback();
// return itmDBAccessEJB.getErrorString("Confirmed","VTMCANC1","","",conn);
// System.out.println("retString(Error in Misc Voucher) ::"+retString);
// throw new ITMException(new Exception(retString) );
}else
//if (confirm.equalsIgnoreCase("CONFIRMED"))
{
System.out.println("--ELSE Inside Confirmation Block..11........");
bw.write("<CONFIRMATION>");
bw.newLine();
System.out.println("R E T U R N S T R I N G"+retString);
int indexChar = retString.indexOf("@") ;
System.out.println("Index of Char @"+indexChar);
String miscTranId=retString.substring(indexChar+1,20);
// bw.write("</CREATE_MISC>");
System.out.println("--ELSE Inside Confirmation Block..miscTranId........"+miscTranId);
stmt1 = conn.createStatement();
try
{
//Arvind --22/08/07----Begin-------------
/* String tranIdMvouch="";
String sql2="select tran_id from misc_voucher where order_ref='"+tranID+"'";
System.out.println("sql2"+sql2);
rs1=stmt1.executeQuery(sql2);
if(rs1.next())
{
tranIdMvouch= rs1.getString(1);
System.out.println("sql's tranIdMvouch::::::::::::::: "+tranIdMvouch);
}*/
//Arvind --22/08/07----end-------------
//start - commented by bipin on 11/03/2010 [reason:Transaction should be confirmed if voucher created or not created ]
/*
sql1= "UPDATE CASH_VOUCHER SET CONFIRMED =?,CONF_DATE = ?,EMP_CODE__APRV = ?,TRAN_ID__MVOUCH=? WHERE TRAN_ID =? ";
System.out.println("sql is::::::::::::::: "+sql1);
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1,"Y");
pstmt.setDate(2,new java.sql.Date(new java.util.Date().getTime()));
pstmt.setString(3,emploginCode);
pstmt.setString(4,miscTranId);
System.out.println("sql's tranIdMvouch::::::::::::::: "+miscTranId);
pstmt.setString(5,tranID);
System.out.println("sql's tranID::::::::::::::: "+tranID);
change = pstmt.executeUpdate();
System.out.println("CASH VOUCHER HAS CONFIRMED ********"+change );
bw.write("The cash voucher("+tranID+")Confirmed Successfully");
bw.write("</CONFIRMATION>");
bw.flush();
bw.newLine();
retString = itmDBAccessEJB.getErrorString("","VTMCONF2 ","","",conn);
conn.commit();
*/
//start - bipin on 11/03/2010
sql1= "UPDATE CASH_VOUCHER SET TRAN_ID__MVOUCH=? WHERE TRAN_ID =? ";
System.out.println("sql is::::::::::::::: "+sql1);
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1,miscTranId);
System.out.println("sql's tranIdMvouch::::::::::::::: "+miscTranId);
pstmt.setString(2,tranID);
System.out.println("sql's tranID::::::::::::::: "+tranID);
int updateCashVoucher = pstmt.executeUpdate();
System.out.println("updateCashVoucher : ["+updateCashVoucher+"]");
//start - bipin on 15/10/2010
// We need to update chg_user of Misc Voucher from SYSTEM to CashVoucher's emp_code__aprv
//int updateMiscVoucher=updateChgUserMiscVoucher(miscTranId, "voucher_advsupp", "S-VOU", tranID, conn);
//16-01-2015 above line commented by santosh set chg_user same as chg_ser from cash_voucher as discuss with Dylan
int updateMiscVoucher=updateChgUserMiscVouh(miscTranId, tranID, conn);
System.out.println("updateMiscVoucher :0:Not Found , 1:Update SuccessFully : ["+updateMiscVoucher+"]");
//end - bipin on 15/10/2010
conn.commit();
retString = itmDBAccessEJB.getErrorString("","VTMCONF2 ","","",conn);
//end - bipin on 11/03/2010
}
catch(Exception e)
{
conn.rollback();
System.out.println("Exception:::::[CashVoucherConfirmEJB]While UPDATE CASH_VOUCHER"+e.getMessage());
return itmDBAccessEJB.getErrorString("","VTADHOC1","","",conn);
}
System.out.println("Misc Voucher Created Successfuly"+retString);
return retString;
}
//Arvind 22/08/07--- End
System.out.println("-----Before Updating in MISC Voucher indexofchar 11.........."+indexofchar);
}
catch(Exception e)
{
System.out.println("Exception :[CashVoucherConfirm's createHashmapForMiscVoucher method]:::::: "+e);
e.printStackTrace();
}
finally
{
try
{
//if (conn != null) {conn.close();conn = null;}//commented by bipin on 11/03/2010
if(pstmt != null) {pstmt.close(); pstmt = null;}
if(stmt != null) {stmt.close(); stmt = null;}
if(stmt1 != null){stmt1.close();stmt1 = null;}
if(stmt2 != null){stmt2.close();stmt2 = null;}
}
catch(Exception e)
{
System.out.println("Exception in closing");
}
}
System.out.println("retString is from Cash voucher:::" + retString);
return retString;
} // END OF createHashmapForMiscVoucher() Method
//======================================= 25/05/07 ================================================
private String getValueFromFinparam(String prdCode,String varName,Connection conn)throws ITMException
{
String returnValue="";
String sql="";
ResultSet rs = null;
Statement stmt = null;
try
{
stmt = conn.createStatement();
sql="SELECT VAR_VALUE FROM FINPARM WHERE PRD_CODE ='"+prdCode+"' AND VAR_NAME ='"+varName+"'";
System.out.println("sql of fin praram" + sql);
rs =stmt.executeQuery(sql);
if(rs.next())
{
returnValue =rs.getString(1);
}
else
{
returnValue = "NULLFOUND";
}
if (stmt != null)
stmt.close();
}
catch(Exception e)
{
throw new ITMException(e);
}
System.out.println("before returnValue in [CreateXML MiscVoucher ] [finparam]" +returnValue );
return(returnValue);
}
//======================= 25/05/07 ================================
private String getValueFromRefTable(String tableName,String fieldName,String fieldValue,String reqdField,Connection conn)
{
Statement stmt = null;
ResultSet rs = null;
String returnValue ="";
try
{
if (fieldValue ==null )
fieldValue ="";
stmt = conn.createStatement();
String sql = "SELECT "+reqdField+" FROM "+tableName+" WHERE "+fieldName+" = '"+fieldValue+"'" ;
System.out.println("*****getValueFromRefTable******* DESCR QUERY IS "+sql);
rs = stmt.executeQuery(sql);
if (rs.next())
{
returnValue = rs.getString(1);
System.out.println("************* VALUE IN "+tableName+" *IS*******"+returnValue );
}
rs.close();
stmt.close();
}catch(Exception e)
{
System.out.println("Inside getValueFromRefTable Exception *******"+e.getMessage());
}
if (returnValue == null)
returnValue="";
return returnValue;
}
//====================== 25/05/07 ==================================
private String getValueFromGencodesTable(String modName,Connection conn)
{
Statement stmt = null;
ResultSet rs = null;
String returnValue ="";
try
{
stmt = conn.createStatement();
String sql = "SELECT FLD_VALUE FROM GENCODES WHERE MOD_NAME='"+modName+"' and FLD_NAME = 'TRAN_TYPE' ";
System.out.println("*****getValueFromRefTable******* DESCR QUERY IS "+sql);
rs = stmt.executeQuery(sql);
if (rs.next())
{
returnValue = rs.getString(1);
System.out.println("************* VALUE IN STRG_EVENT IS*******"+returnValue );
}
rs.close();
stmt.close();
}catch(Exception e)
{
System.out.println("Inside getValueFromRefTable Exception *******"+e.getMessage());
}
if (returnValue == null)
returnValue="";
return returnValue;
}
//===========================================================================================
private HashMap getMapForAdvDet(String tranID,Connection conn,HashMap headerMap)
{
Statement stmt=null;
ResultSet rss=null;
String lineNo="";
String sql = "";
int count = 0;
String returnValue = "";
HashMap detMap = new HashMap();
HashMap errMap=new HashMap();
try
{
//Haneesh 02/11/09 begin
E12GenericUtility e12GenericUtilityObj =new E12GenericUtility();
String format= e12GenericUtilityObj.getApplDateFormat();
java.text.SimpleDateFormat dtf= new SimpleDateFormat(format);
//Haneesh 02/11/09 end
Statement stmt1,stmt2=null;
ResultSet rs1,rs2=null;
ResultSet rs=null;
String sql1=null;
String columnName = "";
int x = 0;
//HashMap detMapChild = null;
String sundryType="";
stmt = conn.createStatement();
//ArrayList lineNoList = new ArrayList();
StringBuffer sqlBufferDet = new StringBuffer();
sql1 = " SELECT LINE_NO FROM CASH_VOUCHER_DET WHERE TRAN_ID = '"+tranID+"'";
System.out.println("sql for count no --> ["+sql1+"]");
rs = stmt.executeQuery(sql1);
//lineNoList.add(0,"0");
int counter = 1;
int lineCount = 1;//Haneesh 02/11/09 added
while (rs.next())
{
/*
//Haneesh 02/11/09 commented
//count = rs.getInt("COUNT");
lineNoList.add(counter,rs.getString("LINE_NO"));
counter++;
//System.out.println("count "+count);
//System.out.println("lineNo "+rs.getString("LINE_NO"));
}
rs.close();
rs = null;
System.out.println("Count --> "+lineNoList.size());
System.out.println("lineNoList --> "+lineNoList);
for (int lineCount = 0; lineCount < lineNoList.size() ; lineCount++)
{
//System.out.println("lineNoList::"+lineNoList.get(lineCount));
System.out.println("lineNoList::"+lineNoList.get(lineCount));
if (lineCount == 0)
{
continue;
}
//sql1 = "SELECT * FROM CASH_VOUCHER_DET WHERE TRAN_ID ='"+tranID+"' and LINE_No="+lineNoList.get(lineCount)+" ";
*/
sql1 = "SELECT * FROM CASH_VOUCHER_DET WHERE TRAN_ID ='"+tranID+"' and LINE_No="+rs.getString("LINE_NO")+" ";//Haneesh 02/11/09 added
System.out.println("sql1 --> "+x+" ["+sql1+"]");
stmt1 = conn.createStatement();
rs1 = stmt1.executeQuery(sql1);
if(rs1.next())
{
HashMap detMapChild = new HashMap();
System.out.println("lineCount-->"+lineCount);
// Arvind -- 21/08/07 --begin
detMapChild.put("tran_id","");
detMapChild.put("ref_id",tranID);
System.out.println("ref id..."+detMapChild.get("ref_id"));
//detMapChild.put("line_no",rs1.getString("line_no")==null?"":rs1.getString("line_no"));
//detMapChild.put("line_no",lineNoList.get(lineCount)); //haneesh 02/11/09 commented
detMapChild.put("line_no",rs.getString("LINE_NO")); //Haneesh 02/11/09 added
detMapChild.put("line_no__ref",rs1.getString("line_no")==null?"":rs1.getString("line_no"));
System.out.println("line no ref..."+detMapChild.get("line_no__ref"));
detMapChild.put("acct_code",rs1.getString("acct_code")==null?"":rs1.getString("acct_code"));
detMapChild.put("cctr_code",rs1.getString("cctr_code")==null?"":rs1.getString("cctr_code"));
// Arvind 21\08\07----------
// for time being setting bill_amt to amount fields.
detMapChild.put("amount",rs1.getString("bill_amt")==null?"":rs1.getString("bill_amt"));
detMapChild.put("rate",rs1.getString("bill_amt")==null?"":rs1.getString("bill_amt"));
System.out.println("rate========>"+detMapChild.get("rate")); detMapChild.put("anal_code",rs1.getString("anal_code")==null?"":rs1.getString("anal_code"));
//Haneesh 31/10/09 begin
returnValue = getValueFromRefTable( "ACCOUNTS","ACCT_CODE", rs1.getString("acct_code"), "DESCR",conn);
detMapChild.put("accounts_descr", returnValue);
returnValue = getValueFromRefTable( "COSTCTR","CCTR_CODE", rs1.getString("cctr_code"), "DESCR",conn);
detMapChild.put("costctr_descr", returnValue);
returnValue = getValueFromRefTable( "ANALYSIS","ANAL_CODE", rs1.getString("anal_code"), "DESCR",conn);
detMapChild.put("analysis_descr", returnValue);
//Haneesh 31/10/09 end
/*
//Haneesh 31/10/09 begin
//------------pradeep--begin--22/11/07----------
sql= "SELECT DESCR FROM ACCOUNTS WHERE ACCT_CODE='"+rs1.getString("acct_code")+"' ";
System.out.println("sql**********************************"+sql);
rs=stmt.executeQuery(sql);
if (rs.next())
{
detMapChild.put("accounts_descr",rs.getString("descr")==null?"":rs.getString("descr"));
}
sql= "SELECT DESCR FROM COSTCTR WHERE CCTR_CODE='"+rs1.getString("cctr_code")+"' ";
System.out.println("sql1*************************"+sql);
rs=stmt.executeQuery(sql);
if (rs.next())
{
detMapChild.put("costctr_descr",rs.getString("descr")==null?"":rs.getString("descr"));
}
sql= "SELECT DESCR FROM ANALYSIS WHERE ANAL_CODE='"+rs1.getString("anal_code")+"' ";
System.out.println("sql1*********************"+sql);
rs=stmt.executeQuery(sql);
if (rs.next())
{
detMapChild.put("analysis_descr",rs.getString("descr")==null?"":rs.getString("descr"));
}
//--------------pradeep--end--22/11/07
///Haneesh 31/10/09 End
*/
detMapChild.put("bill_amt",rs1.getString("bill_amt")==null?"":rs1.getString("bill_amt"));
detMapChild.put("tax_class",rs1.getString("tax_class")==null?"":rs1.getString("tax_class"));
detMapChild.put("tax_chap",rs1.getString("tax_chap")==null?"":rs1.getString("tax_chap"));
detMapChild.put("tax_env", rs1.getString("tax_env")==null?"":rs1.getString("tax_env"));
System.out.println("REMARKS*****************"+rs1.getString("remarks"));
//start - bipin on 17/02/2010 [reason: While creating misc voucher, length of remarks should be 60 char, beacause datatype of remarks column in misc_vouchdet table is 'varchar2(60)' and datatype of remarks column in cash_voucher_det table is 'varchar2(120)' ]
//detMapChild.put("remarks",rs1.getString("remarks")==null?"":rs1.getString("remarks"));
String remarks=rs1.getString("remarks")==null?"":rs1.getString("remarks");
System.out.println("remarks.length() : ["+remarks.length()+"]");
remarks=(remarks.length()>60)?remarks.substring(0,60):remarks;
System.out.println("remarks : ["+remarks+"]");
detMapChild.put("remarks",remarks);
//end - bipin on 17/02/2010
detMapChild.put("tax_amt", rs1.getString("tax_amt")==null?"0":rs1.getString("tax_amt"));
System.out.println("TAX amount*****************"+rs1.getString("tax_amt"));
detMapChild.put("sundry_type__for",rs1.getString("sundry_type")==null?"":rs1.getString("sundry_type"));
detMapChild.put("sundry_code__for",rs1.getString("sundry_code")==null?"":rs1.getString("sundry_code"));
detMapChild.put("bill_no",rs1.getString("bill_no")==null?"":rs1.getString("bill_no"));
if(rs1.getString("apply_tax").equals("Y"))
{
detMapChild.put("apply_tax","Y");
}
else
{
detMapChild.put("apply_tax","N");
}
// }
// detMapChild.put("bill_date","");
if (rs1.getString("bill_date") != null)
{
detMapChild.put("bill_date", dtf.format(rs1.getDate("bill_date")).toString());
//Haneesh 02/11/09 commented
/*
try
{
//String sql2 = "SELECT TO_CHAR(TO_DATE('"+rs1.getDate("bill_date").toString()+"','yyyy/mm/dd'),'dd/mm/yy') FROM CASH_VOUCHER_DET WHERE TRAN_ID='"+tranID+"' and LINE_NO='"+lineNoList.get(lineCount)+"'";//Haneesh 02/11/09 commented
String sql2 = "SELECT TO_CHAR(TO_DATE('"+rs1.getDate("bill_date").toString()+"','yyyy/mm/dd'),'dd/mm/yy') FROM CASH_VOUCHER_DET WHERE TRAN_ID='"+tranID+"' and LINE_NO='"+rs.getString("LINE_NO")+"'";//Haneesh 02/11/09 added
System.out.println("sql2 "+sql2);
stmt2=conn.createStatement();
rs2 = stmt2.executeQuery(sql2);
if(rs2.next())
{
detMapChild.put("bill_date",rs2.getString(1));
}
}
catch (Exception e)
{
System.out.println("Exception to get bill date : "+e.getMessage());
}
*/
}
else
detMapChild.put("bill_date", "");
System.out.println("continue misc voucher....");
detMapChild.put("acct_code__dr","");
detMapChild.put("cctr_code__dr","");
detMapChild.put("acct_code__cr","");
detMapChild.put("cctr_code__cr","");
detMapChild.put("prcp_id","");
detMapChild.put(" line_no__rcp", "");
detMapChild.put("item_code","");
detMapChild.put("item_descr", "");
detMapChild.put("sundry_name", "");
detMapChild.put("sudcity", "");
detMapChild.put("budget_amt_anal", "");
detMapChild.put("budget_amt_cctr", "");
detMapChild.put("consumed_amt_anal", "");
detMapChild.put("consumed_amt_cctr", "");
detMapChild.put("department_descr", "");
detMapChild.put("quantity","1");
detMapChild.put("rate__clg","0");
detMapChild.put("taxed_adj_amt", "0.0");
detMapChild.put("dept_code",(headerMap.get("dept_code")==null)?"":headerMap.get("dept_code"));
detMapChild.put("pkNames", "tran_id:line_no:");
//System.out.println("putting line no : ["+lineNoList.get(lineCount)+"] and line index : ["+lineCount+"]");
//rs.getString("LINE_NO")
//System.out.println("\nLine : "+lineNoList.get(lineCount)+"\n"+detMapChild);
System.out.println("\nLine : "+lineCount+"\n"+detMapChild);//Haneesh 02/11/09
detMap.put(String.valueOf(lineCount),detMapChild);
}
lineCount++;//Haneesh 02/11/09 added
}
}//EOF TRY
catch(Exception e)
{
System.out.println("\n\n\n\n\n\n\nError in Cash Voucher Detail.(Can't return Detail Map)"+e);
e.getMessage();
e.printStackTrace();
}
finally
{
try
{
if (stmt != null)
{
stmt.close();
stmt = null;
}
}
catch ( Exception e )
{
System.out.println("Exception inside finally " +e.getMessage());
}
}
return detMap;
}
//start - bipin on 08/03/2010
private String getAdvAcctCode(String tranId, Connection conn)throws Exception
{
Statement stmt = null;
ResultSet rs = null;
String advAcctCode="";
try
{
stmt = conn.createStatement();
String sql = "SELECT distinct acct_code FROM CASH_VOUCHER_DET WHERE TRAN_ID ='"+tranId+"'";
System.out.println("sql::"+sql);
rs = stmt.executeQuery(sql);
if (rs.next())
{
advAcctCode = rs.getString(1);
}
else
{
advAcctCode="";
}
System.out.println("advAcctCode ["+advAcctCode+"]");
}
catch(Exception e)
{
System.out.println("Inside getAdvAcctCode Exception *******"+e.getMessage());
}
finally
{
if(rs != null){rs.close();rs=null;}
if(stmt != null){stmt.close();stmt=null;}
System.out.println("Inside getAdvAcctCode finally *******");
}
return advAcctCode;
}
private int updateCashVoucher(String tranID,String emploginCode,Connection conn) throws Exception
{
PreparedStatement pstmt=null;
int confirmCashVoucher=0;
try
{
String sql1= "UPDATE CASH_VOUCHER SET CONFIRMED =?, CONF_DATE = ?,EMP_CODE__APRV = ? WHERE TRAN_ID =? ";
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1,"Y");
pstmt.setDate(2,new java.sql.Date(new java.util.Date().getTime()));
pstmt.setString(3,emploginCode);
pstmt.setString(4,tranID);
System.out.println("Sql to confirm cash voucher"+sql1);
confirmCashVoucher = pstmt.executeUpdate();
System.out.println("confirmCashVoucher : ["+confirmCashVoucher+"]");
}
catch(Exception e)
{
System.out.println("Exception in updateCashVoucher :"+e.getMessage());
}
finally
{
if(pstmt != null){pstmt.close();pstmt=null;}
System.out.println("finally in updateCashVoucher :");
}
return confirmCashVoucher;
}
//end - bipin on 08/03/2010
//start - bipin on 15/10/2010
private int updateChgUserMiscVoucher(String miscTranId, String objName, String refSer, String refId, Connection conn) throws Exception
{
PreparedStatement pstmt=null;
ResultSet rs=null;
int updMiscVouch=0;
String signUserCode="";
System.out.println("----- Updating in MISC Voucher ..........");
try
{
String sql="select DDF_GET_WFAPRV_USERCODE(?, ?, ?) from dual";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,objName);
pstmt.setString(2,refSer);
pstmt.setString(3,refId);
System.out.println("sql : ["+sql+"]");
rs=pstmt.executeQuery();
if(rs.next())
{
signUserCode=rs.getString(1);
}
signUserCode=(signUserCode == null)?"":signUserCode.trim();
System.out.println("signUserCode : ["+signUserCode+"]");
pstmt=null;
String sql1= "UPDATE misc_voucher SET CHG_USER =? WHERE TRAN_ID =? ";
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1,signUserCode);
pstmt.setString(2,miscTranId);
System.out.println("Sql to update misc_voucher"+sql1);
updMiscVouch = pstmt.executeUpdate();
System.out.println("updMiscVouch : ["+updMiscVouch+"]");
}
catch(Exception e)
{
System.out.println("Exception in updateChgUserMiscVoucher :"+e.getMessage());
}
finally
{
if(rs != null){rs.close();rs=null;}
if(pstmt != null){pstmt.close();pstmt=null;}
System.out.println("finally in updateChgUserMiscVoucher :");
}
return updMiscVouch;
}
//end - bipin on 15/10/2010
//Start 16-01-2015 added by santosh to set chg_user same as chg_ser from cash_voucher as discuss with Dylan
private int updateChgUserMiscVouh(String miscTranId, String tranId, Connection conn) throws Exception
{
PreparedStatement pstmt=null;
ResultSet rs=null;
int updMiscVouch=0;
String signUserCode="";
System.out.println("----- Updating in MISC Voucher ..........");
try
{
String sql="SELECT CHG_USER FROM CASH_VOUCHER where tran_id =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
System.out.println("sql : ["+sql+"]");
rs=pstmt.executeQuery();
if(rs.next())
{
signUserCode=rs.getString(1);
}
signUserCode=(signUserCode == null)?"":signUserCode.trim();
System.out.println("signUserCode : ["+signUserCode+"]");
pstmt=null;
String sql1= "UPDATE misc_voucher SET CHG_USER =? WHERE TRAN_ID =? ";
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1,signUserCode);
pstmt.setString(2,miscTranId);
System.out.println("Sql to update misc_voucher"+sql1);
updMiscVouch = pstmt.executeUpdate();
System.out.println("updMiscVouch : ["+updMiscVouch+"]");
}
catch(Exception e)
{
System.out.println("Exception in updateChgUserMiscVoucher :"+e.getMessage());
}
finally
{
if(rs != null){rs.close();rs=null;}
if(pstmt != null){pstmt.close();pstmt=null;}
System.out.println("finally in updateChgUserMiscVoucher :");
}
return updMiscVouch;
}
//End 16-01-2015 added by santosh to set chg_user same as chg_ser from cash_voucher as discuss with Dylan
}//end of class
//-----------------------14/08/2007
package ibase.webitm.ejb.fin.advfield;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.*;
import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.*;
import java.io.*;//added by bipin on 22/02/2010
@javax.ejb.Local
public interface AdvanceVoucherSuppConfirmLocal extends ActionHandlerLocal
{
public String confirm() throws RemoteException,ITMException;
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String createHashmapForMiscVoucher(String tranID, String xtraParams, String userId, BufferedWriter bw,Connection conn) throws ITMException ,Exception;//added by bipin on 22/02/2010
}
\ No newline at end of file
package ibase.webitm.ejb.fin.advfield;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.*;
import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.*;
import java.io.*;//added by bipin on 22/02/2010
@javax.ejb.Remote
public interface AdvanceVoucherSuppConfirmRemote extends ActionHandlerRemote
{
public String confirm() throws RemoteException,ITMException;
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String createHashmapForMiscVoucher(String tranID, String xtraParams, String userId, BufferedWriter bw,Connection conn) throws ITMException ,Exception;//added by bipin on 22/02/2010
}
\ No newline at end of file
package ibase.webitm.ejb.fin.advfield;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.sys_UTL.SignInUpdateWFStatus;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException;
import java.io.PrintStream;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@Stateless
public class AdvanceVoucherSuppSubmit extends ActionHandlerEJB
implements AdvanceVoucherSuppSubmitLocal, AdvanceVoucherSuppSubmitRemote
{
public String confirm()
throws RemoteException, ITMException
{
return "";
}
public String confirm(String paramString1, String paramString2, String paramString3) throws RemoteException, ITMException
{
String str = "";
try
{
System.out.println("Advance Confirm Process...");
str = submitCashVoucher(paramString1, paramString2);
System.out.println("result..." + str);
}
catch (Exception localException)
{
System.out.println("Exception ::" + localException.getMessage());
throw new ITMException(localException);
}
return str;
}
private String submitCashVoucher(String paramString1, String paramString2) throws RemoteException, ITMException {
Connection localConnection = null;
Statement localStatement = null;
PreparedStatement localPreparedStatement = null;
ResultSet localResultSet = null;
String str1 = "";
String str2 = "";
String str3 = "";
String str4 = "";
String str5 = "";
String str6 = "BASE";
double d1 = 0.0D;
String str7 = "";
String str8 = "";
Double localDouble = Double.valueOf(0.0D);
double d2 = 0.0D;
String str9 = "";
String str10 = "";
E12GenericUtility localE12GenericUtility = new E12GenericUtility();
ITMDBAccessEJB localITMDBAccessEJB = new ITMDBAccessEJB();
ConnDriver localConnDriver = new ConnDriver();
try
{
str5 = localE12GenericUtility.getApplDateFormat();
}
catch (Exception localException1)
{
System.out.println("Exception :[generateXML]While Getting Date Format" + localException1.getMessage());
}
Date localDate = new Date();
SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat(str5);
java.sql.Timestamp currdate = new java.sql.Timestamp( System.currentTimeMillis() );
try
{
//Comment By sanket J as request by Manoj sir on [21/06/2018]
//localConnection = localConnDriver.getConnectDB("DriverITM");
localConnection = getConnection() ;
localStatement = localConnection.createStatement();
str1 = "SELECT CONFIRMED,NET_AMT,STATUS,NET_AMT__CONV FROM CASH_VOUCHER WHERE TRAN_ID='" + paramString1 + "'";
System.out.println("sql:::::::" + str1);
localResultSet = localStatement.executeQuery(str1);
if (localResultSet.next())
{
str2 = localResultSet.getString("CONFIRMED");
System.out.println("confirm==>" + str2);
str4 = localResultSet.getString("STATUS");
System.out.println("status==>" + str4);
d2 = localResultSet.getDouble("NET_AMT");
System.out.println("netAmount==>" + d2);
localDouble = Double.valueOf(localResultSet.getDouble("NET_AMT__CONV"));
System.out.println("convNetAmount:::" + localDouble);
}
String str11;
if (str2.equalsIgnoreCase("Y"))
{
str11 = localITMDBAccessEJB.getErrorString("", "VTALCONF", "", "", localConnection);
return str11;
}
if (str4.equalsIgnoreCase("S"))
{
str3 = localITMDBAccessEJB.getErrorString("submited", "VTINWRFLOW", str6, "", localConnection);
str11 = str3;
return str11;
}
/* if (d2 > 20000.0D)
{
str11 = localITMDBAccessEJB.getErrorString("", "VNAMT1", "", "", localConnection);
return str11;
}*/
int i = getCount("CASH_VOUCHER_DET", "TRAN_ID", paramString1, localConnection);
String errString="";
if (i == 0) {
errString = localITMDBAccessEJB.getErrorString("", "VTRLNM1", "", "", localConnection);
return errString;
}
/* str1 = "SELECT SUM(AMOUNT)AS AMOUNT FROM CASH_VOUCHER_CONV WHERE TRAN_ID='" + paramString1 + "'";
localResultSet = localStatement.executeQuery(str1);
if (localResultSet.next())
{
d1 = localResultSet.getDouble("AMOUNT");
System.out.println("amount::" + d1);
}
if (localDouble.doubleValue() > 0.0D)
{
if (d1 != localDouble.doubleValue())
{
localObject1 = localITMDBAccessEJB.getErrorString("", "VTAMOUNT4", "", "", localConnection);
return localObject1;
}
}
if ((localDouble.doubleValue() == 0.0D) && (d1 > 0.0D))
{
localObject1 = localITMDBAccessEJB.getErrorString("", "VMACTCONV", "", "", localConnection);
return localObject1;
}*/
Object localObject1 = new SignInUpdateWFStatus();
str9 = ((SignInUpdateWFStatus)localObject1).updateWFStatus(paramString1, "voucher_advsupp", paramString2, str2);
System.out.println("result========>" + str9);
System.out.println("status......[" + str4 + "]");
Document localDocument = localE12GenericUtility.parseString(str9);
Node localNode = localDocument.getElementsByTagName("error").item(0);
NamedNodeMap localNamedNodeMap = localNode.getAttributes();
String str12 = localNamedNodeMap.getNamedItem("id").getNodeValue();
if (!str12.trim().equalsIgnoreCase("VTSUBMIT"))
{
if (str9.trim().length() != 0)
{
localConnection.rollback();
String str13 = str9;
return str13;
}
}
else
{
str8 = ((SignInUpdateWFStatus)localObject1).getValueFromXTRA_PARAMS(paramString2, "chgTerm");
System.out.println("chgTerm......[" + str8 + "]");
str7 = ((SignInUpdateWFStatus)localObject1).getValueFromXTRA_PARAMS(paramString2, "loginCode");
System.out.println("chgUser......[" + str7 + "]");
System.out.println("chgDate......[" + currdate+ "]");
/*
* Changes by Manoj Sarode on 10-Oct-2013 Start
* Update the change date when the transaction is submitted using Submit button
* */
str1 = "UPDATE CASH_VOUCHER SET CHG_USER= ?,CHG_TERM= ?, CHG_DATE =? WHERE TRAN_ID='" + paramString1 + "'";
System.out.println("sql......[" + str1 + "]");
localPreparedStatement = localConnection.prepareStatement(str1);
localPreparedStatement.setString(1, str7);
localPreparedStatement.setString(2, str8);
localPreparedStatement.setTimestamp(3, currdate);
int j = localPreparedStatement.executeUpdate();
localPreparedStatement.close();
localPreparedStatement = null;
/*
* Changes by Manoj Sarode on 10-Oct-2013 End
* Update the change date when the transaction is submitted using Submit button
* */
}
localConnection.commit();
}
catch (Exception localSQLException2)
{
System.out.println("Exception:: [AdvanceVoucherSuppSubmit ]EXCEPTION" + localSQLException2.getMessage());
localSQLException2.printStackTrace();
}
finally
{
try
{
if (localConnection != null)
{
localStatement.close();
localConnection.close();
localConnection = null;
}
}
catch (SQLException localSQLException10)
{
System.out.println("Exception inside finally" + localSQLException10.getMessage());
return localITMDBAccessEJB.getErrorString("", "VTADHOC1", "", "", localConnection);
}
}
return (String)str9;
}
int getCount(String paramString1, String paramString2, String paramString3, Connection paramConnection)
{
Statement localStatement = null;
ResultSet localResultSet = null;
int i = 0;
try
{
if (paramString3 == null)
paramString3 = "";
localStatement = paramConnection.createStatement();
String str = "SELECT COUNT(*) AS COUNT FROM " + paramString1 + " WHERE " + paramString2 + " = '" + paramString3 + "'";
System.out.println("sql::" + str);
localResultSet = localStatement.executeQuery(str);
if (localResultSet.next())
{
System.out.println("inside getCount");
i = localResultSet.getInt("COUNT");
System.out.println("************* COUNT IN " + paramString1 + " ********" + i);
}
localResultSet.close();
localStatement.close();
System.out.println("************* COUNT out 33 " + paramString1 + " ********" + i);
}
catch (Exception localException)
{
System.out.println("Inside getCount Exception *******" + localException.getMessage());
localException.printStackTrace();
}
return i;
}
/* private String getValueFromFinparam(String paramString1, String paramString2, Connection paramConnection) throws ITMException {
String str1 = "";
String str2 = "";
ResultSet localResultSet = null;
Statement localStatement = null;
try
{
localStatement = paramConnection.createStatement();
str2 = "SELECT VAR_VALUE FROM FINPARM WHERE PRD_CODE ='" + paramString1 + "' AND VAR_NAME ='" + paramString2 + "'";
System.out.println("sql of fin praram" + str2);
localResultSet = localStatement.executeQuery(str2);
if (localResultSet.next())
{
str1 = localResultSet.getString(1);
}
else
{
str1 = "NULLFOUND";
}
if (localStatement != null)
localStatement.close();
}
catch (Exception localException)
{
throw new ITMException(localException);
}
return str1;
}*/
}
\ No newline at end of file
package ibase.webitm.ejb.fin.advfield;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Local;
@Local
public interface AdvanceVoucherSuppSubmitLocal extends ActionHandlerLocal {
public String confirm() throws RemoteException, ITMException;
public String confirm(String paramString1, String paramString2, String paramString3)
throws RemoteException, ITMException;
}
package ibase.webitm.ejb.fin.advfield;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Remote;
@Remote
public interface AdvanceVoucherSuppSubmitRemote extends ActionHandlerRemote {
public String confirm() throws RemoteException, ITMException;
public String confirm(String paramString1, String paramString2, String paramString3)
throws RemoteException, ITMException;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
package ibase.webitm.ejb.fin.advfield;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
import ibase.webitm.ejb.*;
import java.sql.*;
import javax.ejb.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import ibase.webitm.utility.ITMException;
@javax.ejb.Local
public interface VoucherAdvFieldLocal extends ValidatorLocal
{
public String wfValData() throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged() throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2,String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String postSave() throws RemoteException,ITMException;
public String postSave(String xmlString, String xmlString1, String xmlString2, String objContext, String xtraParams, Connection conn) throws RemoteException,ITMException;
//public String preSave(String arg1, String editFlag, String xtraParams, Connection conn) throws RemoteException,ITMException;
// public String preSaveRec(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, Connection conn,String xtraParam ) throws RemoteException,ITMException;
//public String preSaveRec(String xmlString, String xmlString1,String xmlString2, String editFlag, String xtraParam, Connection conn ,String objContext) throws RemoteException,ITMException;
//public String postValData(String xmlString, String xmlString1,String xmlString2,String objContext,String winName,String xtraParam) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.fin.advfield;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import java.sql.*;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.*;
@javax.ejb.Remote
public interface VoucherAdvFieldRemote extends ValidatorRemote
{
public String wfValData() throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged() throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2,String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String postSave() throws RemoteException,ITMException;
public String postSave(String xmlString, String xmlString1, String xmlString2, String objContext, String xtraParams, Connection conn) throws RemoteException,ITMException;
//public String preSave(String arg1, String editFlag, String xtraParams, Connection conn) throws RemoteException,ITMException;
// public String preSaveRec(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, Connection conn,String xtraParam ) throws RemoteException,ITMException;
//public String preSaveRec(String xmlString, String xmlString1,String xmlString2, String editFlag, String xtraParam, Connection conn ,String objContext) throws RemoteException,ITMException;
//public String postValData(String xmlString, String xmlString1,String xmlString2,String objContext,String winName,String xtraParam) throws RemoteException,ITMException;
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
package ibase.webitm.ejb.fin.advfield;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
import ibase.webitm.ejb.*;
import java.sql.*;
import javax.ejb.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import ibase.webitm.utility.ITMException;
@javax.ejb.Local
public interface VoucherAdvSuppLocal extends ValidatorLocal
{
public String wfValData() throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged() throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2,String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String postSave() throws RemoteException,ITMException;
public String postSave(String xmlString, String xmlString1, String xmlString2, String objContext, String xtraParams, Connection conn) throws RemoteException,ITMException;
//public String preSave(String arg1, String editFlag, String xtraParams, Connection conn) throws RemoteException,ITMException;
// public String preSaveRec(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, Connection conn,String xtraParam ) throws RemoteException,ITMException;
//public String preSaveRec(String xmlString, String xmlString1,String xmlString2, String editFlag, String xtraParam, Connection conn ,String objContext) throws RemoteException,ITMException;
//public String postValData(String xmlString, String xmlString1,String xmlString2,String objContext,String winName,String xtraParam) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.fin.advfield;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import java.sql.*;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.*;
@javax.ejb.Remote
public interface VoucherAdvSuppRemote extends ValidatorRemote
{
public String wfValData() throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged() throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2,String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String postSave() throws RemoteException,ITMException;
public String postSave(String xmlString, String xmlString1, String xmlString2, String objContext, String xtraParams, Connection conn) throws RemoteException,ITMException;
//public String preSave(String arg1, String editFlag, String xtraParams, Connection conn) throws RemoteException,ITMException;
// public String preSaveRec(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, Connection conn,String xtraParam ) throws RemoteException,ITMException;
//public String preSaveRec(String xmlString, String xmlString1,String xmlString2, String editFlag, String xtraParam, Connection conn ,String objContext) throws RemoteException,ITMException;
//public String postValData(String xmlString, String xmlString1,String xmlString2,String objContext,String winName,String xtraParam) throws RemoteException,ITMException;
}
\ 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