Commit 5945641f authored by sshinde's avatar sshinde

Modify All SQL of Dashboard add Ticket Condition (Union All) in evry sql


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99983 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b384cbaf
......@@ -104,13 +104,31 @@ 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' or comp_stat_dt>=?)";
// sql = "select count(1) opening_request from ser_request where req_date < ? and emp_code__assign = ? and (comp_stat <> 'C' or comp_stat_dt>=?)";
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql=" select sum (opening_request) as opening_request from (select count(1) opening_request from ser_request " +
" where req_date < ? and emp_code__assign = ? and req_id <>'9999999999' and (comp_stat <> 'C' or " +
" comp_stat_dt >=?) and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG' union all " +
" select count(1) opening_request from service_complaint where TICKET_DATE < ? and submitted_to2 = ? " +
" and (status <> 'C' or Resolve_date1>= ?))";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
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*/
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setString(5, empCode);
/*Add for comp_stat_dt as a from date as per manohar sir by Dhanendra on 12-01-2016*/
pstmt.setTimestamp(6, frmDateInTs);
/*[END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -132,12 +150,25 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rs.close();
rs = null;
/* End Foe Opening Request * */
sql = "select count(1) as rece_dur_prd from ser_request where req_date between ? and ? and emp_code__assign = ?";
/*Receive Opening Request * */
// sql = "select count(1) as rece_dur_prd from ser_request where req_date between ? and ? and emp_code__assign = ?";
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql="select sum(rece_dur_prd) as rece_dur_prd from ( select count(1) as rece_dur_prd from ser_request where req_date between ? and ? and emp_code__assign = ? " +
" and req_id <>'9999999999' and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG' union all select count(1) as rece_dur_prd from service_complaint " +
" where ticket_date between ? and ? and submitted_to2 = ? )";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setTimestamp(5, toDateInTs);
pstmt.setString(6, empCode);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -160,12 +191,22 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rs = null;
//Promised during this period
//sql = "select count(1) as proms_dur_prd from ser_request where EXP_END_DATE between ? and ? and emp_code__assign = ?";
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql="select sum(proms_dur_prd) proms_dur_prd from ( select count(1) as proms_dur_prd from ser_request where EXP_END_DATE between ? and ? and emp_code__assign = ? and req_id <>'9999999999' " +
" and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG' union all select count(1)" +
" as proms_dur_prd from service_complaint where resolve_date1 between ? and ? and submitted_to2 = ? )" ;
sql = "select count(1) as proms_dur_prd from ser_request where EXP_END_DATE between ? and ? and emp_code__assign = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setTimestamp(5, toDateInTs);
pstmt.setString(6, empCode);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
......@@ -188,13 +229,23 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rs = null;
//--- Delivered during this period
//sql = "select count(1) as del_dur_prd from ser_request where COMP_STAT_DT between ? and ? and emp_code__assign = ? and comp_stat = 'C'";
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql = " select sum( del_dur_prd) as del_dur_prd from (select count(1) as del_dur_prd from ser_request where " +
" COMP_STAT_DT between ? and ? and emp_code__assign = ? and comp_stat = 'C' and req_id <>'9999999999' " +
" and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG' union all" +
" select count(1) as del_dur_prd from service_complaint where Resolve_date1 between ? and ? and submitted_to2 = ? " +
" and status = 'C' )";
sql = "select count(1) as del_dur_prd from ser_request where COMP_STAT_DT between ? and ? and emp_code__assign = ? and comp_stat = 'C'";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setTimestamp(5, toDateInTs);
pstmt.setString(6, empCode);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -218,10 +269,17 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
// --- Count without a promised date
sql = "select count(1) cnt_wit_prom from ser_request where emp_code__assign = ? and EXP_END_DATE is null";
//sql = "select count(1) cnt_wit_prom from ser_request where emp_code__assign = ? and EXP_END_DATE is null";
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql = "select sum(cnt_wit_prom) AS cnt_wit_prom from (select count(1) as cnt_wit_prom " +
" from ser_request where emp_code__assign = ? and EXP_END_DATE is null and req_id <>'9999999999' and " +
" comp_stat <> 'C' and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG'" +
" union all select count(1) as cnt_wit_prom from service_complaint where submitted_to2 = ? and resolve_date1 is null " +
" and status <> 'C' )";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, empCode);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
......@@ -244,23 +302,29 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rs = null;
//--- Count on which work going on
//sql = "select count(distinct r.req_id) as cnt_wrk_gng from ser_req_feedbk f, ser_request r where f.req_id = r.req_id and r.emp_code__assign = ? and f.EXECUT_DT between ? and ? ";
/*
* Added by sachin on 13-Jan-15
*/
sql = "select count(distinct r.req_id) as cnt_wrk_gng from ser_req_feedbk f, ser_request r where f.req_id = r.req_id and r.emp_code__assign = ? and f.EXECUT_DT between ? and ? and r.comp_stat <> 'C'";
// sql = "select count(distinct r.req_id) as cnt_wrk_gng from ser_req_feedbk f, ser_request r where f.req_id = r.req_id and r.emp_code__assign = ? and f.EXECUT_DT between ? and ? and r.comp_stat <> 'C'";
/*
End Added by sachin on 13-Jan-15
*/
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql = " SELECT count(DISTINCT cnt_wrk_gng) as cnt_wrk_gng FROM ( select r.req_id as cnt_wrk_gng from ser_req_feedbk f ," +
" ser_request r WHERE f.req_id = r.req_id AND r.emp_code__assign = ? AND f.EXECUT_DT BETWEEN ? AND ? AND r.comp_stat <> 'C' " +
" and r.req_id <>'9999999999' and R.req_id not like 'CO%' and lower(R.dtl_descr) like 'client sup%' AND R.ITEM_SER <>'TRG' " +
" union all select s.ticket_no as cnt_wrk_gng from ser_req_feedbk f ,service_complaint s WHERE f.ticket_no = s.ticket_no " +
" AND s.submitted_to2 = ? AND f.EXECUT_DT BETWEEN ? AND ? AND s.status <> 'C' )";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, frmDateInTs);
pstmt.setTimestamp(3, toDateInTs);
pstmt.setString(4, empCode);
pstmt.setTimestamp(5, frmDateInTs);
pstmt.setTimestamp(6, toDateInTs);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -285,17 +349,29 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
//--- Total man hours spent on completed request
//--- Estimated man hours for the completed request
sql = " select nvl(fn_feedbk_time(sum(d.time_spent)),'0') as time_spent,nvl(r.STD_COMP_TIME,'0') as STD_COMP_TIME "
/* sql = " select nvl(fn_feedbk_time(sum(d.time_spent)),'0') as time_spent,nvl(r.STD_COMP_TIME,'0') as STD_COMP_TIME "
+ " from ser_request r, SER_REQ_FEEDBKDTL d,SER_REQ_FEEDBK h "
+ " where d.feedbk_id = h.feedbk_id "
+ " and r.req_id = h.req_id "
+ " and r.COMP_STAT_DT between ? and ? "
+ " and r.emp_code__assign = ? and r.comp_stat = 'C' group by r.STD_COMP_TIME ";
+ " and r.emp_code__assign = ? and r.comp_stat = 'C' group by r.STD_COMP_TIME ";*/
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql = " SELECT nvl(fn_feedbk_time(sum(time_spent)), '0') AS time_spent ,nvl(STD_COMP_TIME, '0') AS STD_COMP_TIME from " +
" (select d.time_spent ,r.std_comp_time FROM ser_request r ,SER_REQ_FEEDBKDTL d ,SER_REQ_FEEDBK h WHERE d.feedbk_id = h.feedbk_id " +
" AND r.req_id = h.req_id AND r.COMP_STAT_DT BETWEEN ? AND ? AND r.emp_code__assign = ? AND r.comp_stat = 'C' and r.req_id <>'9999999999' " +
" and r.req_id not like 'CO%' and lower(r.dtl_descr) like 'client sup%' AND r.ITEM_SER <>'TRG' union all select d.time_spent ,0 as std_comp_time FROM " +
" service_complaint s ,SER_REQ_FEEDBKDTL d ,SER_REQ_FEEDBK h WHERE d.feedbk_id = h.feedbk_id AND s.ticket_no = h.ticket_no AND s.resolve_date1" +
" BETWEEN ? AND ? AND s.submitted_to2 = ? AND s.status = 'C' ) group by STD_COMP_TIME";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setTimestamp(5, toDateInTs);
pstmt.setString(6, empCode);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
......@@ -329,7 +405,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
//--- Closing Opening + received - delivered
sql = " select sum(no_request) as no_req from (select count(1) as no_request from ser_request where " +
/*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' or comp_stat_dt>=?) union all select count(1) " +
......@@ -339,10 +415,20 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
"and emp_code__assign = ? " +
" union all select -1 * count(1) from ser_request where " +
" COMP_STAT_DT between ? and ? and emp_code__assign = ? and comp_stat = 'C' )";
*/
//--- Closing Opening + received - delivered
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql = "SELECT sum(no_request) AS no_req FROM ( SELECT count(1) AS no_request FROM ser_request WHERE req_date < ? AND emp_code__assign = ? AND ( comp_stat <> 'C' OR comp_stat_dt >= ? ) " +
" and req_id <>'9999999999' and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG' UNION ALL SELECT count(1) AS no_request FROM " +
" ser_request WHERE req_date BETWEEN ? AND ? AND emp_code__assign = ? and req_id <>'9999999999' and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' " +
" AND ITEM_SER <>'TRG' UNION ALL SELECT - 1 * count(1) AS no_request FROM ser_request WHERE COMP_STAT_DT BETWEEN ? AND ? AND emp_code__assign = ? " +
" AND comp_stat = 'C' and req_id <>'9999999999' and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG' UNION ALL SELECT count(1) " +
" AS no_request FROM service_complaint WHERE ticket_date < ? AND submitted_to2 = ? AND ( status <> 'C' OR Resolve_date1 >= ? ) UNION ALL SELECT count(1) AS no_request " +
" FROM service_complaint WHERE ticket_date BETWEEN ? AND ? AND submitted_to2 = ? UNION ALL SELECT - 1 * count(1) AS no_request FROM service_complaint WHERE Resolve_date1 " +
" BETWEEN ? AND ? AND submitted_to2 = ? AND status = 'C' ) ";
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);
......@@ -354,6 +440,21 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
pstmt.setTimestamp(8, toDateInTs);
pstmt.setString(9,empCode);
pstmt.setTimestamp(10, frmDateInTs);
pstmt.setString(11, empCode);
/*Add for comp_stat_dt as a from date as per manohar sir by Dhanendra on 12-01-2016*/
pstmt.setTimestamp(12, frmDateInTs);
/*End for comp_stat_dt as a from date as per manohar sir by Dhanendra on 12-01-2016*/
pstmt.setTimestamp(13, frmDateInTs);
pstmt.setTimestamp(14, toDateInTs);
pstmt.setString(15, empCode);
pstmt.setTimestamp(16, frmDateInTs);
pstmt.setTimestamp(17, toDateInTs);
pstmt.setString(18,empCode);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
......@@ -474,13 +575,36 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
&& (empCode!=null && empCode.trim().length()>0) )
{
/*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>=?)";
/* 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.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*/
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql=" select sum (opening_request) as opening_request from (select count(1) opening_request from ser_request " +
" where req_date < ? and emp_code__assign = ? and req_id <>'9999999999' and (comp_stat <> 'C' or " +
" comp_stat_dt >=?) and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG' union all " +
" select count(1) opening_request from service_complaint where TICKET_DATE < ? and submitted_to2 = ? " +
" and (status <> 'C' or Resolve_date1>= ?))";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
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*/
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setString(5, empCode);
/*Add for comp_stat_dt as a from date as per manohar sir by Dhanendra on 12-01-2016*/
pstmt.setTimestamp(6, frmDateInTs);
/*[END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -496,11 +620,26 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
/* End Foe Opening Request * */
sql = "select count(1) as rece_dur_prd from ser_request where req_date between ? and ? and emp_code__assign = ?";
/* sql = "select count(1) as rece_dur_prd from ser_request where req_date between ? and ? and emp_code__assign = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
*/
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql="select sum(rece_dur_prd) as rece_dur_prd from ( select count(1) as rece_dur_prd from ser_request where req_date between ? and ? and emp_code__assign = ? " +
" and req_id <>'9999999999' and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG' union all select count(1) as rece_dur_prd from service_complaint " +
" where ticket_date between ? and ? and submitted_to2 = ? )";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setTimestamp(5, toDateInTs);
pstmt.setString(6, empCode);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -517,12 +656,25 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rs = null;
//Promised during this period
/* sql = "select count(1) as proms_dur_prd from ser_request where EXP_END_DATE between ? and ? and emp_code__assign = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
*/
sql="select sum(proms_dur_prd) proms_dur_prd from ( select count(1) as proms_dur_prd from ser_request where EXP_END_DATE between ? and ? and emp_code__assign = ? and req_id <>'9999999999' " +
" and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG' union all select count(1)" +
" as proms_dur_prd from service_complaint where resolve_date1 between ? and ? and submitted_to2 = ? )" ;
sql = "select count(1) as proms_dur_prd from ser_request where EXP_END_DATE between ? and ? and emp_code__assign = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setTimestamp(5, toDateInTs);
pstmt.setString(6, empCode);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -539,12 +691,29 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rs = null;
//--- Delivered during this period
/*
sql = "select count(1) as del_dur_prd from ser_request where COMP_STAT_DT between ? and ? and emp_code__assign = ? and comp_stat = 'C'";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);*/
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql = " select sum( del_dur_prd) as del_dur_prd from (select count(1) as del_dur_prd from ser_request where " +
" COMP_STAT_DT between ? and ? and emp_code__assign = ? and comp_stat = 'C' and req_id <>'9999999999' " +
" and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG' union all" +
" select count(1) as del_dur_prd from service_complaint where Resolve_date1 between ? and ? and submitted_to2 = ? " +
" and status = 'C' )";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setTimestamp(5, toDateInTs);
pstmt.setString(6, empCode);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
......@@ -562,17 +731,23 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rs = null;
// --- Count without a promised date
// sql = "select count(1) cnt_wit_prom from ser_request where emp_code__assign = ? and COMP_STAT_DT is null";
/*Start Modify by sachin on 13 -Jan-16*/
sql = "select count(1) cnt_wit_prom from ser_request where emp_code__assign = ? and EXP_END_DATE is null";
/* End Modify by sachin on 13 -Jan-16*/
/*sql = "select count(1) cnt_wit_prom from ser_request where emp_code__assign = ? and EXP_END_DATE is null";
End Modify by sachin on 13 -Jan-16
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);*/
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql = "select sum(cnt_wit_prom) AS cnt_wit_prom from (select count(1) as cnt_wit_prom " +
" from ser_request where emp_code__assign = ? and EXP_END_DATE is null and req_id <>'9999999999' and " +
" comp_stat <> 'C' and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG'" +
" union all select count(1) as cnt_wit_prom from service_complaint where submitted_to2 = ? and resolve_date1 is null " +
" and status <> 'C' )";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, empCode);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
......@@ -590,23 +765,32 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rs = null;
//--- Count on which work going on
// sql = "select count(distinct r.req_id) as cnt_wrk_gng from ser_req_feedbk f, ser_request r where f.req_id = r.req_id and r.emp_code__assign = ? and f.EXECUT_DT between ? and ? ";
/*
* Added by sachin on 13-Jan-16
*/
sql = "select count(distinct r.req_id) as cnt_wrk_gng from ser_req_feedbk f, ser_request r where f.req_id = r.req_id and r.emp_code__assign = ? and f.EXECUT_DT between ? and ? and r.comp_stat <> 'C'";
/*
/* sql = "select count(distinct r.req_id) as cnt_wrk_gng from ser_req_feedbk f, ser_request r where f.req_id = r.req_id and r.emp_code__assign = ? and f.EXECUT_DT between ? and ? and r.comp_stat <> 'C'";
End Added by sachin on 13-Jan-16
*/
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, frmDateInTs);
pstmt.setTimestamp(3, toDateInTs);*/
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql = " SELECT count(DISTINCT cnt_wrk_gng) as cnt_wrk_gng FROM ( select r.req_id as cnt_wrk_gng from ser_req_feedbk f ," +
" ser_request r WHERE f.req_id = r.req_id AND r.emp_code__assign = ? AND f.EXECUT_DT BETWEEN ? AND ? AND r.comp_stat <> 'C' " +
" and r.req_id <>'9999999999' and R.req_id not like 'CO%' and lower(R.dtl_descr) like 'client sup%' AND R.ITEM_SER <>'TRG' " +
" union all select s.ticket_no as cnt_wrk_gng from ser_req_feedbk f ,service_complaint s WHERE f.ticket_no = s.ticket_no " +
" AND s.submitted_to2 = ? AND f.EXECUT_DT BETWEEN ? AND ? AND s.status <> 'C' )";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, frmDateInTs);
pstmt.setTimestamp(3, toDateInTs);
pstmt.setString(4, empCode);
pstmt.setTimestamp(5, frmDateInTs);
pstmt.setTimestamp(6, toDateInTs);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
if (rs.next())
......@@ -625,12 +809,29 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
//--- Total man hours spent on completed request
//--- Estimated man hours for the completed request
/* sql = " select nvl(fn_feedbk_time(sum(d.time_spent)),'0') as time_spent,nvl(r.STD_COMP_TIME,'0') as STD_COMP_TIME from ser_request r, SER_REQ_FEEDBKDTL d,SER_REQ_FEEDBK h where d.feedbk_id = h.feedbk_id and r.req_id = h.req_id and r.COMP_STAT_DT between ? and ? and r.emp_code__assign = ? and r.comp_stat = 'C' group by r.STD_COMP_TIME ";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
*/
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
sql = " SELECT nvl(fn_feedbk_time(sum(time_spent)), '0') AS time_spent ,nvl(STD_COMP_TIME, '0') AS STD_COMP_TIME from " +
" (select d.time_spent ,r.std_comp_time FROM ser_request r ,SER_REQ_FEEDBKDTL d ,SER_REQ_FEEDBK h WHERE d.feedbk_id = h.feedbk_id " +
" AND r.req_id = h.req_id AND r.COMP_STAT_DT BETWEEN ? AND ? AND r.emp_code__assign = ? AND r.comp_stat = 'C' and r.req_id <>'9999999999' " +
" and r.req_id not like 'CO%' and lower(r.dtl_descr) like 'client sup%' AND r.ITEM_SER <>'TRG' union all select d.time_spent ,0 as std_comp_time FROM " +
" service_complaint s ,SER_REQ_FEEDBKDTL d ,SER_REQ_FEEDBK h WHERE d.feedbk_id = h.feedbk_id AND s.ticket_no = h.ticket_no AND s.resolve_date1" +
" BETWEEN ? AND ? AND s.submitted_to2 = ? AND s.status = 'C' ) group by STD_COMP_TIME";
sql = " select nvl(fn_feedbk_time(sum(d.time_spent)),'0') as time_spent,nvl(r.STD_COMP_TIME,'0') as STD_COMP_TIME from ser_request r, SER_REQ_FEEDBKDTL d,SER_REQ_FEEDBK h where d.feedbk_id = h.feedbk_id and r.req_id = h.req_id and r.COMP_STAT_DT between ? and ? and r.emp_code__assign = ? and r.comp_stat = 'C' group by r.STD_COMP_TIME ";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setTimestamp(5, toDateInTs);
pstmt.setString(6, empCode);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
String time_spnet="",STD_COMP_TIME="";
......@@ -654,7 +855,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
pstmt = null;
rs.close();
rs = null;
sql = " select sum(no_request) as no_req from (select count(1) as no_request from ser_request where " +
/* 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' or comp_stat_dt>=?) union all select count(1) " +
......@@ -671,12 +872,53 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
pstmt.setTimestamp(3, frmDateInTs);
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setTimestamp(5, toDateInTs);
pstmt.setString(6, empCode);
pstmt.setTimestamp(7, frmDateInTs);
pstmt.setTimestamp(8, toDateInTs);
pstmt.setString(9,empCode);*/
//--- Closing Opening + received - delivered
/* [START] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data */
sql = "SELECT sum(no_request) AS no_req FROM ( SELECT count(1) AS no_request FROM ser_request WHERE req_date < ? AND emp_code__assign = ? AND ( comp_stat <> 'C' OR comp_stat_dt >= ? ) " +
" and req_id <>'9999999999' and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG' UNION ALL SELECT count(1) AS no_request FROM " +
" ser_request WHERE req_date BETWEEN ? AND ? AND emp_code__assign = ? and req_id <>'9999999999' and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' " +
" AND ITEM_SER <>'TRG' UNION ALL SELECT - 1 * count(1) AS no_request FROM ser_request WHERE COMP_STAT_DT BETWEEN ? AND ? AND emp_code__assign = ? " +
" AND comp_stat = 'C' and req_id <>'9999999999' and req_id not like 'CO%' and lower(dtl_descr) like 'client sup%' AND ITEM_SER <>'TRG' UNION ALL SELECT count(1) " +
" AS no_request FROM service_complaint WHERE ticket_date < ? AND submitted_to2 = ? AND ( status <> 'C' OR Resolve_date1 >= ? ) UNION ALL SELECT count(1) AS no_request " +
" FROM service_complaint WHERE ticket_date BETWEEN ? AND ? AND submitted_to2 = ? UNION ALL SELECT - 1 * count(1) AS no_request FROM service_complaint WHERE Resolve_date1 " +
" BETWEEN ? AND ? AND submitted_to2 = ? AND status = 'C' ) ";
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*/
pstmt.setTimestamp(4, frmDateInTs);
pstmt.setTimestamp(5, toDateInTs);
pstmt.setString(6, empCode);
pstmt.setTimestamp(7, frmDateInTs);
pstmt.setTimestamp(8, toDateInTs);
pstmt.setString(9,empCode);
pstmt.setTimestamp(10, frmDateInTs);
//pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(11, empCode);
/*Add for comp_stat_dt as a from date as per manohar sir by Dhanendra on 12-01-2016*/
pstmt.setTimestamp(12, frmDateInTs);
/*End for comp_stat_dt as a from date as per manohar sir by Dhanendra on 12-01-2016*/
pstmt.setTimestamp(13, frmDateInTs);
pstmt.setTimestamp(14, toDateInTs);
pstmt.setString(15, empCode);
pstmt.setTimestamp(16, frmDateInTs);
pstmt.setTimestamp(17, toDateInTs);
pstmt.setString(18,empCode);
/* [END] Modify SQL By sachin on 20-JAN-16 For Adding Ticket data*/
rs = pstmt.executeQuery();
......@@ -787,51 +1029,9 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
{
empCode = dashboardUtility.getCommaSeparated(empCode);
/* sql="Select e.emp_fname || ' ' || e.emp_lname Employee ,i.req_id, i.dtl_descr,i.cust_code, cc.cust_name, "
+" sum(i.time_spent) time_spent, sum(i.emp_time_spent) emp_time_spent, i.plan_start_date,i.act_start_date, i.plan_end_date "
+" ,I.STD_TIME,I.ACTION_DETL "
+" from ( "
+" select d.emp_code, r.req_id, r.cust_code,r.dtl_descr, "
+" (select min(di.PLANSTDATE) from ser_req_act_detl di, ser_req_act hi "
+" where hi.action_id = di.action_id "
+" and hi.req_id = r.req_id "
+" and di.emp_code = d.emp_code "
+" ) plan_start_date, d.STD_TIME,d.ACTION_DETL, "
+" (select min(fd.START_DATE_ACTUAL) from SER_REQ_FEEDBKDTL fd, SER_REQ_FEEDBK fh where fd.feedbk_id = fh.feedbk_id and fh.req_id = r.req_id and fh.emp_code = d.emp_code) act_start_date, "
+" (select max(di.PLANENDDATE) from ser_req_act_detl di, ser_req_act hi "
+" where hi.action_id = di.action_id "
+" and hi.req_id = r.req_id "
+" and di.emp_code = d.emp_code "
+" ) plan_end_date, "
+" (select fn_feedbk_time(sum(iid.time_spent)) from SER_REQ_FEEDBKDTL iid,SER_REQ_FEEDBK iih "
+" where iid.feedbk_id = iih.feedbk_id "
+" and iih.req_id = r.req_id "
+" ) time_spent, "
+" sum(emp_spent.emp_time ) emp_time_spent "
+" from ser_request r, ser_req_act h, ser_req_act_detl d, "
+" ( select iih.emp_code, iih.req_id, iid.action_id, iid.action_code, fn_feedbk_time(sum(iid.time_spent)) emp_time from SER_REQ_FEEDBKDTL iid,SER_REQ_FEEDBK iih "
+" where iid.feedbk_id = iih.feedbk_id "
+" group by iih.emp_code, iih.req_id, iid.action_id, iid.action_code) emp_spent "
+" where d.action_id = h.action_id "
+" and r.req_id = h.req_id "
+" and emp_spent.req_id = r.req_id and emp_spent.action_id = d.action_id and emp_spent.req_id = r.req_id and "
+" emp_spent.emp_code = d.emp_code and emp_spent.action_id = d.action_id and emp_spent.action_code = d.action_code "
+" and r.comp_stat <> 'C' "
+" 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+")) "
+ dateInpute
+" group by d.emp_code, r.req_id, r.cust_code, r.dtl_descr, d.STD_TIME, d.ACTION_DETL "
+" ) i, employee e, customer cc "
+" where i.emp_code = e.emp_code "
+" and cc.cust_code = i.cust_code "
+" group by e.emp_fname || ' ' || e.emp_lname, i.req_id, i.dtl_descr, i.cust_code, cc.cust_name, i.plan_start_date, i.act_start_date, i.plan_end_date, I.STD_TIME, I.ACTION_DETL "
+" order by e.emp_fname || ' ' || e.emp_lname,i.req_id";*/
/**Change Sql For Emp Unit time by sachin on 13-Jan-16**/
sql="select e.emp_fname || ' ' || e.emp_lname Employee ,i.req_id, i.dtl_descr,i.cust_code, cc.cust_name, sum(i.time_spent) as time_spent," +
/* sql="select e.emp_fname || ' ' || e.emp_lname Employee ,i.req_id, i.dtl_descr,i.cust_code, cc.cust_name, sum(i.time_spent) as time_spent," +
" sum(i.emp_time_spent) as emp_time_spent, i.plan_start_date,i.act_start_date, i.plan_end_date ,I.STD_TIME,I.ACTION_DETL" +
" from ( select d.emp_code, r.req_id," +
" r.cust_code,r.dtl_descr, d.STD_TIME, d.ACTION_DETL , (select min(di.PLANSTDATE) from ser_req_act_detl di, ser_req_act hi where hi.action_id = di.action_id " +
......@@ -848,15 +1048,50 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
" group by d.emp_code, r.req_id, r.cust_code, r.dtl_descr,d.action_code,h.action_id,d.STD_TIME,d.ACTION_DETL ) i, employee e, customer cc" +
" where i.emp_code = e.emp_code and cc.cust_code = i.cust_code group by e.emp_fname || ' ' || e.emp_lname,i.req_id, i.dtl_descr," +
" i.cust_code, cc.cust_name, i.plan_start_date,i.act_start_date, i.plan_end_date ,I.STD_TIME,I.ACTION_DETL order by e.emp_fname || ' ' || e.emp_lname,i.req_id" ;
*/
/**Change Sql For Emp Unit time by sachin on 13-Jan-16**/
/**Modify Sql Add Ticket Condition by sachin on 20-Jan-16**/
sql= " SELECT e.emp_fname || ' ' || e.emp_lname Employee ,i.req_id ,i.dtl_descr ,i.cust_code ,cc.cust_name ,sum(i.time_spent) AS time_spent ,sum(i.emp_time_spent) AS emp_time_spent, " +
" i.plan_start_date ,i.act_start_date ,i.plan_end_date ,I.STD_TIME ,I.ACTION_DETL FROM ( SELECT d.emp_code ,r.req_id ,r.cust_code ,r.dtl_descr ,d.STD_TIME ,d.ACTION_DETL ," +
" ( SELECT min(di.PLANSTDATE) FROM ser_req_act_detl di ,ser_req_act hi WHERE hi.action_id = di.action_id AND hi.req_id = r.req_id AND di.emp_code = d.emp_code ) plan_start_date ," +
" ( SELECT min(fd.START_DATE_ACTUAL) FROM SER_REQ_FEEDBKDTL fd ,SER_REQ_FEEDBK fh WHERE fd.feedbk_id = fh.feedbk_id AND fh.req_id = r.req_id " +
" AND fh.emp_code = d.emp_code ) act_start_date ,( SELECT max(di.PLANENDDATE) FROM ser_req_act_detl di ,ser_req_act hi WHERE " +
" hi.action_id = di.action_id AND hi.req_id = r.req_id AND di.emp_code = d.emp_code ) plan_end_date ," +
" ( SELECT fn_feedbk_time(sum(iid.time_spent)) FROM SER_REQ_FEEDBKDTL iid ,SER_REQ_FEEDBK iih WHERE iid.feedbk_id = iih.feedbk_id AND" +
" iih.req_id = r.req_id ) time_spent ,( SELECT fn_feedbk_time(sum(iiid.time_spent)) AS dd FROM SER_REQ_FEEDBKDTL iiid ,SER_REQ_FEEDBK iiih " +
" WHERE iiid.feedbk_id = iiih.feedbk_id AND iiih.req_id = r.req_id AND iiid.action_id = h.action_id AND iiid.action_code = d.action_code AND" +
" iiih.emp_code = d.emp_code ) emp_time_spent FROM ser_request r ,ser_req_act h ,ser_req_act_detl d WHERE d.action_id = h.action_id AND" +
" r.req_id = h.req_id AND r.comp_stat <> 'C' and r.req_id <>'9999999999' and r.req_id not like 'CO%' and lower(r.dtl_descr) like 'client sup%' " +
" AND r.ITEM_SER <>'TRG' 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+")) "+ dateInpute +
" GROUP BY d.emp_code ,r.req_id ,r.cust_code ,r.dtl_descr ,d.action_code ,h.action_id ,d.STD_TIME ,d.ACTION_DETL UNION " +
" ALL SELECT d.emp_code ,r.ticket_no AS req_id ,r.cust_code ,r.TICKET_DETAIL AS dtl_descr ,d.STD_TIME ,d.ACTION_DETL ," +
" ( SELECT min(di.PLANSTDATE) FROM ser_req_act_detl di ,ser_req_act hi WHERE hi.action_id = di.action_id AND hi.ticket_no = r.ticket_no " +
" AND di.emp_code = d.emp_code ) plan_start_date ,( SELECT min(fd.START_DATE_ACTUAL) FROM SER_REQ_FEEDBKDTL fd ,SER_REQ_FEEDBK fh " +
" WHERE fd.feedbk_id = fh.feedbk_id AND fh.ticket_no = r.ticket_no AND fh.emp_code = d.emp_code ) act_start_date ," +
" ( SELECT max(di.PLANENDDATE) FROM ser_req_act_detl di ,ser_req_act hi WHERE hi.action_id = di.action_id AND hi.ticket_no = r.ticket_no " +
" AND di.emp_code = d.emp_code ) plan_end_date ,( SELECT fn_feedbk_time(sum(iid.time_spent)) FROM SER_REQ_FEEDBKDTL iid ,SER_REQ_FEEDBK iih " +
" WHERE iid.feedbk_id = iih.feedbk_id AND iih.ticket_no = r.ticket_no ) time_spent ,( SELECT fn_feedbk_time(sum(iiid.time_spent)) AS dd FROM " +
" SER_REQ_FEEDBKDTL iiid ,SER_REQ_FEEDBK iiih WHERE iiid.feedbk_id = iiih.feedbk_id AND iiih.ticket_no = r.ticket_no AND iiid.action_id = h.action_id " +
" AND iiid.action_code = d.action_code AND iiih.emp_code = d.emp_code ) emp_time_spent FROM service_complaint r ,ser_req_act h ,ser_req_act_detl d WHERE" +
" d.action_id = h.action_id AND r.ticket_no = h.ticket_no AND r.STATUS <> 'C' 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+") ) "+ dateInpute +" GROUP BY d.emp_code ,r.ticket_no ,r.cust_code ,r.TICKET_DETAIL ,d.action_code , " +
" h.action_id,d.STD_TIME ,d.ACTION_DETL ) i ,employee e ,customer cc WHERE i.emp_code = e.emp_code AND cc.cust_code = i.cust_code " +
" GROUP BY e.emp_fname || ' ' || e.emp_lname ,i.req_id ,i.dtl_descr ,i.cust_code ,cc.cust_name ,i.plan_start_date ,i.act_start_date ,i.plan_end_date ," +
" I.STD_TIME ,I.ACTION_DETL ORDER BY e.emp_fname || ' ' || e.emp_lname ,i.req_id ";
/** End Modify Sql Add Ticket Condition by sachin on 20-Jan-16**/
pstmt = conn.prepareStatement(sql);
if(dateInpute.trim().length()>0)
{
pstmt.setTimestamp(1,frmDateInTs);
pstmt.setTimestamp(2,toDateInTs);
pstmt.setTimestamp(3,frmDateInTs);
pstmt.setTimestamp(4,toDateInTs);
}
rs = pstmt.executeQuery();
int count = 0;
......@@ -1005,23 +1240,9 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
if((fromDateInTS!=null && fromDateInTS.toString().length()>0) && (toDateInTS!=null && toDateInTS.toString().length()>0)
&& (empCode!=null && empCode.trim().length()>0) )
{
/*sql = "SELECT R.COMP_STAT_DT,R.COMP_STAT,R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, E.EMP_FNAME || ' ' || E.EMP_LNAME EMP_NAME, "
+" AD.STD_TIME as STD_TIME ,MAX((SELECT FN_FEEDBK_TIME(SUM(FD.TIME_SPENT)) FROM SER_REQ_FEEDBKDTL FD, "
+" SER_REQ_FEEDBK FH , WHERE FD.FEEDBK_ID = FH.FEEDBK_ID AND FH.REQ_ID = R.REQ_ID "
+" AND FD.ACTION_ID = AD.ACTION_ID "
+" AND FD.ACTION_CODE = AD.ACTION_CODE AND FH.EMP_CODE = E.EMP_CODE)) ACTUAL_TIME "
+" FROM SER_REQUEST R, SER_REQ_ACT AH, SER_REQ_ACT_DETL AD, EMPLOYEE E "
+" WHERE AH.ACTION_ID = AD.ACTION_ID "
+" AND AH.REQ_ID = R.REQ_ID "
+" AND E.EMP_CODE = ad.EMP_CODE "
+" AND R.COMP_STAT_DT >= ? AND R.COMP_STAT_DT <= ? "//--?
+" AND AD.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 )) "
+" GROUP BY R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, R.COMP_STAT,E.EMP_FNAME || ' ' || E.EMP_LNAME, AD.STD_TIME ,R.COMP_STAT_DT " +
" ORDER BY R.COMP_STAT_DT DESC ";*/
sql = "SELECT r.comp_stat_dt,r.COMP_STAT,R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, E.EMP_FNAME || ' ' || E.EMP_LNAME EMP_NAME, "
/* sql = "SELECT r.comp_stat_dt,r.COMP_STAT,R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, E.EMP_FNAME || ' ' || E.EMP_LNAME EMP_NAME, "
+" AD.STD_TIME as STD_TIME ,max((SELECT FN_FEEDBK_TIME(SUM(FD.TIME_SPENT)) FROM SER_REQ_FEEDBKDTL FD, "
+" SER_REQ_FEEDBK FH WHERE FD.FEEDBK_ID = FH.FEEDBK_ID AND FH.REQ_ID = R.REQ_ID "
+" AND FD.ACTION_ID = AD.ACTION_ID "
......@@ -1035,12 +1256,36 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
+" CONNECT BY PRIOR EMP_CODE = REPORT_TO AND REPORT_TO IS NOT NULL "
+" AND ( RELIEVE_DATE IS NULL OR RELIEVE_DATE >= SYSDATE )) ) OR (ad.emp_code="+empCode+"))"
+" group by r.req_id,r.dtl_descr, ad.action_detl, r.COMP_STAT,e.emp_fname || ' ' || e.emp_lname, ad.STD_TIME ,r.comp_stat_dt "
+ " order by r.comp_stat_dt desc ";
+ " order by r.comp_stat_dt desc ";*/
/* [Start] Modify SQL By sachin on 20-Jan-16 for Adding Ticket Condition*/
sql=" SELECT comp_stat_dt ,COMP_STAT ,REQ_ID ,DTL_DESCR ,ACTION_DETL ,EMP_NAME ,STD_TIME ,ACTUAL_TIME FROM" +
" ( SELECT r.comp_stat_dt ,r.COMP_STAT ,R.REQ_ID ,R.DTL_DESCR ,AD.ACTION_DETL ,E.EMP_FNAME || ' ' || E.EMP_LNAME EMP_NAME ," +
" AD.STD_TIME AS STD_TIME ,max(( SELECT FN_FEEDBK_TIME(SUM(FD.TIME_SPENT)) FROM SER_REQ_FEEDBKDTL FD ,SER_REQ_FEEDBK FH WHERE" +
" FD.FEEDBK_ID = FH.FEEDBK_ID AND FH.REQ_ID = R.REQ_ID AND FD.ACTION_ID = AD.ACTION_ID AND FD.ACTION_CODE = AD.ACTION_CODE AND " +
" fh.emp_code = e.emp_code )) ACTUAL_TIME FROM ser_request r ,ser_req_act ah ,ser_req_act_detl ad ,employee e " +
" WHERE ah.action_id = ad.action_id AND ah.req_id = r.req_id AND E.EMP_CODE = ad.EMP_CODE AND r.comp_stat = 'C' " +
" and r.req_id <>'9999999999' AND r.ITEM_SER <>'TRG' AND r.comp_stat_dt >= ? AND r.comp_stat_dt <= ? " +
" AND ( ( ad.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 (ad.emp_code = "+empCode+") ) GROUP BY r.comp_stat_dt ,r.COMP_STAT ,R.REQ_ID ,R.DTL_DESCR ,AD.ACTION_DETL ," +
" E.EMP_FNAME || ' ' || E.EMP_LNAME ,AD.STD_TIME UNION ALL SELECT r.resolve_date3 AS comp_stat_dt ," +
" r.STATUS AS COMP_STAT ,R.ticket_no AS REQ_ID ,r.ticket_Detail AS DTL_DESCR ,AD.ACTION_DETL ACTION_DETL ,E.EMP_FNAME || ' ' || E.EMP_LNAME AS EMP_NAME ," +
" AD.STD_TIME AS STD_TIME ,max(( SELECT FN_FEEDBK_TIME(SUM(FD.TIME_SPENT)) FROM SER_REQ_FEEDBKDTL FD ,SER_REQ_FEEDBK FH " +
" WHERE FD.FEEDBK_ID = FH.FEEDBK_ID AND FH.ticket_no = r.ticket_no AND FD.ACTION_ID = AD.ACTION_ID AND FD.ACTION_CODE = AD.ACTION_CODE" +
" AND fh.emp_code = e.emp_code )) ACTUAL_TIME FROM service_complaint r ,ser_req_act ah ,ser_req_act_detl ad ,employee e WHERE ah.action_id = ad.action_id " +
" AND ah.ticket_no = r.ticket_no AND E.EMP_CODE = ad.EMP_CODE AND r.STATUS = 'C' AND r.resolve_date3 >= ? AND r.resolve_date3 <= ? " +
" AND ( ( ad.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 (ad.emp_code = "+empCode+") ) GROUP BY r.resolve_date3 ,r.STATUS ,R.ticket_no ,r.ticket_Detail ," +
" AD.ACTION_DETL ,E.EMP_FNAME || ' ' || E.EMP_LNAME ,AD.STD_TIME ) ORDER BY comp_stat_dt DESC";
/* [END] Modify SQL By sachin on 20-Jan-16 for Adding Ticket Condition*/
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,fromDateInTS);
pstmt.setTimestamp(2,toDateInTS);
pstmt.setTimestamp(3,fromDateInTS);
pstmt.setTimestamp(4,toDateInTS);
rs = pstmt.executeQuery();
int count = 0;
while (rs.next())
......@@ -1445,23 +1690,9 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
if((fromDateInTS!=null && fromDateInTS.toString().length()>0) && (toDateInTS!=null && toDateInTS.toString().length()>0)
&& (empCode!=null && empCode.trim().length()>0) )
{
/*sql = "SELECT R.COMP_STAT_DT,R.COMP_STAT,R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, E.EMP_FNAME || ' ' || E.EMP_LNAME EMP_NAME, "
+" AD.STD_TIME as STD_TIME ,MAX((SELECT FN_FEEDBK_TIME(SUM(FD.TIME_SPENT)) FROM SER_REQ_FEEDBKDTL FD, "
+" SER_REQ_FEEDBK FH , WHERE FD.FEEDBK_ID = FH.FEEDBK_ID AND FH.REQ_ID = R.REQ_ID "
+" AND FD.ACTION_ID = AD.ACTION_ID "
+" AND FD.ACTION_CODE = AD.ACTION_CODE AND FH.EMP_CODE = E.EMP_CODE)) ACTUAL_TIME "
+" FROM SER_REQUEST R, SER_REQ_ACT AH, SER_REQ_ACT_DETL AD, EMPLOYEE E "
+" WHERE AH.ACTION_ID = AD.ACTION_ID "
+" AND AH.REQ_ID = R.REQ_ID "
+" AND E.EMP_CODE = ad.EMP_CODE "
+" AND R.COMP_STAT_DT >= ? AND R.COMP_STAT_DT <= ? "//--?
+" AND AD.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 )) "
+" GROUP BY R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, R.COMP_STAT,E.EMP_FNAME || ' ' || E.EMP_LNAME, AD.STD_TIME ,R.COMP_STAT_DT " +
" ORDER BY R.COMP_STAT_DT DESC ";*/
sql = " SELECT r.comp_stat_dt,r.COMP_STAT,R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, E.EMP_FNAME || ' ' || E.EMP_LNAME EMP_NAME, "
/* sql = " SELECT r.comp_stat_dt,r.COMP_STAT,R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, E.EMP_FNAME || ' ' || E.EMP_LNAME EMP_NAME, "
+" AD.STD_TIME as STD_TIME ,max((SELECT FN_FEEDBK_TIME(SUM(FD.TIME_SPENT)) FROM SER_REQ_FEEDBKDTL FD, "
+" SER_REQ_FEEDBK FH WHERE FD.FEEDBK_ID = FH.FEEDBK_ID AND FH.REQ_ID = R.REQ_ID "
+" AND FD.ACTION_ID = AD.ACTION_ID "
......@@ -1476,10 +1707,36 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
+" AND ( RELIEVE_DATE IS NULL OR RELIEVE_DATE >= SYSDATE ))) OR (ad.emp_code ="+empCode+")) "
+" group by r.req_id,r.dtl_descr, ad.action_detl, r.COMP_STAT,e.emp_fname || ' ' || e.emp_lname, ad.STD_TIME ,r.comp_stat_dt " +
" order by r.comp_stat_dt desc ";
*/
/* [START] Modify SQL By sachin on 20-Jan-15 for Adding Ticket Condition*/
sql=" SELECT comp_stat_dt ,COMP_STAT ,REQ_ID ,DTL_DESCR ,ACTION_DETL ,EMP_NAME ,STD_TIME ,ACTUAL_TIME FROM" +
" ( SELECT r.comp_stat_dt ,r.COMP_STAT ,R.REQ_ID ,R.DTL_DESCR ,AD.ACTION_DETL ,E.EMP_FNAME || ' ' || E.EMP_LNAME EMP_NAME ," +
" AD.STD_TIME AS STD_TIME ,max(( SELECT FN_FEEDBK_TIME(SUM(FD.TIME_SPENT)) FROM SER_REQ_FEEDBKDTL FD ,SER_REQ_FEEDBK FH WHERE" +
" FD.FEEDBK_ID = FH.FEEDBK_ID AND FH.REQ_ID = R.REQ_ID AND FD.ACTION_ID = AD.ACTION_ID AND FD.ACTION_CODE = AD.ACTION_CODE AND " +
" fh.emp_code = e.emp_code )) ACTUAL_TIME FROM ser_request r ,ser_req_act ah ,ser_req_act_detl ad ,employee e " +
" WHERE ah.action_id = ad.action_id AND ah.req_id = r.req_id AND E.EMP_CODE = ad.EMP_CODE AND r.comp_stat = 'C' " +
" and r.req_id <>'9999999999' AND r.ITEM_SER <>'TRG' AND r.comp_stat_dt >= ? AND r.comp_stat_dt <= ? " +
" AND ( ( ad.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 (ad.emp_code = "+empCode+") ) GROUP BY r.comp_stat_dt ,r.COMP_STAT ,R.REQ_ID ,R.DTL_DESCR ,AD.ACTION_DETL ," +
" E.EMP_FNAME || ' ' || E.EMP_LNAME ,AD.STD_TIME UNION ALL SELECT r.resolve_date3 AS comp_stat_dt ," +
" r.STATUS AS COMP_STAT ,R.ticket_no AS REQ_ID ,r.ticket_Detail AS DTL_DESCR ,AD.ACTION_DETL ACTION_DETL ,E.EMP_FNAME || ' ' || E.EMP_LNAME AS EMP_NAME ," +
" AD.STD_TIME AS STD_TIME ,max(( SELECT FN_FEEDBK_TIME(SUM(FD.TIME_SPENT)) FROM SER_REQ_FEEDBKDTL FD ,SER_REQ_FEEDBK FH " +
" WHERE FD.FEEDBK_ID = FH.FEEDBK_ID AND FH.ticket_no = r.ticket_no AND FD.ACTION_ID = AD.ACTION_ID AND FD.ACTION_CODE = AD.ACTION_CODE" +
" AND fh.emp_code = e.emp_code )) ACTUAL_TIME FROM service_complaint r ,ser_req_act ah ,ser_req_act_detl ad ,employee e WHERE ah.action_id = ad.action_id " +
" AND ah.ticket_no = r.ticket_no AND E.EMP_CODE = ad.EMP_CODE AND r.STATUS = 'C' AND r.resolve_date3 >= ? AND r.resolve_date3 <= ? " +
" AND ( ( ad.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 (ad.emp_code = "+empCode+") ) GROUP BY r.resolve_date3 ,r.STATUS ,R.ticket_no ,r.ticket_Detail ," +
" AD.ACTION_DETL ,E.EMP_FNAME || ' ' || E.EMP_LNAME ,AD.STD_TIME ) ORDER BY comp_stat_dt DESC";
/*[END] Modify SQL By sachin on 20-Jan-15 for Adding Ticket Condition*/
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,fromDateInTS);
pstmt.setTimestamp(2,toDateInTS);
pstmt.setTimestamp(3,fromDateInTS);
pstmt.setTimestamp(4,toDateInTS);
rs = pstmt.executeQuery();
int count = 0;
while (rs.next())
......@@ -1517,7 +1774,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rowData = new JSONObject();
rowData.put("tot_deviation", totActTime);
rowData.put("tot_descr", "Actual Man Hour");
rowData.put("time_lag", posTimeCtr);
rowData.put("time_lag",negTimeCtr );
rowData.put("time_lag_descr", "Extra Time");
rowDataEmpReqEffJson.put(Integer.valueOf(count), rowData);
count++;
......@@ -1525,7 +1782,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rowData = new JSONObject();
rowData.put("tot_deviation", totStdTime);
rowData.put("tot_descr", "Estimated Man Hour");
rowData.put("time_lag", negTimeCtr);
rowData.put("time_lag", posTimeCtr);
rowData.put("time_lag_descr", "Before Time");
rowDataEmpReqEffJson.put(Integer.valueOf(count), rowData);
}
......
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