Commit a46de71a authored by vdhoble's avatar vdhoble

change by vishakha for F14ISUN006 07-APR-15


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97776 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a3a8c646
...@@ -2,8 +2,12 @@ package ibase.webitm.ejb.fin; ...@@ -2,8 +2,12 @@ package ibase.webitm.ejb.fin;
import java.sql.*; import java.sql.*;
import java.text.*; import java.text.*;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.*; import ibase.webitm.utility.*;
import java.util.HashMap; import java.util.HashMap;
...@@ -8123,6 +8127,13 @@ public class FinCommon ...@@ -8123,6 +8127,13 @@ public class FinCommon
///////////// /////////////
public String glTraceUpdate(HashMap glTrace,Connection conn) throws ITMException//Added by Jiten 16/04/07 public String glTraceUpdate(HashMap glTrace,Connection conn) throws ITMException//Added by Jiten 16/04/07
{ {
String errString = glTraceUpdate( glTrace, conn,false);//change by vishakha for F14ISUN006 07-APR-15
return errString;
}
public String glTraceUpdate(HashMap glTrace,Connection conn,boolean isPreview) throws ITMException//Added by Jiten 16/04/07
{
System.out.println("inside gltraceupdate");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
Statement stmt = null; Statement stmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -8140,8 +8151,10 @@ public class FinCommon ...@@ -8140,8 +8151,10 @@ public class FinCommon
SimpleDateFormat sdf = null; SimpleDateFormat sdf = null;
HashMap glTran = null; HashMap glTran = null;
String analysis1="", analysis2="", analysis3=""; // cpatil; String analysis1="", analysis2="", analysis3=""; // cpatil;
String tableName="";
String refSerTemp="";
try{ try{
System.out.println("Inside Try Catch...");
genericUtility = new GenericUtility(); genericUtility = new GenericUtility();
chgDate = new Timestamp(System.currentTimeMillis()); chgDate = new Timestamp(System.currentTimeMillis());
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
...@@ -8171,7 +8184,7 @@ public class FinCommon ...@@ -8171,7 +8184,7 @@ public class FinCommon
analysis2 = (glTrace.get("analysis2") == null ? "":glTrace.get("analysis2").toString()); // added by cpatil analysis2 = (glTrace.get("analysis2") == null ? "":glTrace.get("analysis2").toString()); // added by cpatil
analysis3 = (glTrace.get("analysis3") == null ? "":glTrace.get("analysis3").toString()); // added by cpatil analysis3 = (glTrace.get("analysis3") == null ? "":glTrace.get("analysis3").toString()); // added by cpatil
System.out.println("SYSO...............2");
//errCode = itmDBAccessEJB.isAcctCode(siteCode,acctCode,"X",conn);//To be uncommented later - Jiten as it is giving resultset closed. //errCode = itmDBAccessEJB.isAcctCode(siteCode,acctCode,"X",conn);//To be uncommented later - Jiten as it is giving resultset closed.
System.out.println("errCode "+errCode); System.out.println("errCode "+errCode);
if(errCode.trim().length() > 0){ if(errCode.trim().length() > 0){
...@@ -8185,23 +8198,30 @@ public class FinCommon ...@@ -8185,23 +8198,30 @@ public class FinCommon
return errString; return errString;
} }
entryBatchNo = (glTrace.get("entry_batch_no") == null ? "":glTrace.get("entry_batch_no").toString()); entryBatchNo = (glTrace.get("entry_batch_no") == null ? "":glTrace.get("entry_batch_no").toString());
if(entryBatchNo != null && entryBatchNo.trim().length() > 0){ //if(entryBatchNo != null && entryBatchNo.trim().length() > 0){
entryBatchNo = entryBatchNo.substring(0,12); // entryBatchNo = entryBatchNo.substring(0,12);
}
// }
exchRate = Double.parseDouble(glTrace.get("exch_rate").toString()); exchRate = Double.parseDouble(glTrace.get("exch_rate").toString());
drAmt = Double.parseDouble(glTrace.get("dr_amt").toString()); drAmt = Double.parseDouble(glTrace.get("dr_amt").toString());
crAmt = Double.parseDouble(glTrace.get("cr_amt").toString()); crAmt = Double.parseDouble(glTrace.get("cr_amt").toString());
if(exchRate == 0){ System.out.println("CR amount>>>>"+crAmt+"DR AMOUNT>>>>>>"+drAmt);
errString = itmDBAccessEJB.getErrorString("","VTEXRAT1","","",conn); System.out.println("eXCH RATE>>>>"+exchRate);
return errString;
}
if (drAmt == 0 && crAmt == 0) if (drAmt == 0 && crAmt == 0)
{ {
return ""; return "";
} }
if(exchRate == 0)
{
errString = itmDBAccessEJB.getErrorString("","VTEXRAT1","","",conn);
return errString;
}
tempDrAmt = drAmt * exchRate; tempDrAmt = drAmt * exchRate;
tempCrAmt = crAmt * exchRate; tempCrAmt = crAmt * exchRate;
System.out.println("SYSO...............3");
postdt = getFinparams("999999", "POST_ON_DATE",conn); postdt = getFinparams("999999", "POST_ON_DATE",conn);
if(postdt == null || postdt.equalsIgnoreCase("NULLFOUND")){ if(postdt == null || postdt.equalsIgnoreCase("NULLFOUND")){
errString = itmDBAccessEJB.getErrorString("","VTENVAR1","","",conn); errString = itmDBAccessEJB.getErrorString("","VTENVAR1","","",conn);
...@@ -8228,13 +8248,17 @@ public class FinCommon ...@@ -8228,13 +8248,17 @@ public class FinCommon
} }
rs.close(); rs.close();
if(currCode.equalsIgnoreCase(finEntCurr)){ if(currCode.equalsIgnoreCase(finEntCurr)){
System.out.println("currCode>>>>"+currCode);
System.out.println("finEntCurr>>>"+finEntCurr);
if(exchRate > 1){ if(exchRate > 1){
errString = itmDBAccessEJB.getErrorString("","VGLEXRTNE","","",conn); errString = itmDBAccessEJB.getErrorString("","VGLEXRTNE","","",conn);
return errString; return errString;
} }
} }
System.out.println("SYSO...............4");
postDate = (Timestamp)glTrace.get("tran_date"); postDate = (Timestamp)glTrace.get("tran_date");
System.out.println("siteCode>>>>>"+siteCode);
System.out.println("postDate>>>>>"+new java.util.Date(postDate.getTime()));
errCode = validatorEJB.nfCheckPeriod("FIN",new java.util.Date(postDate.getTime()),siteCode); errCode = validatorEJB.nfCheckPeriod("FIN",new java.util.Date(postDate.getTime()),siteCode);
if(errCode.trim().length() > 0){ if(errCode.trim().length() > 0){
errString = itmDBAccessEJB.getErrorString("",errCode,"","",conn); errString = itmDBAccessEJB.getErrorString("",errCode,"","",conn);
...@@ -8276,11 +8300,23 @@ public class FinCommon ...@@ -8276,11 +8300,23 @@ public class FinCommon
} }
rs.close(); rs.close();
pstmt.close(); pstmt.close();
//change by vishakha for F14ISUN006 07-APR-15
if(isPreview)
{
tableName="gltrace_preview";
refSerTemp="GLTR";
}
else
{
tableName="gltrace";
refSerTemp="GLTRCE";
}
String xmlString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n<header>"+ String xmlString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n<header>"+
"\r\n</header><Detail1><item_ser></item_ser>"+ "\r\n</header><Detail1><item_ser></item_ser>"+
"\r\n<site_code>"+siteCode+"</site_code>\r\n<tran_date>"+sdf.format(new java.util.Date(tranDate.getTime()))+"</tran_date></Detail1></Root>"; "\r\n<site_code>"+siteCode+"</site_code>\r\n<tran_date>"+sdf.format(new java.util.Date(tranDate.getTime()))+"</tran_date></Detail1></Root>";
sql = "select key_string from transetup where tran_window = 't_gltrace'"; sql = "select key_string from transetup where tran_window = 't_"+tableName+"'";
System.out.println("SQL :"+sql); System.out.println("SQL :"+sql);
rs = stmt.executeQuery(sql); rs = stmt.executeQuery(sql);
if(rs.next()){ if(rs.next()){
...@@ -8288,7 +8324,7 @@ public class FinCommon ...@@ -8288,7 +8324,7 @@ public class FinCommon
} }
rs.close(); rs.close();
TransIDGenerator tg = new TransIDGenerator(xmlString, "SYSTEM", CommonConstants.DB_NAME); TransIDGenerator tg = new TransIDGenerator(xmlString, "SYSTEM", CommonConstants.DB_NAME);
tranId = tg.generateTranSeqID("GLTRCE", "tran_id", keyString, conn); tranId = tg.generateTranSeqID(refSerTemp, "tran_id", keyString, conn);
if(projCode == null || projCode.trim().length() == 0){ if(projCode == null || projCode.trim().length() == 0){
glTrace.put("proj_code",getProject(refSer,refId,conn)); glTrace.put("proj_code",getProject(refSer,refId,conn));
...@@ -8298,6 +8334,8 @@ public class FinCommon ...@@ -8298,6 +8334,8 @@ public class FinCommon
entryBatchNo = glTrace.get("entry_batch_no").toString(); entryBatchNo = glTrace.get("entry_batch_no").toString();
} }
System.out.println("postOnLine : "+postOnLine); System.out.println("postOnLine : "+postOnLine);
System.out.println("SYSO...............6");
if(postOnLine.equalsIgnoreCase("Y")){ if(postOnLine.equalsIgnoreCase("Y")){
postStat = "Y"; postStat = "Y";
postDate = chgDate; postDate = chgDate;
...@@ -8329,7 +8367,10 @@ public class FinCommon ...@@ -8329,7 +8367,10 @@ public class FinCommon
glTran.put("analysis2",(glTrace.get("analysis2") == null ? "":glTrace.get("analysis2"))); // added by cpatil glTran.put("analysis2",(glTrace.get("analysis2") == null ? "":glTrace.get("analysis2"))); // added by cpatil
glTran.put("analysis3",(glTrace.get("analysis3") == null ? "":glTrace.get("analysis3"))); // added by cpatil glTran.put("analysis3",(glTrace.get("analysis3") == null ? "":glTrace.get("analysis3"))); // added by cpatil
if( ! isPreview )//change by vishakha for F14ISUN006 07-APR-15
{
errString = glTranUpdate(glTran,conn); errString = glTranUpdate(glTran,conn);
}
System.out.println("errString :: From glTranUpdate(glTran,conn) "+errString); System.out.println("errString :: From glTranUpdate(glTran,conn) "+errString);
if(errString != null && errString.trim().length() > 0){ if(errString != null && errString.trim().length() > 0){
return errString; return errString;
...@@ -8338,7 +8379,21 @@ public class FinCommon ...@@ -8338,7 +8379,21 @@ public class FinCommon
postStat = "N"; postStat = "N";
postDate = null; postDate = null;
} }
sql = "insert into gltrace (tran_id, tran_date, eff_date, ref_type, ref_ser," +
System.out.println("iNSERTING INTO GLTRACE_PREVIEW ......****isPreview Value>>>"+isPreview);
/*sql = "select key_string from transetup where tran_window = 't_"+tableName+"'";
System.out.println("SQL :"+sql);
rs = stmt.executeQuery(sql);
if(rs.next()){
keyString = rs.getString(1);
}
rs.close();
TransIDGenerator tg1 = new TransIDGenerator(xmlString, "SYSTEM", CommonConstants.DB_NAME);
tranId = tg1.generateTranSeqID("GLTR", "tran_id", keyString, conn);*/
System.out.println("Tran id for preview>>>****************"+tranId);
System.out.println("CR AMT for preview*****************"+crAmt);
sql = "insert into "+tableName+" (tran_id, tran_date, eff_date, ref_type, ref_ser," +
"ref_id, fin_entity, site_code, sundry_type," + "ref_id, fin_entity, site_code, sundry_type," +
"sundry_code, acct_code, cctr_code, curr_code," + "sundry_code, acct_code, cctr_code, curr_code," +
"exch_rate, dr_amt, cr_amt,emp_code, anal_code, remarks, post_stat, post_date," + "exch_rate, dr_amt, cr_amt,emp_code, anal_code, remarks, post_stat, post_date," +
...@@ -8433,12 +8488,16 @@ public class FinCommon ...@@ -8433,12 +8488,16 @@ public class FinCommon
System.out.println("EXCH_RATE :"+exchRate); System.out.println("EXCH_RATE :"+exchRate);
pstmt.executeUpdate(); pstmt.executeUpdate();
pstmt.close(); pstmt.close();
System.out.println("errString :::: "+errString); System.out.println("errString :::: "+errString);
if(errString != null && errString.trim().length() == 0){ if(errString == null || errString.trim().length() == 0 ){
System.out.println("Calling glTraceUpdatebudget...."); if(conn !=null){
errString = glTraceUpdatebudget(tranId,refId,refSer,conn); conn.commit();
//conn.close();
}
System.out.println("connection close and commit");
} }
}catch(Exception e){ }catch(Exception e){
System.out.println("Exception in GlTraceUpdate "+e); System.out.println("Exception in GlTraceUpdate "+e);
e.printStackTrace(); e.printStackTrace();
......
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