Commit 428bed9b authored by vkadam's avatar vkadam

Change in Auto payment generation process, Purchase voucher create scheduler,...

Change in Auto payment generation process, Purchase voucher create scheduler, Generate tax voucher scheduler.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100349 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 78a35a9a
...@@ -56,9 +56,12 @@ public class AutoPmtGenPrc extends ProcessEJB ...@@ -56,9 +56,12 @@ public class AutoPmtGenPrc extends ProcessEJB
Timestamp dateTo = null; Timestamp dateTo = null;
Timestamp dateFr = null; Timestamp dateFr = null;
String startDateStr = null; String startDateStr = null;
FileOutputStream fos1 = null; FileOutputStream fos1 = null;
java.util.Date startDate = new java.util.Date(System.currentTimeMillis()); java.util.Date startDate = new java.util.Date(System.currentTimeMillis());
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
FinCommon finCommon=new FinCommon();
public String getData(String xmlString, String xmlString2, String windowName, String xtraParams) public String getData(String xmlString, String xmlString2, String windowName, String xtraParams)
throws RemoteException, ITMException throws RemoteException, ITMException
...@@ -155,10 +158,11 @@ public class AutoPmtGenPrc extends ProcessEJB ...@@ -155,10 +158,11 @@ public class AutoPmtGenPrc extends ProcessEJB
String resultString = ""; String resultString = "";
String getSql = null; String getSql = null;
String currCode = ""; String currCode = "";
String checkBarCd="";
String sql = null; String sql = null;
ResultSet rs = null; ResultSet rs = null;
ResultSet rs1 = null; ResultSet rs1 = null;
String spiltChq = ""; String spiltChq = "",barCode="";
PreparedStatement pstmt = null; PreparedStatement pstmt1 = null; PreparedStatement pstmt = null; PreparedStatement pstmt1 = null;
double unapprovedPayAmt = 0.0D; double payAmt = 0.0D; double netPayable = 0.0D; double unapprovedPayAmt = 0.0D; double payAmt = 0.0D; double netPayable = 0.0D;
...@@ -173,6 +177,24 @@ public class AutoPmtGenPrc extends ProcessEJB ...@@ -173,6 +177,24 @@ public class AutoPmtGenPrc extends ProcessEJB
conn.setAutoCommit(false); conn.setAutoCommit(false);
stmtTemp = conn.createStatement(); stmtTemp = conn.createStatement();
DatabaseMetaData dbmd = conn.getMetaData(); DatabaseMetaData dbmd = conn.getMetaData();
/**
* [F15KSUN014]
* VALLABH KADAM
* select finparam 'CHECK_BARCD_APMT'
* */
checkBarCd=checkNull(finCommon.getFinparams("999999", "CHECK_BARCD_APMT", conn));
if(checkBarCd==null || checkBarCd.trim().length() == 0 || checkBarCd.trim().equalsIgnoreCase("NULLFOUND"))
{
checkBarCd="N";
}
System.out.println("Check bar code from finparm :- ["+checkBarCd+"]");
/**
* [F15KSUN014]
* VALLABH KADAM
* select finparam 'CHECK_BARCD_APMT'
* END
* */
getSql = "select var_value from finparm where prd_code='999999' and var_name='AUTOPAYGEN_LOG_FLAG'"; getSql = "select var_value from finparm where prd_code='999999' and var_name='AUTOPAYGEN_LOG_FLAG'";
pstmt = conn.prepareStatement(getSql); pstmt = conn.prepareStatement(getSql);
...@@ -372,6 +394,45 @@ public class AutoPmtGenPrc extends ProcessEJB ...@@ -372,6 +394,45 @@ public class AutoPmtGenPrc extends ProcessEJB
payAmt = rs.getDouble("pay_amt"); payAmt = rs.getDouble("pay_amt");
netPayable = rs.getDouble("net_payable"); netPayable = rs.getDouble("net_payable");
dueDate = rs.getString("due_date"); dueDate = rs.getString("due_date");
/**
* [F15KSUN014]
* VALLABH KADAM
* Select BARCODE
* using 'DDF_GET_MULTI_BARCODE' function
* 24/FEB/16
* */
if("Y".equalsIgnoreCase(checkBarCd))
{
System.out.println("Check bar code found Y");
tempSql="select DDF_GET_MULTI_BARCODE(?) as barcode from dual";
pstmt1=conn.prepareStatement(tempSql);
pstmt1.setString(1, refNo);
rsTemp = pstmt1.executeQuery();
if (rsTemp.next())
{
barCode=checkNull(rsTemp.getString("barcode"));
}
pstmt1.close();
pstmt1 = null;
rsTemp.close();
rsTemp = null;
if(barCode==null || barCode.trim().length()==0)
{
continue;
}
}
/**
* [F15KSUN014]
* VALLABH KADAM
* Select BARCODE
* using 'DDF_GET_MULTI_BARCODE' function
* 24/FEB/16
* END
* */
tempSql = " select sum(b.net_amt) as unconfirm_amt from misc_payment a,misc_paydet b where a.tran_id=b.tran_id and b.tran_ser=? and b.vouch_no= ? and a.confirmed='N' "; tempSql = " select sum(b.net_amt) as unconfirm_amt from misc_payment a,misc_paydet b where a.tran_id=b.tran_id and b.tran_ser=? and b.vouch_no= ? and a.confirmed='N' ";
...@@ -572,7 +633,7 @@ public class AutoPmtGenPrc extends ProcessEJB ...@@ -572,7 +633,7 @@ public class AutoPmtGenPrc extends ProcessEJB
String wfStatus = ""; String wfStatus = "";
String spiltChq = ""; String spiltChq = "";
String stanCode = ""; String stanCode = "";
String checkBarCd="";
String tranDate = ""; String tranDate = "";
double diffAmt = 0.0D; double diffAmt = 0.0D;
String retString = ""; String retString = "";
...@@ -649,6 +710,9 @@ Timestamp refDateSTr=null; ...@@ -649,6 +710,9 @@ Timestamp refDateSTr=null;
String maxRefNo = ""; String maxRefNo = "";
try try
{ {
System.out.println("intializingLog$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$........." + intializingLog("Gen_bank_payment_log")); System.out.println("intializingLog$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$........." + intializingLog("Gen_bank_payment_log"));
StringBuffer retBuf = new StringBuffer(); StringBuffer retBuf = new StringBuffer();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
......
...@@ -435,7 +435,7 @@ public class AutoPmtPrcSch ...@@ -435,7 +435,7 @@ public class AutoPmtPrcSch
System.out.println("Calling getData() Method@@@@@@@@@@@"); System.out.println("Calling getData() Method@@@@@@@@@@@");
retString = aPayPrc.getData(xmlString1, xmlString2, windowName, xtraParams, isSSCUsers); retString = aPayPrc.getData(xmlString1, xmlString2, windowName, xtraParams, isSSCUsers);
System.out.println("ResultString....." + retString); System.out.println("Get DATA Result String :- [" + retString+"]");
System.out.println("Processing DATA *****"); System.out.println("Processing DATA *****");
System.out.println("getData Method Finished@@@@@@@@@@@2"); System.out.println("getData Method Finished@@@@@@@@@@@2");
...@@ -543,7 +543,7 @@ public class AutoPmtPrcSch ...@@ -543,7 +543,7 @@ public class AutoPmtPrcSch
System.out.println("xmlString4@@@@@@@@@@@@@@@@:" + xmlString4); System.out.println("xmlString4@@@@@@@@@@@@@@@@:" + xmlString4);
System.out.println("Calling process() Method@@@@@@@@@@@@"); System.out.println("Calling process() Method@@@@@@@@@@@@");
retString1 = aPayPrc.process(xmlString1, xmlString4, windowName, xtraParams); retString1 = aPayPrc.process(xmlString1, xmlString4, windowName, xtraParams);
System.out.println("retString1 in Scheduler=====" + retString1); System.out.println("Process return String :-[" + retString1+"]");
System.out.println("-----Process() called successfully-------"); System.out.println("-----Process() called successfully-------");
} }
......
...@@ -75,7 +75,9 @@ public class CreatePoRcpVoucher ...@@ -75,7 +75,9 @@ public class CreatePoRcpVoucher
String remarks = "", siteCode = "", invoiceNo = "", DcNo = "", retOpt = "", postType = "", itemSer = ""; String remarks = "", siteCode = "", invoiceNo = "", DcNo = "", retOpt = "", postType = "", itemSer = "";
String invOnLine = "", poRcpOnLine = "", postProv = "", crTerm = "", projCode = "", pordType = ""; String invOnLine = "", poRcpOnLine = "", postProv = "", crTerm = "", projCode = "", pordType = "";
String analCode = "", bankCodePay = "", acctCodePur = "", cctrCodePur = "", payMode = "", profileId = "",tranIdVoucher=""; String analCode = "", bankCodePay = "", acctCodePur = "", cctrCodePur = "", payMode = "", profileId = "",tranIdVoucher="";
String finEntity = "", bankCode = "", keyString = "", ledgPostConf = "",whetherToConvert = "N", userId = "SYSTEM", termId = "SYSTEM"; String finEntity = "", bankCode = "", keyString = "", ledgPostConf = "",whetherToConvert = "N";
// String userId = "SYSTEM", termId = "SYSTEM";
String userId = "", termId = "";
java.text.SimpleDateFormat sdf = null; java.text.SimpleDateFormat sdf = null;
String acctCodeCF = "", acctCodeCFAP = "", cctrCodeCF = "", cctrCodeCFAP = "", suppCodePay = ""; String acctCodeCF = "", acctCodeCFAP = "", cctrCodeCF = "", cctrCodeCFAP = "", suppCodePay = "";
String rcpLine = "", purcOrderDet = "", lineNoOrd = "", rcpItemCode = "", rcpUnit = ""; String rcpLine = "", purcOrderDet = "", lineNoOrd = "", rcpItemCode = "", rcpUnit = "";
...@@ -95,6 +97,10 @@ public class CreatePoRcpVoucher ...@@ -95,6 +97,10 @@ public class CreatePoRcpVoucher
InitialContext ctx = new InitialContext(p); InitialContext ctx = new InitialContext(p);
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
termId= genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId");
System.out.println("@@@ User Id from xtraparam :- ["+userId+"]");
System.out.println("@@@ Term Id from xtraparam :- ["+termId+"]");
sql = "SELECT PROFILE_ID FROM USERS WHERE CODE = ? "; sql = "SELECT PROFILE_ID FROM USERS WHERE CODE = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -839,9 +845,14 @@ public class CreatePoRcpVoucher ...@@ -839,9 +845,14 @@ public class CreatePoRcpVoucher
xmlBuff.append("<diff_amt__exch><![CDATA[0]]></diff_amt__exch>"); xmlBuff.append("<diff_amt__exch><![CDATA[0]]></diff_amt__exch>");
xmlBuff.append("<supp_bill_amt><![CDATA[" + suppBillAmount + "]]></supp_bill_amt>"); xmlBuff.append("<supp_bill_amt><![CDATA[" + suppBillAmount + "]]></supp_bill_amt>");
sdf = new java.text.SimpleDateFormat(genericUtility.getApplDateTimeFormat());
xmlBuff.append("<add_date><![CDATA[" + sdf.format(today) + "]]></add_date>");
xmlBuff.append("<add_user><![CDATA[" + (userId==null?"BASE":userId) + "]]></add_user>");
xmlBuff.append("<add_term><![CDATA[" + (termId==null?"BASE":termId) + "]]></add_term>");
xmlBuff.append("<chg_user><![CDATA[" + (userId==null?"BASE":userId) + "]]></chg_user>"); xmlBuff.append("<chg_user><![CDATA[" + (userId==null?"BASE":userId) + "]]></chg_user>");
xmlBuff.append("<chg_term><![CDATA[" + (termId==null?"BASE":termId) + "]]></chg_term>"); xmlBuff.append("<chg_term><![CDATA[" + (termId==null?"BASE":termId) + "]]></chg_term>");
sdf = new java.text.SimpleDateFormat(genericUtility.getApplDateTimeFormat()); //sdf = new java.text.SimpleDateFormat(genericUtility.getApplDateTimeFormat());
xmlBuff.append("<chg_date><![CDATA[" + sdf.format(today) + "]]></chg_date>"); xmlBuff.append("<chg_date><![CDATA[" + sdf.format(today) + "]]></chg_date>");
xmlBuff.append("</Detail1>"); xmlBuff.append("</Detail1>");
...@@ -1775,7 +1786,9 @@ public class CreatePoRcpVoucher ...@@ -1775,7 +1786,9 @@ public class CreatePoRcpVoucher
userInfoBean.setUserCountry(userInfoArray[19]); userInfoBean.setUserCountry(userInfoArray[19]);
//masterStatefulLocal = (MasterStatefulLocal) ctx.lookup("ibase/MasterStatefulEJB/local"); //masterStatefulLocal = (MasterStatefulLocal) ctx.lookup("ibase/MasterStatefulEJB/local");
//String retString = masterStatefulLocal.processRequest(userInfoBean, xmlString, true, conn); //String retString = masterStatefulLocal.processRequest(userInfoBean, xmlString, true, conn);
String retString =saveData(userInfoBean,siteCode, xmlBuff.toString(), conn);
// String retString =saveData(userInfoBean,siteCode, xmlBuff.toString(), conn);
String retString =saveData(xtraParams,siteCode, xmlBuff.toString(), conn);
/** /**
* Vishakha Dhoble 02-Nov-15 (F15GSUN009) * Vishakha Dhoble 02-Nov-15 (F15GSUN009)
* */ * */
...@@ -2170,8 +2183,86 @@ public class CreatePoRcpVoucher ...@@ -2170,8 +2183,86 @@ public class CreatePoRcpVoucher
return dueDate; return dueDate;
} }
// public double[] getPurcRate(String purcOrder,String itemCode,double poRate,double poDisc, Connection conn) throws ITMException
// {
// PreparedStatement pstmt = null;
// ResultSet rs = null;
// String sql = "";
// String porderNo = "", provNo = "";
// double rateDiscount[] = {0,0};
// try
// {
// sql = " select purc_order, (case when provi_tran_id is null then '' else provi_tran_id end) as provi_tran_id"
// + " from porder where purc_order = ?"; //: ;
//
// pstmt = conn.prepareStatement(sql);
// pstmt.setString(1,purcOrder);
// rs = pstmt.executeQuery();
// if(rs.next())
// {
// porderNo = rs.getString("purc_order");
// provNo = rs.getString("provi_tran_id");
// }
// rs.close();
// rs = null;
// pstmt.close();
// pstmt = null;
//
// if (porderNo.equals(provNo))
// {
// sql = " select rate, discount "
// + " from porder a, porddet b "
// + " where a.purc_order = b.purc_order "
// + " and a.purc_order <> ? "
// + " and a.provi_tran_id = ? "
// + " and b.item_code = ? "
// + " and a.confirmed = 'Y' ";
//
// pstmt = conn.prepareStatement(sql);
// pstmt.setString(1,purcOrder);
// pstmt.setString(2,purcOrder);
// pstmt.setString(3,itemCode);
// rs = pstmt.executeQuery();
// if(rs.next())
// {
// poRate = rs.getDouble("rate");
// poDisc = rs.getDouble("discount");
// }
// rs.close();
// rs = null;
// pstmt.close();
// pstmt = null;
// }
// else
// {
// poRate = -999;
// poDisc = -999;
// }
// rateDiscount[0] = poRate;
// rateDiscount[1] = poDisc;
// } // try
// catch(Exception e)
// {
// throw new ITMException(e);
// }
// finally
// {
// try
// {
// if(rs != null){rs.close();rs = null;}
// if(pstmt != null){pstmt.close();pstmt = null;}
// }
// catch(Exception e)
// {
// throw new ITMException(e);
// }
// }
// return rateDiscount;
//
// }
public double[] getPurcRate(String purcOrder,String itemCode,double poRate,double poDisc, Connection conn) throws ITMException public double[] getPurcRate(String purcOrder,String itemCode,double poRate,double poDisc, Connection conn) throws ITMException
{ {
System.out.println("Change method getPurcRate()");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql = ""; String sql = "";
...@@ -2179,36 +2270,36 @@ public class CreatePoRcpVoucher ...@@ -2179,36 +2270,36 @@ public class CreatePoRcpVoucher
double rateDiscount[] = {0,0}; double rateDiscount[] = {0,0};
try try
{ {
sql = " select purc_order, (case when provi_tran_id is null then '' else provi_tran_id end) as provi_tran_id" // sql = " select purc_order, (case when provi_tran_id is null then '' else provi_tran_id end) as provi_tran_id"
+ " from porder where purc_order = ?"; //: ; // + " from porder where purc_order = ?"; //: ;
//
pstmt = conn.prepareStatement(sql); // pstmt = conn.prepareStatement(sql);
pstmt.setString(1,purcOrder); // pstmt.setString(1,purcOrder);
rs = pstmt.executeQuery(); // rs = pstmt.executeQuery();
if(rs.next()) // if(rs.next())
{ // {
porderNo = rs.getString("purc_order"); // porderNo = rs.getString("purc_order");
provNo = rs.getString("provi_tran_id"); // provNo = rs.getString("provi_tran_id");
} // }
rs.close(); // rs.close();
rs = null; // rs = null;
pstmt.close(); // pstmt.close();
pstmt = null; // pstmt = null;
//
if (porderNo.equals(provNo)) // if (porderNo.equals(provNo))
{ // {
sql = " select rate, discount " sql = " select rate, discount "
+ " from porder a, porddet b " + " from porder a, porddet b "
+ " where a.purc_order = b.purc_order " + " where a.purc_order = b.purc_order "
+ " and a.purc_order <> ? " + " and a.purc_order = ? "
+ " and a.provi_tran_id = ? " //+ " and a.provi_tran_id = ? "
+ " and b.item_code = ? " + " and b.item_code = ? "
+ " and a.confirmed = 'Y' "; + " and a.confirmed = 'Y' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,purcOrder); pstmt.setString(1,purcOrder);
pstmt.setString(2,purcOrder); // pstmt.setString(2,purcOrder);
pstmt.setString(3,itemCode); pstmt.setString(2,itemCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
...@@ -2219,12 +2310,12 @@ public class CreatePoRcpVoucher ...@@ -2219,12 +2310,12 @@ public class CreatePoRcpVoucher
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} // }
else // else
{ // {
poRate = -999; // poRate = -999;
poDisc = -999; // poDisc = -999;
} // }
rateDiscount[0] = poRate; rateDiscount[0] = poRate;
rateDiscount[1] = poDisc; rateDiscount[1] = poDisc;
} // try } // try
...@@ -2244,6 +2335,10 @@ public class CreatePoRcpVoucher ...@@ -2244,6 +2335,10 @@ public class CreatePoRcpVoucher
throw new ITMException(e); throw new ITMException(e);
} }
} }
System.out.println("Arry length :- ["+rateDiscount.length+"]");
System.out.println("Arry :- ["+rateDiscount[0]+"]");
System.out.println("Arry :- ["+rateDiscount[1]+"]");
return rateDiscount; return rateDiscount;
} }
...@@ -2387,12 +2482,16 @@ public class CreatePoRcpVoucher ...@@ -2387,12 +2482,16 @@ public class CreatePoRcpVoucher
} }
return errCode; return errCode;
} }
private String saveData(UserInfoBean userInfoBean,String siteCode, String xmlString, Connection conn) throws ITMException // private String saveData(UserInfoBean userInfoBean,String siteCode, String xmlString, Connection conn) throws ITMException
private String saveData(String xtraParams,String siteCode, String xmlString, Connection conn) throws ITMException
{ {
System.out.println("saving data..........."); System.out.println("saving data...........");
InitialContext ctx = null; InitialContext ctx = null;
String retString = null; String retString = null;
MasterStatefulLocal masterStateful = null; // for ejb3 MasterStatefulLocal masterStateful = null; // for ejb3
ibase.utility.UserInfoBean userInfoBean=new UserInfoBean();
try try
{ {
AppConnectParm appConnect = new AppConnectParm(); AppConnectParm appConnect = new AppConnectParm();
...@@ -2403,6 +2502,21 @@ public class CreatePoRcpVoucher ...@@ -2403,6 +2502,21 @@ public class CreatePoRcpVoucher
authencate[0] = ""; authencate[0] = "";
authencate[1] = ""; authencate[1] = "";
System.out.println("xmlString to masterstateful [" + xmlString + "]"); System.out.println("xmlString to masterstateful [" + xmlString + "]");
// chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgUser");
// chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
// loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
// loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
// loginSiteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
userInfoBean.setEmpCode(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"));
userInfoBean.setRemoteHost(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"));
userInfoBean.setSiteCode(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"));
userInfoBean.setLoginCode(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
userInfoBean.setEntityCode(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"));
// userInfoBean=
// retString=masterStateful.processRequest(authencate, siteCode, true, xmlString, true, conn);
retString=masterStateful.processRequest(userInfoBean,xmlString,true,conn); retString=masterStateful.processRequest(userInfoBean,xmlString,true,conn);
//retString = masterStateful.processRequest(authencate, siteCode, true, xmlString, true, conn); //retString = masterStateful.processRequest(authencate, siteCode, true, xmlString, true, conn);
} catch (ITMException itme) } catch (ITMException itme)
......
/* /*
* Request Id=F15GSUN010 * Request Id=F15GSUN010
* developer : mahendra jadhav * developer : mahendra jadhav
* Functinal Impact : Provision to generate scheduler for creation of Tax Voucher for each * Functinal Impact : Provision to generate scheduler for creation of Tax Voucher for each
* series which mapped with each tax code. * series which mapped with each tax code.
* *
* *
*/ */
package ibase.webitm.ejb.fin; package ibase.webitm.ejb.fin;
import ibase.scheduler.utility.interfaces.Schedule; import ibase.scheduler.utility.interfaces.Schedule;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ITMDBAccessLocal; import ibase.webitm.ejb.ITMDBAccessLocal;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.sql.Timestamp; import java.sql.Timestamp;
import org.w3c.dom.Attr; import org.w3c.dom.Attr;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
//import com.sun.jmx.snmp.Timestamp; //import com.sun.jmx.snmp.Timestamp;
import ibase.webitm.ejb.dis.POrderMilestone; import ibase.webitm.ejb.dis.POrderMilestone;
import ibase.webitm.ejb.sys.UtilMethods; import ibase.webitm.ejb.sys.UtilMethods;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import javax.xml.rpc.ParameterMode; import javax.xml.rpc.ParameterMode;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.MasterStatefulLocal; import ibase.webitm.ejb.MasterStatefulLocal;
import ibase.system.config.AppConnectParm; import ibase.system.config.AppConnectParm;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import org.apache.axis.client.Call; import org.apache.axis.client.Call;
import org.apache.axis.client.Service; import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType; import org.apache.axis.encoding.XMLType;
import org.w3c.dom.*; import org.w3c.dom.*;
public class GenTaxVoucherSch extends ValidatorEJB implements Schedule { public class GenTaxVoucherSch extends ValidatorEJB implements Schedule {
E12GenericUtility e12GenericUtility = new E12GenericUtility(); E12GenericUtility e12GenericUtility = new E12GenericUtility();
UtilMethods utilmethod = new UtilMethods(); UtilMethods utilmethod = new UtilMethods();
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
FileOutputStream fos1 = null; FileOutputStream fos1 = null;
java.util.Date startDate = new java.util.Date(System.currentTimeMillis()); java.util.Date startDate = new java.util.Date(System.currentTimeMillis());
UtilMethods utilMethod = new UtilMethods(); UtilMethods utilMethod = new UtilMethods();
ibase.webitm.ejb.dis.DistCommon dist = new ibase.webitm.ejb.dis.DistCommon(); ibase.webitm.ejb.dis.DistCommon dist = new ibase.webitm.ejb.dis.DistCommon();
FinCommon finCommon = new FinCommon(); FinCommon finCommon = new FinCommon();
String startDateStr = null; String startDateStr = null;
String strToWrite="",strToWriteHead=""; String strToWrite="",strToWriteHead="";
@Override @Override
public String schedule(HashMap arg0) throws Exception { public String schedule(HashMap arg0) throws Exception {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public String schedulePriority(String arg0) throws Exception { public String schedulePriority(String arg0) throws Exception {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public String schedule(String scheduleParamXML) throws Exception { public String schedule(String scheduleParamXML) throws Exception {
// TODO Auto-generated method stub // TODO Auto-generated method stub
String siteCode = "",actualLoginSiteCode="",errString="",logFileInit=""; String siteCode = "",actualLoginSiteCode="",errString="",logFileInit="";
String xtraParams = "",loginSiteCode=""; String xtraParams = "",loginSiteCode="";
ibase.utility.UserInfoBean userInfo = null; ibase.utility.UserInfoBean userInfo = null;
Connection conn = null; Connection conn = null;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
try try
{ {
System.out.println("Calling GenTaxVoucherSch : ["+scheduleParamXML+"]"); System.out.println("Calling GenTaxVoucherSch : ["+scheduleParamXML+"]");
userInfo = new ibase.utility.UserInfoBean( scheduleParamXML ); userInfo = new ibase.utility.UserInfoBean( scheduleParamXML );
loginSiteCode = userInfo.getSiteCode(); loginSiteCode = userInfo.getSiteCode();
System.out.println("loginSiteCode :"+loginSiteCode); System.out.println("loginSiteCode :"+loginSiteCode);
xtraParams = "loginEmpCode="+userInfo.getEmpCode()+"~~loginCode="+userInfo.getLoginCode()+"~~termId="+userInfo.getRemoteHost()+"~~loginSiteCode="+loginSiteCode; xtraParams = "loginEmpCode="+userInfo.getEmpCode()+"~~loginCode="+userInfo.getLoginCode()+"~~termId="+userInfo.getRemoteHost()+"~~loginSiteCode="+loginSiteCode;
GenericUtility genericUtility=GenericUtility.getInstance(); GenericUtility genericUtility=GenericUtility.getInstance();
Document dom=genericUtility.parseString(scheduleParamXML); Document dom=genericUtility.parseString(scheduleParamXML);
NodeList paramList = dom.getElementsByTagName( "SCHEDULE" ); NodeList paramList = dom.getElementsByTagName( "SCHEDULE" );
NodeList parentNodeList = null,childNodeList = null; NodeList parentNodeList = null,childNodeList = null;
Node parentNode = null,childNode = null; Node parentNode = null,childNode = null;
int childNodeListLength = 0; int childNodeListLength = 0;
String childNodeName = null; String childNodeName = null;
parentNodeList = dom.getElementsByTagName("ACTUALPARAMETERS"); parentNodeList = dom.getElementsByTagName("ACTUALPARAMETERS");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
for(int ctr = 0; ctr < childNodeListLength; ctr++) for(int ctr = 0; ctr < childNodeListLength; ctr++)
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
/*if(childNodeName!=null && !"#text".equalsIgnoreCase(childNodeName)) /*if(childNodeName!=null && !"#text".equalsIgnoreCase(childNodeName))
{ {
if(ctr==0) if(ctr==0)
{ {
actualLoginSiteCode=childNode.getFirstChild().getNodeValue(); actualLoginSiteCode=childNode.getFirstChild().getNodeValue();
} }
}*/ }*/
} }
logFileInit=intializingLog("Tax_Vou_sch_log"); logFileInit=intializingLog("Tax_Vou_sch_log");
System.out.println("intializingLog !!!!"+logFileInit); System.out.println("intializingLog !!!!"+logFileInit);
errString = genTextVouchSch(xtraParams,conn); errString = genTextVouchSch(xtraParams,conn);
if(errString.trim().length() > 0) if(errString.trim().length() > 0)
{ {
System.out.println(">>>After Schedulaer Process completed>> strToWrite:"+strToWrite); System.out.println(">>>After Schedulaer Process completed>> strToWrite:"+strToWrite);
strToWrite= "Schedulaer Process completed!!"; strToWrite= "Schedulaer Process completed!!";
fos1.write(strToWrite.getBytes()); fos1.write(strToWrite.getBytes());
} }
else else
{ {
System.out.println(">>>No date Found to complete the process:"+strToWrite); System.out.println(">>>No date Found to complete the process:"+strToWrite);
strToWrite = "<?xml version='1.0'?><Root><errors><message>"; strToWrite = "<?xml version='1.0'?><Root><errors><message>";
strToWrite = strToWrite + "<![CDATA[Error :Data Not Found To Generate Tax Voucher!!]]></message>"; strToWrite = strToWrite + "<![CDATA[Error :Data Not Found To Generate Tax Voucher!!]]></message>";
strToWrite= strToWrite + "</errors></Root>"; strToWrite= strToWrite + "</errors></Root>";
fos1.write(strToWrite.getBytes()); fos1.write(strToWrite.getBytes());
} }
} }
catch(Exception e) catch(Exception e)
{ {
throw new Exception(e); throw new Exception(e);
} }
finally finally
{ {
try try
{ {
if(conn != null) if(conn != null)
{ {
conn.close(); conn.close();
} }
} }
catch(Exception e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
} }
System.out.println("errString>>>["+errString+"]"); System.out.println("errString>>>["+errString+"]");
return errString; return errString;
} }
/*------------------------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------------------------*/
public String genTextVouchSch(String xtraParams,Connection conn) public String genTextVouchSch(String xtraParams,Connection conn)
{ {
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null,pstmt3 = null,pstmt4 = null; PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null,pstmt3 = null,pstmt4 = null;
ResultSet rs = null,rs1=null,rs2=null,rs3=null,rs4=null; ResultSet rs = null,rs1=null,rs2=null,rs3=null,rs4=null;
java.sql.Timestamp tranDateFrm=null,tranDateTo=null,prdFrom=null,sysDateTstmp=null,frmDateCurr=null,toDateCurr=null,vouchDateFrm=null,vouchDateTo=null; java.sql.Timestamp tranDateFrm=null,tranDateTo=null,prdFrom=null,sysDateTstmp=null,frmDateCurr=null,toDateCurr=null,vouchDateFrm=null,vouchDateTo=null;
Map<String,List<String>> taxSiteMap = new HashMap<String,List<String>>(); // Map<String,List<String>> taxSiteMap = new HashMap<String,List<String>>();
Date currentDate = new Date(); ArrayList<String> taxCodeList = new ArrayList<String>(); // added by cpatil for tax list for site
String sql="",valuexmlString="",retString="",sysDateStr="",taxCode="",siteCode="",vauchDtVar=""; Date currentDate = new Date();
try String sql="",valuexmlString="",retString="",sysDateStr="";
{ // ,taxCode="",
System.out.println("called genTextVouchSch !!"); String siteCode="",vauchDtVar="";
SimpleDateFormat sdf= new SimpleDateFormat((GenericUtility.getInstance()).getApplDateFormat());
String seriesArr [] = new String[8]; String series="",prdDateAppl="",sql1=""; //added by cpatil on 05/02/16
/*seriesArr[0] = "M-VOUC"; // Misc.Voucher try
seriesArr[1] = "VOUCH"; // Purchase Voucher {
seriesArr[2] = "S-INV"; // Sales Invoice System.out.println("called genTextVouchSch !!");
seriesArr[3] = "MDRCRD"; // Misc Debit Note SimpleDateFormat sdf= new SimpleDateFormat((GenericUtility.getInstance()).getApplDateFormat());
seriesArr[4] = "MDRCRC"; // Misc.Credit Note // String seriesArr [] = new String[8]; // comment by cpatil on 05/02/16
seriesArr[5] = "CRNRCP"; // Credit Note
seriesArr[6] = "DRNRCP"; // Debit Note /*seriesArr[0] = "M-VOUC"; // Misc.Voucher
seriesArr[7] = "DRNPAY"; // Dr Note Payable seriesArr[1] = "VOUCH"; // Purchase Voucher
seriesArr[8] = "CRNPAY"; // Cr Note Payable seriesArr[2] = "S-INV"; // Sales Invoice
seriesArr[9] = "CRNINV"; // Comm Credit Note seriesArr[3] = "MDRCRD"; // Misc Debit Note
*/ seriesArr[4] = "MDRCRC"; // Misc.Credit Note
seriesArr[5] = "CRNRCP"; // Credit Note
seriesArr[6] = "DRNRCP"; // Debit Note
seriesArr[0] = "M-VOUC"; // Misc.Voucher seriesArr[7] = "DRNPAY"; // Dr Note Payable
seriesArr[1] = "VOUCH"; // Purchase Voucher seriesArr[8] = "CRNPAY"; // Cr Note Payable
seriesArr[2] = "S-INV"; // Sales Invoice seriesArr[9] = "CRNINV"; // Comm Credit Note
seriesArr[3] = "MDRCRD"; // Misc Debit Note */
seriesArr[4] = "MDRCRC"; // Misc.Credit Note
seriesArr[5] = "CRNINV"; // Comm Credit Note
seriesArr[6] = "CRNRCP"; // Credit Note /* seriesArr[0] = "M-VOUC"; // Misc.Voucher
seriesArr[7] = "DRNRCP"; // Debit Note seriesArr[1] = "VOUCH"; // Purchase Voucher
//seriesArr[8] = "DRNPAY"; // Dr Note Payable(not use) seriesArr[2] = "S-INV"; // Sales Invoice
//seriesArr[9] = "CRNPAY"; // Cr Note Payable(not use) seriesArr[3] = "MDRCRD"; // Misc Debit Note
seriesArr[4] = "MDRCRC"; // Misc.Credit Note
/*---------------Calculate previous month of first date and last date-------------------------*/ seriesArr[5] = "CRNINV"; // Comm Credit Note
sysDateStr = sdf.format(currentDate); seriesArr[6] = "CRNRCP"; // Credit Note
sysDateTstmp = java.sql.Timestamp.valueOf(e12GenericUtility.getValidDateString(sysDateStr, e12GenericUtility.getApplDateFormat(),e12GenericUtility.getDBDateFormat()) + " 00:00:00.0"); seriesArr[7] = "DRNRCP"; // Debit Note
System.out.println("sysDateTstmp :"+sysDateTstmp); //seriesArr[8] = "DRNPAY"; // Dr Note Payable(not use)
//seriesArr[9] = "CRNPAY"; // Cr Note Payable(not use)
*/
sql= " select FR_DATE,TO_DATE from period where ? " /*---------------Calculate previous month of first date and last date-------------------------*/
+ " between FR_DATE and TO_DATE"; sysDateStr = sdf.format(currentDate);
pstmt = conn.prepareStatement(sql); sysDateTstmp = java.sql.Timestamp.valueOf(e12GenericUtility.getValidDateString(sysDateStr, e12GenericUtility.getApplDateFormat(),e12GenericUtility.getDBDateFormat()) + " 00:00:00.0");
pstmt.setTimestamp(1, sysDateTstmp); System.out.println("sysDateTstmp :"+sysDateTstmp);
rs = pstmt.executeQuery();
if(rs.next())
{
frmDateCurr = rs.getTimestamp("FR_DATE"); sql= " select FR_DATE,TO_DATE from period where ? "
toDateCurr = rs.getTimestamp("TO_DATE"); + " between FR_DATE and TO_DATE";
} pstmt = conn.prepareStatement(sql);
rs.close(); pstmt.setTimestamp(1, sysDateTstmp);
rs = null; rs = pstmt.executeQuery();
pstmt.close(); if(rs.next())
pstmt = null; {
System.out.println("frmDateCurr :"+frmDateCurr); frmDateCurr = rs.getTimestamp("FR_DATE");
System.out.println("toDateCurr :"+toDateCurr); toDateCurr = rs.getTimestamp("TO_DATE");
}
//frmDateCurr: 1st date of current month rs.close();
prdFrom = getPreviousDate(frmDateCurr,conn); rs = null;
System.out.println("prdFrom :"+prdFrom); pstmt.close();
pstmt = null;
System.out.println("frmDateCurr :"+frmDateCurr);
sql= " select FR_DATE,TO_DATE from period where ? " System.out.println("toDateCurr :"+toDateCurr);
+ " between FR_DATE and TO_DATE";
pstmt = conn.prepareStatement(sql); //frmDateCurr: 1st date of current month
pstmt.setTimestamp(1, prdFrom); prdFrom = getPreviousDate(frmDateCurr,conn);
rs = pstmt.executeQuery(); System.out.println("prdFrom :"+prdFrom);
if(rs.next())
{
tranDateFrm = rs.getTimestamp("FR_DATE"); //first date of previous month sql= " select FR_DATE,TO_DATE from period where ? "
tranDateTo = rs.getTimestamp("TO_DATE"); // last date of previous month + " between FR_DATE and TO_DATE";
} pstmt = conn.prepareStatement(sql);
rs.close(); pstmt.setTimestamp(1, prdFrom);
rs = null; rs = pstmt.executeQuery();
pstmt.close(); if(rs.next())
pstmt = null; {
System.out.println("tranDateFrm :"+tranDateFrm); tranDateFrm = rs.getTimestamp("FR_DATE"); //first date of previous month
System.out.println("tranDateTo :"+tranDateTo); tranDateTo = rs.getTimestamp("TO_DATE"); // last date of previous month
}
rs.close();
/*----------------------------------------------------------------------------------------*/ rs = null;
startDateStr = sdf.format(startDate)+" "+calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE)+":"+calendar.get(Calendar.SECOND); pstmt.close();
System.out.println("seriesArr.length :"+seriesArr.length); pstmt = null;
System.out.println("tranDateFrm :"+tranDateFrm);
/*String frmdate= "29/06/15"; System.out.println("tranDateTo :"+tranDateTo);
String todate= "30/06/15";
//added by cpatil
tranDateFrm = java.sql.Timestamp.valueOf(e12GenericUtility.getValidDateString(frmdate, e12GenericUtility.getApplDateFormat(),e12GenericUtility.getDBDateFormat()) + " 00:00:00.0"); sql1 = " select descr , sh_descr, udf_str1 from gencodes " +
System.out.println("tranDateFrm :"+tranDateFrm); " where mod_name = 'W_TAX_VOUCH_PARM' and active = 'Y' ";
tranDateTo = java.sql.Timestamp.valueOf(e12GenericUtility.getValidDateString(todate, e12GenericUtility.getApplDateFormat(),e12GenericUtility.getDBDateFormat()) + " 00:00:00.0"); pstmt1 = conn.prepareStatement(sql1);
System.out.println("tranDateTo :"+tranDateTo);*/ rs1 = pstmt1.executeQuery();
while(rs1.next())
vauchDtVar = checkNull(finCommon.getFinparams("999999", "TAX_VOUCH_DATE", conn)); {
System.out.println("vauchDtVar="+vauchDtVar); series = checkNull(rs1.getString("descr"));
if(vauchDtVar.equalsIgnoreCase("Y")) siteCode = checkNull(rs1.getString("sh_descr"));
{ prdDateAppl = checkNull(rs1.getString("udf_str1"));
vouchDateFrm=tranDateTo; /*
vouchDateTo=tranDateTo; }
} rs.close();
else rs = null;
{ pstmt.close();
vouchDateFrm=sysDateTstmp; pstmt = null;
vouchDateTo=sysDateTstmp; */
} System.out.println("@@@@@@@@@@@ series["+series+"]siteCode["+siteCode+"]prdDateAppl["+prdDateAppl+"]");
for(int serNo = 0 ; serNo < seriesArr.length ; serNo++ ) String seriesArr[]=series.split(",");
{
System.out.println("for count :"+serNo); /*----------------------------------------------------------------------------------------*/
System.out.println("Series :"+seriesArr[serNo]); startDateStr = sdf.format(startDate)+" "+calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE)+":"+calendar.get(Calendar.SECOND);
taxSiteMap=getTaxSiteCodeOfSer(seriesArr[serNo],tranDateFrm,tranDateTo,conn); System.out.println("seriesArr.length :"+seriesArr.length);
for (Map.Entry<String, List<String>> entry : taxSiteMap.entrySet()) /*String frmdate= "29/06/15";
{ String todate= "30/06/15";
String key = entry.getKey(); tranDateFrm = java.sql.Timestamp.valueOf(e12GenericUtility.getValidDateString(frmdate, e12GenericUtility.getApplDateFormat(),e12GenericUtility.getDBDateFormat()) + " 00:00:00.0");
List<String> values = entry.getValue(); System.out.println("tranDateFrm :"+tranDateFrm);
System.out.println("Key = " + key); tranDateTo = java.sql.Timestamp.valueOf(e12GenericUtility.getValidDateString(todate, e12GenericUtility.getApplDateFormat(),e12GenericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("Values = " + values); System.out.println("tranDateTo :"+tranDateTo);*/
for (String code : values) //commented by cpatil on 05/02/16
{ //vauchDtVar = checkNull(finCommon.getFinparams("999999", "TAX_VOUCH_DATE", conn));
System.out.println(code); //System.out.println("vauchDtVar="+vauchDtVar);
int pos = code.indexOf("@"); //if(vauchDtVar.equalsIgnoreCase("Y"))
System.out.println(pos); if( prdDateAppl != null && prdDateAppl.equalsIgnoreCase("Y"))
taxCode = code.substring(0,pos); {
System.out.println("taxCode :"+taxCode); vouchDateFrm=tranDateTo;
siteCode = code.substring(pos+1); vouchDateTo=tranDateTo;
System.out.println("SiteCode :"+siteCode); }
else
{
vouchDateFrm=sysDateTstmp;
strToWrite=""; vouchDateTo=sysDateTstmp;
strToWriteHead="Series :"+seriesArr[serNo]+" Tax Code:"+taxCode+" Site Code:"+siteCode+" Tran Date From:"+tranDateFrm+" Tran Date To:"+tranDateTo+" Voucher Date:"+tranDateFrm+" Voucher Due on:"+tranDateTo+"\n"; }
strToWrite=strToWrite + strToWriteHead;
strToWrite=strToWrite+startDateStr+","; for(int serNo = 0 ; serNo < seriesArr.length ; serNo++ )
{
System.out.println("for count :"+serNo);
System.out.println("Series :"+seriesArr[serNo]);
StringBuffer TaxVocStrBuff = new StringBuffer(); taxCodeList= getTaxCodeOfSer(seriesArr[serNo],tranDateFrm,tranDateTo,siteCode,conn);
TaxVocStrBuff.append(taxCode).append("\t"); //tax_code System.out.println("@@@@@@@@@ siteCode["+siteCode+"]taxCodeList["+taxCodeList+"]");
TaxVocStrBuff.append(siteCode).append("\t"); //site_code__fr // for (Map.Entry<String, List<String>> entry : taxSiteMap.entrySet()) // commented by cpatil
TaxVocStrBuff.append(siteCode).append("\t"); //site_code__to // {
TaxVocStrBuff.append(seriesArr[serNo]).append("\t"); //as_transfer
TaxVocStrBuff.append(tranDateFrm).append("\t"); //ad_trandate_fr // String key = entry.getKey();
TaxVocStrBuff.append(tranDateTo).append("\t"); //ad_trandate_to // List<String> values = entry.getValue();
TaxVocStrBuff.append(vouchDateFrm).append("\t"); //ad_tran_date // System.out.println("========>>>Key["+key+"]Values["+values+"]");
TaxVocStrBuff.append(vouchDateTo).append("\t"); //ad_due_date
TaxVocStrBuff.append("X").append("\t"); //sundry_type // for (String code : values)
TaxVocStrBuff.append("").append("\t"); //tran_type for (String taxCode : taxCodeList)
TaxVocStrBuff.append("0").append("\t"); //vch_amt {
TaxVocStrBuff.append("D").append("\t"); //as_opt System.out.println("tax code:["+taxCode+"]");
TaxVocStrBuff.append("").append("\t"); //as_id //taxCode = code;
TaxVocStrBuff.append("").append("\t"); //acct_code /*
TaxVocStrBuff.append("").append("\t"); //cctr_code int pos = code.indexOf("@");
System.out.println(pos);
taxCode = code.substring(0,pos);
valuexmlString=TaxVocStrBuff.toString(); System.out.println("taxCode :"+taxCode);
System.out.println("valuexmlString :"+valuexmlString); siteCode = code.substring(pos+1);
StringBuffer TaxVocStrBuffAll = new StringBuffer(); System.out.println("SiteCode :"+siteCode);
*/
retString = taxVochProcess("taxpost_chap",valuexmlString, xtraParams, conn);
System.out.println("retString :"+retString); strToWrite="";
strToWriteHead="Series :"+seriesArr[serNo]+" Tax Code:"+taxCode+" Site Code:"+siteCode+" Tran Date From:"+tranDateFrm+" Tran Date To:"+tranDateTo+" Voucher Date:"+tranDateFrm+" Voucher Due on:"+tranDateTo+"\n";
strToWrite = strToWrite + retString+"\r\n\r\n"; strToWrite=strToWrite + strToWriteHead;
//fos1.write(strToWrite.getBytes()); strToWrite=strToWrite+startDateStr+",";
System.out.println(">>>Before Write to fos1 strToWrite:"+strToWrite);
fos1.write(strToWrite.getBytes()); StringBuffer TaxVocStrBuff = new StringBuffer();
TaxVocStrBuff.append(taxCode).append("\t"); //tax_code
TaxVocStrBuff.append(siteCode).append("\t"); //site_code__fr
} TaxVocStrBuff.append(siteCode).append("\t"); //site_code__to
}//end of loop for tax and site code map TaxVocStrBuff.append(seriesArr[serNo]).append("\t"); //as_transfer
System.out.println("000000000000"); TaxVocStrBuff.append(tranDateFrm).append("\t"); //ad_trandate_fr
System.out.println(serNo); TaxVocStrBuff.append(tranDateTo).append("\t"); //ad_trandate_to
}//end of for loop for series TaxVocStrBuff.append(vouchDateFrm).append("\t"); //ad_tran_date
TaxVocStrBuff.append(vouchDateTo).append("\t"); //ad_due_date
System.out.println("end of for loop for series!!!!"); TaxVocStrBuff.append("X").append("\t"); //sundry_type
TaxVocStrBuff.append("").append("\t"); //tran_type
TaxVocStrBuff.append("0").append("\t"); //vch_amt
TaxVocStrBuff.append("D").append("\t"); //as_opt
} TaxVocStrBuff.append("").append("\t"); //as_id
catch(Exception e) TaxVocStrBuff.append("").append("\t"); //acct_code
{ TaxVocStrBuff.append("").append("\t"); //cctr_code
e.printStackTrace();
}
return retString; valuexmlString=TaxVocStrBuff.toString();
} System.out.println("=====>>>valuexmlString:["+valuexmlString+"]");
//StringBuffer TaxVocStrBuffAll = new StringBuffer();
retString = taxVochProcess("taxpost_chap",valuexmlString, xtraParams, conn);
public String taxVochProcess(String businessObj, String tabXmlData, String xtraParams, Connection conn) throws ITMException System.out.println("retString :"+retString);
{
String methodName = ""; strToWrite = strToWrite + retString+"\r\n\r\n";
String compName = ""; //fos1.write(strToWrite.getBytes());
String retString = ""; System.out.println(">>>Before Write to fos1 strToWrite:"+strToWrite);
String serviceCode = ""; fos1.write(strToWrite.getBytes());
String serviceURI = "";
String actionURI = "",compType=""; } // end of for
String sql = ""; // }//end of loop for tax and site code map
PreparedStatement pstmt = null; System.out.println(serNo);
ResultSet rs = null; }//end of for loop for series
try
{ ////
System.out.println("Check In taxVochProcess businessObj:"+businessObj);
methodName = "gbf_process"; }
actionURI = "http://NvoServiceurl.org/" + methodName; rs1.close();
sql = "SELECT SERVICE_CODE,COMP_NAME,COMP_TYPE FROM SYSTEM_EVENTS WHERE OBJ_NAME = ? AND EVENT_CODE = 'process' "; rs1 = null;
pstmt = conn.prepareStatement(sql); pstmt1.close();
pstmt.setString(1,businessObj); pstmt1 = null;
rs = pstmt.executeQuery();
if ( rs.next() ) ////
{ System.out.println("end of for loop for series!!!!");
serviceCode = rs.getString("SERVICE_CODE");
compName = rs.getString("COMP_NAME");
compType = rs.getString("COMP_TYPE");
} }
System.out.println(">>>In recPayProcess serviceCode = "+serviceCode+" compName "+compName); catch(Exception e)
sql = "SELECT SERVICE_URI FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = ? "; {
pstmt = conn.prepareStatement(sql); e.printStackTrace();
pstmt.setString(1,serviceCode); }
rs = pstmt.executeQuery(); return retString;
if ( rs.next() ) }
{
serviceURI = rs.getString("SERVICE_URI");
}
System.out.println(">>>In recPayProcess serviceURI = "+serviceURI+" compName = "+compName); public String taxVochProcess(String businessObj, String tabXmlData, String xtraParams, Connection conn) throws ITMException
Service service = new Service(); {
Call call = (Call)service.createCall(); String methodName = "";
call.setTargetEndpointAddress(new java.net.URL(serviceURI)); String compName = "";
call.setOperationName( new javax.xml.namespace.QName("http://NvoServiceurl.org", methodName ) ); String retString = "";
call.setUseSOAPAction(true); String serviceCode = "";
call.setSOAPActionURI(actionURI); String serviceURI = "";
Object[] aobj = new Object[5]; String actionURI = "",compType="";
System.out.println("compType :"+compType); String sql = "";
System.out.println("compName :"+compName); PreparedStatement pstmt = null;
System.out.println("tabXmlData :"+tabXmlData); ResultSet rs = null;
System.out.println("xtraParams :"+xtraParams); try
{
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_type"), XMLType.XSD_STRING, ParameterMode.IN); System.out.println("Check In taxVochProcess businessObj:"+businessObj);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN); methodName = "gbf_process";
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tab_xml_data_1"), XMLType.XSD_STRING, ParameterMode.IN); actionURI = "http://NvoServiceurl.org/" + methodName;
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "dummy"), XMLType.XSD_STRING, ParameterMode.IN); sql = "SELECT SERVICE_CODE,COMP_NAME,COMP_TYPE FROM SYSTEM_EVENTS WHERE OBJ_NAME = ? AND EVENT_CODE = 'process' ";
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,businessObj);
aobj[0] = new String(compType); rs = pstmt.executeQuery();
aobj[1] = new String(compName); if ( rs.next() )
aobj[2] = new String(tabXmlData); {
aobj[3] = new String(""); serviceCode = rs.getString("SERVICE_CODE");
aobj[4] = new String(xtraParams); compName = rs.getString("COMP_NAME");
compType = rs.getString("COMP_TYPE");
}
System.out.println(">>>>>>call.taxVochProcess(XMLType.XSD_STRING) executed........"); System.out.println(">>>In recPayProcess serviceCode = "+serviceCode+" compName "+compName);
call.setReturnType(XMLType.XSD_STRING); sql = "SELECT SERVICE_URI FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = ? ";
retString = (String)call.invoke(aobj); pstmt = conn.prepareStatement(sql);
System.out.println(">>>>taxVochProcess Complete Return string from NVO is:"+retString); pstmt.setString(1,serviceCode);
} rs = pstmt.executeQuery();
catch(Exception e) if ( rs.next() )
{ {
e.printStackTrace(); serviceURI = rs.getString("SERVICE_URI");
throw new ITMException(e); }
} System.out.println(">>>In recPayProcess serviceURI = "+serviceURI+" compName = "+compName);
finally Service service = new Service();
{ Call call = (Call)service.createCall();
try{ call.setTargetEndpointAddress(new java.net.URL(serviceURI));
call.setOperationName( new javax.xml.namespace.QName("http://NvoServiceurl.org", methodName ) );
call.setUseSOAPAction(true);
if (pstmt != null ) call.setSOAPActionURI(actionURI);
{ Object[] aobj = new Object[5];
pstmt.close(); System.out.println("compType :"+compType);
pstmt = null; System.out.println("compName :"+compName);
} System.out.println("tabXmlData :"+tabXmlData);
/*if( conn != null ){ System.out.println("xtraParams :"+xtraParams);
conn.close();
conn = null; call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_type"), XMLType.XSD_STRING, ParameterMode.IN);
}*/ call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN);
} call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tab_xml_data_1"), XMLType.XSD_STRING, ParameterMode.IN);
catch(Exception e) call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "dummy"), XMLType.XSD_STRING, ParameterMode.IN);
{ call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN);
System.out.println("Exception in taxVochProcess!!!!");
e.printStackTrace(); aobj[0] = new String(compType);
try aobj[1] = new String(compName);
{ aobj[2] = new String(tabXmlData);
conn.rollback(); aobj[3] = new String("");
aobj[4] = new String(xtraParams);
}
catch (Exception s)
{ System.out.println(">>>>>>call.taxVochProcess(XMLType.XSD_STRING) executed........");
System.out.println("Unable to rollback"); call.setReturnType(XMLType.XSD_STRING);
s.printStackTrace(); retString = (String)call.invoke(aobj);
} System.out.println(">>>>taxVochProcess Complete Return string from NVO is:"+retString);
throw new ITMException(e); }
} catch(Exception e)
} {
return retString; e.printStackTrace();
} throw new ITMException(e);
}
/*----------------Calculate TAX Code for Each Series-------------------------------------------------------*/ finally
{
try{
public Map getTaxSiteCodeOfSer(String series,java.sql.Timestamp tranDateFrm,java.sql.Timestamp tranDateTo,Connection conn)
{
//List<String> taxCodeList = new ArrayList<String>(); if (pstmt != null )
//List<String> siteCodeList = new ArrayList<String>(); {
List<String> taxSiteList = new ArrayList<String>(); pstmt.close();
Map<String,List<String>> seriesMap = new HashMap<String,List<String>>(); pstmt = null;
PreparedStatement pstmt = null; }
ResultSet rs = null; /*if( conn != null ){
String sql = ""; conn.close();
String taxCode="",siteCode=""; conn = null;
}*/
}
try catch(Exception e)
{ {
/*String frmdate= "29/06/15"; System.out.println("Exception in taxVochProcess!!!!");
String todate= "30/06/15"; e.printStackTrace();
try
tranDateFrm = java.sql.Timestamp.valueOf(e12GenericUtility.getValidDateString(frmdate, e12GenericUtility.getApplDateFormat(),e12GenericUtility.getDBDateFormat()) + " 00:00:00.0"); {
System.out.println("tranDateFrm :"+tranDateFrm); conn.rollback();
tranDateTo = java.sql.Timestamp.valueOf(e12GenericUtility.getValidDateString(todate, e12GenericUtility.getApplDateFormat(),e12GenericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("tranDateTo :"+tranDateTo);*/ }
catch (Exception s)
if(series.equalsIgnoreCase("M-VOUC")) //MISC. Voucher {
{ System.out.println("Unable to rollback");
sql = " SELECT distinct taxtran.tax_code, misc_voucher.site_code " + s.printStackTrace();
" FROM misc_voucher,taxtran,tax_authority, tax " + }
" WHERE ( taxtran.tran_id = misc_voucher.tran_id ) and " + throw new ITMException(e);
"( taxtran.tax_code = tax.tax_code ) and" + }
" ( tax.tauth_code = tax_authority.tauth_code ) " + }
" and ( taxtran.tran_code = 'M-VOUC' ) AND " + return retString;
" (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END)" + }
" = 'N' AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0 " +
// "and ( misc_voucher.tran_date between ? and ? )" + /*----------------Calculate TAX Code for Each Series-------------------------------------------------------*/
"and ( misc_voucher.tran_date between ? and ? )" +
" AND ( misc_voucher.confirmed = 'Y' )";
pstmt = conn.prepareStatement(sql); public ArrayList<String> getTaxCodeOfSer(String series,java.sql.Timestamp tranDateFrm,java.sql.Timestamp tranDateTo,String siteCode,Connection conn)
pstmt.setTimestamp(1,tranDateFrm); {
pstmt.setTimestamp(2,tranDateTo); //List<String> taxCodeList = new ArrayList<String>();
rs = pstmt.executeQuery(); //List<String> siteCodeList = new ArrayList<String>();
while( rs.next()) ArrayList<String> taxCodeList = new ArrayList<String>();
{ //Map<String,List<String>> seriesMap = new HashMap<String,List<String>>();
taxCode = rs.getString("tax_code"); PreparedStatement pstmt = null;
siteCode = rs.getString("site_code"); ResultSet rs = null;
System.out.print("taxCode :"+taxCode); String sql = "";
System.out.print("siteCode :"+siteCode); String taxCode=""; //siteCode="";
//taxCodeList.add(taxCode);
//siteCodeList.add(siteCode);
taxSiteList.add(taxCode+"@"+siteCode); try
{
/*String frmdate= "29/06/15";
String todate= "30/06/15";
}
rs.close(); tranDateFrm = java.sql.Timestamp.valueOf(e12GenericUtility.getValidDateString(frmdate, e12GenericUtility.getApplDateFormat(),e12GenericUtility.getDBDateFormat()) + " 00:00:00.0");
rs=null; System.out.println("tranDateFrm :"+tranDateFrm);
pstmt.close(); tranDateTo = java.sql.Timestamp.valueOf(e12GenericUtility.getValidDateString(todate, e12GenericUtility.getApplDateFormat(),e12GenericUtility.getDBDateFormat()) + " 00:00:00.0");
pstmt=null; System.out.println("tranDateTo :"+tranDateTo);*/
seriesMap.put("m-vouc@Code",taxSiteList);
if(series.equalsIgnoreCase("M-VOUC")) //MISC. Voucher
{
} sql = " SELECT distinct taxtran.tax_code" +
else if(series.equalsIgnoreCase("VOUCH")) // Purchase Voucher //", misc_voucher.site_code " +
{ " FROM misc_voucher,taxtran,tax_authority, tax " +
" WHERE ( taxtran.tran_id = misc_voucher.tran_id ) and " +
sql="SELECT distinct taxtran.tax_code,voucher.site_code " + "( taxtran.tax_code = tax.tax_code ) and" +
" FROM voucher, taxtran, tax_authority,tax WHERE " + " ( tax.tauth_code = tax_authority.tauth_code ) " +
" ( taxtran.tran_id = voucher.tran_id ) and ( taxtran.tax_code = tax.tax_code )" + " and ( taxtran.tran_code = 'M-VOUC' ) AND " +
" and ( tax.tauth_code = tax_authority.tauth_code ) and ( taxtran.tran_code = 'VOUCH' )" + " (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END)" +
" AND (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END) = 'N' " + " = 'N' AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0 " +
" AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0 " + // "and ( misc_voucher.tran_date between ? and ? )" +
//" and ( voucher.tran_date between ? and ? )" + "and ( misc_voucher.tran_date between ? and ? )" +
" and ( voucher.tran_date between ? and ?)" + " AND ( misc_voucher.confirmed = 'Y' )" +
" AND ( voucher.confirmed = 'Y' ) " ; " And misc_voucher.site_code = ? "; // added by cpatil
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDateFrm);
pstmt = conn.prepareStatement(sql); pstmt.setTimestamp(2,tranDateTo);
pstmt.setTimestamp(1,tranDateFrm); pstmt.setString(3,siteCode); // added by cpatil
pstmt.setTimestamp(2,tranDateTo); rs = pstmt.executeQuery();
rs = pstmt.executeQuery(); while( rs.next())
while( rs.next()) {
{ taxCode = rs.getString("tax_code");
taxCode = rs.getString("tax_code"); //siteCode = rs.getString("site_code");
siteCode = rs.getString("site_code"); System.out.print("taxCode :"+taxCode);
System.out.print("taxCode :"+taxCode); //System.out.print("siteCode :"+siteCode);
System.out.print("siteCode :"+siteCode); //taxCodeList.add(taxCode);
//siteCodeList.add(siteCode);
taxSiteList.add(taxCode+"@"+siteCode);
//taxSiteList.add(taxCode+"@"+siteCode);
} taxCodeList.add(taxCode);
rs.close();
rs=null;
pstmt.close(); }
pstmt=null; rs.close();
seriesMap.put("vouc@Code",taxSiteList); rs=null;
pstmt.close();
} pstmt=null;
else if(series.equalsIgnoreCase("S-INV")) // Sales Invoice //seriesMap.put("m-vouc@Code",taxSiteList);
{
sql= "SELECT distinct taxtran.tax_code, invoice.site_code FROM invoice,TAXTRAN WHERE " +
" ( TAXTRAN.TRAN_ID = invoice.INVOICE_ID ) and ( taxtran.tran_code ='S-INV' ) " + }
" AND (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END) = 'N' AND " + else if(series.equalsIgnoreCase("VOUCH")) // Purchase Voucher
" (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0 and " + {
" ( invoice.tran_date between ? and ? ) AND ( invoice.confirmed = 'Y' ) ";
sql="SELECT distinct taxtran.tax_code" +
pstmt = conn.prepareStatement(sql); //",voucher.site_code " +
pstmt.setTimestamp(1,tranDateFrm); " FROM voucher, taxtran, tax_authority,tax WHERE " +
pstmt.setTimestamp(2,tranDateTo); " ( taxtran.tran_id = voucher.tran_id ) and ( taxtran.tax_code = tax.tax_code )" +
rs = pstmt.executeQuery(); " and ( tax.tauth_code = tax_authority.tauth_code ) and ( taxtran.tran_code = 'VOUCH' )" +
while( rs.next()) " AND (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END) = 'N' " +
{ " AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0 " +
taxCode = rs.getString("tax_code"); //" and ( voucher.tran_date between ? and ? )" +
siteCode = rs.getString("site_code"); " and ( voucher.tran_date between ? and ?)" +
System.out.print("taxCode :"+taxCode); " AND ( voucher.confirmed = 'Y' ) " +
System.out.print("siteCode :"+siteCode); " AND voucher.site_code = ? " ; // added by cpatil
taxSiteList.add(taxCode+"@"+siteCode);
pstmt = conn.prepareStatement(sql);
} pstmt.setTimestamp(1,tranDateFrm);
rs.close(); pstmt.setTimestamp(2,tranDateTo);
rs=null; pstmt.setString(3,siteCode); // added by cpatil
pstmt.close(); rs = pstmt.executeQuery();
pstmt=null; while( rs.next())
seriesMap.put("SINV@Code",taxSiteList); {
taxCode = rs.getString("tax_code");
} //siteCode = rs.getString("site_code");
else if(series.equalsIgnoreCase("CRNINV")) //Comm Credit Note System.out.print("taxCode :"+taxCode);
{ //System.out.print("siteCode :"+siteCode);
sql=" select distinct taxtran.tax_code,drcr_inv.site_code from drcr_inv, " +
" taxtran where ( taxtran.tran_id = drcr_inv.tran_id ) and" + //taxSiteList.add(taxCode+"@"+siteCode);
" ( taxtran.tran_code = 'CRNINV' ) and (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N'" + taxCodeList.add(taxCode);
" ELSE TAXTRAN.POSTED END) = 'N' AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE " +
" TAXTRAN.TAX_AMT END) <> 0 and ( drcr_inv.tran_date between ? and ? )" + }
" and ( drcr_inv.confirmed = 'Y' ) "; rs.close();
rs=null;
pstmt = conn.prepareStatement(sql); pstmt.close();
pstmt.setTimestamp(1,tranDateFrm); pstmt=null;
pstmt.setTimestamp(2,tranDateTo); //seriesMap.put("vouc@Code",taxSiteList);
rs = pstmt.executeQuery();
while( rs.next()) }
{ else if(series.equalsIgnoreCase("S-INV")) // Sales Invoice
taxCode = rs.getString("tax_code"); {
siteCode = rs.getString("site_code"); sql= "SELECT distinct taxtran.tax_code" +
System.out.print("taxCode :"+taxCode); //", invoice.site_code " +
System.out.print("siteCode :"+siteCode); " FROM invoice,TAXTRAN WHERE " +
" ( TAXTRAN.TRAN_ID = invoice.INVOICE_ID ) and ( taxtran.tran_code ='S-INV' ) " +
taxSiteList.add(taxCode+"@"+siteCode); " AND (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END) = 'N' AND " +
" (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0 and " +
} " ( invoice.tran_date between ? and ? ) AND ( invoice.confirmed = 'Y' )" +
rs.close(); " AND invoice.site_code = ? "; // added by cpatil
rs=null;
pstmt.close(); pstmt = conn.prepareStatement(sql);
pstmt=null; pstmt.setTimestamp(1,tranDateFrm);
seriesMap.put("CRNINV@Code",taxSiteList); pstmt.setTimestamp(2,tranDateTo);
pstmt.setString(3,siteCode); // added by cpatil
} rs = pstmt.executeQuery();
else if(series.equalsIgnoreCase("MDRCRC")) //Misc. Credit Note while( rs.next())
{ {
sql=" select distinct taxtran.tax_code,misc_drcr_rcp.site_code " + taxCode = rs.getString("tax_code");
" from misc_drcr_rcp, taxtran where" + //siteCode = rs.getString("site_code");
" ( taxtran.tran_id = misc_drcr_rcp.tran_id ) " + System.out.print("taxCode :"+taxCode);
" and ( taxtran.tran_code = 'MDRCRC' ) and " + //System.out.print("siteCode :"+siteCode);
" (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END) = 'N'" +
" AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0 " + //taxSiteList.add(taxCode+"@"+siteCode);
" and ( misc_drcr_rcp.tran_date between ? and ? ) and" + taxCodeList.add(taxCode);
" ( misc_drcr_rcp.confirmed = 'Y' ) ";
}
pstmt = conn.prepareStatement(sql); rs.close();
pstmt.setTimestamp(1,tranDateFrm); rs=null;
pstmt.setTimestamp(2,tranDateTo); pstmt.close();
rs = pstmt.executeQuery(); pstmt=null;
while( rs.next()) //seriesMap.put("SINV@Code",taxSiteList);
{
taxCode = rs.getString("tax_code"); }
siteCode = rs.getString("site_code"); else if(series.equalsIgnoreCase("CRNINV")) //Comm Credit Note
System.out.print("taxCode :"+taxCode); {
System.out.print("siteCode :"+siteCode); sql=" select distinct taxtran.tax_code" +
//",drcr_inv.site_code " +
taxSiteList.add(taxCode+"@"+siteCode); " from drcr_inv, " +
" taxtran where ( taxtran.tran_id = drcr_inv.tran_id ) and" +
} " ( taxtran.tran_code = 'CRNINV' ) and (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N'" +
rs.close(); " ELSE TAXTRAN.POSTED END) = 'N' AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE " +
rs=null; " TAXTRAN.TAX_AMT END) <> 0 and ( drcr_inv.tran_date between ? and ? )" +
pstmt.close(); " and ( drcr_inv.confirmed = 'Y' ) " +
pstmt=null; " AND drcr_inv.site_code = ? "; // added by cpatil
seriesMap.put("MDRCRC@Code",taxSiteList);
pstmt = conn.prepareStatement(sql);
} pstmt.setTimestamp(1,tranDateFrm);
else if(series.equalsIgnoreCase("MDRCRD")) // Misc.debit Note pstmt.setTimestamp(2,tranDateTo);
{ pstmt.setString(3,siteCode); // added by cpatil
sql=" select distinct taxtran.tax_code,misc_drcr_rcp.site_code " + rs = pstmt.executeQuery();
" from misc_drcr_rcp, taxtran where" + while( rs.next())
" ( taxtran.tran_id = misc_drcr_rcp.tran_id ) " + {
" and ( taxtran.tran_code = 'MDRCRD' ) and " + taxCode = rs.getString("tax_code");
" (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END) = 'N'" + //siteCode = rs.getString("site_code");
" AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0 " + System.out.print("taxCode :"+taxCode);
" and ( misc_drcr_rcp.tran_date between ? and ? ) and" + //System.out.print("siteCode :"+siteCode);
" ( misc_drcr_rcp.confirmed = 'Y' ) ";
//taxSiteList.add(taxCode+"@"+siteCode);
pstmt = conn.prepareStatement(sql); taxCodeList.add(taxCode);
pstmt.setTimestamp(1,tranDateFrm);
pstmt.setTimestamp(2,tranDateTo); }
rs = pstmt.executeQuery(); rs.close();
while( rs.next()) rs=null;
{ pstmt.close();
taxCode = rs.getString("tax_code"); pstmt=null;
siteCode = rs.getString("site_code"); //seriesMap.put("CRNINV@Code",taxSiteList);
System.out.print("taxCode :"+taxCode);
System.out.print("siteCode :"+siteCode); }
else if(series.equalsIgnoreCase("MDRCRC")) //Misc. Credit Note
taxSiteList.add(taxCode+"@"+siteCode); {
sql=" select distinct taxtran.tax_code " +
} //" ,misc_drcr_rcp.site_code " +
rs.close(); " from misc_drcr_rcp, taxtran where" +
rs=null; " ( taxtran.tran_id = misc_drcr_rcp.tran_id ) " +
pstmt.close(); " and ( taxtran.tran_code = 'MDRCRC' ) and " +
pstmt=null; " (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END) = 'N'" +
seriesMap.put("MDRCRD@Code",taxSiteList); " AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0 " +
} " and ( misc_drcr_rcp.tran_date between ? and ? ) and" +
else if(series.equalsIgnoreCase("DRNRCP")) //Debit Note " ( misc_drcr_rcp.confirmed = 'Y' ) " +
{ " AND misc_drcr_rcp.site_code = ? "; // added by cpatil
sql= " select distinct drcr_rcp.site_code,taxtran.tax_code from drcr_rcp," +
" taxtran where ( taxtran.tran_id = drcr_rcp.tran_id ) and " + pstmt = conn.prepareStatement(sql);
" ( taxtran.tran_code = 'DRNRCP' ) and " + pstmt.setTimestamp(1,tranDateFrm);
" (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END) = 'N'" + pstmt.setTimestamp(2,tranDateTo);
" AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0" + pstmt.setString(3,siteCode); // added by cpatil
" and ( drcr_rcp.tran_date between ? and ? )" + rs = pstmt.executeQuery();
" and ( drcr_rcp.confirmed = 'Y' ) "; while( rs.next())
pstmt = conn.prepareStatement(sql); {
pstmt.setTimestamp(1,tranDateFrm); taxCode = rs.getString("tax_code");
pstmt.setTimestamp(2,tranDateTo); //siteCode = rs.getString("site_code");
rs = pstmt.executeQuery(); System.out.print("taxCode :"+taxCode);
while( rs.next()) //System.out.print("siteCode :"+siteCode);
{
taxCode = rs.getString("tax_code"); //taxSiteList.add(taxCode+"@"+siteCode);
siteCode = rs.getString("site_code"); taxCodeList.add(taxCode);
System.out.print("taxCode :"+taxCode);
System.out.print("siteCode :"+siteCode); }
rs.close();
taxSiteList.add(taxCode+"@"+siteCode); rs=null;
pstmt.close();
} pstmt=null;
rs.close(); //seriesMap.put("MDRCRC@Code",taxSiteList);
rs=null;
pstmt.close(); }
pstmt=null; else if(series.equalsIgnoreCase("MDRCRD")) // Misc.debit Note
seriesMap.put("DRNRCP@Code",taxSiteList); {
sql=" select distinct taxtran.tax_code " +
} //" ,misc_drcr_rcp.site_code " +
else if(series.equalsIgnoreCase("CRNRCP")) // Credit Note " from misc_drcr_rcp, taxtran where" +
{ " ( taxtran.tran_id = misc_drcr_rcp.tran_id ) " +
" and ( taxtran.tran_code = 'MDRCRD' ) and " +
" (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END) = 'N'" +
sql= " select distinct drcr_rcp.site_code,taxtran.tax_code from drcr_rcp," + " AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0 " +
" taxtran where ( taxtran.tran_id = drcr_rcp.tran_id ) and " + " and ( misc_drcr_rcp.tran_date between ? and ? ) and" +
" ( taxtran.tran_code = 'CRNRCP' ) and " + " ( misc_drcr_rcp.confirmed = 'Y' ) " +
" (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END) = 'N' AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0" + " AND misc_drcr_rcp.site_code = ? "; // added by cpatil
" and ( drcr_rcp.tran_date between ? and ? )" +
" and ( drcr_rcp.confirmed = 'Y' ) "; pstmt = conn.prepareStatement(sql);
pstmt = conn.prepareStatement(sql); pstmt.setTimestamp(1,tranDateFrm);
pstmt.setTimestamp(1,tranDateFrm); pstmt.setTimestamp(2,tranDateTo);
pstmt.setTimestamp(2,tranDateTo); pstmt.setString(3,siteCode); // added by cpatil
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while( rs.next()) while( rs.next())
{ {
taxCode = rs.getString("tax_code"); taxCode = rs.getString("tax_code");
siteCode = rs.getString("site_code"); //siteCode = rs.getString("site_code");
System.out.print("taxCode :"+taxCode); System.out.print("taxCode :"+taxCode);
System.out.print("siteCode :"+siteCode); //System.out.print("siteCode :"+siteCode);
taxSiteList.add(taxCode+"@"+siteCode); //taxSiteList.add(taxCode+"@"+siteCode);
taxCodeList.add(taxCode);
}
rs.close(); }
rs=null; rs.close();
pstmt.close(); rs=null;
pstmt=null; pstmt.close();
seriesMap.put("CRNRCP@Code",taxSiteList); pstmt=null;
//seriesMap.put("MDRCRD@Code",taxSiteList);
} }
else if(series.equalsIgnoreCase("DRNRCP")) //Debit Note
{
sql= " select distinct " +
} //" drcr_rcp.site_code," +
catch(Exception e) " taxtran.tax_code from drcr_rcp," +
{ " taxtran where ( taxtran.tran_id = drcr_rcp.tran_id ) and " +
e.printStackTrace(); " ( taxtran.tran_code = 'DRNRCP' ) and " +
} " (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END) = 'N'" +
" AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0" +
return seriesMap; " and ( drcr_rcp.tran_date between ? and ? )" +
} " and ( drcr_rcp.confirmed = 'Y' ) " +
" AND drcr_rcp.site_code = ? "; // added by cpatil
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDateFrm);
pstmt.setTimestamp(2,tranDateTo);
/*----------------------------------------------------------------------------------------------------------*/ pstmt.setString(3,siteCode); // added by cpatil
rs = pstmt.executeQuery();
private String intializingLog(String fileName) while( rs.next())
{ {
String log=""; taxCode = rs.getString("tax_code");
String strToWrite = ""; //siteCode = rs.getString("site_code");
String currTime = null; System.out.print("taxCode :"+taxCode);
try //System.out.print("siteCode :"+siteCode);
{
System.out.println(">>>In intializingLog() fileName:"+fileName); //taxSiteList.add(taxCode+"@"+siteCode);
SimpleDateFormat sdf1 = new SimpleDateFormat(e12GenericUtility.getDBDateFormat()); taxCodeList.add(taxCode);
try
{ }
currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString(); rs.close();
currTime = currTime.replaceAll("-",""); rs=null;
calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis())); pstmt.close();
fileName = fileName+currTime+calendar.get(Calendar.HOUR)+""+calendar.get(Calendar.MINUTE)+".csv"; pstmt=null;
fos1 = new FileOutputStream(CommonConstants.JBOSSHOME + File.separator +"EDI"+File.separator+fileName); //seriesMap.put("DRNRCP@Code",taxSiteList);
//strToWrite="\"TRANID\",\"START TIME\",\"END TIME\",\"STATUS\"\r\n";
//fos1.write(strToWrite.getBytes()); }
log ="IntializingLog_Successesfull"; else if(series.equalsIgnoreCase("CRNRCP")) // Credit Note
} {
catch(Exception e)
{
System.out.println("Exception []::"+e.getMessage()); sql= " select distinct " +
e.printStackTrace(); //" drcr_rcp.site_code," +
} " taxtran.tax_code from drcr_rcp," +
startDate = new java.util.Date(System.currentTimeMillis()); " taxtran where ( taxtran.tran_id = drcr_rcp.tran_id ) and " +
calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis())); " ( taxtran.tran_code = 'CRNRCP' ) and " +
startDateStr = sdf1.format(startDate)+" "+calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE)+":"+calendar.get(Calendar.SECOND); " (CASE WHEN TAXTRAN.POSTED IS NULL THEN 'N' ELSE TAXTRAN.POSTED END) = 'N' AND (CASE WHEN TAXTRAN.TAX_AMT IS NULL THEN 0 ELSE TAXTRAN.TAX_AMT END) <> 0" +
fos1.write(("Tax Voucher Scheduler Started At: " + startDateStr +"\r\n").getBytes()); " and ( drcr_rcp.tran_date between ? and ? )" +
} " and ( drcr_rcp.confirmed = 'Y' ) "; // added by cpatil
catch(Exception e) pstmt = conn.prepareStatement(sql);
{ pstmt.setTimestamp(1,tranDateFrm);
System.out.println("Exception []::"+e.getMessage()); pstmt.setTimestamp(2,tranDateTo);
log="IntializingLog_Failed"; rs = pstmt.executeQuery();
e.printStackTrace(); while( rs.next())
} {
return log; taxCode = rs.getString("tax_code");
} //siteCode = rs.getString("site_code");
public void writeLog(File f,String Msg,boolean flag) throws Exception System.out.print("taxCode :"+taxCode);
{ //System.out.print("siteCode :"+siteCode);
//taxSiteList.add(taxCode+"@"+siteCode);
try taxCodeList.add(taxCode);
{
SimpleDateFormat sdf1 = new SimpleDateFormat(e12GenericUtility.getDBDateFormat()); }
String currTime = null; rs.close();
Calendar calendar = Calendar.getInstance(); rs=null;
currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString(); pstmt.close();
currTime = currTime.replaceAll("-",""); pstmt=null;
calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis())); //seriesMap.put("CRNRCP@Code",taxSiteList);
if(! CommonConstants.DEBUG_LEVEL.equals("0")) }
{
PrintWriter pw = new PrintWriter((new FileOutputStream(f,flag)),flag);
pw.println("{" + currTime + " " + calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE) + "}\t" + Msg);
pw.close(); }
} catch(Exception e)
} {
catch(Exception exWm){exWm.printStackTrace();} e.printStackTrace();
} }
//return seriesMap;
/*--------------------------------------------------------------------------------------------------*/ return taxCodeList;
}
private String saveData(String siteCode,String xmlString,String xtraParams, Connection conn) throws ITMException /*----------------------------------------------------------------------------------------------------------*/
{
System.out.println("saving data..........."); private String intializingLog(String fileName)
InitialContext ctx = null; {
String retString = null; String log="";
MasterStatefulLocal masterStateful = null; // for ejb3 String strToWrite = "";
ibase.utility.UserInfoBean userInfo; String currTime = null;
String chgUser="",chgTerm="",loginEmpCode=""; try
E12GenericUtility genericUtility=new E12GenericUtility(); {
System.out.println(">>>In intializingLog() fileName:"+fileName);
try SimpleDateFormat sdf1 = new SimpleDateFormat(e12GenericUtility.getDBDateFormat());
{ userInfo = new ibase.utility.UserInfoBean(); try
AppConnectParm appConnect = new AppConnectParm(); {
ctx = new InitialContext(appConnect.getProperty()); currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString();
masterStateful = (MasterStatefulLocal)ctx.lookup("ibase/MasterStatefulEJB/local"); currTime = currTime.replaceAll("-","");
System.out.println("-----------masterStateful------- " + masterStateful); calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis()));
String [] authencate = new String[2]; fileName = fileName+currTime+calendar.get(Calendar.HOUR)+""+calendar.get(Calendar.MINUTE)+".csv";
authencate[0] = ""; fos1 = new FileOutputStream(CommonConstants.JBOSSHOME + File.separator +"EDI"+File.separator+fileName);
authencate[1] = ""; //strToWrite="\"TRANID\",\"START TIME\",\"END TIME\",\"STATUS\"\r\n";
System.out.println("xmlString to masterstateful [" + xmlString + "]"); //fos1.write(strToWrite.getBytes());
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgUser"); log ="IntializingLog_Successesfull";
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgTerm"); }
loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode"); catch(Exception e)
siteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"); {
System.out.println("Exception []::"+e.getMessage());
e.printStackTrace();
userInfo.setEmpCode(loginEmpCode); }
userInfo.setLoginCode(chgUser); startDate = new java.util.Date(System.currentTimeMillis());
userInfo.setRemoteHost(chgTerm); calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis()));
userInfo.setSiteCode(siteCode); startDateStr = sdf1.format(startDate)+" "+calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE)+":"+calendar.get(Calendar.SECOND);
userInfo.setEntityCode(loginEmpCode); fos1.write(("Tax Voucher Scheduler Started At: " + startDateStr +"\r\n").getBytes());
System.out.println("userInfo>>>>>"+userInfo); }
retString = masterStateful.processRequest(userInfo,xmlString,true,conn); catch(Exception e)
} {
catch(ITMException itme) System.out.println("Exception []::"+e.getMessage());
{ log="IntializingLog_Failed";
System.out.println("ITMException :CreateDistOrder :saveData :==>"); e.printStackTrace();
throw itme; }
} return log;
catch(Exception e) }
{ public void writeLog(File f,String Msg,boolean flag) throws Exception
e.printStackTrace(); {
System.out.println("Exception :CreateDistOrder :saveData :==>");
throw new ITMException(e);
} try
return retString; {
} SimpleDateFormat sdf1 = new SimpleDateFormat(e12GenericUtility.getDBDateFormat());
String currTime = null;
Calendar calendar = Calendar.getInstance();
private String checkNull(String input) currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString();
{ currTime = currTime.replaceAll("-","");
if (input == null) calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis()));
{
input = ""; if(! CommonConstants.DEBUG_LEVEL.equals("0"))
} {
return input; PrintWriter pw = new PrintWriter((new FileOutputStream(f,flag)),flag);
} pw.println("{" + currTime + " " + calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE) + "}\t" + Msg);
pw.close();
/*-------------------------------------------------------------------------------------------------*/ }
private Timestamp getPreviousDate(java.sql.Timestamp FromDate, Connection conn) }
{ catch(Exception exWm){exWm.printStackTrace();}
String varValueStr=""; }
int varValue = 0;
java.sql.Timestamp compDate=null,ToDate=null,prdFrom=null;
/*--------------------------------------------------------------------------------------------------*/
try
{
varValueStr = dist.getDisparams("999999","SSD_TRANSIT_DAYS",conn);
System.out.println("varValue.." + varValueStr);
private String saveData(String siteCode,String xmlString,String xtraParams, Connection conn) throws ITMException
if( varValueStr.equalsIgnoreCase("NULLFOUND") ) {
{ System.out.println("saving data...........");
System.out.println("varValue is NULLFOUND" + varValueStr); InitialContext ctx = null;
} String retString = null;
else MasterStatefulLocal masterStateful = null; // for ejb3
{ ibase.utility.UserInfoBean userInfo;
varValue = Integer.parseInt(varValueStr); String chgUser="",chgTerm="",loginEmpCode="";
} E12GenericUtility genericUtility=new E12GenericUtility();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(e12GenericUtility.getDBDateFormat());
System.out.println("varValue = .. " + varValue); try
varValue = (-1) * varValue; { userInfo = new ibase.utility.UserInfoBean();
System.out.println("changed varValue for to date>>>>>>>>>>>>>>>> = .. " + varValue); AppConnectParm appConnect = new AppConnectParm();
/*compDate = utilMethod.RelativeDate(ToDate,varValue); ctx = new InitialContext(appConnect.getProperty());
masterStateful = (MasterStatefulLocal)ctx.lookup("ibase/MasterStatefulEJB/local");
System.out.println("compDate >>>>>>"+compDate);*/ System.out.println("-----------masterStateful------- " + masterStateful);
String [] authencate = new String[2];
varValue = (-1) * 1; authencate[0] = "";
System.out.println("changed varValue>>>>>>>>>>>>>>>> = .. " + varValue); authencate[1] = "";
System.out.println("xmlString to masterstateful [" + xmlString + "]");
if(FromDate !=null) chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgUser");
{ chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgTerm");
prdFrom = utilMethod.RelativeDate(FromDate,varValue); loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
} siteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode");
System.out.println("prdFrom :"+prdFrom);
} userInfo.setEmpCode(loginEmpCode);
catch(Exception e) userInfo.setLoginCode(chgUser);
{ userInfo.setRemoteHost(chgTerm);
} userInfo.setSiteCode(siteCode);
userInfo.setEntityCode(loginEmpCode);
System.out.println("userInfo>>>>>"+userInfo);
return prdFrom; retString = masterStateful.processRequest(userInfo,xmlString,true,conn);
} }
catch(ITMException itme)
/*--------------------------------------------------------------------------------------------------*/ {
System.out.println("ITMException :CreateDistOrder :saveData :==>");
/* throw itme;
public static void main(String arg[]) }
{ catch(Exception e)
System.out.println("@@@@@@@@@@@@@@@"); {
String xtraParams=""; e.printStackTrace();
String empCode="E17532"; System.out.println("Exception :CreateDistOrder :saveData :==>");
String termId="172.16.9.1"; throw new ITMException(e);
String loginSiteCode=""; }
try { return retString;
Class.forName("oracle.jdbc.driver.OracleDriver"); }
Connection con = DriverManager.
getConnection("jdbc:oracle:thin:@172.16.10.24:1521:fintest"
,"SUN","LAXMIMATA1234$"); private String checkNull(String input)
xtraParams = "loginEmpCode="+empCode+"~~termId="+termId+"~~loginSiteCode="+loginSiteCode; {
callProcess(xtraParams,con); if (input == null)
//genTextVouchSch(xtraParams,con); {
input = "";
System.out.println("Created DB Connection...."); }
} catch (ClassNotFoundException e) { return input;
// TODO Auto-generated catch block }
e.printStackTrace();
} catch (SQLException e) { /*-------------------------------------------------------------------------------------------------*/
// TODO Auto-generated catch block private Timestamp getPreviousDate(java.sql.Timestamp FromDate, Connection conn)
e.printStackTrace(); {
} String varValueStr="";
int varValue = 0;
java.sql.Timestamp compDate=null,ToDate=null,prdFrom=null;
}*/
try
/*public static void callProcess(String xtraParams,Connection conn ) {
{
genTextVouchSch(xtraParams,conn); varValueStr = dist.getDisparams("999999","SSD_TRANSIT_DAYS",conn);
}*/ System.out.println("varValue.." + varValueStr);
} if( varValueStr.equalsIgnoreCase("NULLFOUND") )
{
System.out.println("varValue is NULLFOUND" + varValueStr);
}
else
{
varValue = Integer.parseInt(varValueStr);
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(e12GenericUtility.getDBDateFormat());
System.out.println("varValue = .. " + varValue);
varValue = (-1) * varValue;
System.out.println("changed varValue for to date>>>>>>>>>>>>>>>> = .. " + varValue);
/*compDate = utilMethod.RelativeDate(ToDate,varValue);
System.out.println("compDate >>>>>>"+compDate);*/
varValue = (-1) * 1;
System.out.println("changed varValue>>>>>>>>>>>>>>>> = .. " + varValue);
if(FromDate !=null)
{
prdFrom = utilMethod.RelativeDate(FromDate,varValue);
}
System.out.println("prdFrom :"+prdFrom);
}
catch(Exception e)
{
}
return prdFrom;
}
/*--------------------------------------------------------------------------------------------------*/
/*
public static void main(String arg[])
{
System.out.println("@@@@@@@@@@@@@@@");
String xtraParams="";
String empCode="E17532";
String termId="172.16.9.1";
String loginSiteCode="";
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.
getConnection("jdbc:oracle:thin:@172.16.10.24:1521:fintest"
,"SUN","LAXMIMATA1234$");
xtraParams = "loginEmpCode="+empCode+"~~termId="+termId+"~~loginSiteCode="+loginSiteCode;
callProcess(xtraParams,con);
//genTextVouchSch(xtraParams,con);
System.out.println("Created DB Connection....");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}*/
/*public static void callProcess(String xtraParams,Connection conn )
{
genTextVouchSch(xtraParams,conn);
}*/
}
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