Commit 0533c50d authored by sbade's avatar sbade

Created new different method for pie chart to resolve 3 row issue


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99572 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0b51f2bf
...@@ -38,7 +38,12 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -38,7 +38,12 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
} }
} }
/**** Start Of getPendingReqSummary() Method
* Method Name : getPendingReqSummary (String dataSourceName, String empCode, String fromDate, String toDate)
* Metadata Xml : management.xml
* Servlet Name : PendingReqSummaryServlet
*
*******/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public JSONObject getPendingReqSummary(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException public JSONObject getPendingReqSummary(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException
...@@ -280,14 +285,21 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -280,14 +285,21 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
} catch (Exception d) } catch (Exception d)
{ {
d.printStackTrace(); d.printStackTrace();
System.out.println("Exception in :TaskActivity:getPendingReqSummary():" + d.getMessage()); System.out.println("Exception in :TaskActivity: getPendingReqSummary() :" + d.getMessage());
throw new ITMException(d); throw new ITMException(d);
} }
} }
return rowDataPendingTaskJson; return rowDataPendingTaskJson;
} }
/**** End of getPendingReqSummary() Method ***/
/**** Start Of getPendingReqSummaryGrpah() Method
* Method Name : getPendingReqSummaryGrpah (String dataSourceName, String empCode, String fromDate, String toDate)
* Metadata Xml : management.xml
* Servlet Name : PendingReqSummaryGraphServlet
*
*******/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public JSONObject getPendingReqSummaryGrpah(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException public JSONObject getPendingReqSummaryGrpah(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException
...@@ -350,7 +362,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -350,7 +362,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
rowData.put("descr","Opening Req" ); rowData.put("descr","Opening Request" );
rowData.put("count",checkNull(rs.getString("opening_request")) ); rowData.put("count",checkNull(rs.getString("opening_request")) );
rowDataPendingTaskJson.put(count, rowData); rowDataPendingTaskJson.put(count, rowData);
count++; count++;
...@@ -371,7 +383,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -371,7 +383,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
if (rs.next()) if (rs.next())
{ {
rowData = new JSONObject(); rowData = new JSONObject();
rowData.put("descr","Received During This Period" ); rowData.put("descr","Received" );
rowData.put("count",checkNull(rs.getString("rece_dur_prd")) ); rowData.put("count",checkNull(rs.getString("rece_dur_prd")) );
rowDataPendingTaskJson.put(count, rowData); rowDataPendingTaskJson.put(count, rowData);
count++; count++;
...@@ -393,7 +405,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -393,7 +405,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
if (rs.next()) if (rs.next())
{ {
rowData = new JSONObject(); rowData = new JSONObject();
rowData.put("descr","Promised During This Period" ); rowData.put("descr","Promised" );
rowData.put("count",checkNull(rs.getString("proms_dur_prd")) ); rowData.put("count",checkNull(rs.getString("proms_dur_prd")) );
rowDataPendingTaskJson.put(count, rowData); rowDataPendingTaskJson.put(count, rowData);
count++; count++;
...@@ -416,7 +428,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -416,7 +428,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
if (rs.next()) if (rs.next())
{ {
rowData = new JSONObject(); rowData = new JSONObject();
rowData.put("descr","Delivered During This Period" ); rowData.put("descr","Delivered" );
rowData.put("count",checkNull(rs.getString("del_dur_prd")) ); rowData.put("count",checkNull(rs.getString("del_dur_prd")) );
rowDataPendingTaskJson.put(count, rowData); rowDataPendingTaskJson.put(count, rowData);
count++; count++;
...@@ -475,7 +487,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -475,7 +487,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
//--- Total man hours spent on completed request //--- Total man hours spent on completed request
//--- Estimated man hours for the 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 "; sql = " select nvl(fn_feedbk_time(sum(d.time_spent)),'0') as time_spent,nvl(r.STD_COMP_TIME,'0') as STD_COMP_TIME from ser_request r, SER_REQ_FEEDBKDTL d,SER_REQ_FEEDBK h where d.feedbk_id = h.feedbk_id and r.req_id = h.req_id and r.COMP_STAT_DT between ? and ? and r.emp_code__assign = ? and r.comp_stat = 'C' group by r.STD_COMP_TIME ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs); pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs); pstmt.setTimestamp(2, toDateInTs);
...@@ -489,12 +501,12 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -489,12 +501,12 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
STD_COMP_TIME=checkNull(rs.getString("STD_COMP_TIME")); STD_COMP_TIME=checkNull(rs.getString("STD_COMP_TIME"));
} }
rowData = new JSONObject(); rowData = new JSONObject();
rowData.put("descr","Total Man Houres" ); rowData.put("descr","Total Hours" );
rowData.put("count",(time_spnet=="" ? 0 : time_spnet) ); rowData.put("count",(time_spnet=="" ? 0 : time_spnet) );
rowDataPendingTaskJson.put(count, rowData); rowDataPendingTaskJson.put(count, rowData);
count++; count++;
rowData = new JSONObject(); rowData = new JSONObject();
rowData.put("descr","Estimated Man Hours" ); rowData.put("descr","Estimated Hours" );
rowData.put("count",(STD_COMP_TIME=="" ? 0 : STD_COMP_TIME)); rowData.put("count",(STD_COMP_TIME=="" ? 0 : STD_COMP_TIME));
rowDataPendingTaskJson.put(count, rowData); rowDataPendingTaskJson.put(count, rowData);
count++; count++;
...@@ -560,15 +572,22 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -560,15 +572,22 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
} catch (Exception d) } catch (Exception d)
{ {
d.printStackTrace(); d.printStackTrace();
System.out.println("Exception in :TaskActivity:getPendingReqSummary():" + d.getMessage()); System.out.println("Exception in :TaskActivity: getPendingReqSummaryGrpah ():" + d.getMessage());
throw new ITMException(d); throw new ITMException(d);
} }
} }
return rowDataPendingTaskJson; return rowDataPendingTaskJson;
} }
/**** End of getPendingReqSummaryGrpah() Method ***/
/**** Start Of getWorkAlloSummary() Method
* Method Name : getWorkAlloSummary (String dataSourceName, String empCode, String fromDate, String toDate)
* Metadata Xml : management.xml
* Servlet Name : WorkAlloSummaryServlet
*
*******/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public JSONObject getWorkAlloSummary(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException public JSONObject getWorkAlloSummary(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException
...@@ -708,8 +727,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -708,8 +727,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
} }
} }
System.out.println(" rowDataEmpWrkAllJson is =" + rowDataEmpWrkAllJson); System.out.println(" rowDataEmpWrkAllJson is =" + rowDataEmpWrkAllJson);
} catch (Exception e) } catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
...@@ -740,7 +757,14 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -740,7 +757,14 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
return rowDataEmpWrkAllJson; return rowDataEmpWrkAllJson;
} }
/**** End of getEmpWorkAllocation() Method ***/
/**** Start Of getReqEfficiencySummary() Method
* Method Name : getReqEfficiencySummary (String dataSourceName, String empCode, String fromDate, String toDate)
* Metadata Xml : management.xml
* Servlet Name : ReqEfficiencySummaryServlet
*
*******/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
...@@ -795,8 +819,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -795,8 +819,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
toDateInTS = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(toDate)).toString() + " 00:00:00.0"); toDateInTS = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(toDate)).toString() + " 00:00:00.0");
System.out.println("getReqEfficiencySummary Date : From Date: "+fromDateInTS+" To Date: "+toDateInTS); System.out.println("getReqEfficiencySummary Date : From Date: "+fromDateInTS+" To Date: "+toDateInTS);
} }
if((fromDateInTS!=null && fromDateInTS.toString().length()>0) if((fromDateInTS!=null && fromDateInTS.toString().length()>0) && (toDateInTS!=null && toDateInTS.toString().length()>0)
&& (toDateInTS!=null && toDateInTS.toString().length()>0)
&& (empCode!=null && empCode.trim().length()>0) ) && (empCode!=null && empCode.trim().length()>0) )
{ {
/*sql = "SELECT R.COMP_STAT_DT,R.COMP_STAT,R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, E.EMP_FNAME || ' ' || E.EMP_LNAME EMP_NAME, " /*sql = "SELECT R.COMP_STAT_DT,R.COMP_STAT,R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, E.EMP_FNAME || ' ' || E.EMP_LNAME EMP_NAME, "
...@@ -819,7 +842,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -819,7 +842,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
+" AD.STD_TIME as STD_TIME ,max((SELECT FN_FEEDBK_TIME(SUM(FD.TIME_SPENT)) FROM SER_REQ_FEEDBKDTL FD, " +" 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 " +" 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_ID = AD.ACTION_ID "
+" AND FD.ACTION_CODE = AD.ACTION_CODE and fh.emp_code = e.emp_code )) ACTUAL_TIME " +" AND FD.ACTION_CODE = AD.ACTION_CODE and fh.emp_code = e.emp_code )) ACTUAL_TIME " //added fh.emp_code = e.emp_code by dhanendra on 24 dec 2015
+" from ser_request r, ser_req_act ah, ser_req_act_detl ad, employee e " +" from ser_request r, ser_req_act ah, ser_req_act_detl ad, employee e "
+" where ah.action_id = ad.action_id " +" where ah.action_id = ad.action_id "
+" and ah.req_id = r.req_id " +" and ah.req_id = r.req_id "
...@@ -864,7 +887,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -864,7 +887,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
{ {
rowData.put("dlv_date",checkNull(rs.getString("comp_stat_dt"))); rowData.put("dlv_date",checkNull(rs.getString("comp_stat_dt")));
} }
if(deviation==0.0) /*if(deviation==0.0)
{ {
onTimeCtr++; onTimeCtr++;
} }
...@@ -879,11 +902,11 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -879,11 +902,11 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rowData.put("tot_deviation", ""); rowData.put("tot_deviation", "");
rowData.put("time_lag", ""); rowData.put("time_lag", "");
rowData.put("time_lag_descr", ""); rowData.put("time_lag_descr", "");
*/
rowDataEmpReqEffJson.put(Integer.valueOf(count), rowData); rowDataEmpReqEffJson.put(Integer.valueOf(count), rowData);
count++; count++;
} }
rowData = new JSONObject(); /* rowData = new JSONObject();
rowData.put("employee", ""); rowData.put("employee", "");
rowData.put("req_id", ""); rowData.put("req_id", "");
rowData.put("descr", ""); rowData.put("descr", "");
...@@ -925,7 +948,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -925,7 +948,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rowData.put("tot_descr", "Estimated Man Hour"); rowData.put("tot_descr", "Estimated Man Hour");
rowData.put("time_lag", negTimeCtr); rowData.put("time_lag", negTimeCtr);
rowData.put("time_lag_descr", "Before Time"); rowData.put("time_lag_descr", "Before Time");
rowDataEmpReqEffJson.put(Integer.valueOf(count), rowData); rowDataEmpReqEffJson.put(Integer.valueOf(count), rowData);*/
} }
System.out.println(" rowDataEmpReqEffJson is =" + rowDataEmpReqEffJson); System.out.println(" rowDataEmpReqEffJson is =" + rowDataEmpReqEffJson);
...@@ -959,7 +982,14 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -959,7 +982,14 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
return rowDataEmpReqEffJson; return rowDataEmpReqEffJson;
} }
/**** End of getEmpReqEfficiency() Method ***/
/**** Start Of getMissingFDBack() Method
* Method Name : getMissingFDBack (String fromDate, String toDate,String empCode,String dataSourceName)
* Metadata Xml : management.xml
* Servlet Name : MissingFDBackServlet
*
*******/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @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 dataSourceName) throws RemoteException, ITMException
...@@ -1154,6 +1184,201 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -1154,6 +1184,201 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
} }
return rowDataMissingFeedbackJson; return rowDataMissingFeedbackJson;
} }
/**** End of getEmpMissingFDBack() Method ***/
/**** Start Of getReqEfficiencySummaryPie() Method
* Method Name : getReqEfficiencySummaryPie (String dataSourceName, String empCode, String fromDate, String toDate)
* Metadata Xml : management.xml
* Servlet Name : ReqEfficiencySummaryPieChartServlet
*
*******/
/*Added by swati for Pie chart Deviation on date : 30 Dec 2015*/
@SuppressWarnings("unchecked")
@Override
public JSONObject getReqEfficiencySummaryPie(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;
DashboardUtility dashboardUtility=null;
try
{
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
System.out.println("In Management Dashboard Req Efficiency Pie chart: ");
dashboardUtility = new DashboardUtility();
empCode=dashboardUtility.getCommaSeparated(empCode);
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals("")))
{
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("getReqEfficiencySummaryPie 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");
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("getReqEfficiencySummaryPie Date : From Date: "+fromDateInTS+" To Date: "+toDateInTS);
}
if((fromDateInTS!=null && fromDateInTS.toString().length()>0) && (toDateInTS!=null && toDateInTS.toString().length()>0)
&& (empCode!=null && empCode.trim().length()>0) )
{
/*sql = "SELECT R.COMP_STAT_DT,R.COMP_STAT,R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, E.EMP_FNAME || ' ' || E.EMP_LNAME EMP_NAME, "
+" AD.STD_TIME as STD_TIME ,MAX((SELECT FN_FEEDBK_TIME(SUM(FD.TIME_SPENT)) FROM SER_REQ_FEEDBKDTL FD, "
+" SER_REQ_FEEDBK FH , WHERE FD.FEEDBK_ID = FH.FEEDBK_ID AND FH.REQ_ID = R.REQ_ID "
+" AND FD.ACTION_ID = AD.ACTION_ID "
+" AND FD.ACTION_CODE = AD.ACTION_CODE AND FH.EMP_CODE = E.EMP_CODE)) ACTUAL_TIME "
+" FROM SER_REQUEST R, SER_REQ_ACT AH, SER_REQ_ACT_DETL AD, EMPLOYEE E "
+" WHERE AH.ACTION_ID = AD.ACTION_ID "
+" AND AH.REQ_ID = R.REQ_ID "
+" AND E.EMP_CODE = ad.EMP_CODE "
+" AND R.COMP_STAT_DT >= ? AND R.COMP_STAT_DT <= ? "//--?
+" AND AD.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = "+empCode+" "
+" CONNECT BY PRIOR EMP_CODE = REPORT_TO AND REPORT_TO IS NOT NULL "
+" AND ( RELIEVE_DATE IS NULL OR RELIEVE_DATE >= SYSDATE )) "
+" GROUP BY R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, R.COMP_STAT,E.EMP_FNAME || ' ' || E.EMP_LNAME, AD.STD_TIME ,R.COMP_STAT_DT " +
" ORDER BY R.COMP_STAT_DT DESC ";*/
sql = "SELECT r.comp_stat_dt,r.COMP_STAT,R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, E.EMP_FNAME || ' ' || E.EMP_LNAME EMP_NAME, "
+" AD.STD_TIME as STD_TIME ,max((SELECT FN_FEEDBK_TIME(SUM(FD.TIME_SPENT)) FROM SER_REQ_FEEDBKDTL FD, "
+" SER_REQ_FEEDBK FH WHERE FD.FEEDBK_ID = FH.FEEDBK_ID AND FH.REQ_ID = R.REQ_ID "
+" AND FD.ACTION_ID = AD.ACTION_ID "
+" AND FD.ACTION_CODE = AD.ACTION_CODE and fh.emp_code = e.emp_code )) ACTUAL_TIME "
+" from ser_request r, ser_req_act ah, ser_req_act_detl ad, employee e "
+" where ah.action_id = ad.action_id "
+" and ah.req_id = r.req_id "
+" AND E.EMP_CODE = ad.EMP_CODE "
+" and r.comp_stat_dt >= ? and r.comp_stat_dt <= ? "//--?
+" AND ad.emp_code in (select emp_code FROM EMPLOYEE START WITH EMP_CODE = "+empCode+" "
+" CONNECT BY PRIOR EMP_CODE = REPORT_TO AND REPORT_TO IS NOT NULL "
+" AND ( RELIEVE_DATE IS NULL OR RELIEVE_DATE >= SYSDATE )) "
+" group by r.req_id,r.dtl_descr, ad.action_detl, r.COMP_STAT,e.emp_fname || ' ' || e.emp_lname, ad.STD_TIME ,r.comp_stat_dt " +
" order by r.comp_stat_dt desc ";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,fromDateInTS);
pstmt.setTimestamp(2,toDateInTS);
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(stdTime - actTime );
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);
rowData.put("req_status",checkNull(rs.getString("COMP_STAT")));
String comp_stat_dt=checkNull(rs.getString("comp_stat_dt"));
if(!comp_stat_dt.equals(null) && comp_stat_dt.trim().length()>0)
{
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 = new JSONObject();
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("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("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(" rowDataEmpReqEffJsonPie 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 : getReqEfficiencySummaryPie() :" + d.getMessage());
throw new ITMException(d);
}
}
return rowDataEmpReqEffJson;
}
/*Ended by swati for Pie chart Deviation on date : 30 Dec 2015*/
/**** End of getReqEfficiencySummaryPie() Method ***/
private String checkDouble(String str) private String checkDouble(String str)
{ {
......
...@@ -13,5 +13,5 @@ public interface ManagmentDashboardLocal ...@@ -13,5 +13,5 @@ public interface ManagmentDashboardLocal
public JSONObject getReqEfficiencySummary(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 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; public JSONObject getMissingFDBack(String fromDate, String toDate,String empCode,String dataSourceName) throws RemoteException, ITMException;
public JSONObject getReqEfficiencySummaryPie(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException;
} }
...@@ -12,4 +12,5 @@ public interface ManagmentDashboardRemote ...@@ -12,4 +12,5 @@ public interface ManagmentDashboardRemote
public JSONObject getReqEfficiencySummary(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 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; public JSONObject getMissingFDBack(String fromDate, String toDate,String empCode,String dataSourceName) throws RemoteException, ITMException;
public JSONObject getReqEfficiencySummaryPie(String dataSourceName, String empCode, String fromDate, String toDate) throws RemoteException, ITMException;
} }
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