Commit 3ea6576b authored by pchavan's avatar pchavan

In updateBudget() variables to be checked for null and space to be assigned...

In updateBudget() variables to be checked for null and space to be assigned also bind the variable in prepared statement.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@208107 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 387f79cc
......@@ -12598,13 +12598,39 @@ public class FinCommon
}
indAmount = Double.parseDouble(indAmtStr);
analCode = genericUtility.getColumnValueFromNode("anal_code",detailNode);
if(deptCode == null || deptCode.trim().length() == 0){
deptCode = " ";
// Changed By PriyankaC on 23Sep2019.[START]
if(deptCode == null || deptCode.trim().length() == 0 || "null".equals(deptCode))
{
deptCode = " ";
}
if(analCode == null || analCode.trim().length() == 0 || "null".equals(analCode))
{
analCode = " ";
}
if(projCode == null || projCode.trim().length() == 0 || "null".equals(projCode))
{
projCode = " ";
}
if(siteCode == null || siteCode.trim().length() == 0 || "null".equals(siteCode))
{
siteCode = " ";
}
if(acctCode == null || acctCode.trim().length() == 0 || "null".equals(acctCode))
{
deptCode = " ";
}
if(cctrCode == null || cctrCode.trim().length() == 0 || "null".equals(cctrCode))
{
cctrCode = " ";
}
// Changed By PriyankaC on 23Sep2019.[END]
try
{ //added by poonam
{
//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)," +
......@@ -12615,16 +12641,21 @@ public class FinCommon
"check_type,a.alloc_amt_po " +
"from acctbudget a, budgets b " +
"where a.budget_id = b.budget_id "+
"and a.from_date <= ? and a.to_date >= ? and a.site_code = '"+siteCode+"' "+
"and a.acct_code = '"+acctCode+"' and a.cctr_code = '"+cctrCode+"' " +
"and a.from_date <= ? and a.to_date >= ? and a.site_code = ? "+
"and a.acct_code = ? and a.cctr_code = ? " +
"and b.def_budget = 'Y' "+
"and a.dept_code = '"+deptCode+"' "+
"and a.anal_code = '"+analCode+"' ";
"and a.dept_code = ? "+
"and a.anal_code = ? ";
System.out.println("SQL :"+sql);
pstmt = conn.prepareStatement(sql);
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.setString(3,siteCode);
pstmt.setString(4,acctCode);
pstmt.setString(5,cctrCode);
pstmt.setString(6,deptCode);
pstmt.setString(7,analCode);
rs = pstmt.executeQuery();
if(rs.next()){
......@@ -12666,17 +12697,24 @@ public class FinCommon
"case when round(b.alloc_amt_po * a.exch_rate,3) is null then 0 else round(b.alloc_amt_po * a.exch_rate,3) end "+
"from budget_alloc a, budget_alloc_det b "+
"where a.tran_id = b.tran_id "+
"and a.site_code = '"+siteCode+"' and a.budget_id = '"+budgetCode+"' "+
"and a.proj_code = '"+projCode+"' "+
"and a.site_code = ? and a.budget_id = ? "+
"and a.proj_code = ? "+
"and a.fr_date <= ? and a.to_date >= ? "+
"and b.acct_code = '"+acctCode+"' and b.cctr_code = '"+cctrCode+"' "+
"and b.anal_code = '"+analCode+"' "+
"and b.acct_code = ? and b.cctr_code = ? "+
"and b.anal_code = ? "+
"and (case when a.confirmed is null then 'N' else a.confirmed end = 'Y')";
System.out.println("SQL :"+sql);
pstmt = conn.prepareStatement(sql);
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.setString(1,siteCode);
pstmt.setString(2,budgetCode);
pstmt.setString(3,projCode);
pstmt.setTimestamp(4,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setTimestamp(5,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setString(6,acctCode);
pstmt.setString(7,cctrCode);
pstmt.setString(8,analCode);
rs = pstmt.executeQuery();
if(rs.next()){
......@@ -12718,16 +12756,24 @@ public class FinCommon
try{ //poonam
sql = "update budget_alloc_det " +
"set consume_amt = consume_amt + "+amount+" ," +
"req_amt = req_amt - "+indAmount+" ," +
"alloc_amt_po = alloc_amt_po - "+reqPo+" " +
"where tran_id = '"+tranIdAlloc+"' " +
"and acct_code = '"+acctCode+"' " +
"and cctr_code = '"+cctrCode+"' " +
"and anal_code = '"+analCode+"'";
"set consume_amt = consume_amt + ? ," +
"req_amt = req_amt - ? ," +
"alloc_amt_po = alloc_amt_po - ? " +
"where tran_id = ? " +
"and acct_code = ? " +
"and cctr_code = ? " +
"and anal_code = ? ";
System.out.println("SQL :"+sql);
//updCnt = stmt.executeUpdate(sql);
pstmt1=conn.prepareStatement(sql);
pstmt1.setDouble(1,amount);
pstmt1.setDouble(2,indAmount);
pstmt1.setDouble(3,reqPo);
pstmt1.setString(4,tranIdAlloc);
pstmt1.setString(5,acctCode);
pstmt1.setString(6,cctrCode);
pstmt1.setString(7,analCode);
updCnt=pstmt1.executeUpdate();
pstmt1.close();pstmt1=null;
}
......@@ -12750,15 +12796,22 @@ public class FinCommon
try{ //poonam
sql = "update budget_alloc_det " +
"set alloc_amt_po = alloc_amt_po + "+amount+" ," +
"req_amt = req_amt - "+indAmount+" " +
"where tran_id = '"+tranIdAlloc+"' " +
"and acct_code = '"+acctCode+"' " +
"and cctr_code = '"+cctrCode+"' " +
"and anal_code = '"+analCode+"'";
"set alloc_amt_po = alloc_amt_po + ? ," +
"req_amt = req_amt - ? " +
"where tran_id = ? " +
"and acct_code = ? " +
"and cctr_code = ? " +
"and anal_code = ? ";
System.out.println("SQL :"+sql);
//updCnt = stmt.executeUpdate(sql);
pstmt1=conn.prepareStatement(sql);
pstmt1.setDouble(1,amount);
pstmt1.setDouble(2,indAmount);
pstmt1.setString(3,tranIdAlloc);
pstmt1.setString(4,acctCode);
pstmt1.setString(5,cctrCode);
pstmt1.setString(6,analCode);
updCnt=pstmt1.executeUpdate();
pstmt1.close();pstmt1=null;
}
......@@ -12778,14 +12831,19 @@ public class FinCommon
}else{
try{ //poonam
sql = "update budget_alloc_det " +
"set req_amt = req_amt + "+amount+" " +
"where tran_id = '"+tranIdAlloc+"' " +
"and acct_code = '"+acctCode+"' " +
"and cctr_code = '"+cctrCode+"' " +
"and anal_code = '"+analCode+"'";
"set req_amt = req_amt + ? " +
"where tran_id = ? " +
"and acct_code = ? " +
"and cctr_code = ? " +
"and anal_code = ? ";
System.out.println("SQL :"+sql);
//updCnt = stmt.executeUpdate(sql);
pstmt1=conn.prepareStatement(sql);
pstmt1.setDouble(1,amount);
pstmt1.setString(2,tranIdAlloc);
pstmt1.setString(3,acctCode);
pstmt1.setString(4,cctrCode);
pstmt1.setString(5,analCode);
updCnt=pstmt1.executeUpdate();
pstmt1.close();pstmt1=null;
}
......@@ -12830,19 +12888,23 @@ public class FinCommon
"round(b.alloc_amt_po * a.exch_rate,3) "+
"from budget_alloc a, budget_alloc_det b "+
"where a.tran_id = b.tran_id "+
"and a.site_code = '"+siteCode+"' "+
"and a.proj_code = '"+projCode+"' "+
"and a.site_code = ? "+
"and a.proj_code = ? "+
"and a.fr_date <= ? and a.to_date >= ? " +
"and b.acct_code = '"+acctCode+"' "+
"and b.cctr_code = '"+cctrCode+"' "+
"and b.anal_code = '"+analCode+"' " +
"and b.acct_code = ? "+
"and b.cctr_code = ? "+
"and b.anal_code = ? " +
"and (case when a.confirmed is null then 'N' else a.confirmed end = 'Y') "+
"and (a.budget_id is null or a.budget_id = '')";
System.out.println("SQL :"+sql);
pstmt = conn.prepareStatement(sql);
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.setString(1,siteCode);
pstmt.setString(2,projCode);
pstmt.setTimestamp(3,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setTimestamp(4,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setString(5,acctCode);
pstmt.setString(6,cctrCode);
pstmt.setString(7,analCode);
rs = pstmt.executeQuery();
if(rs.next()){
tranIdAlloc = rs.getString(1);
......@@ -12875,15 +12937,22 @@ public class FinCommon
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+"' " +
"and acct_code = '"+acctCode+"' " +
"and cctr_code = '"+cctrCode+"' " +
"and anal_code = '"+analCode+"'";
sql = "update budget_alloc_det set consume_amt = consume_amt + ? ," +
"alloc_amt_po = alloc_amt_po - ? " +
"where tran_id = ? " +
"and acct_code = ? " +
"and cctr_code = ? " +
"and anal_code = ? ";
System.out.println("SQL :"+sql);
//updCount = stmt.executeUpdate(sql);
pstmt1=conn.prepareStatement(sql);
pstmt1.setDouble(1,amount);
pstmt1.setDouble(2,reqPo);
pstmt1.setString(3,tranIdAlloc);
pstmt1.setString(4,acctCode);
pstmt1.setString(5,cctrCode);
pstmt1.setString(6,analCode);
updCount=pstmt1.executeUpdate();
pstmt1.close();pstmt1=null;
}
......@@ -12905,15 +12974,21 @@ public class FinCommon
try{ //poonam
sql = "update budget_alloc_det " +
"set alloc_amt_po = alloc_amt_po + "+amount+", " +
"req_amt = req_amt - "+indAmount+" " +
"where tran_id = '"+tranIdAlloc+"' " +
"and acct_code = '"+acctCode+"' " +
"and cctr_code = '"+cctrCode+"' " +
"and anal_code = '"+analCode+"'";
"set alloc_amt_po = alloc_amt_po + ? , " +
"req_amt = req_amt - ? " +
"where tran_id = ? " +
"and acct_code = ? " +
"and cctr_code = ? " +
"and anal_code = ? ";
System.out.println("SQL :"+sql);
//updCount = stmt.executeUpdate(sql);
pstmt1=conn.prepareStatement(sql);
pstmt1.setDouble(1,amount);
pstmt1.setDouble(2,indAmount);
pstmt1.setString(3,tranIdAlloc);
pstmt1.setString(4,acctCode);
pstmt1.setString(5,cctrCode);
pstmt1.setString(6,analCode);
updCount=pstmt1.executeUpdate();
pstmt1.close();pstmt1=null;
}
......@@ -12933,14 +13008,19 @@ public class FinCommon
}else{
try { //poonam
sql = "update budget_alloc_det " +
"set req_amt = req_amt + "+amount+" " +
"where tran_id = '"+tranIdAlloc+"' " +
"and acct_code = '"+acctCode+"' " +
"and cctr_code = '"+cctrCode+"' " +
"and anal_code = '"+analCode+"'";
"set req_amt = req_amt + ? " +
"where tran_id = ? " +
"and acct_code = ? " +
"and cctr_code = ? " +
"and anal_code = ? ";
System.out.println("SQL :"+sql);
//updCount = stmt.executeUpdate(sql);
pstmt1=conn.prepareStatement(sql);
pstmt1.setDouble(1,amount);
pstmt1.setString(2,tranIdAlloc);
pstmt1.setString(3,acctCode);
pstmt1.setString(4,cctrCode);
pstmt1.setString(5,analCode);
updCount=pstmt1.executeUpdate();
pstmt1.close();pstmt1=null;
}
......@@ -13010,16 +13090,27 @@ public class FinCommon
if(tranType.equalsIgnoreCase("PORD")){
try{ //poonam
sql = "update acctbudget " +
"set dir_req_amt = dir_req_amt + "+indAmount+" ," +
"alloc_amt_po = alloc_amt_po - "+amount+" " +
"set dir_req_amt = dir_req_amt + ? ," +
"alloc_amt_po = alloc_amt_po - ? " +
"where from_date <= ? and to_date >= ? " +
"and site_code = '"+siteCode+"' " +
"and acct_code = '"+acctCode+"' " +
"and cctr_code = '"+cctrCode+"' " +
"and dept_code = '"+deptCode+"' " +
"and anal_code = '"+analCode+"'";
"and site_code = ? " +
"and acct_code = ? " +
"and cctr_code = ? " +
"and dept_code = ? " +
"and anal_code = ? ";
System.out.println("SQL :"+sql);
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1,indAmount);
pstmt.setDouble(2,amount);
pstmt.setTimestamp(3,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setTimestamp(4,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setString(5,siteCode);
pstmt.setString(6,acctCode);
pstmt.setString(7,cctrCode);
pstmt.setString(8,deptCode);
pstmt.setString(9,analCode);
pstmt.executeUpdate();
//Added by Varsha V for closing resultset on 19-04-2018
if(pstmt != null)
......@@ -13049,18 +13140,26 @@ public class FinCommon
}
try { //poonam
sql = "update acctbudget " +
"set con_amt = con_amt + "+amount+" ," +
"alloc_amt_po = alloc_amt_po - "+reqPo+" , " +
"dir_req_amt = dir_req_amt - "+indAmount+" " +
"set con_amt = con_amt + ? ," +
"alloc_amt_po = alloc_amt_po - ? , " +
"dir_req_amt = dir_req_amt - ? " +
"where from_date <= ? and to_date >= ? " +
"and site_code = '"+siteCode+"' and acct_code = '"+acctCode+"' " +
"and cctr_code = '"+cctrCode+"' and dept_code = '"+deptCode+"' " +
"and anal_code = '"+analCode+"'";
"and site_code = ? and acct_code = ? " +
"and cctr_code = ? and dept_code = ? " +
"and anal_code = ? ";
System.out.println("SQL :"+sql);
pstmt = conn.prepareStatement(sql);
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.setDouble(1,amount);
pstmt.setDouble(2,reqPo);
pstmt.setDouble(3,indAmount);
pstmt.setTimestamp(4,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setTimestamp(5,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setString(6,siteCode);
pstmt.setString(7,acctCode);
pstmt.setString(8,cctrCode);
pstmt.setString(9,deptCode);
pstmt.setString(10,analCode);
pstmt.executeUpdate();
//Added by Varsha V for closing resultset on 19-04-2018
if(pstmt != null)
......@@ -13086,19 +13185,27 @@ public class FinCommon
}else{
if(tranType.equalsIgnoreCase("PORD")){
if(indAmount > 0){
try{ //poonam
try{
//poonam
sql = "update acctbudget " +
"set dir_req_amt = dir_req_amt - "+indAmount+" ," +
"alloc_amt_po = alloc_amt_po + "+amount+" " +
"set dir_req_amt = dir_req_amt - ? ," +
"alloc_amt_po = alloc_amt_po + ? " +
"where from_date <= ? and to_date >= ? " +
"and site_code = '"+siteCode+"' and acct_code = '"+acctCode+"' " +
"and cctr_code = '"+cctrCode+"' and dept_code = '"+deptCode+"' " +
"and anal_code = '"+analCode+"'";
"and site_code = ? and acct_code = ? " +
"and cctr_code = ? and dept_code = ? " +
"and anal_code = ? ";
System.out.println("SQL :"+sql);
pstmt = conn.prepareStatement(sql);
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.setDouble(1,indAmount);
pstmt.setDouble(2,amount);
pstmt.setTimestamp(3,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setTimestamp(4,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setString(5,siteCode);
pstmt.setString(6,acctCode);
pstmt.setString(7,cctrCode);
pstmt.setString(8,deptCode);
pstmt.setString(9,analCode);
pstmt.executeUpdate();
//Added by Varsha V for closing resultset on 19-04-2018
if(pstmt != null)
......@@ -13123,16 +13230,22 @@ public class FinCommon
}else{
try{ //poonam
sql = "update acctbudget " +
"set alloc_amt_po = alloc_amt_po + "+amount+" " +
"set alloc_amt_po = alloc_amt_po + ? " +
"where from_date <= ? and to_date >= ? " +
"and site_code = '"+siteCode+"' and acct_code = '"+acctCode+"' " +
"and cctr_code = '"+cctrCode+"' and dept_code = '"+deptCode+"' " +
"and anal_code = '"+analCode+"'";
"and site_code = ? and acct_code = ? " +
"and cctr_code = ? and dept_code = ? " +
"and anal_code = ? ";
System.out.println("SQL :"+sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setDouble(1,amount);
pstmt.setTimestamp(2,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setTimestamp(3,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setString(4,siteCode);
pstmt.setString(5,acctCode);
pstmt.setString(6,cctrCode);
pstmt.setString(7,deptCode);
pstmt.setString(8,analCode);
pstmt.executeUpdate();
//Added by Varsha V for closing resultset on 19-04-2018
if(pstmt != null)
......@@ -13157,16 +13270,22 @@ public class FinCommon
}else{
try{ //poonam
sql = "update acctbudget " +
"set dir_req_amt = dir_req_amt + "+amount+" " +
"set dir_req_amt = dir_req_amt + ? " +
"where from_date <= ? and to_date >= ? " +
"and site_code = '"+siteCode+"' and acct_code = '"+acctCode+"' " +
"and cctr_code = '"+cctrCode+"' and dept_code = '"+deptCode+"' " +
"and anal_code = '"+analCode+"'" ;
"and site_code = ? and acct_code = ? " +
"and cctr_code = ? and dept_code = ? " +
"and anal_code = ? " ;
System.out.println("SQL :"+sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setDouble(1,amount);
pstmt.setTimestamp(2,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setTimestamp(3,Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmt.setString(4,siteCode);
pstmt.setString(5,acctCode);
pstmt.setString(6,cctrCode);
pstmt.setString(7,deptCode);
pstmt.setString(8,analCode);
pstmt.executeUpdate();
//Added by Varsha V for closing resultset on 19-04-2018
if(pstmt != null)
......
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