Commit e50f73a1 authored by kshinde's avatar kshinde

Bug fix in getProject

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@196762 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7227ec9d
...@@ -11729,48 +11729,63 @@ public class FinCommon ...@@ -11729,48 +11729,63 @@ public class FinCommon
ResultSet rs = null; ResultSet rs = null;
String sql = "",projectCode = "",tname=""; String sql = "",projectCode = "",tname="";
try{ try{
//stmt = conn.createStatement(); Statement stmt = null;
if(refSer.equalsIgnoreCase("JOUR")){ PreparedStatement pstmt = null;
sql = "select proj_code from journal where tran_id = '"+refId+"'"; ResultSet rs = null;
tname = "journal"; String sql = "",projectCode = "",tname="";
} try{
if(refSer.equalsIgnoreCase("E-PAY")){ //stmt = conn.createStatement();
//sql = "select proj_code from payment_exp where tran_id = '"+refId+"'"; if(refSer.equalsIgnoreCase("JOUR")){
tname = "payment_exp"; sql = "select proj_code from journal where tran_id = '"+refId+"'";
} //tname = "journal";
if(refSer.equalsIgnoreCase("M-VOUC")){
//sql = "select proj_code from misc_voucher where tran_id = '"+refId+"'";
tname = "misc_voucher";
}
if(refSer.equalsIgnoreCase("VOUCH")){
//sql = "select proj_code from voucher where tran_id = '"+refId+"'";
tname = "voucher";
}
if(tname.trim().length() > 0){
sql = "select proj_code from '"+tname+"' where tran_id = ? ";
//rs = stmt.executeQuery(sql);
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, refId);
rs=pstmt.executeQuery();
if(rs.next()){
projectCode = rs.getString(1);
} }
if(projectCode == null){ if(refSer.equalsIgnoreCase("E-PAY")){
projectCode = ""; sql = "select proj_code from payment_exp where tran_id = '"+refId+"'";
//tname = "payment_exp";
} }
if(refSer.equalsIgnoreCase("M-VOUC")){
sql = "select proj_code from misc_voucher where tran_id = '"+refId+"'";
//tname = "misc_voucher";
}
if(refSer.equalsIgnoreCase("VOUCH")){
sql = "select proj_code from voucher where tran_id = '"+refId+"'";
//tname = "voucher";
}
if(sql.trim().length() > 0){
pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery();
if(rs.next()){
projectCode = rs.getString(1);
}
if(projectCode == null){
projectCode = "";
}
}
//Added by Varsha V for closing resultset on 19-04-2018
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}catch(Exception e){
System.out.println("Exception in getProject [Fincommon]"+e);
e.printStackTrace();
throw new ITMException(e);
} }
//Added by Varsha V for closing resultset on 19-04-2018 finally{
if(rs != null) try{
{ if(stmt != null) stmt.close();
rs.close(); if(rs != null)rs.close();
rs = null; }catch(Exception e1){}
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
} }
return projectCode;
}catch(Exception e){ }catch(Exception e){
System.out.println("Exception in getProject [Fincommon]"+e); System.out.println("Exception in getProject [Fincommon]"+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