Commit 85cd772e authored by sbade's avatar sbade

Modified Sql due to syntax error and added conditions


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99187 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 80da8d63
package ibase.dashboard.iem.ejb; package ibase.dashboard.iem.ejb;
import ibase.dashboard.Report.Utility.DashboardUtility;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
...@@ -10,14 +10,12 @@ import java.sql.ResultSet; ...@@ -10,14 +10,12 @@ import java.sql.ResultSet;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import javax.ejb.Stateless;
import org.json.simple.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import javax.ejb.Stateless;
import org.json.simple.JSONObject;
@Stateless @Stateless
public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDashboardRemote public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDashboardRemote
...@@ -47,53 +45,52 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -47,53 +45,52 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
{ {
JSONObject rowDataPendingTaskJson = new JSONObject(); JSONObject rowDataPendingTaskJson = new JSONObject();
JSONObject rowData = null; JSONObject rowData = null;
String sql = ""; String sql = "";
ResultSet rs = null; ResultSet rs = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
Connection conn = null; Connection conn = null;
Timestamp frmDateInTs = null; Timestamp frmDateInTs = null;
Timestamp toDateInTs = null; Timestamp toDateInTs = null;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
SimpleDateFormat convertToDbDate = null; SimpleDateFormat convertToDbDate = null;
SimpleDateFormat simpleDateFormat = null; SimpleDateFormat simpleDateFormat = null;
Calendar calendar=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 try
{ {
conn = connDriver.getConnectDB(dataSourceName); conn = connDriver.getConnectDB(dataSourceName);
connDriver = null; connDriver = null;
rowData = new JSONObject(); rowData = new JSONObject();
convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat()); convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals(""))) if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals("")))
{ {
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat()); simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
calendar = Calendar.getInstance(); calendar = Calendar.getInstance();
System.out.println("In Management Dashboard Pending Request: "); toDate = simpleDateFormat.format(calendar.getTime());
toDate = simpleDateFormat.format(calendar.getTime()); calendar = Calendar.getInstance();
calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -12); calendar.add(Calendar.MONTH, -12);
fromDate = simpleDateFormat.format(calendar.getTime()); fromDate = simpleDateFormat.format(calendar.getTime());
frmDateInTs = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(fromDate)).toString() + " 00:00:00.0"); 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"); 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); System.out.println("getPendingReqSummary default date ,when user dont enter date, From Date="+frmDateInTs+"To Date="+toDateInTs);
} }
else else
{ {
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); //comment date
frmDateInTs = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(fromDate)).toString() + " 00:00:00.0"); //simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
toDateInTs = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(toDate)).toString() + " 00:00:00.0"); simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
System.out.println("Get Date : From Date: "+fromDate+" To Date: "+toDate); 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("getPendingReqSummary Date : From Date: "+frmDateInTs+" To Date: "+toDateInTs);
} }
/* Foe Opening Request * */ /* Foe Opening Request * */
if((frmDateInTs!=null && frmDateInTs.toString().length()>0)
&& (toDateInTs!=null && toDateInTs.toString().length()>0)
&& (empCode!=null && empCode.trim().length()>0) )
{
sql = "select count(1) opening_request from ser_request where req_date between ? and ? and emp_code__assign = ? and comp_stat <> 'C'"; 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 = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(1, toDateInTs);
pstmt.setTimestamp(2, toDateInTs); pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode); pstmt.setString(3, empCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -109,7 +106,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -109,7 +106,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
/* End Foe Opening Request * */ /* End Foe Opening Request * */
sql = "select count(1) as rece_dur_prd from ser_request where req_date between ? and ? and emp_code__assign = ?"; sql = "select count(1) as rece_dur_prd from ser_request where req_date between ? and ? and emp_code__assign = ?";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs); pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs); pstmt.setTimestamp(2, toDateInTs);
...@@ -128,7 +124,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -128,7 +124,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
//Promised during this period //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 = ?"; 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 = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs); pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs); pstmt.setTimestamp(2, toDateInTs);
...@@ -147,7 +142,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -147,7 +142,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
//--- Delivered during this period //--- 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'"; 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 = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs); pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs); pstmt.setTimestamp(2, toDateInTs);
...@@ -167,7 +161,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -167,7 +161,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
// --- Count without a promised date // --- 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"; 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 = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
...@@ -185,8 +178,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -185,8 +178,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
//--- Count on which work going on //--- 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 ? "; 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 = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
pstmt.setTimestamp(2, frmDateInTs); pstmt.setTimestamp(2, frmDateInTs);
...@@ -207,7 +198,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -207,7 +198,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
//--- 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 ";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs); pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs); pstmt.setTimestamp(2, toDateInTs);
...@@ -233,7 +223,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -233,7 +223,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
" from ser_request where req_date between ? and ? and emp_code__assign = ? " + " from ser_request where req_date between ? and ? and emp_code__assign = ? " +
" union all select -1 * count(1) from ser_request where " + " union all select -1 * count(1) from ser_request where " +
" COMP_STAT_DT between ? and ? and emp_code__assign = ? and comp_stat = 'C' )"; " 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 = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs); pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs); pstmt.setTimestamp(2, toDateInTs);
...@@ -258,8 +248,9 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -258,8 +248,9 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rs = null; rs = null;
rowDataPendingTaskJson.put(Integer.valueOf(0), rowData); rowDataPendingTaskJson.put(Integer.valueOf(0), rowData);
System.out.println(" rowDataPendingTaskJson is =" + rowDataPendingTaskJson); System.out.println(" rowDataPendingTaskJson is =" + rowDataPendingTaskJson);
}
} catch (Exception e) } catch (Exception e)
{ {
...@@ -299,16 +290,15 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -299,16 +290,15 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
JSONObject rowDataPendingTaskJson = new JSONObject(); JSONObject rowDataPendingTaskJson = new JSONObject();
JSONObject rowData = null; JSONObject rowData = null;
String sql = ""; String sql = "";
ResultSet rs = null; ResultSet rs = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
Connection conn = null; Connection conn = null;
Timestamp frmDateInTs = null; Timestamp frmDateInTs = null;
Timestamp toDateInTs = null; Timestamp toDateInTs = null;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
SimpleDateFormat convertToDbDate = null; SimpleDateFormat convertToDbDate = null;
SimpleDateFormat simpleDateFormat = null; SimpleDateFormat simpleDateFormat = null;
Calendar calendar=null; Calendar calendar=null;
String no_req="";
int count=0; int count=0;
try try
{ {
...@@ -321,19 +311,21 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -321,19 +311,21 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals(""))) if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals("")))
{ {
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat()); simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
calendar = Calendar.getInstance(); calendar = Calendar.getInstance();
System.out.println("In Management Dashboard Pending Request Graph: "); System.out.println("In Management Dashboard Pending Request Graph: ");
toDate = simpleDateFormat.format(calendar.getTime()); toDate = simpleDateFormat.format(calendar.getTime());
calendar = Calendar.getInstance(); calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
fromDate = simpleDateFormat.format(calendar.getTime()); fromDate = simpleDateFormat.format(calendar.getTime());
frmDateInTs = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(fromDate)).toString() + " 00:00:00.0"); 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"); 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); System.out.println("get default date ,when user not entering date from GUI in TS format: From Date="+frmDateInTs+"To Date="+toDateInTs);
} }
else else
{ {
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); //comment date
//simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
frmDateInTs = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(fromDate)).toString() + " 00:00:00.0"); 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"); 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); System.out.println("Get Date from input in TS format : From Date: "+frmDateInTs+" To Date: "+toDateInTs);
...@@ -341,12 +333,13 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -341,12 +333,13 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
/* Foe Opening Request * */ /* Foe Opening Request * */
if((frmDateInTs!=null && frmDateInTs.toString().length()>0)
&& (toDateInTs!=null && toDateInTs.toString().length()>0)
&& (empCode!=null && empCode.trim().length()>0) )
{
sql = "select count(1) opening_request from ser_request where req_date between ? and ? and emp_code__assign = ? and comp_stat <> 'C'"; 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 = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(1, toDateInTs);
pstmt.setTimestamp(2, toDateInTs); pstmt.setTimestamp(2, toDateInTs);
pstmt.setString(3, empCode); pstmt.setString(3, empCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -365,7 +358,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -365,7 +358,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
/* End Foe Opening Request * */ /* End Foe Opening Request * */
sql = "select count(1) as rece_dur_prd from ser_request where req_date between ? and ? and emp_code__assign = ?"; sql = "select count(1) as rece_dur_prd from ser_request where req_date between ? and ? and emp_code__assign = ?";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs); pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs); pstmt.setTimestamp(2, toDateInTs);
...@@ -388,7 +380,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -388,7 +380,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
//Promised during this period //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 = ?"; 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 = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs); pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs); pstmt.setTimestamp(2, toDateInTs);
...@@ -411,7 +402,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -411,7 +402,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
//--- Delivered during this period //--- 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'"; 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 = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs); pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs); pstmt.setTimestamp(2, toDateInTs);
...@@ -434,8 +424,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -434,8 +424,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
// --- Count without a promised date // --- 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"; 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 = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
...@@ -452,12 +441,11 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -452,12 +441,11 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
rs.close(); rs.close();
rs = null; rs = null;
//--- Count on which work going on //--- 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 ? "; 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 = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
...@@ -477,13 +465,12 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -477,13 +465,12 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
rs.close(); rs.close();
rs = null; rs = null;
//--- 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 ";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs); pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs); pstmt.setTimestamp(2, toDateInTs);
...@@ -511,15 +498,11 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -511,15 +498,11 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
pstmt = null; pstmt = null;
rs.close(); rs.close();
rs = null; 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 " + 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) " + " 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 = ? " + " from ser_request where req_date between ? and ? and emp_code__assign = ? " +
" union all select -1 * count(1) from ser_request where " + " union all select -1 * count(1) from ser_request where " +
" COMP_STAT_DT between ? and ? and emp_code__assign = ? and comp_stat = 'C' )"; " 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 = conn.prepareStatement(sql);
pstmt.setTimestamp(1, frmDateInTs); pstmt.setTimestamp(1, frmDateInTs);
pstmt.setTimestamp(2, toDateInTs); pstmt.setTimestamp(2, toDateInTs);
...@@ -546,7 +529,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -546,7 +529,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
pstmt = null; pstmt = null;
rs.close(); rs.close();
rs = null; rs = null;
}
System.out.println(" rowDataPendingTaskJson is =" + rowDataPendingTaskJson); System.out.println(" rowDataPendingTaskJson is =" + rowDataPendingTaskJson);
} catch (Exception e) } catch (Exception e)
...@@ -596,17 +579,21 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -596,17 +579,21 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
Timestamp toDateInTs=null; Timestamp toDateInTs=null;
SimpleDateFormat convertToDbDate=null; SimpleDateFormat convertToDbDate=null;
SimpleDateFormat simpleDateFormat=null; SimpleDateFormat simpleDateFormat=null;
Calendar calendar=null; DashboardUtility dashboardUtility=null;
String dateInpute="";
try try
{ {
conn = connDriver.getConnectDB(dataSourceName); conn = connDriver.getConnectDB(dataSourceName);
connDriver = null; connDriver = null;
convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat()); convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
System.out.println("In Management Dashboard Work Allocation: "); System.out.println("In Management Dashboard Work Allocation: ");
dashboardUtility = new DashboardUtility();
empCode = dashboardUtility.getCommaSeparated(empCode);
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals(""))) if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals("")))
{ {
simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat()); /*simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
calendar = Calendar.getInstance(); calendar = Calendar.getInstance();
//calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); //calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
toDate = simpleDateFormat.format(calendar.getTime()); toDate = simpleDateFormat.format(calendar.getTime());
calendar = Calendar.getInstance(); calendar = Calendar.getInstance();
...@@ -614,21 +601,23 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -614,21 +601,23 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
fromDate = simpleDateFormat.format(calendar.getTime()); fromDate = simpleDateFormat.format(calendar.getTime());
frmDateInTs = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(fromDate)).toString() + " 00:00:00.0"); 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"); 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); System.out.println("get default date ,when user not entering date from GUI in TS format: From Date="+frmDateInTs+"To Date="+toDateInTs);*/
} }
else else
{ {
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); //comment date
frmDateInTs = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(fromDate)).toString() + " 00:00:00.0"); //simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
toDateInTs = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(toDate)).toString() + " 00:00:00.0"); frmDateInTs = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(fromDate)).toString() + " 00:00:00.0");
System.out.println("Get Date from input in TS format : From Date: "+frmDateInTs+" To Date: "+toDateInTs); toDateInTs = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(toDate)).toString() + " 00:00:00.0");
System.out.println ("getWorkAlloSummary Date from input in TS format : From Date: "+frmDateInTs+" To Date: "+toDateInTs);
dateInpute =" and to_date(h.TRAN_DATE) >= ? AND TO_DATE(H.TRAN_DATE) <= ?";
} }
System.out.println("get default date ,when user not entering date from GUI in TS format: From Date="+frmDateInTs+"To Date="+toDateInTs);
simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat()); if( (empCode!=null && empCode.trim().length()>0) )
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, "
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.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, " +" 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, " +" c.cust_code, c.cust_name,r.dtl_descr, "
...@@ -646,26 +635,24 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -646,26 +635,24 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
+" (select fn_feedbk_time(sum(iid.time_spent)) from SER_REQ_FEEDBKDTL iid,SER_REQ_FEEDBK iih " +" (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 " +" 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 " +" 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 " +" where d.action_id = h.action_id "
+" and r.req_id = h.req_id " +" and r.req_id = h.req_id "
+" AND R.CUST_CODE = C.CUST_CODE " +" AND R.CUST_CODE = C.CUST_CODE "
/*((r.emp_code__assign in (select emp_code FROM EMPLOYEE START WITH EMP_CODE = 'BE001' +" AND ((r.emp_code__assign in (select emp_code FROM EMPLOYEE START WITH EMP_CODE = "+empCode+" "
* CONNECT BY PRIOR EMP_CODE = REPORT_TO AND REPORT_TO IS NOT NULL +" 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 ( RELIEVE_DATE IS NULL OR RELIEVE_DATE >= SYSDATE )) ) or d.emp_code="+empCode+" ) "
* */ + dateInpute
+" 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 " +" 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 " +" ) 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, " +" 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 " +" 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 "; +" ORDER BY I.PLAN_END_DATE asc ";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
//pstmt.setString(1,empCode); if(dateInpute.trim().length()>0)
{
pstmt.setTimestamp(1,frmDateInTs); pstmt.setTimestamp(1,frmDateInTs);
pstmt.setTimestamp(2,toDateInTs); pstmt.setTimestamp(2,toDateInTs);
}
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
int count = 0; int count = 0;
while (rs.next()) while (rs.next())
...@@ -673,17 +660,16 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -673,17 +660,16 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rowData = new JSONObject(); rowData = new JSONObject();
rowData.put("employee", checkNull(rs.getString("EMPLOYEE"))); rowData.put("employee", checkNull(rs.getString("EMPLOYEE")));
rowData.put("req_no", checkNull(rs.getString("REQ_ID"))); rowData.put("req_no", checkNull(rs.getString("REQ_ID")));
rowData.put("descr", checkNull(rs.getString("REQ_DESCR"))); rowData.put("descr", checkNull(rs.getString("REQ_DESCR")));
rowData.put("client", checkNull(rs.getString("CUST_NAME"))); 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 startDate =checkNull(rs.getString("PLAN_START_DATE"));
String actStartDate =checkNull(rs.getString("ACT_START_DATE")); String endDate =checkNull(rs.getString("PLAN_END_DATE"));
System.out.println("endDate in Date format :"+rs.getDate("PLAN_START_DATE")); String actStartDate =checkNull(rs.getString("ACT_START_DATE"));
if(!startDate.equals(null) && startDate.trim().length()>0) 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))); rowData.put("pln_strt_date", simpleDateFormat.format(convertToDbDate.parse(startDate)));
} }
else else
...@@ -692,7 +678,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -692,7 +678,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
} }
if(!endDate.equals(null) && endDate.trim().length()>0) 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("pln_end_date", simpleDateFormat.format(convertToDbDate.parse(endDate)));
rowData.put("exp_cmplt_date", simpleDateFormat.format(convertToDbDate.parse(endDate))); rowData.put("exp_cmplt_date", simpleDateFormat.format(convertToDbDate.parse(endDate)));
} }
...@@ -703,7 +688,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -703,7 +688,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
} }
if(!actStartDate.equals(null) && actStartDate.trim().length()>0) 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))); rowData.put("act_strt_date", simpleDateFormat.format(convertToDbDate.parse(actStartDate)));
} }
else else
...@@ -717,6 +701,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -717,6 +701,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rowDataEmpWrkAllJson.put(Integer.valueOf(count), rowData); rowDataEmpWrkAllJson.put(Integer.valueOf(count), rowData);
count++; count++;
} }
}
System.out.println(" rowDataEmpWrkAllJson is =" + rowDataEmpWrkAllJson); System.out.println(" rowDataEmpWrkAllJson is =" + rowDataEmpWrkAllJson);
...@@ -768,61 +753,65 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -768,61 +753,65 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
Timestamp toDateInTS=null; Timestamp toDateInTS=null;
double deviation=0.0,stdTime=0.0,actTime=0.0; double deviation=0.0,stdTime=0.0,actTime=0.0;
double totDeviation=0.0,totStdTime=0.0,totActTime=0.0; double totDeviation=0.0,totStdTime=0.0,totActTime=0.0;
int onTimeCtr=0,posTimeCtr=0,negTimeCtr=0; int onTimeCtr=0,posTimeCtr=0,negTimeCtr=0;
SimpleDateFormat simpleDateFormat = null; SimpleDateFormat simpleDateFormat = null;
SimpleDateFormat convertToDbDate=null; SimpleDateFormat convertToDbDate=null;
Calendar calendar=null; Calendar calendar=null;
DashboardUtility dashboardUtility=null;
try try
{ {
conn = connDriver.getConnectDB(dataSourceName); conn = connDriver.getConnectDB(dataSourceName);
connDriver = null; connDriver = null;
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); //comment date static
//simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat()); convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
System.out.println("In Management Dashboard Req Efficiency: "); System.out.println("In Management Dashboard Req Efficiency: ");
dashboardUtility = new DashboardUtility();
empCode=dashboardUtility.getCommaSeparated(empCode);
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals(""))) if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals("")))
{ {
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat()); calendar = Calendar.getInstance();
calendar = Calendar.getInstance(); toDate = simpleDateFormat.format(calendar.getTime());
toDate = simpleDateFormat.format(calendar.getTime()); calendar = Calendar.getInstance();
calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -7); calendar.add(Calendar.DAY_OF_MONTH, -7);
fromDate = simpleDateFormat.format(calendar.getTime()); fromDate = simpleDateFormat.format(calendar.getTime());
fromDateInTS = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(fromDate)).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"); 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); System.out.println("getReqEfficiencySummary default date ,when user dnt enter date : From Date="+fromDate+"To Date="+toDate);
} }
else else
{ {
fromDateInTS = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(fromDate)).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"); toDateInTS = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(toDate)).toString() + " 00:00:00.0");
//simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); fromDateInTS = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(fromDate)).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");
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("Get Date : From Date: "+fromDate+" To Date: "+toDate);
} }
if((fromDateInTS!=null && fromDateInTS.toString().length()>0)
sql = "SELECT r.comp_stat_dt,R.REQ_ID,R.DTL_DESCR, AD.ACTION_DETL, E.EMP_FNAME || ' ' || E.EMP_LNAME EMP_NAME, " && (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, " +" 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 )) ACTUAL_TIME " +" AND FD.ACTION_CODE = AD.ACTION_CODE )) ACTUAL_TIME "
+" 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 "
+" AND E.EMP_CODE = AD.EMP_CODE " +" AND E.EMP_CODE = ad.EMP_CODE "
+" and r.comp_stat_dt >= ? and r.comp_stat_dt <= ? "//--? +" 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' +" AND ((r.emp_code__assign in (select emp_code FROM EMPLOYEE START WITH EMP_CODE = "+empCode+" "
* CONNECT BY PRIOR EMP_CODE = REPORT_TO AND REPORT_TO IS NOT NULL +" 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 ( RELIEVE_DATE IS NULL OR RELIEVE_DATE >= SYSDATE )) ) or ad.emp_code="+empCode+" ) "
* */ +" group by r.req_id,r.dtl_descr, ad.action_detl, r.COMP_STAT,e.emp_fname || ' ' || e.emp_lname, ad.STD_TIME ,r.comp_stat_dt " +
+" 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 "; " order by r.comp_stat_dt desc ";
System.out.println("sql is in new Interface =" + sql);
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,fromDateInTS); pstmt.setTimestamp(1,fromDateInTS);
pstmt.setTimestamp(2,toDateInTS); pstmt.setTimestamp(2,toDateInTS);
//pstmt.setString(3,empCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
int count = 0; int count = 0;
while (rs.next()) while (rs.next())
...@@ -831,7 +820,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -831,7 +820,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
stdTime=Double.parseDouble(checkDouble(rs.getString("STD_TIME"))); stdTime=Double.parseDouble(checkDouble(rs.getString("STD_TIME")));
actTime=Double.parseDouble(checkDouble(rs.getString("ACTUAL_TIME"))); actTime=Double.parseDouble(checkDouble(rs.getString("ACTUAL_TIME")));
deviation=Math.round(actTime - stdTime); deviation=Math.round(stdTime - actTime );
totDeviation=totDeviation+deviation; totDeviation=totDeviation+deviation;
totStdTime=totStdTime+stdTime; totStdTime=totStdTime+stdTime;
totActTime=totActTime+actTime; totActTime=totActTime+actTime;
...@@ -841,12 +830,12 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -841,12 +830,12 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rowData.put("act_descr", checkNull(rs.getString("ACTION_DETL"))); rowData.put("act_descr", checkNull(rs.getString("ACTION_DETL")));
rowData.put("est_man_hour", checkNull(rs.getString("STD_TIME"))); rowData.put("est_man_hour", checkNull(rs.getString("STD_TIME")));
rowData.put("act_man_hour", checkNull(rs.getString("ACTUAL_TIME"))); rowData.put("act_man_hour", checkNull(rs.getString("ACTUAL_TIME")));
rowData.put("deviation", ""+deviation); rowData.put("deviation", ""+deviation);
rowData.put("req_status",checkNull(rs.getString("COMP_STAT")));
String comp_stat_dt=checkNull(rs.getString("comp_stat_dt")); String comp_stat_dt=checkNull(rs.getString("comp_stat_dt"));
if(!comp_stat_dt.equals(null) && comp_stat_dt.trim().length()>0) 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))); rowData.put("dlv_date", simpleDateFormat.format(convertToDbDate.parse(comp_stat_dt)));
} }
else else
...@@ -869,7 +858,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -869,7 +858,6 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
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++;
} }
...@@ -916,14 +904,9 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -916,14 +904,9 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
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("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); System.out.println(" rowDataEmpReqEffJson is =" + rowDataEmpReqEffJson);
} catch (Exception e) } catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
...@@ -967,8 +950,8 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -967,8 +950,8 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
Connection conn = null; Connection conn = null;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
Calendar calendar=null; Calendar calendar=null;
Timestamp fromDateInTS=null; Timestamp fromDateInTS= null;
Timestamp toDateInTS=null; Timestamp toDateInTS= null;
List<String> executeDayList= new ArrayList<String>(); List<String> executeDayList= new ArrayList<String>();
LinkedHashMap<String, List<String> > empMap = new LinkedHashMap<String, List<String>>(); LinkedHashMap<String, List<String> > empMap = new LinkedHashMap<String, List<String>>();
List<String> empList= new ArrayList<String>(); List<String> empList= new ArrayList<String>();
...@@ -985,21 +968,23 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -985,21 +968,23 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
{ {
conn = connDriver.getConnectDB(dataSourceName); conn = connDriver.getConnectDB(dataSourceName);
connDriver = null; connDriver = null;
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); //comment date
//simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
convrtToTimStmDate = new SimpleDateFormat( genericUtility.getDBDateFormat()); convrtToTimStmDate = new SimpleDateFormat( genericUtility.getDBDateFormat());
convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat()); convertToDbDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
gridDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat()); gridDateFormat = new SimpleDateFormat("dd/MMM");
System.out.println("In Employee Dashboard Missing FeedBack: "); System.out.println("In Employee Dashboard Missing FeedBack: "+empCode);
if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals(""))) if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals("")))
{ {
simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat()); simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
calendar = Calendar.getInstance(); calendar = Calendar.getInstance();
toDate = simpleDateFormat.format(calendar.getTime()); toDate = simpleDateFormat.format(calendar.getTime());
calendar = Calendar.getInstance(); calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -7); calendar.add(Calendar.DAY_OF_MONTH, -7);
fromDate = simpleDateFormat.format(calendar.getTime()); fromDate = simpleDateFormat.format(calendar.getTime());
fromDateInTS = java.sql.Timestamp.valueOf(convertToDbDate.format(simpleDateFormat.parse(fromDate)).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"); 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); System.out.println("get default date ,when user dnt enter date : From Date="+fromDate+"To Date="+toDate);
} }
else else
...@@ -1008,23 +993,38 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -1008,23 +993,38 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
toDateInTS=java.sql.Timestamp.valueOf(convrtToTimStmDate.format(originalFormat.parse(toDate)).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); System.out.println("Get Date from input : From Date: "+fromDate+" To Date: "+toDate);
} }
if(empCode!=null && empCode.trim().length()>0) if((fromDateInTS!=null && fromDateInTS.toString().length()>0)
&& (toDateInTS!=null && toDateInTS.toString().length()>0)
&& (empCode!=null && empCode.trim().length()>0) )
{ {
sql=" select distinct b.execut_dt,to_char(b.execut_dt,'day') as day " /*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 " +" 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 " +" 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 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') " +" and trim(to_char(b.execut_dt,'day')) NOT in ('saturday','sunday') "
+" order by b.execut_dt "; +" order by b.execut_dt ";*/
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') "
+" )";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,fromDate); pstmt.setString(1,fromDate);
pstmt.setString(2,toDate); pstmt.setString(2,fromDate);
pstmt.setString(3,toDate);
pstmt.setString(4,fromDate);
pstmt.setString(5,toDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
executeDayList.add(checkNull(rs.getString("execut_dt"))); executeDayList.add(checkNull(rs.getString("mydate")));
} }
rs.close(); rs.close();
rs=null; rs=null;
...@@ -1067,9 +1067,9 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -1067,9 +1067,9 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
System.out.println("empMap in feddback missing: "+empMap); System.out.println("empMap in feddback missing: "+empMap);
rs.close(); rs.close();
pstmt.close(); pstmt.close();
int cnt=0;
for (String keyMap : empMap.keySet()) for (String keyMap : empMap.keySet())
{ {
int cnt=0;
excDate=new StringBuilder(); excDate=new StringBuilder();
valueList = new ArrayList<String>(); valueList = new ArrayList<String>();
valueList = empMap.get(keyMap); valueList = empMap.get(keyMap);
...@@ -1095,6 +1095,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas ...@@ -1095,6 +1095,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
} }
} }
} }
rowData.put("missing_count",""+cnt );
rowData.put("missing_date",excDate.toString() ); rowData.put("missing_date",excDate.toString() );
rowDataMissingFeedbackJson.put(count, rowData); rowDataMissingFeedbackJson.put(count, rowData);
count++; count++;
......
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