Commit be9383e6 authored by manohar's avatar manohar

In case of selective period if feedback exists in that period then only show the work allocation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103306 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5633eba2
......@@ -1071,7 +1071,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
SimpleDateFormat convertToDbDate=null;
SimpleDateFormat simpleDateFormat=null;
DashboardUtility dashboardUtility=null;
String dateInpute="", dateInpute1 = "";
String dateInput="", dateInput1 = "";
try
{
conn = connDriver.getConnectDB(dataSourceName);
......@@ -1102,10 +1102,10 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
//toDateInTs = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(toDate)).toString() + " 00:00:00.0");
frmDateInTs= Timestamp.valueOf(genericUtility.getValidDateString(fromDate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
toDateInTs= Timestamp.valueOf(genericUtility.getValidDateString(toDate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
//dateInpute =" and h.TRAN_DATE >= ? AND h.TRAN_DATE <= ?";
//dateInput =" and h.TRAN_DATE >= ? AND h.TRAN_DATE <= ?";
dateInpute = "and (select count(1) from SER_REQ_FEEDBK f where f.req_id = h.req_id and f.execut_dt between ? AND ? ) > 0 ";
dateInpute1 = "and (select count(1) from SER_REQ_FEEDBK f where f.ticket_no = h.ticket_no and f.execut_dt between ? AND ? ) > 0 ";
dateInput = "and (select count(1) from SER_REQ_FEEDBK f where f.req_id = h.req_id and f.execut_dt between ? AND ? ) > 0 ";
dateInput1 = "and (select count(1) from SER_REQ_FEEDBK f where f.ticket_no = h.ticket_no and f.execut_dt between ? AND ? ) > 0 ";
}
System.out.println("getWorkAlloSummary frmDateInTs :"+frmDateInTs +"---- toDateInTs :"+toDateInTs);
......@@ -1128,7 +1128,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
" 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 ((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 +
" REPORT_TO IS NOT NULL AND ( RELIEVE_DATE IS NULL OR RELIEVE_DATE >= SYSDATE ))) or (d.emp_code = "+empCode+")) " + dateInput +
" 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" ;
......@@ -1137,7 +1137,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
/**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, " +
/*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 " +
......@@ -1148,11 +1148,9 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
" 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) not like 'client sup%' " +
" AND r.ITEM_SER <>'TRG'" +*/
" r.REQ_TYPE <> 'GENSUPP'" +
" 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 +
" REPORT_TO IS NOT NULL AND ( RELIEVE_DATE IS NULL OR RELIEVE_DATE >= SYSDATE ) ) ) OR (d.emp_code = "+empCode+")) "+ dateInput +
" 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 " +
......@@ -1165,16 +1163,59 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
" 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+") ) "+ dateInpute1 +" GROUP BY d.emp_code ,r.ticket_no ,r.cust_code ,r.TICKET_DETAIL ,d.action_code , " +
" OR (d.emp_code = "+empCode+") ) "+ dateInput1 +" 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 ";
*/
// manoharan in case of multiple resolution for same req_id,emp_code,action_code there is issue of double timespend
sql= " SELECT e.emp_code, 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, min(i.plan_start_date) as plan_start_date,min(i.act_start_date) as act_start_date ,max(i.plan_end_date) as plan_end_date ,I.STD_TIME ,I.ACTION_DETL "
+" FROM ( "
+" SELECT d.emp_code ,r.req_id ,r.cust_code ,r.dtl_descr ,a.ACTION_DETL, "
+" ( SELECT sum(di.std_time) 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 and di.action_code = d.action_code ) std_time, "
+" ( SELECT min(di.PLANSTDATE) FROM ser_req_act_detl di ,ser_req_act hi WHERE 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.req_id = r.req_id AND di.emp_code = d.emp_code ) plan_end_date, "
+" ( SELECT sum(fn_feedbk_time(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 sum(fn_feedbk_time(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_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,SER_COMP_RES a "
+" WHERE d.action_id = h.action_id "
+" AND r.req_id = h.req_id "
+" and a.action_code = d.action_code "
+" and a.action_type = d.action_type "
+" AND r.comp_stat <> 'C' "
+" and r.req_id <>'9999999999' "
+" and r.REQ_TYPE <> 'GENSUPP' "
+" 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+")) " + dateInput
+" GROUP BY d.emp_code ,r.req_id ,r.cust_code ,r.dtl_descr ,d.action_code ,a.ACTION_DETL "
+" UNION ALL "
+" SELECT d.emp_code ,r.ticket_no AS req_id ,r.cust_code ,r.TICKET_DETAIL AS dtl_descr ,a.ACTION_DETL, "
+" ( SELECT sum(di.std_time) 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 and di.action_code = d.action_code ) as std_time, "
+" ( SELECT min(di.PLANSTDATE) FROM ser_req_act_detl di ,ser_req_act hi WHERE 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.ticket_no = r.ticket_no AND di.emp_code = d.emp_code ) plan_end_date, "
+" ( SELECT nvl(fn_feedbk_time(sum(nvl(iid.time_spent,0))),0) 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 nvl(fn_feedbk_time(sum(nvl(iiid.time_spent,0))),0) 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_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,SER_COMP_RES a "
+" WHERE d.action_id = h.action_id "
+" AND r.ticket_no = h.ticket_no "
+" and a.action_code = d.action_code "
+" and a.action_type = d.action_type "
+" 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+") ) "+ dateInput1
+" GROUP BY d.emp_code ,r.ticket_no ,r.cust_code ,r.TICKET_DETAIL ,d.action_code ,a.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_code, e.emp_fname || ' ' || e.emp_lname ,i.req_id ,i.dtl_descr ,i.cust_code ,cc.cust_name , I.STD_TIME ,I.ACTION_DETL "
+" having sum(i.emp_time_spent) >0 "
+" 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)
if(dateInput.trim().length()>0)
{
pstmt.setTimestamp(1,frmDateInTs);
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