Commit 6e73ce5f authored by pgole's avatar pgole

Updated finCommon for chg_term and chg_user and exception handling changes


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@102727 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a13358c4
......@@ -30,7 +30,6 @@ public class FinCommon
ResultSet rs = null;
Statement stmt = null;
PreparedStatement pstmt = null;
java.sql.Timestamp postdate = null;
String closePrd = "zzzzzz";
String cctrCode = "";
String errCode = "";
......@@ -39,7 +38,6 @@ public class FinCommon
String prdCode = "000000"; //Gulzar 30/11/06
int count =0;
int sundrybalCnt = 0;
double ll_cnt = 0.0;
double exchRate = 0.0;
double drAmount = 0.0;
double crAmount = 0.0;
......@@ -49,7 +47,7 @@ public class FinCommon
try
{
System.out.println("In SUNDRY-BAL !!!!!!!!!!!!!!!!!!!!!!!!!!");
System.out.println("In SUNDRY-BAL !!!!!!!!!!!!!!!!!!!!!!!!!!"+sundrybalMap.toString());
stmt = conn.createStatement();
java.sql.Timestamp ld_postdate = java.sql.Timestamp.valueOf((sundrybalMap.get("tran_date").toString()));
String finEntity = (String)sundrybalMap.get("fin_entity");
......@@ -59,8 +57,16 @@ public class FinCommon
String acctCode = (String)sundrybalMap.get("acct_code");
String acctPrd = (String)sundrybalMap.get("acct_prd"); //Gulzar 30/11/06
String userId = (String)sundrybalMap.get("user_id"); //Gulzar 30/11/06
String chgTerm = (String)sundrybalMap.get("chg_term"); //Added by poonam on 28-07-16
java.sql.Timestamp chgDate = new java.sql.Timestamp(System.currentTimeMillis());
System.out.println("chgTerm in sundrybalOpnUpd"+chgTerm);
if(chgTerm == null || chgTerm.trim().length() == 0)
{
chgTerm = "SYSTEM" ;
}
String sundCctrUpd = getFinparams("999999","SUND_UPD_CCTR",conn);
if(sundCctrUpd.trim().equals("NULLFOUND"))
{
......@@ -122,6 +128,11 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:sundrybalOpnUpd()[Excuting Query Failed]" + sql +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
errCode = se.getMessage();
return errCode ;
//Added by poonam on 28-07-16 for exception handling:End
}
if (sundrybalCnt == 0)
{
......@@ -151,7 +162,8 @@ public class FinCommon
pstmt.setString(15,contactCode);
pstmt.setTimestamp(16,chgDate);
pstmt.setString(17,userId);
pstmt.setString(18,userId);
//pstmt.setString(18,userId);
pstmt.setString(18,chgTerm); //Changed by poonam on 28-07-16 for chg_term from map
count = pstmt.executeUpdate();
if(count < 1)
......@@ -166,6 +178,11 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:sundrybalOpnUpd()[Excuting Query Failed]" + sqlnstr +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
errCode = se.getMessage();
return errCode ;
//Added by poonam on 28-07-16 for exception handling:End
}
}//if
else
......@@ -188,7 +205,8 @@ public class FinCommon
pstmt.setDouble(5,advAmount);
pstmt.setTimestamp(6,chgDate);
pstmt.setString(7,userId);
pstmt.setString(8,userId);
//pstmt.setString(8,userId);
pstmt.setString(8,chgTerm); //Changed by poonam on 28-07-16 for chg_term from map
count = pstmt.executeUpdate();
if(count < 1)
{
......@@ -202,6 +220,11 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:sundrybalOpnUpd()[Excuting Query Failed]" + sqlUpd +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
errCode = se.getMessage();
return errCode ;
//Added by poonam on 28-07-16 for exception handling:End
}
}//else
try
......@@ -227,6 +250,11 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:sundrybalOpnUpd()[Excuting Query Failed]" + sql +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
errCode = se.getMessage();
return errCode ;
//Added by poonam on 28-07-16 for exception handling:End
}
if (sundrybalCnt == 0 )
{
......@@ -256,7 +284,8 @@ public class FinCommon
pstmt.setString(15,contactCode);
pstmt.setTimestamp(16,chgDate);
pstmt.setString(17,userId);
pstmt.setString(18,userId);
//pstmt.setString(18,userId);
pstmt.setString(18,chgTerm); //Changed by poonam on 28-07-16 for chg_term from map
count = pstmt.executeUpdate();
if(count < 1)
......@@ -271,6 +300,11 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:sundrybalOpnUpd()[Excuting Query Failed]" + sqlnstr +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
errCode = se.getMessage();
return errCode ;
//Added by poonam on 28-07-16 for exception handling:End
}
}//if
else
......@@ -293,7 +327,8 @@ public class FinCommon
pstmt.setDouble(5,advAmount);
pstmt.setTimestamp(6,chgDate);
pstmt.setString(7,userId);
pstmt.setString(8,userId);
//pstmt.setString(8,userId);
pstmt.setString(8,chgTerm);//Changed by poonam on 28-07-16 for chg_term from map
count = pstmt.executeUpdate();
if(count < 1)
{
......@@ -307,6 +342,11 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:sundrybalOpnUpd()[Excuting Query Failed]" + sqlUpd +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
errCode = se.getMessage();
return errCode ;
//Added by poonam on 28-07-16 for exception handling:End
}
}//else
break;
......@@ -342,7 +382,7 @@ public class FinCommon
return (errCode);
}//sundrybalOpnUpd()
public String acctbalOpnUpd(HashMap acctbalMap, Connection conn)throws ITMException
public String acctbalOpnUpd(HashMap acctbalMap, Connection conn)throws ITMException, SQLException
{
String retString = "";
String sql=null;
......@@ -352,21 +392,22 @@ public class FinCommon
String ls_errcode = "";
String prdCode = "000000";
String closePrd ="zzzzzz";
String refSer="";
String insertSql = null;
//String refSer="";
//String insertSql = null;
int q =0;
int count = 0;
double lc_dramt_base = 0;
double lc_cramt_base =0;
//double lc_dramt_base = 0;
//double lc_cramt_base =0;
int ll_cnt = 0;
double lc_dramt = 0;
double lc_cramt = 0;
double lc_advamt = 0;
//double lc_dramt = 0;
//double lc_cramt = 0;
//double lc_advamt = 0;
double lc_cramt_b = 0;
double lc_dramt_b = 0;
try
{
System.out.println("Inside acctbalOpnUpd...."+acctbalMap.toString());
stmt = conn.createStatement();
String acctVar_contactcode = (String)acctbalMap.get("contact_code");
String acctVar_finentity = (String)acctbalMap.get("fin_entity");
......@@ -377,12 +418,21 @@ public class FinCommon
String acctVar_empcode = (String)acctbalMap.get("emp_code");
String userId = (String)acctbalMap.get("user_id");
String acctPrd = (String)acctbalMap.get("acct_prd");
String chgTerm = (String)acctbalMap.get("chg_term"); //Added by poonam on 28-07-16 for chg_term from map
System.out.println("chgTerm in sundrybalOpnUpd"+chgTerm);
if(chgTerm == null || chgTerm.trim().length() == 0)
{
chgTerm = "SYSTEM" ;
}
if (acctVar_cctrcode == null)
{
acctVar_cctrcode = " ";
}
java.sql.Timestamp ld_postdate = java.sql.Timestamp.valueOf(acctbalMap.get("tran_date").toString());
java.sql.Timestamp acctVar_trandate = java.sql.Timestamp.valueOf(acctbalMap.get("tran_date").toString());
//java.sql.Timestamp ld_postdate = java.sql.Timestamp.valueOf(acctbalMap.get("tran_date").toString());
//java.sql.Timestamp acctVar_trandate = java.sql.Timestamp.valueOf(acctbalMap.get("tran_date").toString());
java.sql.Timestamp acctVar_effdate = java.sql.Timestamp.valueOf(acctbalMap.get("eff_date").toString());
java.sql.Timestamp chgDate = new java.sql.Timestamp(System.currentTimeMillis());
......@@ -456,7 +506,8 @@ public class FinCommon
//pstmt.setTimestamp(12,acctVar_effdate);//Gulzar 01-12-06
pstmt.setTimestamp(12,chgDate); //Gulzar 01-12-06
pstmt.setString(13,userId);
pstmt.setString(14,userId);
//pstmt.setString(14,userId);
pstmt.setString(14,chgTerm); //Changed by poonam on 28-07-16 for chg_term from map
int cnt = pstmt.executeUpdate();
pstmt.close(); pstmt = null; // ADDED BY ALKA
System.out.println("INSERTED IN ACCTBAL FOR CURRENT PERIODE : " + cnt);
......@@ -465,6 +516,7 @@ public class FinCommon
{
System.out.println("SQLException []:acctbalOpnUpd()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
retString = se.getMessage();
return retString;
}
......@@ -485,7 +537,8 @@ public class FinCommon
pstmt.setDouble(4,lc_cramt_b);
pstmt.setTimestamp(5,chgDate); //Gulzar 01-12-06
pstmt.setString(6,userId); //Gulzar 01-12-06
pstmt.setString(7,userId); //Gulzar 01-12-06
//pstmt.setString(7,userId); //Gulzar 01-12-06
pstmt.setString(7,chgTerm); //Changed by poonam on 28-07-16 for chg_term from map
count = pstmt.executeUpdate();
pstmt.close(); pstmt = null; // ADDED BY ALKA
System.out.println("NO. OF RECORDS UPDATED IN ACCTBAL...(CURRENT) :"+count);
......@@ -553,7 +606,8 @@ public class FinCommon
//pstmt.setTimestamp(12,acctVar_effdate); //Gulzar 01-12-06
pstmt.setTimestamp(12,chgDate); //Gulzar 01-12-06
pstmt.setString(13,userId);
pstmt.setString(14,userId);
//pstmt.setString(14,userId);
pstmt.setString(14,chgTerm); //Changed by poonam on 28-07-16 for chg_term from map
int cnt = pstmt.executeUpdate();
pstmt.close(); pstmt = null; // ADDED BY ALKA
System.out.println("INSERTED IN ACCTBAL FOR CLOSING BALANCE : " + cnt);
......@@ -578,7 +632,8 @@ public class FinCommon
pstmt.setDouble(4,lc_cramt_b);
pstmt.setTimestamp(5,chgDate); //Gulzar 01-12-06
pstmt.setString(6,userId); //Gulzar 01-12-06
pstmt.setString(7,userId); //Gulzar 01-12-06
//pstmt.setString(7,userId); //Gulzar 01-12-06
pstmt.setString(7,chgTerm); //Changed by poonam on 28-07-16 for chg_term from map
int cnt = pstmt.executeUpdate();
pstmt.close(); pstmt = null; // ADDED BY ALKA
System.out.println("NO. OF RECORDS UPDATED IN ACCTBAL...(CLOSING)" + cnt);
......@@ -670,7 +725,7 @@ public class FinCommon
try
{
System.out.println("In SUNDRY-BAL !!!!!!!!!!!!!!!!!!!!!!!!!!");
System.out.println("In SUNDRY-BAL !!!!!!!!!!!!!!!!!!!!!!!!!!"+sundrybalMap.toString());
stmt = conn.createStatement();
java.sql.Timestamp ld_postdate = java.sql.Timestamp.valueOf((sundrybalMap.get("tran_date").toString()));
String ls_finentity = (String)sundrybalMap.get("fin_entity");
......@@ -678,7 +733,19 @@ public class FinCommon
String ls_sundrytype = (String)sundrybalMap.get("sundry_type");
String ls_sundrycode = (String)sundrybalMap.get("sundry_code");
String ls_acctcode = (String)sundrybalMap.get("acct_code");
String chgTerm = (String)sundrybalMap.get("chg_term"); //Added by poonam on 28-07-16 for chg_term from map
String chgUser = (String)sundrybalMap.get("chg_user"); //Added by poonam on 28-07-16 for chg_term from map
System.out.println("befor chgTerm "+chgTerm + "chgUser" +chgUser);
if(chgTerm == null || chgTerm.trim().length() == 0)
{
chgTerm = "SYSTEM" ;
}
if(chgUser == null || chgUser.trim().length() == 0)
{
chgUser = "SYSTEM" ;
}
System.out.println("gbf_sundrybal_upd chgTerm "+chgTerm + "chgUser" +chgUser);
String ls_cctr_upd = getFinparams("999999","SUND_UPD_CCTR",conn);
if(ls_cctr_upd.trim().equals("NULLFOUND"))
{
......@@ -742,6 +809,11 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sql +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
ls_errcode = se.getMessage();
return ls_errcode ;
//Added by poonam on 28-07-16 for exception handling:End
}
try
{
......@@ -785,8 +857,10 @@ public class FinCommon
pstmt.setDouble(14,0);
pstmt.setString(15,ls_contactcode);
pstmt.setTimestamp(16,ld_postdate);
pstmt.setString(17,userId);
pstmt.setString(18,userId);
//pstmt.setString(17,userId);
pstmt.setString(17,chgUser);//Added by poonam on 28-07-16 for chg_term from map
//pstmt.setString(18,userId);
pstmt.setString(18,chgTerm ); //Added by poonam on 28-07-16 for chg_term from map
count = pstmt.executeUpdate();
pstmt.close(); pstmt = null; // ADDED BY ALKA
......@@ -800,12 +874,24 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sqlnstr +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
ls_errcode = se.getMessage();
System.out.println("ls_errcode11 28-07-16"+ls_errcode);
return ls_errcode ;
//Added by poonam on 28-07-16 for exception handling:End
}
}//if
}//outer try
catch(SQLException se)
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sql +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
ls_errcode = se.getMessage();
System.out.println("ls_errcode12 28-07-16"+ls_errcode);
return ls_errcode ;
//Added by poonam on 28-07-16 for exception handling:End
}
try
......@@ -828,6 +914,11 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sql +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
ls_errcode = se.getMessage();
return ls_errcode ;
//Added by poonam on 28-07-16 for exception handling:End
}
if (ll_cnt == 0 )
{
......@@ -856,8 +947,10 @@ public class FinCommon
pstmt.setDouble(14,lc_advamt);
pstmt.setString(15,ls_contactcode);
pstmt.setTimestamp(16,ld_postdate);
pstmt.setString(17,userId);
pstmt.setString(18,userId);
//pstmt.setString(17,userId);
pstmt.setString(17,chgUser);//Added by poonam on 28-07-16 for chg_term from map
//pstmt.setString(18,userId);
pstmt.setString(18,chgTerm); //Added by poonam on 28-07-16 for chg_term from map
count = pstmt.executeUpdate();
pstmt.close(); pstmt = null; // ADDED BY ALKA
......@@ -871,6 +964,11 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sqlnstr +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
ls_errcode = se.getMessage();
return ls_errcode ;
//Added by poonam on 28-07-16 for exception handling:End
}
}//if
else
......@@ -892,8 +990,10 @@ public class FinCommon
pstmt.setDouble(4,lc_dramt_b);
pstmt.setDouble(5,lc_advamt);
pstmt.setTimestamp(6,ld_postdate);
pstmt.setString(7,userId);
pstmt.setString(8,userId);
//pstmt.setString(7,userId);
//pstmt.setString(8,userId);
pstmt.setString(7,chgUser); //Added by poonam on 28-07-16 for chg_term from map
pstmt.setString(8,chgTerm); //Added by poonam on 28-07-16 for chg_term from map
count = pstmt.executeUpdate();
pstmt.close(); pstmt = null; // ADDED BY ALKA
if(count<1)
......@@ -906,6 +1006,11 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sqlUpd +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
ls_errcode = se.getMessage();
return ls_errcode ;
//Added by poonam on 28-07-16 for exception handling:End
}
}//else
try
......@@ -928,6 +1033,11 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sql +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
ls_errcode = se.getMessage();
return ls_errcode ;
//Added by poonam on 28-07-16 for exception handling:End
}
if (ll_cnt == 0 )
{
......@@ -956,8 +1066,10 @@ public class FinCommon
pstmt.setDouble(14,lc_advamt);
pstmt.setString(15,ls_contactcode);
pstmt.setTimestamp(16,ld_postdate);
pstmt.setString(17,userId);
pstmt.setString(18,userId);
//pstmt.setString(17,userId);
//pstmt.setString(18,userId);
pstmt.setString(17,chgUser);//Added by poonam on 28-07-16 for chg_term from map
pstmt.setString(18,chgTerm);//Added by poonam on 28-07-16 for chg_term from map
count = pstmt.executeUpdate();
if(count<1)
......@@ -970,6 +1082,11 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sqlnstr +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
ls_errcode = se.getMessage();
return ls_errcode ;
//Added by poonam on 28-07-16 for exception handling:End
}
}//if
else
......@@ -991,8 +1108,10 @@ public class FinCommon
pstmt.setDouble(4,lc_dramt_b);
pstmt.setDouble(5,lc_advamt);
pstmt.setTimestamp(6,ld_postdate);
pstmt.setString(7,userId);
pstmt.setString(8,userId);
//pstmt.setString(7,userId);
//pstmt.setString(8,userId);
pstmt.setString(7,chgUser);//Added by poonam on 28-07-16 for chg_user from map
pstmt.setString(8,chgTerm);//Added by poonam on 28-07-16 for chg_term from map
count = pstmt.executeUpdate();
if(count<1)
{
......@@ -1004,6 +1123,11 @@ public class FinCommon
catch(SQLException se)
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sqlUpd +se.getMessage());
//Added by poonam on 28-07-16 for exception handling:Start
se.printStackTrace();
ls_errcode = se.getMessage();
return ls_errcode ;
//Added by poonam on 28-07-16 for exception handling:End
}
}//else
break;
......@@ -1048,8 +1172,9 @@ public class FinCommon
* @param conn Database connection
* @return Error code if fails
* @exception ITMException
* @throws SQLException
*/
public String gbf_acctbal_upd(HashMap acctbalMap, Connection conn)throws ITMException
public String gbf_acctbal_upd(HashMap acctbalMap, Connection conn)throws ITMException, SQLException
{
String retString = "";
String sql=null;
......@@ -1059,24 +1184,22 @@ public class FinCommon
String ls_errcode = "";
String ls_openprd = "000000";
String ls_closeprd ="zzzzzz";
String refSer="";
String insertSql = null;
//String refSer="";
//String insertSql = null;
String ls_acctprd = null;
String ls_prdcode = null;
String ls_prd_code = null;
int q =0;
//String ls_prd_code = null;
//int q =0;
int count = 0;
double lc_dramt_base = 0;
double lc_cramt_base =0;
double ll_cnt = 0;
double lc_dramt = 0;
double lc_cramt = 0;
double lc_advamt = 0;
double lc_cramt_b = 0;
double lc_dramt_b = 0;
try
{
System.out.println("Inside acctbalMap......"+acctbalMap.toString());
stmt = conn.createStatement();
String acctVar_contactcode = (String)acctbalMap.get("contact_code");
String acctVar_finentity = (String)acctbalMap.get("fin_entity");
......@@ -1084,10 +1207,17 @@ public class FinCommon
String acctVar_acctcode = (String)acctbalMap.get("acct_code");
String acctVar_cctrcode = (String)acctbalMap.get("cctr_code");
String acctVar_currcode = (String)acctbalMap.get("curr_code");
String acctVar_empcode = (String)acctbalMap.get("emp_code");
//String acctVar_empcode = (String)acctbalMap.get("emp_code");
String userId = (String)acctbalMap.get("user_id");
String chgTerm = (String)acctbalMap.get("chg_term");
if(chgTerm == null || chgTerm.trim().length() == 0)
{
chgTerm = "SYSTEM" ;
}
System.out.println("acctbalMap chgTerm"+chgTerm + "userId"+userId);
java.sql.Timestamp ld_postdate = java.sql.Timestamp.valueOf(acctbalMap.get("tran_date").toString());
java.sql.Timestamp acctVar_trandate = java.sql.Timestamp.valueOf(acctbalMap.get("tran_date").toString());
//java.sql.Timestamp acctVar_trandate = java.sql.Timestamp.valueOf(acctbalMap.get("tran_date").toString());
java.sql.Timestamp acctVar_effdate = java.sql.Timestamp.valueOf(acctbalMap.get("eff_date").toString());
double acctVar_exchrate = ((Double)acctbalMap.get("exch_rate")).doubleValue();
......@@ -1169,7 +1299,8 @@ public class FinCommon
pstmt.setDouble(10,0);
pstmt.setTimestamp(11,acctVar_effdate);
pstmt.setString(12,userId);
pstmt.setString(13,userId);
//pstmt.setString(13,userId);
pstmt.setString(13,chgTerm);//Added by poonam on 28-07-16 for chg_term from map
pstmt.setString(14,acctVar_sitecode);
int cnt = pstmt.executeUpdate();
......@@ -1236,7 +1367,8 @@ public class FinCommon
pstmt.setDouble(11,lc_cramt_base);
pstmt.setTimestamp(12,acctVar_effdate);
pstmt.setString(13,userId);
pstmt.setString(14,userId);
//pstmt.setString(14,userId);
pstmt.setString(14,chgTerm);//Added by poonam on 28-07-16 for chg_term from map
int cnt = pstmt.executeUpdate();
System.out.println("INSERTED IN ACCTBAL FOR CURRENT PERIODE : " + cnt);
......@@ -1299,6 +1431,7 @@ public class FinCommon
if(ll_cnt == 0)
{
// insert a record for closing balance
try{ //poonam
sql="INSERT INTO ACCTBAL (ACCT_PRD, PRD_CODE, FIN_ENTITY, SITE_CODE,ACCT_CODE, CCTR_CODE, CURR_CODE__AC, DR_AMT, CR_AMT,"+
" DR_AMT__BASE, CR_AMT__BASE, CHG_DATE, CHG_USER, CHG_TERM)"+
" VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,? )";
......@@ -1316,7 +1449,8 @@ public class FinCommon
pstmt.setDouble(11,lc_cramt_base);
pstmt.setTimestamp(12,acctVar_effdate);
pstmt.setString(13,userId);
pstmt.setString(14,userId);
//pstmt.setString(13,userId);
pstmt.setString(14,chgTerm); //Added by poonam on 28-07-16 for chg_term from map
int cnt = pstmt.executeUpdate();
System.out.println("INSERTED IN ACCTBAL FOR CLOSING BALANCE : " + cnt);
......@@ -1326,8 +1460,19 @@ public class FinCommon
break;
}
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
ls_errcode = se.getMessage();
return ls_errcode ;
}
//Added by poonam on 28-07-16 for exception handling:End
}
else
{
try{ //poonam
// update closing in acctbal
sql="UPDATE ACCTBAL SET DR_AMT = (DR_AMT + ( ? )), CR_AMT = (CR_AMT + ( ? )), DR_AMT__BASE = (DR_AMT__BASE + ( ? )), CR_AMT__BASE = (CR_AMT__BASE + ( ? )) "+
"WHERE ACCT_PRD = '"+ls_acctprd+"' AND PRD_CODE = '"+ls_closeprd+"' AND "+
......@@ -1346,6 +1491,16 @@ public class FinCommon
ls_errcode = "DS000";
break;
}
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
ls_errcode = se.getMessage();
return ls_errcode ;
}
//Added by poonam on 28-07-16 for exception handling:End
}
break;
}
......@@ -1556,6 +1711,8 @@ public class FinCommon
catch(SQLException e)
{
System.out.println("Exception :: [][getDailyExchRateSellBuy]"+sql+e);
}
catch(Exception ex)
{
......@@ -1733,7 +1890,7 @@ public class FinCommon
public String isAcctCode(String siteCode,String acctCode,String modName,Connection con) throws ITMException
{
String errCode = "", siteSpec = "";
long counter;
//long counter;
String sql1 = "";
Statement statement1 = null;
ResultSet resultSet1 = null;
......@@ -1838,7 +1995,10 @@ public class FinCommon
{
System.out.println("SQLException :ITMDBAccessEJB :isAcctCode:" + se.getMessage() + ":");
se.printStackTrace();
errCode = se.getMessage();
throw new ITMException(se);
}
catch(Exception e)
{
......@@ -2957,7 +3117,7 @@ public class FinCommon
pstmt.close(); pstmt = null;
if (cheque_or_name.equalsIgnoreCase("C"))
{
if (chqName == null && chqName.trim().length() == 0)
if (chqName == null || chqName.trim().length() == 0)
{
chqName = sName;
}
......@@ -8364,7 +8524,7 @@ public class FinCommon
String deptCode = "",currCode = "",empCode = "",analCode = "",projCode = "";
String refType = "",refSer = "",refId = "",remarks = "",partyDocRef = "";
String entryBatchNo = "",postdt = "",postOnLine = "",postStat = "",finEntCurr = "",sql= "";
String sundryTypeAc = "",acctPrd = "",code = "",keyString = "",tranId = "";
String acctPrd = "",code = "",keyString = "",tranId = "";
double exchRate = 0,drAmt = 0,crAmt = 0,tempDrAmt = 0,tempCrAmt = 0;
Timestamp tranDate = null,effDate = null,postDate = null,chgDate = null;
ITMDBAccessEJB itmDBAccessEJB = null;
......@@ -8373,10 +8533,11 @@ public class FinCommon
SimpleDateFormat sdf = null;
HashMap glTran = null;
String analysis1="", analysis2="", analysis3=""; // cpatil;
String chgUser = "",chgTerm = ""; //poonam
String tableName="";
String refSerTemp="";
try{
System.out.println("Inside Try Catch...");
System.out.println("Inside Try Catch..."+ glTrace.toString());
// genericUtility = new GenericUtility();
chgDate = new Timestamp(System.currentTimeMillis());
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
......@@ -8405,6 +8566,18 @@ public class FinCommon
analysis1 = (glTrace.get("analysis1") == null ? "":glTrace.get("analysis1").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
chgUser = (glTrace.get("chg_user") == null ? "":glTrace.get("chg_user").toString()); // added by poonam
chgTerm = (glTrace.get("chg_term") == null ? "":glTrace.get("chg_term").toString()); // added by poonam
if(chgUser == null || chgUser.trim().length() == 0)
{
chgUser = "SYSTEM" ;
}
if(chgTerm == null || chgTerm.trim().length() == 0)
{
chgTerm = "SYSTEM" ;
}
System.out.println("glTraceUpdate chgUser"+chgUser + "chgTerm"+chgTerm);
System.out.println("SYSO...............2");
//errCode = itmDBAccessEJB.isAcctCode(siteCode,acctCode,"X",conn);//To be uncommented later - Jiten as it is giving resultset closed.
......@@ -8603,6 +8776,8 @@ public class FinCommon
glTran.put("analysis1",(glTrace.get("analysis1") == null ? "":glTrace.get("analysis1"))); // 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("chg_user",(glTrace.get("chg_user") == null ? "":glTrace.get("chg_user"))); // added by Poonam
glTran.put("chg_term",(glTrace.get("chg_term") == null ? "":glTrace.get("chg_term"))); // added by poonam
if( ! isPreview )//change by vishakha for F14ISUN006 07-APR-15
{
......@@ -8617,7 +8792,7 @@ public class FinCommon
postDate = null;
}
System.out.println("iNSERTING INTO GLTRACE_PREVIEW ......****isPreview Value>>>"+isPreview);
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);
......@@ -8630,6 +8805,7 @@ public class FinCommon
System.out.println("Tran id for preview>>>****************"+tranId);
System.out.println("CR AMT for preview*****************"+crAmt);
try{
sql = "insert into "+tableName+" (tran_id, tran_date, eff_date, ref_type, ref_ser," +
"ref_id, fin_entity, site_code, sundry_type," +
"sundry_code, acct_code, cctr_code, curr_code," +
......@@ -8706,8 +8882,12 @@ public class FinCommon
pstmt.setString(23,code);
}
pstmt.setTimestamp(24,chgDate);
pstmt.setString(25,"SYSTEM");
pstmt.setString(26,"SYSTEM");
//pstmt.setString(25,"SYSTEM");
// pstmt.setString(26,"SYSTEM");
pstmt.setString(25,chgUser); // added by poonam
pstmt.setString(26,chgTerm); // added by poonam
pstmt.setString(27,entryBatchNo);
pstmt.setString(28,projCode);
pstmt.setString(29,partyDocRef);
......@@ -8726,6 +8906,19 @@ public class FinCommon
System.out.println("EXCH_RATE :"+exchRate);
pstmt.executeUpdate();
pstmt.close();
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException P []:TRACE()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
System.out.println("errString TRACE(" + errString );
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
System.out.println("errString :::: ["+errString+"]["+isPreview+"]");
if(errString == null || errString.trim().length() == 0 ){
if(conn !=null && isPreview == true){
......@@ -8953,6 +9146,7 @@ public class FinCommon
Statement stmt = null;
ResultSet rs = null;
String sql = "",ledgPost = "",errString = "";
String chgUser = "",chgTerm = ""; //poonam
String glTranId = "",keyString = "",tranIdTrace = "";
String openPeriod = "000000",closePeriod = "zzzzzz";
Timestamp chgDate = null,tranDate = null,effDate = null;
......@@ -8963,6 +9157,7 @@ public class FinCommon
int cnt;
ibase.webitm.ejb.sys.UtilMethods util=new ibase.webitm.ejb.sys.UtilMethods();
try{
System.out.println("Inside glTranUpdate :"+glTran.toString());
stmt = conn.createStatement();
// genericUtility = new GenericUtility();
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
......@@ -8974,6 +9169,19 @@ public class FinCommon
//Date should be in applDate Format
tranDate = (Timestamp)glTran.get("tran_date");
effDate = (Timestamp)glTran.get("eff_date");
chgUser = glTran.get("chg_user").toString();
chgTerm = glTran.get("chg_term").toString();
if(chgTerm == null || chgTerm.trim().length() == 0)
{
chgTerm = "SYSTEM" ;
}
if(chgUser == null || chgUser.trim().length() == 0)
{
chgUser = "SYSTEM" ;
}
System.out.println("Inside glTranUpdate chg_user :"+glTran.get("chg_user").toString() + "chg_term"+glTran.get("chg_term").toString());
if(glTran.get("entry_batch_no").toString() == null || glTran.get("entry_batch_no").toString().trim().length() == 0){
glTran.put("entry_batch_no"," ");
......@@ -9007,6 +9215,9 @@ public class FinCommon
errString = itmDBAccessEJB.getErrorString("","VTGLTRAN1","","",conn);
return errString;
}else if(cnt == 1){
try //added by poonam
{
sql = "update gltran set dr_amt = dr_amt + ? ," +
"cr_amt = cr_amt + ? ," +
"tran_date = ? ," +
......@@ -9023,8 +9234,10 @@ public class FinCommon
pstmt.setTimestamp(3,tranDate);
pstmt.setTimestamp(4,effDate);
pstmt.setTimestamp(5,chgDate);
pstmt.setString(6,"SYSTEM");
pstmt.setString(7,"SYSTEM");
//pstmt.setString(6,"SYSTEM");
// pstmt.setString(7,"SYSTEM");
pstmt.setString(6,chgUser); //Added By poonam on 28-07-16
pstmt.setString(7,chgTerm); //Added By poonam on 28-07-16
pstmt.setString(8,glTran.get("prd_code").toString());
pstmt.setString(9,glTran.get("site_code").toString());
pstmt.setString(10,glTran.get("acct_code").toString());
......@@ -9032,6 +9245,16 @@ public class FinCommon
pstmt.setString(12,glTran.get("entry_batch_no").toString());
pstmt.executeUpdate();
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:glTranUpdate()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}
}
if(cnt == 0){
String xmlString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n<header>"+
......@@ -9058,6 +9281,9 @@ public class FinCommon
}else{
tranIdTrace = glTran.get("tran_id__trace").toString().trim();
}
try{ //added by poonam
sql = "insert into gltran (tran_id, tran_date, eff_date, ref_ser," +
"ref_id, fin_entity, site_code, acct_code, cctr_code," +
"dr_amt, cr_amt, emp_code, anal_code, remarks," +
......@@ -9119,8 +9345,10 @@ public class FinCommon
pstmt.setString(16,prdCode);
}
pstmt.setTimestamp(17,chgDate);
pstmt.setString(18,"SYSTEM");
pstmt.setString(19,"SYSTEM");
//pstmt.setString(18,"SYSTEM");
//pstmt.setString(19,"SYSTEM");
pstmt.setString(18,chgUser); //Added By poonam on 28-07-16
pstmt.setString(19,chgTerm); //Added By poonam on 28-07-16
pstmt.setString(20,tranIdTrace);
pstmt.setString(21,glTran.get("proj_code").toString());
pstmt.setString(22,glTran.get("dept_code").toString());
......@@ -9132,6 +9360,19 @@ public class FinCommon
pstmt.executeUpdate();
pstmt.close();
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:glTranUpdate()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}
sql ="select count(*) from acctbal where acct_prd = '"+glTran.get("acct_prd").toString()+"' " +
"and prd_code = '"+openPeriod+"' " +
......@@ -9146,6 +9387,8 @@ public class FinCommon
}
rs.close();
if(cnt == 0){
try{ //added by poonam
sql = "insert into acctbal (acct_prd, prd_code, fin_entity, site_code, " +
"acct_code, cctr_code, curr_code__ac, dr_amt, cr_amt," +
"dr_amt__base, cr_amt__base, chg_date, chg_user, chg_term) " +
......@@ -9164,13 +9407,27 @@ public class FinCommon
pstmt.setInt(10,0);
pstmt.setInt(11,0);
pstmt.setTimestamp(12,chgDate);
pstmt.setString(13,"SYSTEM");
pstmt.setString(14,"SYSTEM");
//pstmt.setString(13,"SYSTEM");
//pstmt.setString(14,"SYSTEM");
pstmt.setString(13,chgUser); //Added By poonam on 28-07-16
pstmt.setString(14,chgTerm); //Added By poonam on 28-07-16
pstmt.executeUpdate();
pstmt.close();
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}
sql = "select count(*) from acctbal where acct_prd = '"+glTran.get("acct_prd").toString()+"' " +
"and prd_code = '"+glTran.get("prd_code").toString()+"' " +
"and fin_entity = '"+glTran.get("fin_entity").toString()+"' " +
......@@ -9183,6 +9440,8 @@ public class FinCommon
cnt = rs.getInt(1);
}
if(cnt == 0){
try{ //Added by poonam
sql = "insert into acctbal (acct_prd, prd_code, fin_entity, site_code," +
"acct_code, cctr_code, curr_code__ac, dr_amt, cr_amt," +
"dr_amt__base, cr_amt__base, chg_date, chg_user, chg_term) " +
......@@ -9201,12 +9460,29 @@ public class FinCommon
pstmt.setDouble(10,drAmtBase);
pstmt.setDouble(11,crAmtBase);
pstmt.setTimestamp(12,chgDate);
pstmt.setString(13,"SYSTEM");
pstmt.setString(14,"SYSTEM");
//pstmt.setString(13,"SYSTEM");
// pstmt.setString(14,"SYSTEM");
pstmt.setString(13,glTran.get("chg_user").toString()); //Added By poonam on 28-07-16
pstmt.setString(14,glTran.get("chg_term").toString()); //Added By poonam on 28-07-16
pstmt.executeUpdate();
pstmt.close();
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}else{
try{ //added by poonam
sql = "update acctbal set dr_amt = dr_amt + "+Double.parseDouble(glTran.get("dr_amt").toString())+" ," +
"cr_amt = cr_amt + "+Double.parseDouble(glTran.get("cr_amt").toString())+", " +
"dr_amt__base = dr_amt__base + "+drAmtBase+"," +
......@@ -9221,6 +9497,17 @@ public class FinCommon
pstmt = conn.prepareStatement(sql);
pstmt.executeUpdate();
pstmt.close();
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}
sql = "select count(*) from acctbal where acct_prd = '"+glTran.get("acct_prd").toString()+"' " +
......@@ -9235,6 +9522,8 @@ public class FinCommon
}
rs.close();
if(cnt == 0){
try{ //added by poonam
sql = "insert into acctbal (acct_prd, prd_code, fin_entity, site_code," +
"acct_code, cctr_code, curr_code__ac, dr_amt, cr_amt," +
"dr_amt__base, cr_amt__base, chg_date, chg_user, chg_term) " +
......@@ -9253,11 +9542,28 @@ public class FinCommon
pstmt.setDouble(10,drAmtBase);
pstmt.setDouble(11,crAmtBase);
pstmt.setTimestamp(12,chgDate);
pstmt.setString(13,"SYSTEM");
pstmt.setString(14,"SYSTEM");
//pstmt.setString(13,"SYSTEM");
//pstmt.setString(14,"SYSTEM");
pstmt.setString(13,glTran.get("chg_user").toString()); //Added By poonam on 28-07-16
pstmt.setString(14,glTran.get("chg_term").toString()); //Added By poonam on 28-07-16
pstmt.executeUpdate();
pstmt.close();
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}else{
try { //Added by poonam
sql = "update acctbal set dr_amt = dr_amt + "+Double.parseDouble(glTran.get("dr_amt").toString())+"," +
"cr_amt = cr_amt + "+Double.parseDouble(glTran.get("cr_amt").toString())+"," +
"dr_amt__base = dr_amt__base + "+drAmtBase+"," +
......@@ -9270,6 +9576,17 @@ public class FinCommon
System.out.println("SQL :"+sql);
stmt.executeUpdate(sql);
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:gbf_sundrybal_upd()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}
}catch(Exception e){
System.out.println("Exception in glTranUpdate[FinCommon]"+e);
e.printStackTrace();
......@@ -9474,6 +9791,8 @@ public class FinCommon
deptCode = " ";
}
try
{ //added by poonam
sql = "select a.budget_id, case when b.alloc_reqd is null then ' ' else b.alloc_reqd end , " +
"(case when a.budget_amt is null then 0 else a.budget_amt end) + " +
"(case when a.adhoc_amt is null then 0 else a.adhoc_amt end)," +
......@@ -9512,6 +9831,19 @@ public class FinCommon
rs.close();
pstmt.close();
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:updateBudget()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
sql = "select a.tran_id, "+
"case when round(b.alloc_amt * a.exch_rate,3) IS NULL THEN 0 else round(b.alloc_amt * a.exch_rate,3) END, "+
"case when round(b.req_amt * a.exch_rate,3) is null then 0 else round(b.req_amt * a.exch_rate,3) end, "+
......@@ -9568,6 +9900,8 @@ public class FinCommon
}else{
reqPo = 0;
}
try{ //poonam
sql = "update budget_alloc_det " +
"set consume_amt = consume_amt + "+amount+" ," +
"req_amt = req_amt - "+indAmount+" ," +
......@@ -9578,9 +9912,22 @@ public class FinCommon
"and anal_code = '"+analCode+"'";
System.out.println("SQL :"+sql);
updCnt = stmt.executeUpdate(sql);
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:updateBudget()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}else{
if(tranType.equalsIgnoreCase("PORD")){
try{ //poonam
sql = "update budget_alloc_det " +
"set alloc_amt_po = alloc_amt_po + "+amount+" ," +
"req_amt = req_amt - "+indAmount+" " +
......@@ -9590,7 +9937,19 @@ public class FinCommon
"and anal_code = '"+analCode+"'";
System.out.println("SQL :"+sql);
updCnt = stmt.executeUpdate(sql);
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:updateBudget()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}else{
try{ //poonam
sql = "update budget_alloc_det " +
"set req_amt = req_amt + "+amount+" " +
"where tran_id = '"+tranIdAlloc+"' " +
......@@ -9600,6 +9959,16 @@ public class FinCommon
System.out.println("SQL :"+sql);
updCnt = stmt.executeUpdate(sql);
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:updateBudget()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}
if(updCnt <= 0){
errString = itmDBAccessEJB.getErrorString("","VTACCTBUD","","",conn);
break;
......@@ -9661,6 +10030,7 @@ public class FinCommon
}else{
reqPo = 0;
}
try{ //poonam
sql = "update budget_alloc_det set consume_amt = consume_amt + "+amount+"," +
"alloc_amt_po = alloc_amt_po - "+reqPo+" " +
"where tran_id = '"+tranIdAlloc+"' " +
......@@ -9669,8 +10039,21 @@ public class FinCommon
"and anal_code = '"+analCode+"'";
System.out.println("SQL :"+sql);
updCount = stmt.executeUpdate(sql);
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:updateBudget()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}else{
if(tranType.equalsIgnoreCase("PORD")){
try{ //poonam
sql = "update budget_alloc_det " +
"set alloc_amt_po = alloc_amt_po + "+amount+", " +
"req_amt = req_amt - "+indAmount+" " +
......@@ -9680,7 +10063,19 @@ public class FinCommon
"and anal_code = '"+analCode+"'";
System.out.println("SQL :"+sql);
updCount = stmt.executeUpdate(sql);
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:updateBudget()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}else{
try { //poonam
sql = "update budget_alloc_det " +
"set req_amt = req_amt + "+amount+" " +
"where tran_id = '"+tranIdAlloc+"' " +
......@@ -9690,6 +10085,17 @@ public class FinCommon
System.out.println("SQL :"+sql);
updCount = stmt.executeUpdate(sql);
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:updateBudget()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}
}
if(updCount <=0){
errString = itmDBAccessEJB.getErrorString("","VTACCTBUD","","",conn);
......@@ -9729,6 +10135,7 @@ public class FinCommon
if(budgetCode != null && budgetCode.trim().length() > 0){
if(updType.equalsIgnoreCase("C") ){
if(tranType.equalsIgnoreCase("PORD")){
try{ //poonam
sql = "update acctbudget " +
"set dir_req_amt = dir_req_amt + "+indAmount+" ," +
"alloc_amt_po = alloc_amt_po - "+amount+" " +
......@@ -9741,12 +10148,24 @@ public class FinCommon
System.out.println("SQL :"+sql);
pstmt = conn.prepareStatement(sql);
pstmt.executeUpdate();
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:updateBudget()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}else{
if((tranType.equalsIgnoreCase("VOUCH") && acctEff.equalsIgnoreCase("N")) || (tranType.equalsIgnoreCase("P-RCP") && acctEff.equalsIgnoreCase("Y"))){
reqPo = amount;
}else{
reqPo = 0;
}
try { //poonam
sql = "update acctbudget " +
"set con_amt = con_amt + "+amount+" ," +
"alloc_amt_po = alloc_amt_po - "+reqPo+" , " +
......@@ -9762,9 +10181,21 @@ public class FinCommon
pstmt.setTimestamp(2,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.executeUpdate();
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:updateBudget()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}
}else{
if(tranType.equalsIgnoreCase("PORD")){
if(indAmount > 0){
try{ //poonam
sql = "update acctbudget " +
"set dir_req_amt = dir_req_amt - "+indAmount+" ," +
"alloc_amt_po = alloc_amt_po + "+amount+" " +
......@@ -9778,8 +10209,19 @@ public class FinCommon
pstmt.setTimestamp(1,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setTimestamp(2,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.executeUpdate();
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:updateBudget()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}else{
try{ //poonam
sql = "update acctbudget " +
"set alloc_amt_po = alloc_amt_po + "+amount+" " +
"where from_date <= ? and to_date >= ? " +
......@@ -9793,7 +10235,18 @@ public class FinCommon
pstmt.setTimestamp(2,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.executeUpdate();
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:updateBudget()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}
}else{
try{ //poonam
sql = "update acctbudget " +
"set dir_req_amt = dir_req_amt + "+amount+" " +
"where from_date <= ? and to_date >= ? " +
......@@ -9807,6 +10260,16 @@ public class FinCommon
pstmt.setTimestamp(2,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.executeUpdate();
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:updateBudget()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}
}
}
}
......@@ -9986,7 +10449,7 @@ public class FinCommon
{
Statement stmt = null;
ResultSet rs = null;
double drAmt = 0,crAmt = 0,exch = 0;
double drAmt = 0,crAmt = 0;
double totDrAmt = 0,totCrAmt = 0,diffAmt = 0;
String sql = "",errString = "",postOnLine = "",acct = "",cctr = "";
ITMDBAccessEJB itmDBAccessEJB = null;
......@@ -10297,6 +10760,7 @@ public class FinCommon
stmtTemp.close();
//amountBc = gf_get_rndamt(lc_amount_bc, ls_rndto, lc_rndoff)
try{ //poonam
sqlTemp = "INSERT INTO BANKTRAN_LOG "
+" (TRAN_ID, BANK_CODE, TRAN_DATE, TRAN_SER, TRAN_NO, REF_NO, REF_DATE, "
+" REF_MODE, AMOUNT, TRAN_TYPE, SITE_CODE, ACCT_CODE, CCTR_CODE, SUNDRY_TYPE, "
......@@ -10334,6 +10798,17 @@ public class FinCommon
//errString = validator.getErrorString("TRAN_ID",errCode,chgUser);//errCode
errString = itmDBAccessEJB.getErrorString("TRAN_ID",errCode,chgUser,"",conn);
}
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:bankTranLogUpdate()[Excuting Query Failed]" + sqlTemp +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
break;
}
while (true);
......@@ -11352,9 +11827,9 @@ public class FinCommon
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
String errString = "" ;
//String errString = "" ;
// GenericUtility genericUtility = null;
ITMDBAccessEJB itmDBAccessEJB = null;
//ITMDBAccessEJB itmDBAccessEJB = itmDBAccessEJB = new ITMDBAccessEJB();;
java.sql.Timestamp docRefDt = null;
String docRefNo="",returns ="",refDt ="";
......@@ -11366,7 +11841,7 @@ public class FinCommon
{
// genericUtility = new GenericUtility();
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
itmDBAccessEJB = new ITMDBAccessEJB();
refSerSub = refSer.substring(0,5);
......@@ -11598,6 +12073,7 @@ public class FinCommon
payblsTranID = tg.generateTranSeqID("PAYL", "tran_id", keyStr, conn);
System.out.println("Transaction Id Generated for Payables :"+payblsTranID);
try{ //poonam
sql = "INSERT INTO MISC_PAYABLES (TRAN_ID,TRAN_SER,TRAN_DATE,REF_NO,REF_DATE,CURR_CODE,EXCH_RATE,"
+ "SUNDRY_TYPE,SUNDRY_CODE,ACCT_CODE,CCTR_CODE,DUE_DATE,FIN_ENTITY,SITE_CODE,BILL_NO,BILL_DATE,"
+ "TOT_AMT,ADJ_AMT,STATUS,STATUS_DATE,BANK_CODE,AUTO_PAY,PAY_MODE,PAID,ADV_AMT,HOLD_AMT,"
......@@ -11642,6 +12118,17 @@ public class FinCommon
return errString;
}
pstmt.close();pstmt = null;
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:gbfMiscPayUpd()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}// end of try
catch(Exception e)
{
......@@ -11678,20 +12165,20 @@ public class FinCommon
ResultSet rs = null;
String sql = "",errString = "";
// GenericUtility genericUtility = null;
ITMDBAccessEJB itmDBAccessEJB = null;
FinCommon Fcommon = new FinCommon();
//ITMDBAccessEJB itmDBAccessEJB = null;
//FinCommon Fcommon = new FinCommon();
// genericUtility = new GenericUtility();
String siteCode= null,finEntity= null,currCode= null,acctCode= null,cctrCode= null;
String refNo= null,custCode= null,crTerm= null,itemSer= null,finScheme= null;
String salesPers= null,salesPers1= null,salesPers2= null,contactCode= null,saleOrder= null;
String status= null,refSerOrg= null,tranSer= null,auotRcp= null,bankCode= null;
String refSerOrg= null,tranSer= null,bankCode= null;
String refType= null,autoRcp= null,lineNoRef= null;
String gpNo= null,gpDate= null,custRefNo= null,custRefDate= null,custRefAmt= null;
String keyString = null,recvTranID = null;
String reasCode=null;
double totAmt=0,diffAmt=0,adjAmt=0,taxAmt=0,exchRate=0,discount=0,mrpValue=0;
double totAmt=0,taxAmt=0,exchRate=0,discount=0,mrpValue=0;
java.sql.Timestamp dueDate = null;
java.sql.Timestamp tranDate = null;
......@@ -11786,6 +12273,7 @@ public class FinCommon
recvTranID = tg.generateTranSeqID("RCVL","tran_id",keyString,conn);
System.out.println("Transaction Id Generated for Receivables :"+recvTranID);
try{ //poonam
sql =" INSERT INTO RECEIVABLES (TRAN_ID,TRAN_SER,TRAN_DATE,REF_NO,REF_DATE,CURR_CODE,EXCH_RATE,"
+" CUST_CODE,ACCT_CODE,CCTR_CODE,DUE_DATE,FIN_ENTITY,SITE_CODE,TOT_AMT,ADJ_AMT,STATUS, "
+" STAT_DATE,DISCOUNT,TAX_AMT,AUTO_RCP,BANK_CODE,RECD,REF_TYPE,CR_TERM,SALES_PERS,ITEM_SER, "
......@@ -11845,6 +12333,17 @@ public class FinCommon
}
pstmt.close();
pstmt =null;
}
catch(SQLException se)//Added by poonam on 28-07-16 for exception handling:Start
{
System.out.println("SQLException []:gbfReceivablesUpd()[Excuting Query Failed]" + sql +se.getMessage());
se.printStackTrace();
errString = se.getMessage();
return errString ;
}
//Added by poonam on 28-07-16 for exception handling:End
}
catch(SQLException e)
......@@ -11905,7 +12404,7 @@ public String nfCheckPeriod(String modCode, java.util.Date tranDate , String sit
Statement stmtPeriod = null;
String dtFormat=""; //$NON-NLS-1$
java.text.SimpleDateFormat dtf=null;
java.util.Date currDate =null;
//java.util.Date currDate =null;
String dateString = ""; //$NON-NLS-1$
PreparedStatement pstmt = null;
// System.out.println("modCode:"+modCode+"tranDate:"+tranDate+"\nsiteCode"+siteCode);
......@@ -12378,7 +12877,7 @@ public String nfCheckPeriod(String modCode, java.util.Date tranDate , String sit
}
rs23.close();
stmt23.close();
if (errCode == null && errCode.length() == 0)
if (errCode == null || errCode.length() == 0)
{
sql24 = "SELECT BLACK_LISTED FROM CUSTOMER WHERE CUST_CODE = '" + custCode + "'"; //$NON-NLS-1$ //$NON-NLS-2$
stmt24 = conn.createStatement();
......
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