Commit 672b000f authored by vbhosale's avatar vbhosale

added new utility for image icon , added new method team attendance details &...

added new utility for image icon , added new method team attendance details & included view option condition in else code.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@172580 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1dc00847
package ibase.dashboard.iem.ejb;
import ibase.dashboard.Report.Utility.DashboardUtility;
import ibase.system.config.ConnDriver;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.io.File;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedHashMap;
import java.util.List;
import javax.ejb.Stateless;
import org.json.simple.JSONObject;
import ibase.dashboard.Report.Utility.DashboardUtility;
import ibase.system.config.ConnDriver;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
@Stateless
public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDashboardRemote
{
{
DashboardUtility dashboardUtility = new DashboardUtility();
GenericUtility genericUtility = GenericUtility.getInstance();
SimpleDateFormat gridDateFormat=null;
SimpleDateFormat convrtToTimStmDate=null;
......@@ -95,15 +93,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
}
else
{
//comment date
//simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
/*Comment and change code to date format by Dhanendra on date 16-06-2016*/
/*simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
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");*/
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");
......@@ -1056,7 +1046,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
*******/
@SuppressWarnings("unchecked")
@Override
public JSONObject getWorkAlloSummary(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException
public JSONObject getWorkAlloSummary(String dataSourceName,String dataProvider, String empCode, String fromDate, String toDate) throws RemoteException, ITMException
{
JSONObject rowDataEmpWrkAllJson = new JSONObject();
JSONObject rowData = null;
......@@ -1096,78 +1086,17 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
}
else
{
/*Comment and change code to date format by Dhanendra on date 16-06-2016*/
//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");
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");
//dateInput =" and h.TRAN_DATE >= ? AND h.TRAN_DATE <= ?";
dateInput = "and (select count(1) from SER_REQ_FEEDBK f,SER_REQ_FEEDBKDTL fd where f.feedbk_id = fd.feedbk_id and fd.action_id = d.action_id and fd.action_code = d.action_code and f.req_id = h.req_id and f.execut_dt between ? AND ? ) > 0 ";
dateInput1 = "and (select count(1) from SER_REQ_FEEDBK f,SER_REQ_FEEDBKDTL fd where f.feedbk_id = fd.feedbk_id and fd.action_id = d.action_id and fd.action_code = d.action_code and f.ticket_no = h.ticket_no and f.execut_dt between ? AND ? ) > 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");
dateInput = "and (select count(1) from SER_REQ_FEEDBK f,SER_REQ_FEEDBKDTL fd where f.feedbk_id = fd.feedbk_id and fd.action_id = d.action_id and fd.action_code = d.action_code and f.req_id = h.req_id and f.execut_dt between ? AND ? ) > 0 ";
dateInput1 = "and (select count(1) from SER_REQ_FEEDBK f,SER_REQ_FEEDBKDTL fd where f.feedbk_id = fd.feedbk_id and fd.action_id = d.action_id and fd.action_code = d.action_code and f.ticket_no = h.ticket_no and f.execut_dt between ? AND ? ) > 0 ";
}
System.out.println("getWorkAlloSummary frmDateInTs :"+frmDateInTs +"---- toDateInTs :"+toDateInTs);
if( (empCode!=null && empCode.trim().length()>0) )
{
empCode = dashboardUtility.getCommaSeparated(empCode);
/**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," +
" 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 ((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,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 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_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_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 ,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+") ) "+ 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
if((empCode!=null && empCode.trim().length()>0) && ("Graph View".equalsIgnoreCase(dataProvider)))
{
empCode = dashboardUtility.getCommaSeparated(empCode);
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 ( "
......@@ -1213,8 +1142,8 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
/** End Modify Sql Add Ticket Condition by sachin on 20-Jan-16**/
pstmt = conn.prepareStatement(sql);
if(dateInput.trim().length()>0)
pstmt = conn.prepareStatement(sql);
if(dateInput.trim().length()>0)
{
pstmt.setTimestamp(1,frmDateInTs);
pstmt.setTimestamp(2,toDateInTs);
......@@ -1279,6 +1208,87 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
pstmt.close();
pstmt = null;
}
else
{
System.out.println("in work allocation for new dashboard");
/*
* version 1
* sql ="select trim(e.emp_fname) || ' '|| trim(e.emp_lname) as emp_name ,r.req_id ,r.dtl_descr as descr ,d.STDTIME,d.PLANSTDATE,d.PLANENDDATE, "
+ "( SELECT sum(fn_feedbk_time(fd.time_spent)) AS dd 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 = h.action_id AND "
+ "fd.action_code = d.action_code AND fh.emp_code = d.emp_code ) emp_time_spent, d.MSG_FOR_EMP "
+ "FROM ser_request r ,ser_req_act h ,ser_req_act_detl d, employee e WHERE d.action_id = h.action_id "
+ "and r.req_id = h.req_id and d.emp_code = e.emp_code and (d.emp_code in (( select EMP_CODE "
+ "FROM EMPLOYEE START WITH EMP_CODE in ("+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 in ( "+empCode+"))) and d.PLANSTDATE >= to_date(sysdate) - 3 and d.PLANENDDATE <= to_date(sysdate) + 6";
*/
sql = "select trim(e.emp_fname) || ' '|| trim(e.emp_lname) as emp_name ,(CASE WHEN H.TICKET_NO IS NULL "
+ " THEN H.REQ_ID ELSE H.TICKET_NO end) AS REQ_ID, case when h.ticket_no is null then r.dtl_descr "
+ " else ( select TICKET_DETAIL from service_complaint c where c.ticket_no = h.ticket_no) end "
+ " as dtl_descr,d.STDTIME,d.PLANSTDATE,d.PLANENDDATE, ( SELECT sum(fn_feedbk_time(fd.time_spent)) "
+ " AS dd 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 = h.action_id "
+ " AND fd.action_code = d.action_code AND fh.emp_code = d.emp_code ) emp_time_spent, d.MSG_FOR_EMP "
+ " FROM ser_request r ,ser_req_act h ,ser_req_act_detl d, employee e "
+ " WHERE d.action_id = h.action_id and r.req_id = h.req_id and d.emp_code = e.emp_code "
+ " 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 (to_date(d.PLANSTDATE)<= to_date(sysdate) +6 and to_date(d.PLANENDDATE) >= to_date(sysdate)-3 )";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
int count = 0;
String startDate="";
String endDate ="";
while (rs.next())
{
rowData = new JSONObject();
rowData.put("emp_name", checkNull(rs.getString("emp_name")));
rowData.put("req_no", checkNull(rs.getString("req_id")));
rowData.put("descr", checkNull(rs.getString("dtl_descr")));
rowData.put("stdtime", checkDouble(rs.getString("STDTIME")));
startDate =checkNull(rs.getString("PLANSTDATE"));
endDate =checkNull(rs.getString("PLANENDDATE"));
if(startDate !=null && startDate.trim().length()>0)
{
rowData.put("pln_strt_date", simpleDateFormat.format(convertToDbDate.parse(startDate)));
}
else
{
rowData.put("pln_strt_date",checkNull(rs.getString("PLANSTDATE")));
}
if(endDate !=null && endDate.trim().length()>0)
{
rowData.put("pln_end_date", simpleDateFormat.format(convertToDbDate.parse(endDate)));
}
else
{
rowData.put("pln_end_date",checkNull(rs.getString("PLANENDDATE")));
}
rowData.put("emp_hour_spent", checkDouble(rs.getString("emp_time_spent")));
rowData.put("msg_for_emp", checkNull(rs.getString("MSG_FOR_EMP")));
rowDataEmpWrkAllJson.put(count, rowData);
count++;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
} catch (Exception e)
{
e.printStackTrace();
......@@ -1582,7 +1592,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
*******/
@SuppressWarnings("unchecked")
@Override
public JSONObject getMissingFDBack(String fromDate, String toDate,String empCode,String dataSourceName) throws RemoteException, ITMException
public JSONObject getMissingFDBack(String fromDate, String toDate,String empCode,String dataProvider,String dataSourceName) throws RemoteException, ITMException
{
JSONObject rowDataMissingFeedbackJson = new JSONObject();
JSONObject rowData = null;
......@@ -1596,22 +1606,20 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
Timestamp toDateInTS= null;
List<String> executeDayList= new ArrayList<String>();
LinkedHashMap<String, List<String> > empMap = new LinkedHashMap<String, List<String>>();
List<String> empList= new ArrayList<String>();
DateFormat originalFormat = new SimpleDateFormat("dd/MM/yy");
List<String> empList= new ArrayList<String>();
int count=0;
List<String> valueList=null;
StringBuilder excDate=null;
String emp="";
String empName="";
String exeDate="";
SimpleDateFormat simpleDateFormat=null;
SimpleDateFormat convertToDbDate = null;
SimpleDateFormat sqlDateFormat = null;
try
{
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
//comment date
//simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
connDriver = null;
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
convrtToTimStmDate = new SimpleDateFormat( genericUtility.getDBDateFormat());
convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
......@@ -1631,33 +1639,20 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
}
else
{
/*Comment and change code for date format by Dhanendra on date 16-06-2016*/
//fromDateInTS =java.sql.Timestamp.valueOf(convrtToTimStmDate.format(originalFormat.parse(fromDate)).toString() + " 00:00:00.0");
//toDateInTS=java.sql.Timestamp.valueOf(convrtToTimStmDate.format(originalFormat.parse(toDate)).toString() + " 00:00:00.0");
fromDateInTS= 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");
}
System.out.println("getMissingFDBack fromDateInTS :"+fromDateInTS+"---- toDateInTS :"+toDateInTS);
if((fromDateInTS!=null && fromDateInTS.toString().length()>0)
&& (toDateInTS!=null && toDateInTS.toString().length()>0)
&& (empCode!=null && empCode.trim().length()>0) )
{
// sql="select mydate from (SELECT TO_DATE(?, 'DD/MM/YY') - 1 + rownum AS mydate " +" FROM all_objects " +" WHERE TO_DATE(?, 'DD/MM/YY') - 1 + rownum <= TO_DATE(?, 'DD/MM/YY') " +" ) " +" where mydate not in " +" ( " +" select hol_date from holiday where hol_date >= TO_DATE(?, 'DD/MM/YY') " +" and hol_date <= TO_DATE(?, 'DD/MM/YY') " +" )";
/*Start Modify By sachin on 13-Jan-16*/
if((fromDateInTS!=null && fromDateInTS.toString().length()>0) && (toDateInTS!=null && toDateInTS.toString().length()>0)&& (empCode!=null && empCode.trim().length()>0)&& ("Graph View".equalsIgnoreCase(dataProvider)))
{
System.out.println("inside if condition for executing old dashboard");
sql="select mydate from (SELECT TO_DATE(?, 'DD/MM/YY') - 1 + rownum AS mydate "
+" FROM all_objects " +" WHERE TO_DATE(?, 'DD/MM/YY') - 1 + rownum < TO_DATE(?, 'DD/MM/YY') " +" ) "
+" where mydate not in " +" ( " +" select hol_date from holiday where hol_date >= TO_DATE(?, 'DD/MM/YY') "
+" and hol_date <= TO_DATE(?, 'DD/MM/YY') " +" )";
/*End Modify By sachin on 13-Jan-16*/
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,fromDate);
......@@ -1695,7 +1690,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
while (rs.next())
{
empCode=((checkNull(rs.getString("emp_code"))).trim())+"@"+((checkNull(rs.getString("emp_name"))).trim());
String exeDate=(checkNull(rs.getString("execut_dt"))).trim();
exeDate=(checkNull(rs.getString("execut_dt"))).trim();
if(empMap.containsKey(empCode))
{
empList=empMap.get(empCode);
......@@ -1793,7 +1788,83 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
}
System.out.println("rowDataMissingFeedbackJson in missing feedback: "+rowDataMissingFeedbackJson);
}
//Here add new code for executing new dashboard for same
else
{
System.out.println("INSIDE ELSE CONDITION for new Missing feedback report");
sql = "select t.emp_code,t.emp_name,t.attd_date from table ( MissingFeedbackPackage.getMissingFeedbakList (?,?,?) ) t order by t.emp_code";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, fromDateInTS);
pstmt.setTimestamp(3, toDateInTS);
rs = pstmt.executeQuery();
count=0;
while (rs.next())
{
empCode = checkNull(rs.getString("emp_code")).trim()+"~"+checkNull(rs.getString("emp_name")).trim();
System.out.println("combination of employee name and code " + empCode);
exeDate = gridDateFormat.format(convrtToTimStmDate.parse(checkNull(rs.getString("attd_date")).trim()));
if(empMap.containsKey(empCode))
{
empList =empMap.get(empCode);
empList.add(exeDate);
empMap.put(empCode, empList);
}
else
{
empList=new ArrayList<String>();
empList.add(exeDate);
empMap.put(empCode, empList);
}
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
String object = "images"+ File.separator + "users";
for (String empCodeWithName : empMap.keySet())
{
System.out.println("employeeName is= : "+empCodeWithName);
excDate =new StringBuilder();
rowData = new JSONObject();
String empCodeWithNameArray[]=empCodeWithName.split("~");
System.out.println("empCodeWithNameArray[0] " + empCodeWithNameArray[0] + "empCodeWithNameArray[1] " + empCodeWithNameArray[1] );
String userImagePath = "/ibase/CustomMenuImageServlet?fldValue="+empCodeWithNameArray[0]+"&object="+object+"&objName="+object+"&ALT_FLD_VALUE="+empCodeWithNameArray[1];
String employee_image = "<img class='cardProdImg2' src='"+userImagePath+"'/>";
System.out.println("IMAGE PATH " +employee_image);
rowData.put("empName_image", employee_image);
rowData.put("emp_name", empCodeWithNameArray[1]+" ("+empCodeWithNameArray[0]+")");
if(excDate.length()==0)
{
excDate.append(empMap.get(empCodeWithName).toString());
}
else
{
excDate.append("; "+empMap.get(empCodeWithName).toString());
}
if(empMap.get(empCodeWithName).size()== 1)
{
rowData.put("missing_count",""+empMap.get(empCodeWithName).size()+" day");
}
else
{
rowData.put("missing_count",""+empMap.get(empCodeWithName).size()+" days");
}
rowData.put("missing_date", excDate.toString().replace("[", "").replace("]", ""));
rowDataMissingFeedbackJson.put(count, rowData);
count++;
}
}
} catch (Exception e)
{
e.printStackTrace();
......@@ -2029,6 +2100,97 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
/*Ended by swati for Pie chart Deviation on date : 30 Dec 2015*/
/**** End of getReqEfficiencySummaryPie() Method ***/
@SuppressWarnings("unchecked")
@Override
public JSONObject getTeamAttendanceDetails(String fromDate, String toDate, String empCode, String dataProvider,String dataSourceName ) throws RemoteException, ITMException
{
System.out.println("INSIDE getTeamAttendanceDetails");
JSONObject rowDataAttendanceDetails = new JSONObject();
JSONObject rowData = null;
String sql = "", empName="" ;
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
try {
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
if((empCode!=null && empCode.trim().length()>0)&& ("1".equalsIgnoreCase(dataProvider)))
{
System.out.println("inside getTeamAttendanceDetails");
empCode = dashboardUtility.getCommaSeparated(empCode);
sql = " select trim(e.emp_fname) || ' ' || trim(e.emp_lname) as emp_name,e.emp_code, in_time, out_time "
+" from attendance_day d, employee e "
+" where e.emp_code = d.emp_code and d.attd_date = to_date(sysdate ) "
+" 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+"))";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
int count=0;
String object = "images"+ File.separator + "users";
while (rs.next())
{
empCode = checkNull(rs.getString("emp_code"));
empName = checkNull(rs.getString("emp_name"));
String userImagePath = "/ibase/CustomMenuImageServlet?fldValue="+empCode+"&object="+object+"&objName="+object+"&ALT_FLD_VALUE="+empName;
String employee_image = "<img class='cardProdImg2' src='"+userImagePath+"'/>";
rowData = new JSONObject();
rowData.put("emp_name_ncode", checkNull(rs.getString("emp_name")).trim()+" ("+checkNull(rs.getString("emp_code")).trim()+")");
//rowData.put("emp_image", dashboardUtility.getDefaultIconImageUtility(checkNull(rs.getString("emp_name")).trim()));
rowData.put("emp_image", employee_image);
rowData.put("in_time", checkNull(rs.getString("in_time")).trim());
rowData.put("out_time", checkNull(rs.getString("out_time")).trim());
rowDataAttendanceDetails.put(count,rowData);
count++;
}
System.out.println("rowDataAttendanceDetails ==== " + rowDataAttendanceDetails);
rs.close();
rs=null;
pstmt.close();
pstmt=null;
}
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Exception in : EmployeeDashboard : getTeamAttendanceDetails() :" + e.getMessage());
throw new ITMException(e);
} finally{
try
{
if (conn != null)
{
if (rs != null)
rs.close();
rs = null;
if (pstmt != null)
pstmt.close();
pstmt = null;
conn.close();
conn = null;
}
conn = null;
} catch (Exception d)
{
d.printStackTrace();
System.out.println("Exception in : EmployeeDashboard : getTeamAttendanceDetails() :" + d.getMessage());
throw new ITMException(d);
}
}
return rowDataAttendanceDetails;
}
private String checkDouble(String str)
{
if (str == null)
......@@ -2039,6 +2201,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
return str;
}
}
}
}
\ No newline at end of file
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