Commit 08615ea5 authored by bpandey's avatar bpandey

Remove To_date from sql and set value in timestamp,


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99873 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f319056f
......@@ -65,6 +65,9 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
rowData = new JSONObject();
SimpleDateFormat gridDateFormat = new SimpleDateFormat( "dd-MMM-yy");
convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals("")))
......@@ -91,11 +94,13 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
&& (toDateInTs!=null && toDateInTs.toString().length()>0)
&& (empCode!=null && empCode.trim().length()>0) )
{
sql = "select count(1) opening_request from ser_request where req_date < ? and emp_code__assign = ? and comp_stat <> 'C'";
sql = "select count(1) opening_request from ser_request where req_date < ? and emp_code__assign = ? and (comp_stat <> 'C' or comp_stat_dt>=?)";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
// pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(2, empCode);
/*Add for comp_stat_dt as a from date as per manohar sir by Dhanendra on 12-01-2016*/
pstmt.setTimestamp(3, frmDateInTs);
/*End for comp_stat_dt as a from date as per manohar sir by Dhanendra on 12-01-2016*/
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -229,7 +234,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
sql = " select sum(no_request) as no_req from (select count(1) as no_request from ser_request where " +
//" req_date between ? and ? " +// commented by swati 05 Dec 2016
" req_date < ? "+ // added by swati 05 Dec 2016
"and emp_code__assign = ? and comp_stat <> 'C' union all select count(1) " +
"and emp_code__assign = ? and (comp_stat <> 'C' or comp_stat_dt>=?) union all select count(1) " +
" from ser_request where " +
"req_date between ? and ? " +
//" req_date < ? "+// added by swati 05 Dec 2016
......@@ -241,12 +246,15 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
pstmt.setTimestamp(1, frmDateInTs);
//pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(2, empCode);
/*Add for comp_stat_dt as a from date as per manohar sir by Dhanendra on 12-01-2016*/
pstmt.setTimestamp(3, frmDateInTs);
pstmt.setTimestamp(4, toDateInTs);
pstmt.setString(5, empCode);
pstmt.setTimestamp(6, frmDateInTs);
pstmt.setTimestamp(7, toDateInTs);
pstmt.setString(8,empCode);
/*End for comp_stat_dt as a from date as per manohar sir by Dhanendra on 12-01-2016*/
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setTimestamp(5, toDateInTs);
pstmt.setString(6, empCode);
pstmt.setTimestamp(7, frmDateInTs);
pstmt.setTimestamp(8, toDateInTs);
pstmt.setString(9,empCode);
rs = pstmt.executeQuery();
......@@ -354,11 +362,14 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
&& (toDateInTs!=null && toDateInTs.toString().length()>0)
&& (empCode!=null && empCode.trim().length()>0) )
{
sql = "select count(1) opening_request from ser_request where req_date < ? and emp_code__assign = ? and comp_stat <> 'C'";
/*Add or condition by Dhanendra as per manohar sir on 12-01-16*/
sql = "select count(1) opening_request from ser_request where req_date < ? and emp_code__assign = ? and (comp_stat <> 'C' or comp_stat_dt>=?)";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
//pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(2, empCode);
/*Add for comp_stat_dt as a from date as per manohar sir by Dhanendra on 12-01-2016*/
pstmt.setTimestamp(3, frmDateInTs);
/*End for comp_stat_dt as a from date as per manohar sir by Dhanendra on 12-01-2016*/
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -518,7 +529,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
sql = " select sum(no_request) as no_req from (select count(1) as no_request from ser_request where " +
//" req_date between ? and ? " +// commented by swati 05 Dec 2016
" req_date < ? "+ // added by swati 05 Dec 2016
"and emp_code__assign = ? and comp_stat <> 'C' union all select count(1) " +
"and emp_code__assign = ? and (comp_stat <> 'C' or comp_stat_dt>=?) union all select count(1) " +
" from ser_request where " +
"req_date between ? and ? " +
//" req_date < ? "+// added by swati 05 Dec 2016
......@@ -529,12 +540,15 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
pstmt.setTimestamp(1, frmDateInTs);
//pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(2, empCode);
pstmt.setTimestamp(3, frmDateInTs);
pstmt.setTimestamp(4, toDateInTs);
pstmt.setString(5, empCode);
pstmt.setTimestamp(6, frmDateInTs);
pstmt.setTimestamp(7, toDateInTs);
pstmt.setString(8,empCode);
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setTimestamp(5, toDateInTs);
pstmt.setString(6, empCode);
pstmt.setTimestamp(7, frmDateInTs);
pstmt.setTimestamp(8, toDateInTs);
pstmt.setString(9,empCode);
rs = pstmt.executeQuery();
......@@ -634,11 +648,10 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
}
else
{
//comment date
//simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
frmDateInTs = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(fromDate)).toString() + " 00:00:00.0");
toDateInTs = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(toDate)).toString() + " 00:00:00.0");
dateInpute =" and to_date(h.TRAN_DATE) >= ? AND TO_DATE(H.TRAN_DATE) <= ?";
dateInpute =" and h.TRAN_DATE >= ? AND h.TRAN_DATE <= ?;
}
if( (empCode!=null && empCode.trim().length()>0) )
......@@ -671,15 +684,17 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
+" where d.action_id = h.action_id "
+" and r.req_id = h.req_id "
+" AND R.CUST_CODE = C.CUST_CODE "
+" AND ((d.emp_code in (select emp_code FROM EMPLOYEE START WITH EMP_CODE = "+empCode+" "
+" AND ((d.emp_code in (select emp_code FROM EMPLOYEE START WITH EMP_CODE = '"+empCode+"' "
+" CONNECT BY PRIOR EMP_CODE = REPORT_TO AND REPORT_TO IS NOT NULL "
+" AND ( RELIEVE_DATE IS NULL OR RELIEVE_DATE >= SYSDATE ))) OR (d.emp_code="+empCode+")) "
+" AND ( RELIEVE_DATE IS NULL OR RELIEVE_DATE >= SYSDATE ))) OR (d.emp_code='"+empCode+"')) "
+ dateInpute
+" group by d.emp_code, r.req_id, c.cust_code, c.cust_name, r.dtl_descr,d.STD_TIME,d.ACTION_DETL "
+" ) i, employee e WHERE I.EMP_CODE = E.EMP_CODE "
+" GROUP BY E.EMP_FNAME || ' ' || E.EMP_LNAME,I.REQ_ID, I.DTL_DESCR,I.CUST_CODE, I.CUST_NAME, "
+" I.PLAN_START_DATE,I.ACT_START_DATE, I.PLAN_END_DATE,i.STD_TIME,i.ACTION_DETL "
+" ORDER BY I.PLAN_END_DATE asc ";
pstmt = conn.prepareStatement(sql);
if(dateInpute.trim().length()>0)
{
......@@ -1114,14 +1129,15 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
+" from ser_req_feedbkdtl a, ser_req_feedbk b, employee c, ser_request "
+" where a.feedbk_id = b.feedbk_id and a.req_id = ser_request.req_id "
+" AND B.EMP_CODE = C.EMP_CODE "
+" AND TO_DATE( B.EXECUT_DT, 'DD/MM/YY' ) >= TO_DATE (?, 'DD/MM/YY') "
+" AND TO_DATE( B.EXECUT_DT, 'DD/MM/YY' ) < TO_DATE(?, 'DD/MM/YY') "
+" AND B.EXECUT_DT >= ? "
+" AND B.EXECUT_DT < ? "
+" and ((c.emp_code in ( select EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = ? CONNECT BY PRIOR EMP_CODE = REPORT_TO "
+" AND REPORT_TO IS NOT NULL AND ( RELIEVE_DATE IS NULL OR RELIEVE_DATE >= SYSDATE ) ))OR (c.emp_code = ? ) ) "
+" order by emp_name,b.execut_dt ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,fromDate);
pstmt.setString(2,toDate);
pstmt.setTimestamp(1, fromDateInTS);
pstmt.setTimestamp(2, toDateInTS);
pstmt.setString(3,empCode);
pstmt.setString(4,empCode);
//pstmt.setTimestamp(2,toDateInTS);
......
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