Commit f9168d1b authored by nsawalakhe's avatar nsawalakhe

Add card view functionality and one more method


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@101581 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3a4b6abe
......@@ -176,9 +176,10 @@ public class ProductAssessment extends ValidatorEJB implements ProductAssessment
return rawDataEmployeeProdSurveylJson;
}
@SuppressWarnings("unchecked")
@Override
public JSONObject getProductAssessmentProductServlet(String dataSourceName,String personName) throws RemoteException, ITMException
public JSONObject getProductAssessmentProductPieServlet(String dataSourceName,String personName) throws RemoteException, ITMException
{
JSONObject rawDataEmployeeProductlJson = new JSONObject();
JSONObject rowData = null;
......@@ -187,9 +188,10 @@ public class ProductAssessment extends ValidatorEJB implements ProductAssessment
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
double percntVal = 0.0;
try
{
System.out.println(" Inside ProductAssessment for getProductAssessmentProductServlet Data Soruc Name ="+dataSourceName+ "==== personName :"+personName);
System.out.println(" Inside ProductAssessment for getProductAssessmentProductPieServlet Data Soruc Name ="+dataSourceName+ "==== personName :"+personName);
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
......@@ -259,15 +261,163 @@ public class ProductAssessment extends ValidatorEJB implements ProductAssessment
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
int count = 0;
int rsltCnt=0,total=0;
while (rs.next())
{
rowData = new JSONObject();
rowData.put("prd_name", checkNull(rs.getString("PRD_NAME")));
rowData.put("name", checkNull(rs.getString("NAME")));
rowData.put("perc", checkNull(rs.getString("PERC")));
rowData.put("report", checkNull(rs.getString("REPORT"))+" out of "+checkNull( rs.getString("TOTAL")));
rowData.put("report", checkNull( rs.getString("RESULTCNT"))+" "+ checkNull( rs.getString("REPORT"))+" out of "+checkNull( rs.getString("TOTAL")));
rowData.put("resultcnt", checkNull(rs.getString("RESULTCNT")));
rowData.put("tooltext",checkNull( rs.getString("TOTAL")));
rawDataEmployeeProductlJson.put(count, rowData);
count++;
}
}
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 :getProductAssessmentProductPieServlet:" + d.getMessage());
throw new ITMException(d);
}
}
System.out.println("ProductAssessment ppie rawDataEmployeeProductlJson String======>>"+rawDataEmployeeProductlJson.toString());
return rawDataEmployeeProductlJson;
}
@SuppressWarnings("unchecked")
@Override
public JSONObject getProductAssessmentProductServlet(String dataSourceName,String personName) throws RemoteException, ITMException
{
JSONObject rawDataEmployeeProductlJson = new JSONObject();
JSONObject rowData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
double percntVal = 0.0;
try
{
System.out.println(" Inside ProductAssessment for getProductAssessmentProductServlet Data Soruc Name ="+dataSourceName+ "==== personName :"+personName);
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
/*sql_base = "select MGR, NAME, SURVEY, SUM(RESULT) RESULT from ( SELECT (e1.FIRSTNAME +' '+ e1.LASTNAME) as MGR, " +
"(e.FIRSTNAME +' '+ e.LASTNAME) as NAME, sm.descr as SURVEY, CAST(SRD.result AS INT) RESULT " +
"FROM hr.hr.dbo.survey_result_EMP SRE INNER JOIN hr.hr.dbo.survey_result SR ON SRE.TRAN_ID = SR.TRAN_ID__FORM " +
"INNER JOIN hr.hr.dbo.survey_result_det SRD ON SR.TRAN_ID = SRD.TRAN_ID " +
"INNER JOIN (SELECT * FROM hr.hr.dbo.survey_result_appl " +
"WHERE APPL_ENTITY = 'E') APP ON SRD.TRAN_ID = APP.TRAN_ID " +
//"INNER JOIN (SELECT * FROM hr.hr.dbo.survey_result_appl " +
//"WHERE APPL_ENTITY = 'P') APPR ON SRD.TRAN_ID = APPR.TRAN_ID " +
"INNER JOIN hr.hr.dbo.employee e ON APP.ENTITY_CODE = e.code " +
"INNER JOIN hr.hr.dbo.survey_master sm ON SRD.SURVEY_CODE = sm.SURVEY_CODE " +
"LEFT OUTER JOIN hr.hr.dbo.employee e1 ON SRE.EMP_CODE = e1.code) A " +
"WHERE NAME = 'Prasad Kadam' " +
"AND SURVEY IN ('Opening','Detailing','Probing','Listening') " +
"GROUP BY MGR, NAME, SURVEY";
*/
/*wORKING SQL*/
sql = "SELECT NAME, PRD_NAME, PERC, REPORT,RESULTCNT,TOTAL FROM (SELECT DET_PRD.NAME , DET_PRD.PRD_NAME,RESULT,TOTAL, " +
"Str((RESULT * 100.0/TOTAL),4,1) AS PERC, 'Marks' AS REPORT,(RESULT) as RESULTCNT " +
"FROM ( select e.CODE, SUM(SUR.RESULT) TOTAL from hr.dbo.employee e " +
"INNER JOIN hr.dbo.REGION r on e.regionid = r.id " +
"INNER JOIN (SELECT APP.ENTITY_CODE EMP_CODE, SRE.EMP_CODE MGR, sum(CAST(SRD.result AS INT)) RESULT, " +
"APPR.ENTITY_CODE PRD_CODE, APPR.ENTITY_DESCR PRD_DESC FROM hr.dbo.survey_result_EMP SRE " +
"INNER JOIN hr.dbo.survey_result SR ON SRE.TRAN_ID = SR.TRAN_ID__FORM " +
"INNER JOIN hr.dbo.survey_result_det SRD ON SR.TRAN_ID = SRD.TRAN_ID " +
"INNER JOIN (SELECT * FROM hr.dbo.survey_result_appl WHERE APPL_ENTITY = 'E') APP ON SRD.TRAN_ID = APP.TRAN_ID " +
"INNER JOIN (SELECT * FROM hr.dbo.survey_result_appl " +
" WHERE APPL_ENTITY = 'I'" +
") APPR ON SRD.TRAN_ID = APPR.TRAN_ID " +
"GROUP BY APP.ENTITY_CODE, SRE.EMP_CODE, APPR.ENTITY_CODE, APPR.ENTITY_DESCR) " +
"SUR ON e.code = SUR.EMP_CODE " +
"WHERE (e.FIRSTNAME +' '+ e.LASTNAME) = '"+personName+"' GROUP BY e.CODE ) HDR " +
"INNER JOIN (SELECT (e.FIRSTNAME +' '+ e.LASTNAME) NAME, APPR.ENTITY_DESCR as PRD_NAME , " +
"SUM(CAST(SRD.result AS INT)) RESULT , e.code FROM hr.dbo.survey_result_EMP SRE " +
"INNER JOIN hr.dbo.survey_result SR ON SRE.TRAN_ID = SR.TRAN_ID__FORM " +
"INNER JOIN hr.dbo.survey_result_det SRD ON SR.TRAN_ID = SRD.TRAN_ID " +
"INNER JOIN (SELECT * FROM hr.dbo.survey_result_appl WHERE APPL_ENTITY = 'E') " +
"APP ON SRD.TRAN_ID = APP.TRAN_ID INNER JOIN (SELECT * FROM hr.dbo.survey_result_appl " +
" WHERE APPL_ENTITY = 'I'" +
") APPR ON SRD.TRAN_ID = APPR.TRAN_ID " +
"INNER JOIN hr.dbo.employee e ON APP.ENTITY_CODE = e.code " +
"INNER JOIN hr.dbo.survey_master sm ON SRD.SURVEY_CODE = sm.SURVEY_CODE " +
"WHERE (e.FIRSTNAME +' '+ e.LASTNAME) = '"+personName+"' " +
"GROUP BY (e.FIRSTNAME +' '+ e.LASTNAME) , APPR.ENTITY_DESCR , e.code) DET_PRD ON HDR.CODE = DET_PRD.CODE " +
"UNION ALL " +
"SELECT DET_PRD.NAME , DET_PRD.PRD_NAME,RESULT,TOTAL, Str((100-(RESULT * 100.0/TOTAL)),4,1) PERC, 'Remaining' AS REPORT,(TOTAL - RESULT) as RESULTCNT " +
"FROM ( select e.CODE, SUM(SUR.RESULT) TOTAL from hr.dbo.employee e INNER JOIN hr.dbo.REGION r on e.regionid = r.id INNER JOIN (SELECT APP.ENTITY_CODE EMP_CODE, " +
"SRE.EMP_CODE MGR, sum(CAST(SRD.result AS INT)) RESULT, APPR.ENTITY_CODE PRD_CODE, APPR.ENTITY_DESCR PRD_DESC FROM hr.dbo.survey_result_EMP SRE " +
"INNER JOIN hr.dbo.survey_result SR ON SRE.TRAN_ID = SR.TRAN_ID__FORM " +
"INNER JOIN hr.dbo.survey_result_det SRD ON SR.TRAN_ID = SRD.TRAN_ID INNER JOIN (SELECT * FROM hr.dbo.survey_result_appl WHERE APPL_ENTITY = 'E') APP ON SRD.TRAN_ID = APP.TRAN_ID " +
"INNER JOIN (SELECT * FROM hr.dbo.survey_result_appl " +
"WHERE APPL_ENTITY = 'I'" +
") APPR ON SRD.TRAN_ID = APPR.TRAN_ID " +
"GROUP BY APP.ENTITY_CODE, SRE.EMP_CODE, APPR.ENTITY_CODE, APPR.ENTITY_DESCR) SUR ON e.code = SUR.EMP_CODE " +
"WHERE (e.FIRSTNAME +' '+ e.LASTNAME) = '"+personName+"' GROUP BY e.CODE ) HDR INNER JOIN (SELECT (e.FIRSTNAME +' '+ e.LASTNAME) NAME, APPR.ENTITY_DESCR as PRD_NAME , " +
"SUM(CAST(SRD.result AS INT)) RESULT , e.code FROM hr.dbo.survey_result_EMP SRE INNER JOIN hr.dbo.survey_result SR ON SRE.TRAN_ID = SR.TRAN_ID__FORM " +
"INNER JOIN hr.dbo.survey_result_det SRD ON SR.TRAN_ID = SRD.TRAN_ID INNER JOIN (SELECT * FROM hr.dbo.survey_result_appl WHERE APPL_ENTITY = 'E') APP ON SRD.TRAN_ID = APP.TRAN_ID " +
"INNER JOIN (SELECT * FROM hr.dbo.survey_result_appl " +
"WHERE APPL_ENTITY = 'I'" +
") APPR ON SRD.TRAN_ID = APPR.TRAN_ID INNER JOIN hr.dbo.employee e ON APP.ENTITY_CODE = e.code " +
"INNER JOIN hr.dbo.survey_master sm ON SRD.SURVEY_CODE = sm.SURVEY_CODE " +
"WHERE (e.FIRSTNAME +' '+ e.LASTNAME) = '"+personName+"' GROUP BY (e.FIRSTNAME +' '+ e.LASTNAME) , APPR.ENTITY_DESCR , e.code) DET_PRD ON HDR.CODE = DET_PRD.CODE) X " +
" where upper(report)='MARKS' "+
"ORDER BY NAME, PRD_NAME";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
int count = 0;
double rsltCnt=0,total=0;
while (rs.next())
{
rowData = new JSONObject();
/* rowData.put("prd_name", checkNull(rs.getString("PRD_NAME")));
rowData.put("name", checkNull(rs.getString("NAME")));
rowData.put("perc", checkNull(rs.getString("PERC")));
rowData.put("report", checkNull( rs.getString("RESULTCNT"))+" "+ checkNull( rs.getString("REPORT"))+" out of "+checkNull( rs.getString("TOTAL")));
rowData.put("resultcnt", checkNull(rs.getString("RESULTCNT")));
rowData.put("tooltext",checkNull( rs.getString("TOTAL")));*/
rsltCnt= Double.parseDouble(checkNull( rs.getString("RESULTCNT")));
total= Double.parseDouble(checkNull( rs.getString("TOTAL")));
System.out.println("rsltCnt:"+rsltCnt);
System.out.println("total:"+total);
percntVal =( (rsltCnt/total) * 100) ;
System.out.println("percntVal:"+percntVal);
rowData.put("descr", "Marks");
rowData.put("percentage", Math.round(percntVal));
rowData.put("spanvalue", Math.round(percntVal)+"%");
rowData.put("person_name", checkNull(rs.getString("NAME")));
rowData.put("prd_name", checkNull(rs.getString("PRD_NAME")));
rowData.put("ontimeval", checkNull( rs.getString("RESULTCNT")));
rowData.put("totalval", checkNull( rs.getString("TOTAL")));
rowData.put("tbldisplay", "style='display: visible'");
rowData.put("circledisplay", "c100");
rawDataEmployeeProductlJson.put(count, rowData);
count++;
}
......
......@@ -13,4 +13,5 @@ public interface ProductAssessmentLocal extends ValidatorLocal
public JSONObject getProductAssessmentEventServlet(String loginId, String dataSourceName,String zone,String region,String product,String team,String event) throws RemoteException, ITMException;
public JSONObject getProductAssessmentProductServlet(String dataSourceName,String name) throws RemoteException, ITMException;
public JSONObject getProductAssessmentProductRatingServlet(String dataSourceName,String personName,String productName) throws RemoteException, ITMException;
public JSONObject getProductAssessmentProductPieServlet(String dataSourceName,String personName) throws RemoteException, ITMException;
}
......@@ -12,4 +12,5 @@ public interface ProductAssessmentRemote extends ValidatorRemote
public JSONObject getProductAssessmentEventServlet(String loginId, String dataSourceName,String zone,String region,String product,String team,String event) throws RemoteException, ITMException;
public JSONObject getProductAssessmentProductServlet(String dataSourceName,String name) throws RemoteException, ITMException;
public JSONObject getProductAssessmentProductRatingServlet(String dataSourceName,String personName,String productName) throws RemoteException, ITMException;
public JSONObject getProductAssessmentProductPieServlet(String dataSourceName,String personName) 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