Commit 4438d69d authored by dkasliwal's avatar dkasliwal

Create EJB and Servlet for Internal Efficiency Measurement Dashboard.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98902 ce508802-f39f-4f6c-b175-0d175dae99d5
parent de20c52e
package ibase.dashboard.iem.ejb;
import ibase.system.config.ConnDriver;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
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 javax.ejb.Stateless;
import org.json.simple.JSONObject;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedHashMap;
import java.util.List;
@Stateless
public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDashboardRemote
{
GenericUtility genericUtility = new GenericUtility();
SimpleDateFormat gridDateFormat=null;
SimpleDateFormat convrtToTimStmDate=null;
public ManagmentDashboard()
{
}
private String checkNull(String str)
{
if (str == null)
{
return "";
} else
{
return str;
}
}
@SuppressWarnings("unchecked")
@Override
public JSONObject getPendingReqSummary(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException
{
JSONObject rowDataPendingTaskJson = new JSONObject();
JSONObject rowData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
Timestamp frmDateInTs = null;
Timestamp toDateInTs = null;
ConnDriver connDriver = new ConnDriver();
SimpleDateFormat convertToDbDate = null;
SimpleDateFormat simpleDateFormat = null;
Calendar calendar=null;
String no_req="";
String std_comp_time ="", cnt_wrk_gng="", cnt_wit_prom="", del_dur_prd="", proms_dur_prd="", rece_dur_prd="", opening_request="";
try
{
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
rowData = new JSONObject();
convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals("")))
{
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
calendar = Calendar.getInstance();
System.out.println("In Management Dashboard Pending Request: ");
toDate = simpleDateFormat.format(calendar.getTime());
calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -12);
fromDate = simpleDateFormat.format(calendar.getTime());
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");
System.out.println("get default date ,when user dont enter date, From Date="+fromDate+"To Date="+toDate);
}
else
{
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");
System.out.println("Get Date : From Date: "+fromDate+" To Date: "+toDate);
}
/* Foe Opening Request * */
sql = "select count(1) opening_request from ser_request where req_date between ? and ? and emp_code__assign = ? and comp_stat <> 'C'";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, toDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData.put("openingrequest", checkNull(rs.getString("opening_request")));
}
pstmt.close();
pstmt = null;
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 = ?";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData.put("receiveduringprd", checkNull(rs.getString("rece_dur_prd")));
}
pstmt.close();
pstmt = null;
rs.close();
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 = ?";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData.put("promceduringprd", checkNull(rs.getString("proms_dur_prd")));
}
pstmt.close();
pstmt = null;
rs.close();
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'";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData.put("deliduringprd", checkNull(rs.getString("del_dur_prd")));
}
pstmt.close();
pstmt = null;
rs.close();
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";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData.put("cntwitpromise", checkNull(rs.getString("cnt_wit_prom")));
}
pstmt.close();
pstmt = null;
rs.close();
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 ? ";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, frmDateInTs);
pstmt.setTimestamp(3, toDateInTs);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData.put("cntwrkgoing", checkNull(rs.getString("cnt_wrk_gng")));
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
//--- 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 ";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData.put("totalmanhrs", checkNull(rs.getString("time_spent")));
rowData.put("estimatedmanhrs", checkNull(rs.getString("STD_COMP_TIME")));
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
//--- Closing Opening + received - delivered
sql = " select sum(no_request) as no_req from (select count(1) as no_request from ser_request where " +
" req_date between ? and ? and emp_code__assign = ? and comp_stat <> 'C' union all select count(1) " +
" from ser_request where req_date between ? and ? 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' )";
System.out.println("sql is in new Interface =" + sql);
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);
pstmt.setTimestamp(7, frmDateInTs);
pstmt.setTimestamp(8, toDateInTs);
pstmt.setString(9,empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData.put("noreq", checkNull(rs.getString("no_req")));
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
rowDataPendingTaskJson.put(Integer.valueOf(0), rowData);
System.out.println(" rowDataPendingTaskJson is =" + rowDataPendingTaskJson);
} catch (Exception e)
{
e.printStackTrace();
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 :TaskActivity:getPendingReqSummary():" + d.getMessage());
throw new ITMException(d);
}
}
return rowDataPendingTaskJson;
}
@SuppressWarnings("unchecked")
@Override
public JSONObject getPendingReqSummaryGrpah(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException
{
JSONObject rowDataPendingTaskJson = new JSONObject();
JSONObject rowData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
Timestamp frmDateInTs = null;
Timestamp toDateInTs = null;
ConnDriver connDriver = new ConnDriver();
SimpleDateFormat convertToDbDate = null;
SimpleDateFormat simpleDateFormat = null;
Calendar calendar=null;
String no_req="";
int count=0;
try
{
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
rowData = new JSONObject();
convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals("")))
{
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
calendar = Calendar.getInstance();
System.out.println("In Management Dashboard Pending Request Graph: ");
toDate = simpleDateFormat.format(calendar.getTime());
calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
fromDate = simpleDateFormat.format(calendar.getTime());
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");
System.out.println("get default date ,when user not entering date from GUI in TS format: From Date="+frmDateInTs+"To Date="+toDateInTs);
}
else
{
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");
System.out.println("Get Date from input in TS format : From Date: "+frmDateInTs+" To Date: "+toDateInTs);
}
/* Foe Opening Request * */
sql = "select count(1) opening_request from ser_request where req_date between ? and ? and emp_code__assign = ? and comp_stat <> 'C'";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, toDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData.put("descr","Opening Req" );
rowData.put("count",checkNull(rs.getString("opening_request")) );
rowDataPendingTaskJson.put(count, rowData);
count++;
}
pstmt.close();
pstmt = null;
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 = ?";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData = new JSONObject();
rowData.put("descr","Received During This Period" );
rowData.put("count",checkNull(rs.getString("rece_dur_prd")) );
rowDataPendingTaskJson.put(count, rowData);
count++;
}
pstmt.close();
pstmt = null;
rs.close();
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 = ?";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData = new JSONObject();
rowData.put("descr","Promised During This Period" );
rowData.put("count",checkNull(rs.getString("proms_dur_prd")) );
rowDataPendingTaskJson.put(count, rowData);
count++;
}
pstmt.close();
pstmt = null;
rs.close();
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'";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData = new JSONObject();
rowData.put("descr","Delivered During This Period" );
rowData.put("count",checkNull(rs.getString("del_dur_prd")) );
rowDataPendingTaskJson.put(count, rowData);
count++;
}
pstmt.close();
pstmt = null;
rs.close();
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";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData = new JSONObject();
rowData.put("descr","Without Promised Date" );
rowData.put("count",checkNull(rs.getString("cnt_wit_prom")) );
rowDataPendingTaskJson.put(count, rowData);
count++;
}
pstmt.close();
pstmt = null;
rs.close();
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 ? ";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, frmDateInTs);
pstmt.setTimestamp(3, toDateInTs);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData = new JSONObject();
rowData.put("descr","Work Going On" );
rowData.put("count",checkNull(rs.getString("cnt_wrk_gng")) );
rowDataPendingTaskJson.put(count, rowData);
count++;
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
//--- 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 ";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode);
rs = pstmt.executeQuery();
String time_spnet="",STD_COMP_TIME="";
if (rs.next())
{
time_spnet=checkNull(rs.getString("time_spent"));
STD_COMP_TIME=checkNull(rs.getString("STD_COMP_TIME"));
}
rowData = new JSONObject();
rowData.put("descr","Total Man Houres" );
rowData.put("count",(time_spnet=="" ? 0 : time_spnet) );
rowDataPendingTaskJson.put(count, rowData);
count++;
rowData = new JSONObject();
rowData.put("descr","Estimated Man Hours" );
rowData.put("count",(STD_COMP_TIME=="" ? 0 : STD_COMP_TIME));
rowDataPendingTaskJson.put(count, rowData);
count++;
pstmt.close();
pstmt = null;
rs.close();
rs = null;
//--- Closing Opening + received - delivered
sql = " select sum(no_request) as no_req from (select count(1) as no_request from ser_request where " +
" req_date between ? and ? and emp_code__assign = ? and comp_stat <> 'C' union all select count(1) " +
" from ser_request where req_date between ? and ? 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' )";
System.out.println("sql is in new Interface =" + sql);
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);
pstmt.setTimestamp(7, frmDateInTs);
pstmt.setTimestamp(8, toDateInTs);
pstmt.setString(9,empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
rowData = new JSONObject();
rowData.put("descr","Closed Request" );
rowData.put("count",checkNull(rs.getString("no_req")) );
rowDataPendingTaskJson.put(count, rowData);
count++;
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
System.out.println(" rowDataPendingTaskJson is =" + rowDataPendingTaskJson);
} catch (Exception e)
{
e.printStackTrace();
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 :TaskActivity:getPendingReqSummary():" + d.getMessage());
throw new ITMException(d);
}
}
return rowDataPendingTaskJson;
}
@SuppressWarnings("unchecked")
@Override
public JSONObject getWorkAlloSummary(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException
{
JSONObject rowDataEmpWrkAllJson = new JSONObject();
JSONObject rowData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
Timestamp frmDateInTs=null;
Timestamp toDateInTs=null;
SimpleDateFormat convertToDbDate=null;
SimpleDateFormat simpleDateFormat=null;
Calendar calendar=null;
try
{
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
System.out.println("In Management Dashboard Work Allocation: ");
if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals("")))
{
simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
calendar = Calendar.getInstance();
//calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
toDate = simpleDateFormat.format(calendar.getTime());
calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
fromDate = simpleDateFormat.format(calendar.getTime());
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");
System.out.println("get default date ,when user not entering date from GUI in TS format: From Date="+frmDateInTs+"To Date="+toDateInTs);
}
else
{
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");
System.out.println("Get Date from input in TS format : From Date: "+frmDateInTs+" To Date: "+toDateInTs);
}
simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
System.out.println("get default date ,when user not entering date from GUI in TS format: From Date="+frmDateInTs+"To Date="+toDateInTs);
sql = " SELECT E.EMP_FNAME || ' ' || E.EMP_LNAME EMPLOYEE ,I.REQ_ID, I.DTL_DESCR AS REQ_DESCR, "
+" I.CUST_CODE, I.CUST_NAME, SUM(I.TIME_SPENT) as 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, "
+" c.cust_code, c.cust_name,r.dtl_descr, "
// +"-- fn_feedbk_time(sum(d.time_spent)) time_spent, "
+" (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,d.STD_TIME,d.ACTION_DETL, "
+" (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 "
+" from ser_request r, customer c, ser_req_act h, ser_req_act_detl d "
//+"---,SER_REQ_FEEDBKDTL fd,SER_REQ_FEEDBK fh "
+" where d.action_id = h.action_id "
+" and r.req_id = h.req_id "
+" AND R.CUST_CODE = C.CUST_CODE "
/*((r.emp_code__assign in (select emp_code FROM EMPLOYEE START WITH EMP_CODE = 'BE001'
* 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='BE001' )
* */
+" and to_date(h.TRAN_DATE) >= ? " //--:from_date
+" AND TO_DATE(H.TRAN_DATE) <= ? " //--:to_date
+" 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 E.EMP_FNAME || ' ' || E.EMP_LNAME,I.REQ_ID ";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
//pstmt.setString(1,empCode);
pstmt.setTimestamp(1,frmDateInTs);
pstmt.setTimestamp(2,toDateInTs);
rs = pstmt.executeQuery();
int count = 0;
while (rs.next())
{
rowData = new JSONObject();
rowData.put("employee", checkNull(rs.getString("EMPLOYEE")));
rowData.put("req_no", checkNull(rs.getString("REQ_ID")));
rowData.put("descr", checkNull(rs.getString("REQ_DESCR")));
rowData.put("client", checkNull(rs.getString("CUST_NAME")));
String startDate =checkNull(rs.getString("PLAN_START_DATE"));
String endDate =checkNull(rs.getString("PLAN_END_DATE"));
String actStartDate =checkNull(rs.getString("ACT_START_DATE"));
System.out.println("endDate in Date format :"+rs.getDate("PLAN_START_DATE"));
if(!startDate.equals(null) && startDate.trim().length()>0)
{
System.out.println("endDate in if :"+startDate);
rowData.put("pln_strt_date", simpleDateFormat.format(convertToDbDate.parse(startDate)));
}
else
{
rowData.put("pln_strt_date",checkNull(rs.getString("PLAN_START_DATE")));
}
if(!endDate.equals(null) && endDate.trim().length()>0)
{
System.out.println("endDate in if :"+endDate);
rowData.put("pln_end_date", simpleDateFormat.format(convertToDbDate.parse(endDate)));
rowData.put("exp_cmplt_date", simpleDateFormat.format(convertToDbDate.parse(endDate)));
}
else
{
rowData.put("pln_end_date",checkNull(rs.getString("PLAN_END_DATE")));
rowData.put("exp_cmplt_date",checkNull(rs.getString("PLAN_END_DATE")));
}
if(!actStartDate.equals(null) && actStartDate.trim().length()>0)
{
System.out.println("endDate in if :"+actStartDate);
rowData.put("act_strt_date", simpleDateFormat.format(convertToDbDate.parse(actStartDate)));
}
else
{
rowData.put("act_strt_date",checkNull(rs.getString("ACT_START_DATE")));
}
rowData.put("man_days_spent",String.format("%.2f",(Double.parseDouble(checkDouble(rs.getString("time_spent"))))/8));
rowData.put("act_descr", checkNull(rs.getString("ACTION_DETL")));
rowData.put("est_man_hour", checkNull(rs.getString("STD_TIME")));
rowData.put("hour_spent", checkNull(rs.getString("time_spent")));
rowDataEmpWrkAllJson.put(Integer.valueOf(count), rowData);
count++;
}
System.out.println(" rowDataEmpWrkAllJson is =" + rowDataEmpWrkAllJson);
} catch (Exception e)
{
e.printStackTrace();
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 : ManagmentDashboard : getEmpWorkAllocation() :" + d.getMessage());
throw new ITMException(d);
}
}
return rowDataEmpWrkAllJson;
}
@SuppressWarnings("unchecked")
@Override
public JSONObject getReqEfficiencySummary(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException
{
JSONObject rowDataEmpReqEffJson = new JSONObject();
JSONObject rowData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
Timestamp fromDateInTS=null;
Timestamp toDateInTS=null;
double deviation=0.0,stdTime=0.0,actTime=0.0;
double totDeviation=0.0,totStdTime=0.0,totActTime=0.0;
int onTimeCtr=0,posTimeCtr=0,negTimeCtr=0;
SimpleDateFormat simpleDateFormat = null;
SimpleDateFormat convertToDbDate=null;
Calendar calendar=null;
try
{
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
System.out.println("In Management Dashboard Req Efficiency: ");
if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals("")))
{
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
calendar = Calendar.getInstance();
toDate = simpleDateFormat.format(calendar.getTime());
calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -7);
fromDate = simpleDateFormat.format(calendar.getTime());
fromDateInTS = 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");
System.out.println("get default date ,when user dnt enter date : From Date="+fromDate+"To Date="+toDate);
}
else
{
fromDateInTS = 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");
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
fromDateInTS = 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");
System.out.println("Get Date : From Date: "+fromDate+" To Date: "+toDate);
}
sql = "SELECT r.comp_stat_dt,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 )) 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 <= ? "//--?
/*((r.emp_code__assign in (select emp_code FROM EMPLOYEE START WITH EMP_CODE = 'BE001'
* 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='BE001' )
* */
+" group by r.req_id,r.dtl_descr, ad.action_detl, e.emp_fname || ' ' || e.emp_lname, ad.STD_TIME ,r.comp_stat_dt " +
" order by r.comp_stat_dt desc ";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,fromDateInTS);
pstmt.setTimestamp(2,toDateInTS);
//pstmt.setString(3,empCode);
rs = pstmt.executeQuery();
int count = 0;
while (rs.next())
{
rowData = new JSONObject();
stdTime=Double.parseDouble(checkDouble(rs.getString("STD_TIME")));
actTime=Double.parseDouble(checkDouble(rs.getString("ACTUAL_TIME")));
deviation=Math.round(actTime - stdTime);
totDeviation=totDeviation+deviation;
totStdTime=totStdTime+stdTime;
totActTime=totActTime+actTime;
rowData.put("employee", checkNull(rs.getString("EMP_NAME")));
rowData.put("req_id", checkNull(rs.getString("REQ_ID")));
rowData.put("descr", checkNull(rs.getString("DTL_DESCR")));
rowData.put("act_descr", checkNull(rs.getString("ACTION_DETL")));
rowData.put("est_man_hour", checkNull(rs.getString("STD_TIME")));
rowData.put("act_man_hour", checkNull(rs.getString("ACTUAL_TIME")));
rowData.put("deviation", ""+deviation);
String comp_stat_dt=checkNull(rs.getString("comp_stat_dt"));
if(!comp_stat_dt.equals(null) && comp_stat_dt.trim().length()>0)
{
System.out.println("endDate in if :"+comp_stat_dt);
rowData.put("dlv_date", simpleDateFormat.format(convertToDbDate.parse(comp_stat_dt)));
}
else
{
rowData.put("dlv_date",checkNull(rs.getString("comp_stat_dt")));
}
if(deviation==0.0)
{
onTimeCtr++;
}
else if(deviation>0.0)
{
posTimeCtr++;
}
else if(deviation<0.0)
{
negTimeCtr++;
}
rowData.put("tot_deviation", "");
rowData.put("time_lag", "");
rowData.put("time_lag_descr", "");
rowDataEmpReqEffJson.put(Integer.valueOf(count), rowData);
count++;
}
rowData = new JSONObject();
rowData.put("employee", "");
rowData.put("req_id", "");
rowData.put("descr", "");
rowData.put("act_descr", "");
rowData.put("est_man_hour", "");
rowData.put("act_man_hour", "");
rowData.put("deviation", "");
rowData.put("tot_deviation", totDeviation);
rowData.put("tot_descr", "Deviation");
rowData.put("time_lag", onTimeCtr);
rowData.put("time_lag_descr", "On Time");
rowDataEmpReqEffJson.put(Integer.valueOf(count), rowData);
count++;
rowData = new JSONObject();
rowData.put("employee", "");
rowData.put("req_id", "");
rowData.put("descr", "");
rowData.put("act_descr", "");
rowData.put("est_man_hour", "");
rowData.put("act_man_hour", "");
rowData.put("deviation", "");
rowData.put("tot_deviation", totActTime);
rowData.put("tot_descr", "Actual Man Hour");
rowData.put("time_lag", posTimeCtr);
rowData.put("time_lag_descr", "Extra Time");
rowDataEmpReqEffJson.put(Integer.valueOf(count), rowData);
count++;
rowData = new JSONObject();
rowData.put("employee", "");
rowData.put("req_id", "");
rowData.put("descr", "");
rowData.put("act_descr", "");
rowData.put("est_man_hour", "");
rowData.put("act_man_hour", "");
rowData.put("deviation", "");
rowData.put("tot_deviation", totStdTime);
rowData.put("tot_descr", "Estimated Man Hour");
rowData.put("time_lag", negTimeCtr);
rowData.put("time_lag_descr", "Before Time");
rowDataEmpReqEffJson.put(Integer.valueOf(count), rowData);
System.out.println("tot_deviation value in mangemnet dashboard in getReqEfficiencySummary(): ");
System.out.println("onTimeCtr: "+onTimeCtr);
System.out.println("posTimeCtr: "+posTimeCtr);
System.out.println("negTimeCtr: "+negTimeCtr);
System.out.println(" rowDataEmpReqEffJson is =" + rowDataEmpReqEffJson);
} catch (Exception e)
{
e.printStackTrace();
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 : ManagmentDashboard : getEmpReqEfficiency() :" + d.getMessage());
throw new ITMException(d);
}
}
return rowDataEmpReqEffJson;
}
@SuppressWarnings("unchecked")
@Override
public JSONObject getMissingFDBack(String fromDate, String toDate,String empCode,String dataSourceName) throws RemoteException, ITMException
{
JSONObject rowDataMissingFeedbackJson = new JSONObject();
JSONObject rowData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
Calendar calendar=null;
Timestamp fromDateInTS=null;
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");
String preEmpCode="";
int count=0;
List<String> valueList=null;
StringBuilder excDate=null;
String emp="";
String empName="";
SimpleDateFormat simpleDateFormat=null;
SimpleDateFormat convertToDbDate = null;
try
{
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
convrtToTimStmDate = new SimpleDateFormat( genericUtility.getDBDateFormat());
convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
gridDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
System.out.println("In Employee Dashboard Missing FeedBack: ");
if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals("")))
{
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
calendar = Calendar.getInstance();
toDate = simpleDateFormat.format(calendar.getTime());
calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -7);
fromDate = simpleDateFormat.format(calendar.getTime());
fromDateInTS = 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");
System.out.println("get default date ,when user dnt enter date : From Date="+fromDate+"To Date="+toDate);
}
else
{
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");
System.out.println("Get Date from input : From Date: "+fromDate+" To Date: "+toDate);
}
if(empCode!=null && empCode.trim().length()>0)
{
sql=" select distinct b.execut_dt,to_char(b.execut_dt,'day') as day "
+" from ser_req_feedbkdtl a, ser_req_feedbk b, ser_request "
+" WHERE A.FEEDBK_ID = B.FEEDBK_ID AND A.REQ_ID = SER_REQUEST.REQ_ID "
+" 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 trim(to_char(b.execut_dt,'day')) NOT in ('saturday','sunday') "
+" order by b.execut_dt ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,fromDate);
pstmt.setString(2,toDate);
rs = pstmt.executeQuery();
while (rs.next())
{
executeDayList.add(checkNull(rs.getString("execut_dt")));
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
System.out.println("executeDayList: "+executeDayList);
sql=" select c.emp_fname || ' ' || c.emp_lname || '' emp_name, c.emp_code emp_code ,b.execut_dt as execut_dt "
+" 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 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 ) ) "
+" order by emp_name,b.execut_dt ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,fromDate);
pstmt.setString(2,toDate);
pstmt.setString(3,empCode);
//pstmt.setTimestamp(2,toDateInTS);
rs = pstmt.executeQuery();
while (rs.next())
{
empCode=((checkNull(rs.getString("emp_code"))).trim())+"@"+((checkNull(rs.getString("emp_name"))).trim());
String exeDate=(checkNull(rs.getString("execut_dt"))).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);
}
}
System.out.println("empMap in feddback missing: "+empMap);
rs.close();
pstmt.close();
int cnt=0;
for (String keyMap : empMap.keySet())
{
excDate=new StringBuilder();
valueList = new ArrayList<String>();
valueList = empMap.get(keyMap);
rowData = new JSONObject();
String[] temp = keyMap.split("@");
emp= temp[0];
empName= temp[1];
for(int keyCtr=0;keyCtr<executeDayList.size();keyCtr++)
{
if(!valueList.contains(executeDayList.get(keyCtr)))
{
cnt++;
rowData.put("emp_code", emp);
rowData.put("emp_name", empName);
if(excDate.length()==0)
{
excDate.append(gridDateFormat.format(convrtToTimStmDate.parse(executeDayList.get(keyCtr))));
}
else
{
excDate.append("; "+gridDateFormat.format(convrtToTimStmDate.parse(executeDayList.get(keyCtr))));
}
}
}
rowData.put("missing_date",excDate.toString() );
rowDataMissingFeedbackJson.put(count, rowData);
count++;
}
}
System.out.println(" rowDataMissingFeedbackJson is =" + rowDataMissingFeedbackJson);
} catch (Exception e)
{
e.printStackTrace();
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 : getEmpMissingFDBack() :" + d.getMessage());
throw new ITMException(d);
}
}
return rowDataMissingFeedbackJson;
}
private String checkDouble(String str)
{
if (str == null)
{
return "0.0";
} else
{
return str;
}
}
}
\ No newline at end of file
package ibase.dashboard.iem.ejb;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import org.json.simple.JSONObject;
@javax.ejb.Local
public interface ManagmentDashboardLocal
{
public JSONObject getPendingReqSummary(String dataSourceName, String empCode, String frmDate, String toDate) throws RemoteException, ITMException;
public JSONObject getWorkAlloSummary(String dataSourceName, String empCode, String frmDate, String toDate) throws RemoteException, ITMException;
public JSONObject getReqEfficiencySummary(String dataSourceName, String empCode, String frmDate, String toDate) throws RemoteException, ITMException;
public JSONObject getPendingReqSummaryGrpah(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException;
public JSONObject getMissingFDBack(String fromDate, String toDate,String empCode,String dataSourceName) throws RemoteException, ITMException;
}
package ibase.dashboard.iem.ejb;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import org.json.simple.JSONObject;
@javax.ejb.Remote
public interface ManagmentDashboardRemote
{
public JSONObject getPendingReqSummary(String dataSourceName,String empCode,String frmDate,String toDate) throws RemoteException, ITMException;
public JSONObject getWorkAlloSummary(String dataSourceName, String empCode, String frmDate, String toDate) throws RemoteException, ITMException;
public JSONObject getReqEfficiencySummary(String dataSourceName, String empCode, String frmDate, String toDate) throws RemoteException, ITMException;
public JSONObject getPendingReqSummaryGrpah(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException;
public JSONObject getMissingFDBack(String fromDate, String toDate,String empCode,String dataSourceName) throws RemoteException, ITMException;
}
package ibase.dashboard.iem.servlet;
import ibase.dashboard.iem.ejb.ManagmentDashboardRemote;
import ibase.system.config.AppConnectParm;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
import javax.servlet.http.HttpSession;
public class MissingFDBackServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
ManagmentDashboardRemote mgmDashBoardRmt = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String empCode = "",dataSourceName="",toDate="",fromDate="";
try
{
response.setContentType("application/xml");
//HttpSession session = request.getSession(true);
//ibase.utility.UserInfoBean userInfo = (ibase.utility.UserInfoBean) session.getAttribute("USER_INFO");
//loginId = userInfo.getEmpCode();
/*if(loginId==null ||loginId=="" )
{
loginId="CPATIL";
}*/
empCode="BE662";
dataSourceName =request.getParameter("dataSourceName");
fromDate = request.getParameter("frmDate");
toDate = request.getParameter("toDate");
System.out.println( "loginId is =" + empCode );
context = new InitialContext(appConnectParm.getProperty());
mgmDashBoardRmt = (ManagmentDashboardRemote)context.lookup("ibase/ManagmentDashboard/remote");
JSONObject jsonObjData = (JSONObject)mgmDashBoardRmt.getMissingFDBack(fromDate,toDate,empCode,dataSourceName);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
outputStream.close();
System.out.println(" Final data set for MissingFDBackServlet build the Graph is===" + jsonObjData);
} catch (Exception e)
{
System.out.println("Exception :ibase.dashboard.iem.servlet: MissingFDBackServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ No newline at end of file
package ibase.dashboard.iem.servlet;
import ibase.dashboard.iem.ejb.ManagmentDashboardRemote;
import ibase.system.config.AppConnectParm;
import ibase.utility.UserInfoBean;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
import javax.servlet.http.HttpSession;
public class PendingReqSummaryGraphServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
ManagmentDashboardRemote mangmntDashboardRmt = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String dataSourceName = "";
String empCode = "";
String frmDate = "";
String toDate = "";
String projectmngr = "";
UserInfoBean userInfo = null;
HttpSession session = null;
try
{
System.out.println("in PendingReqSummaryGraphServlet ");
response.setContentType("application/xml");
context = new InitialContext(appConnectParm.getProperty());
projectmngr = request.getParameter("projMngr");
System.out.println(" projectmngr from drop down is="+projectmngr);
if (projectmngr == null || projectmngr.trim().length()== 0)
{
//session = request.getSession(true);
//userInfo = (UserInfoBean) session.getAttribute("USER_INFO");
//projectmngr = userInfo.getEmpCode();
}
System.out.println(" projectmngr comming from session ="+projectmngr);
frmDate = request.getParameter("frmDate");
toDate = request.getParameter("toDate");
dataSourceName = request.getParameter("dataSourceName");
System.out.println("projectmngr= " + projectmngr + " from data =" + frmDate + " to date =" + toDate + " projectmngr =" + projectmngr);
context = new InitialContext(appConnectParm.getProperty());
mangmntDashboardRmt = (ManagmentDashboardRemote) context.lookup("ibase/ManagmentDashboard/remote");
JSONObject jsonObjData = (JSONObject) mangmntDashboardRmt.getPendingReqSummaryGrpah(dataSourceName, projectmngr, frmDate, toDate);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
outputStream.close();
System.out.println(" Final data set for PendingReqSummaryGraphServlet build the Graph is===" + jsonObjData);
} catch (Exception e)
{
System.out.println("Exception :ibase.dashboard.iem.servlet: PendingReqSummaryGraphServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ No newline at end of file
package ibase.dashboard.iem.servlet;
import ibase.dashboard.iem.ejb.ManagmentDashboardRemote;
import ibase.system.config.AppConnectParm;
import ibase.utility.UserInfoBean;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
import javax.servlet.http.HttpSession;
public class PendingReqSummaryServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
ManagmentDashboardRemote mangmntDashboardRmt = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String dataSourceName = "";
String empCode = "";
String frmDate = "";
String toDate = "";
String projectmngr = "";
UserInfoBean userInfo = null;
HttpSession session = null;
try
{
System.out.println("in PendingReqSummaryServlet ");
response.setContentType("application/xml");
context = new InitialContext(appConnectParm.getProperty());
projectmngr = request.getParameter("projMngr");
System.out.println(" projectmngr from drop down is="+projectmngr);
if (projectmngr == null || projectmngr.trim().length()== 0)
{
//session = request.getSession(true);
//userInfo = (UserInfoBean) session.getAttribute("USER_INFO");
//projectmngr = userInfo.getEmpCode();
}
System.out.println(" projectmngr comming from session ="+projectmngr);
frmDate = request.getParameter("frmDate");
toDate = request.getParameter("toDate");
dataSourceName = request.getParameter("dataSourceName");
System.out.println("projectmngr= " + projectmngr + " from data =" + frmDate + " to date =" + toDate + " projectmngr =" + projectmngr);
context = new InitialContext(appConnectParm.getProperty());
mangmntDashboardRmt = (ManagmentDashboardRemote) context.lookup("ibase/ManagmentDashboard/remote");
JSONObject jsonObjData = (JSONObject) mangmntDashboardRmt.getPendingReqSummary(dataSourceName, projectmngr, frmDate, toDate);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
outputStream.close();
System.out.println(" Final data set for TaskActivityServlet build the Graph is===" + jsonObjData);
} catch (Exception e)
{
System.out.println("Exception :ibase.dashboard.iem.servlet: PendingReqSummaryServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ No newline at end of file
package ibase.dashboard.iem.servlet;
import ibase.dashboard.iem.ejb.ManagmentDashboardRemote;
import ibase.system.config.AppConnectParm;
import ibase.utility.UserInfoBean;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.json.simple.JSONObject;
public class ReqEfficiencySummaryServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
ManagmentDashboardRemote mangmntDashboardRmt = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
UserInfoBean userInfo = null;
HttpSession session = null;
String dataSourceName = "";
String frmDate = "";
String toDate = "";
String projectmngr = "";
try
{
System.out.println("in ReqEfficiencySummaryServlet ");
response.setContentType("application/xml");
context = new InitialContext(appConnectParm.getProperty());
frmDate = request.getParameter("frmDate");
toDate = request.getParameter("toDate");
dataSourceName = request.getParameter("dataSourceName");
projectmngr = request.getParameter("projMngr");
System.out.println(" projectmngr from drop down is="+projectmngr);
if (projectmngr == null || projectmngr.trim().length() == 0)
{
//session = request.getSession(true);
//userInfo = (UserInfoBean) session.getAttribute("USER_INFO");
//projectmngr = userInfo.getEmpCode();
}
System.out.println(" projectmngr from session is ="+projectmngr);
System.out.println("projectmngr= "+projectmngr + " from data ="+ frmDate +" to date ="+toDate +" projectmngr ="+projectmngr);
context = new InitialContext(appConnectParm.getProperty());
mangmntDashboardRmt = (ManagmentDashboardRemote) context.lookup("ibase/ManagmentDashboard/remote");
JSONObject jsonObjData = (JSONObject) mangmntDashboardRmt.getReqEfficiencySummary(dataSourceName, projectmngr, frmDate, toDate);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
outputStream.close();
System.out.println(" Final data set for ReqEfficiencySummaryServlet build the Graph is===" + jsonObjData);
} catch (Exception e)
{
System.out.println("Exception :ibase.dashboard.iem.servlet: ReqEfficiencySummaryServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ No newline at end of file
package ibase.dashboard.iem.servlet;
import ibase.dashboard.iem.ejb.ManagmentDashboardRemote;
import ibase.system.config.AppConnectParm;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
public class TodayAttendanceServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
ManagmentDashboardRemote tmanagemnetRptRemote = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String jsnData = "";
try
{
System.out.println("in SaveGanttServlet " );
response.setContentType("application/xml");
jsnData = request.getParameter("jsnData");
context = new InitialContext(appConnectParm.getProperty());
tmanagemnetRptRemote = (ManagmentDashboardRemote) context.lookup("ibase/ManagmentDashboard/remote");
System.out.println("jsnData ="+jsnData);
} catch (Exception e)
{
System.out.println("Exception :ibase.dashboard.iem.servlet: TodayAttendanceServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ No newline at end of file
package ibase.dashboard.iem.servlet;
import ibase.dashboard.iem.ejb.ManagmentDashboardRemote;
import ibase.system.config.AppConnectParm;
import ibase.utility.UserInfoBean;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.json.simple.JSONObject;
public class WorkAlloSummaryServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
ManagmentDashboardRemote mangmntDashboardRmt = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String dataSourceName = "";
String frmDate = "";
String toDate = "";
String projectmngr = "";
UserInfoBean userInfo = null;
HttpSession session = null;
try
{
System.out.println("in WorkAlloSummaryServlet ");
response.setContentType("application/xml");
context = new InitialContext(appConnectParm.getProperty());
frmDate = request.getParameter("frmDate");
toDate = request.getParameter("toDate");
dataSourceName = request.getParameter("dataSourceName");
projectmngr = request.getParameter("projMngr");
System.out.println(" projectmngr from drop down is="+projectmngr);
if (projectmngr == null || projectmngr.trim().length() == 0)
{
//session = request.getSession(true);
//userInfo = (UserInfoBean) session.getAttribute("USER_INFO");
//projectmngr = userInfo.getEmpCode();
}
System.out.println(" projectmngr from session is ="+projectmngr);
System.out.println("projectmngr= "+projectmngr + " from data ="+ frmDate +" to date ="+toDate +" projectmngr ="+projectmngr);
context = new InitialContext(appConnectParm.getProperty());
mangmntDashboardRmt = (ManagmentDashboardRemote) context.lookup("ibase/ManagmentDashboard/remote");
JSONObject jsonObjData = (JSONObject) mangmntDashboardRmt.getWorkAlloSummary(dataSourceName, projectmngr, frmDate, toDate);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
outputStream.close();
System.out.println(" Final data set for WorkAlloSummaryServlet build the Graph is===" + jsonObjData);
} catch (Exception e)
{
System.out.println("Exception :ibase.dashboard.iem.servlet: WorkAlloSummaryServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ 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