Commit 29541909 authored by vishalt's avatar vishalt

Pophelp system entries is added in SQL and bug changes is made in EJB,Servlet and Metadata.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@44066 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 89e4ed11
......@@ -23,295 +23,160 @@ public class ContactCommDashboard implements ContactCommDashboardLocal, ContactC
}
@SuppressWarnings({ "unchecked"})
/*Modified by Anjali Rawankar on[10/05/2017][Start]
* [Purpose : Modify method declaration]
*/
//public JSONObject getCommunicationSchedule(String dataSourceName) throws RemoteException, ITMException
public JSONObject getCommunicationSchedule(String dataSourceName,String loginCode) throws RemoteException, ITMException
/*[Purpose : Modify method declaration]
* Modified by Anjali Rawankar on[10/05/2017][End]
*/
public JSONObject getCommunicationSchedule(String dataSourceName,String loginCode, String empCode) throws RemoteException, ITMException
{
StringBuffer xmlString = null;
JSONObject rowDataBasicJsn = new JSONObject();
JSONObject rowData = null;
String sql = "" ,sql1 = "" , sql2 = "";
ResultSet rs = null,rs1 = null,rs2 = null;
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null;
String sql = "" ;
ResultSet rs = null;
PreparedStatement pstmt = null,pstmt1 = null, pstmtDS = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
int count = 0;
String commPlanId ="",plandate = "",salesPers ="",sconCode = "",commDate = "",contactType = "",
activityCode = "",planDetail = "",commId = "",resultFlag = "",spName = "";
Date planDate1= null,commDate1 = null;
String newPlanDate = "",newCommDate = "";
String firstName ="",lastName = "",emailAddr = "" ,mobileNo = "",sorgCode = "",sorgName = "",contactPerson = "";
String dbDateFormat = "",applDateFormat = "";
try
{
E12GenericUtility genericUtility = new E12GenericUtility();
conn = connDriver.getConnectDB(dataSourceName);
dbDateFormat = genericUtility.getDBDateFormat();
applDateFormat = genericUtility.getApplDateFormat();
/*Modified by Anjali Rawankar on [10/05/2017][start]
*[Purpose : xmlString initialize inside while loop]
*/
/*xmlString = new StringBuffer("<table class='mtBackgroundWhite' border=''><tbody><tr>"
+ "<th class='mtBackgroundWhite' style='width: 4%;'>Sales Person</th>"
+"<th class='mtBackgroundWhite' colspan='2' style='width: 4%;'> Date </th>"
+"<th class='mtBackgroundWhite' colspan='' style='width: 4%;'> Contact Person</th>"
+"<th class='mtBackgroundWhite' style='width: 4%;'>Orgnization</th>"
+"<th class='mtBackgroundWhite' style='width: 4%;'>Plan Detail</th>"
+"</tr>");
/*[Purpose : xmlString initialize inside while loop]
*Modified by Anjali Rawankar on [10/05/2017][End]
*/
activityCode = "",planDetail = "",commId = "",resultFlag = "",spName = "", pstmtDSInput = "";;
Date planDate1= null,commDate1 = null;
String newPlanDate = "",newCommDate = "";
String firstName ="",lastName = "",emailAddr = "" ,mobileNo = "",sorgCode = "",sorgName = "",contactPerson = "";
String dbDateFormat = "",applDateFormat = "";
StringBuffer dataSourceSql = null;
try
{
E12GenericUtility genericUtility = new E12GenericUtility();
conn = connDriver.getConnectDB(dataSourceName);
dbDateFormat = genericUtility.getDBDateFormat();
applDateFormat = genericUtility.getApplDateFormat();
/*Modified by Anjali Rawankar on[10/05/2017][Start]
* [Purpose : Added where clause for sales_pers]
*/
/*sql = "SELECT (STR.FIRST_NAME||' '||STR.LAST_NAME) AS CONTACT_PERSON,"+
" STR.SORG_CODE, "+
" STR.EMAIL_ADDR, "+
" STR.MOBILE_NO, "+
" SP.SP_NAME, "+
" COM.COMM_PLAN_ID, "+
" COM.PLAN_DATE, "+
" COM.ACTIVITY_CODE, "+
" COM.COMM_ID, "+
" COM.RESULT_FLAG, "+
" COM.SALES_PERS, "+
" COM.SCON_CODE, "+
" TO_CHAR(COM.COMM_DATE,'DD-MM-YYYY')AS NEW_COMM_DATE, "+
" CASE COM.CONTACT_TYPE WHEN '1' THEN 'CALL' WHEN '2' THEN 'MAIL' WHEN '3' THEN 'MEETING' WHEN '4' "+
" THEN 'VIDEOCONFERENCING'WHEN '5' THEN 'OTHERS'END AS DESCR," +
" COM.PLAN_DETAIL," +
" COM.START_TIME," +
" COM.END_TIME "+
" FROM CONTACT_COMM_PLAN COM " +
" INNER JOIN STRG_CONTACT STR ON COM.SCON_CODE=STR.SCON_CODE " +
" INNER JOIN SALES_PERS SP ON COM.SALES_PERS=SP.SALES_PERS "+
" WHERE COMM_DATE >= SYSDATE ORDER:03-04-2017 BY SP.SP_NAME,NEW_COMM_DATE";*/
/*Modified by Anjali Rawankar on[12/05/2017][Start]
* [Purpose : Chnage sql statement]
*/
/*sql = "SELECT (STR.FIRST_NAME||' '||STR.LAST_NAME) AS CONTACT_PERSON,"+
" STR.SORG_CODE, "+
" STR.EMAIL_ADDR, "+
" STR.MOBILE_NO, "+
" SP.SP_NAME, "+
" COM.COMM_PLAN_ID, "+
" COM.PLAN_DATE, "+
" COM.ACTIVITY_CODE, "+
" COM.COMM_ID, "+
" COM.RESULT_FLAG, "+
" COM.SALES_PERS, "+
" COM.SCON_CODE, "+
" TO_CHAR(COM.COMM_DATE,'DD-MM-YYYY')AS NEW_COMM_DATE, "+
" CASE COM.CONTACT_TYPE WHEN '1' THEN 'CALL' WHEN '2' THEN 'MAIL' WHEN '3' THEN 'MEETING' WHEN '4' "+
" THEN 'VIDEOCONFERENCING'WHEN '5' THEN 'OTHERS'END AS DESCR," +
" COM.PLAN_DETAIL," +
" COM.START_TIME," +
" COM.END_TIME "+
" FROM CONTACT_COMM_PLAN COM " +
" INNER JOIN STRG_CONTACT STR ON COM.SCON_CODE=STR.SCON_CODE " +
" INNER JOIN SALES_PERS SP ON COM.SALES_PERS=SP.SALES_PERS "+
" WHERE COMM_DATE >= SYSDATE AND COM.SALES_PERS = ? "+
" ORDER BY SP.SP_NAME,NEW_COMM_DATE";*/
sql = "select sales_pers from sales_pers where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginCode);
rs = pstmt.executeQuery();
while (rs.next())
{
salesPers = rs.getString("sales_pers");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(empCode == null || empCode.trim().length() == 0)
{
empCode = loginCode;
}
sql = "SELECT (STR.FIRST_NAME||' '||STR.LAST_NAME) AS CONTACT_PERSON,"+
" STR.SORG_CODE, "+
" STR.EMAIL_ADDR, "+
" STR.MOBILE_NO, "+
" SP.SP_NAME, "+
" COM.COMM_PLAN_ID, "+
" COM.PLAN_DATE, "+
" COM.ACTIVITY_CODE, "+
" COM.COMM_ID, "+
" COM.RESULT_FLAG, "+
" COM.SALES_PERS, "+
" COM.SCON_CODE, "+
" COM.COMM_DATE AS NEW_COMM_DATE, "+
" CASE COM.CONTACT_TYPE WHEN '1' THEN 'CALL' WHEN '2' THEN 'MAIL' WHEN '3' THEN 'MEETING' WHEN '4' "+
" THEN 'VIDEOCONFERENCING'WHEN '5' THEN 'OTHERS'END AS DESCR," +
" COM.PLAN_DETAIL," +
" COM.START_TIME," +
" COM.END_TIME ," +
" COM.START_DATE," +
" COM.END_DATE , " +
" COM.REMARKS,"+
" STRO.SORG_NAME "+
" FROM CONTACT_COMM_PLAN COM " +
" INNER JOIN STRG_CONTACT STR ON COM.SCON_CODE=STR.SCON_CODE " +
" INNER JOIN SALES_PERS SP ON COM.SALES_PERS=SP.SALES_PERS "+
" INNER JOIN STRG_ORG STRO ON STRO.SORG_CODE = STR.SORG_CODE "+
" WHERE COMM_DATE >= TRUNC(SYSDATE) ";
sql = "SELECT (STR.FIRST_NAME||' '||STR.LAST_NAME) AS CONTACT_PERSON,"+
" STR.SORG_CODE, "+
" STR.EMAIL_ADDR, "+
" STR.MOBILE_NO, "+
" SP.SP_NAME, "+
" COM.COMM_PLAN_ID, "+
" COM.PLAN_DATE, "+
" COM.ACTIVITY_CODE, "+
" COM.COMM_ID, "+
" COM.RESULT_FLAG, "+
" COM.SALES_PERS, "+
" COM.SCON_CODE, "+
" COM.COMM_DATE AS NEW_COMM_DATE, "+
" CASE COM.CONTACT_TYPE WHEN '1' THEN 'CALL' WHEN '2' THEN 'MAIL' WHEN '3' THEN 'MEETING' WHEN '4' "+
" THEN 'VIDEOCONFERENCING'WHEN '5' THEN 'OTHERS'END AS DESCR," +
" COM.PLAN_DETAIL," +
" COM.START_TIME," +
" COM.END_TIME ," +
" COM.START_DATE," +
" COM.END_DATE , " +
" COM.REMARKS "+
" FROM CONTACT_COMM_PLAN COM " +
" INNER JOIN STRG_CONTACT STR ON COM.SCON_CODE=STR.SCON_CODE " +
" INNER JOIN SALES_PERS SP ON COM.SALES_PERS=SP.SALES_PERS "+
" WHERE COMM_DATE >= TRUNC(SYSDATE) AND COM.SALES_PERS = ? "+
" ORDER BY SP.SP_NAME,NEW_COMM_DATE";
/*[Purpose : Chnage sql statement]
* Modified by Anjali Rawankar on[12/05/2017][End]
*/
dataSourceSql = new StringBuffer(sql);
/*[Purpose : Added where clause for sales_pers]
* Modified by Anjali Rawankar on[10/05/2017][End]
*/
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPers);// Modified by Anjali Rawankar on[10/05/2017]
rs = pstmt.executeQuery();
while (rs.next())
{
/*Modified by Anjali Rawankar on[10/05/2017][Start]
* [Purpose : added table definition]
*/
count++;
if(count == 1)
{
xmlString = new StringBuffer("<table class='mtBackgroundWhite' border=''><tbody><tr>"
+ "<th class='mtBackgroundWhite' style='width: 4%;'>Sales Person</th>"
+"<th class='mtBackgroundWhite' colspan='' style='width: 4%;'> Date </th>"
+"<th class='mtBackgroundWhite' colspan='' style='width: 4%;'> Contact Person</th>"
+"<th class='mtBackgroundWhite' style='width: 4%;'>Plan Detail</th>"
+"</tr>");
}
/*[Purpose : added table definition]
* Modified by Anjali Rawankar on[10/05/2017][End]
*/
spName = checkNull(rs.getString("sp_name"));
contactPerson = checkNull(rs.getString("contact_person"));
sorgCode = checkNull(rs.getString("sorg_code"));
emailAddr = checkNull(rs.getString("email_addr"));
mobileNo = checkNull(rs.getString("mobile_no"));
commDate1 = rs.getDate("NEW_COMM_DATE");
String newdate = (commDate1 != null )? genericUtility.getValidDateString(commDate1.toString(), dbDateFormat, applDateFormat ):null;
sql1="";
sql1 = "select sorg_name from strg_org where sorg_code = ?";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1,sorgCode);
rs1 = pstmt1.executeQuery();
while (rs1.next())
{
sorgName = rs1.getString("sorg_name");
System.out.println("Organization name :::: ["+sorgName+"]");
}
/*Modified by Anjali Rawankar on[10/05/2017][Start]
* [Purpose : close resultset and preparedstatment]
*/
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
if(rs1 != null)
{
rs1.close();
rs1 = null;
}
/*[Purpose : close resultset and preparedstatment]
* Modified by Anjali Rawankar on[10/05/2017][End]
*/
xmlString.append("<tr><td class= 'cardHtmlTableBodyAlignLft' rowspan='4' style='width: 4%;'>"+spName+"</td>");
xmlString.append("<td rowspan = '2' class= 'cardHtmlTableBodyAlignLft' style='width: 4%;'>"+newdate+"</td> ");
xmlString.append("<td class= 'cardHtmlTableBodyAlignLft' style='width: 4%;'>"+contactPerson+"</td>");
xmlString.append("<td class= 'cardHtmlTableBodyAlignLft' rowspan='4'style='width: 4%;'>"+checkNull(rs.getString("plan_detail"))+"</td></tr>");
xmlString.append("<tr><td class= 'cardHtmlTableBodyAlignLft' style='width: 4%;border-top: 1px solid transparent;vertical-align:top;'>"+sorgName+"</td></tr>");
xmlString.append("<tr><td rowspan = '2' class= 'cardHtmlTableBodyAlignLft' style='width: 4%;border-top: 1px solid transparent;vertical-align:top;'>From:"+checkNull(rs.getString("start_time"))+" To:"+checkNull(rs.getString("end_time"))+"</td>");
xmlString.append("<td class= 'cardHtmlTableBodyAlignLft' style='width: 4%;border-top: 1px solid transparent;'>"+emailAddr+"</td></tr>");
xmlString.append("<tr><td class= 'cardHtmlTableBodyAlignLft' style='width: 4%;border-top: 1px solid transparent;'><img src='../webitm/images/Standard/tele-1-1.ico' style='width:10px;height:10px;'>"+mobileNo+"</td></tr>");
}
/*Modified by Anjali Rawankar on[10/05/2017][Start]
*[Purpose : else condition for table definition in case of data not available]
*/
if(count == 0)
{
/*Modified by Anjali Rawankar on[12/05/2017][Start]
*[Purpose : Changed table definition]
*/
/*xmlString = new StringBuffer("<table id='htmlTable' cellpadding='2'"+
"align='center'><tr><td align = 'center' class='gwt-ScrollTable'>No "+
"Data Found</td></tr></table>");*/
xmlString = new StringBuffer("<table id='htmlTable' cellpadding='2'"+
"align='center'><tbody><tr><td align = 'center' class='gwt-ScrollTable'>No "+
"Data Found</td></tr>");
/*[Purpose : Changed table definition]
* Modified by Anjali Rawankar on[12/05/2017][End]
*
*/
}
/*[Purpose : else condition for table definition in case of data not available]
*Modified by Anjali Rawankar on[10/05/2017][End]
*/
System.out.println("xmlString ::::[ "+xmlString+" ]");
xmlString.append("</tbody></table>");
rowData =new JSONObject();
rowData.put("xmlString", xmlString.toString());
rowDataBasicJsn.put(0,rowData);
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
pstmtDSInput = "";
if(empCode.equalsIgnoreCase("TEAM"))
{
dataSourceSql.append(" AND SP.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = ? CONNECT BY PRIOR EMP_CODE = REPORT_TO) ORDER BY SP.SP_NAME,NEW_COMM_DATE");
pstmtDSInput = loginCode;
}
else
{
dataSourceSql.append(" AND SP.EMP_CODE = ? ORDER BY SP.SP_NAME,NEW_COMM_DATE");
pstmtDSInput = empCode;
}
sql = dataSourceSql.toString();
pstmtDS = conn.prepareStatement(sql);
pstmtDS.setString(1, pstmtDSInput);
rs = pstmtDS.executeQuery();
while (rs.next())
{
count++;
if(count == 1)
{
xmlString = new StringBuffer("<table class='mtBackgroundWhite' border=''><tbody><tr>"
+ "<th class='mtBackgroundWhite' style='width: 2%;'>Sales Person</th>"
+"<th class='mtBackgroundWhite' colspan='' style='width: 2%;'> Date </th>"
+"<th class='mtBackgroundWhite' colspan='' style='width: 4%;'> Contact Person</th>"
+"<th class='mtBackgroundWhite' style='width: 4%;'>Plan Detail</th>"
+"</tr>");
}
spName = checkNull(rs.getString("sp_name"));
contactPerson = checkNull(rs.getString("contact_person"));
sorgCode = checkNull(rs.getString("sorg_code"));
emailAddr = checkNull(rs.getString("email_addr"));
mobileNo = checkNull(rs.getString("mobile_no"));
commDate1 = rs.getDate("NEW_COMM_DATE");
String newdate = (commDate1 != null )? genericUtility.getValidDateString(commDate1.toString(), dbDateFormat, applDateFormat ):null;
xmlString.append("<tr><td class= 'cardHtmlTableBodyAlignLft' rowspan='4' style='text-align: center;'>"+spName+"</td>");
xmlString.append("<td rowspan = '2' class= 'cardHtmlTableBodyAlignLft' >"+newdate+"</td> ");
xmlString.append("<td class= 'cardHtmlTableBodyAlignLft' >"+contactPerson+"</td>");
xmlString.append("<td class= 'cardHtmlTableBodyAlignLft' rowspan='4'>"+checkNull(rs.getString("plan_detail"))+"</td></tr>");
xmlString.append("<tr><td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;vertical-align:top;'>"+checkNull(rs.getString("SORG_NAME"))+"</td></tr>");
xmlString.append("<tr><td rowspan = '2' class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;vertical-align:top;'>From:"+checkNull(rs.getString("start_time"))+" To:"+checkNull(rs.getString("end_time"))+"</td>");
xmlString.append("<td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;'>"+emailAddr+"</td></tr>");
xmlString.append("<tr><td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;'><img src='../webitm/images/Standard/tele-1-1.ico' style='width:10px;height:10px;'>"+mobileNo+"</td></tr>");
}
if(count == 0)
{
xmlString = new StringBuffer("<table id='htmlTable' cellpadding='2'"+
"align='center'><tbody><tr><td align = 'center' class='gwt-ScrollTable'>No "+
"Data Found</td></tr>");
}
System.out.println("xmlString ::::[ "+xmlString+" ]");
xmlString.append("</tbody></table>");
rowData =new JSONObject();
rowData.put("xmlString", xmlString.toString());
rowDataBasicJsn.put(0,rowData);
if(pstmtDS != null)
{
pstmtDS.close();
pstmtDS = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
}
catch (Exception e)
{
rs.close();
rs = null;
}
if (pstmt != null)
e.printStackTrace();
throw new ITMException(e);
}
finally
{
pstmt.close();
pstmt = null;
try
{
if (conn != null)
{
conn.close();
conn = null;
}
conn = null;
}
catch (Exception d)
{
d.printStackTrace();
System.out.println("Exception in : ContactCommDashboard :::: " + d.getMessage());
throw new ITMException(d);
}
}
if (conn != null)
{
conn.close();
conn = null;
}
conn = null;
}
catch (Exception d)
{
d.printStackTrace();
System.out.println("Exception in : ContactCommDashboard : ContactCommDashboard :" + d.getMessage());
throw new ITMException(d);
}
}
return rowDataBasicJsn;
return rowDataBasicJsn;
}
private String checkNull(String str)
{
......
......@@ -11,6 +11,6 @@ import org.json.simple.JSONObject;
@Local
public interface ContactCommDashboardLocal
{
public JSONObject getCommunicationSchedule(String dataSourceName,String loginCode) throws RemoteException, ITMException;
public JSONObject getCommunicationSchedule(String dataSourceName,String loginCode, String empCode) throws RemoteException, ITMException;
}
......@@ -11,6 +11,6 @@ import org.json.simple.JSONObject;
@Remote
public interface ContactCommDashboardRemote
{
public JSONObject getCommunicationSchedule(String dataSourceName,String loginCode) throws RemoteException, ITMException;
public JSONObject getCommunicationSchedule(String dataSourceName,String loginCode, String empCode) throws RemoteException, ITMException;
}
......@@ -3,7 +3,10 @@ package ibase.dashboard.crm.ejb;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.*;
import java.rmi.RemoteException;
import java.sql.*;
import javax.ejb.*;
import org.json.simple.JSONObject;
......@@ -14,13 +17,17 @@ public class OpportunityStageInfo implements OpportunityStageInfoLocal,Opportuni
}
@SuppressWarnings({ "unchecked"})
public JSONObject getOpportunityStage(String dataSourceName,String loginCode) {
public JSONObject getOpportunityStage(String dataSourceName,
String loginCode, String empCode) throws RemoteException,
ITMException {
JSONObject rowDataBasicJsn = new JSONObject();
JSONObject rowData = null;
StringBuffer xmlString = null;
String sql = "";
StringBuffer dataSourceSql = null;
String sql = "", pstmtDSInput = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
PreparedStatement pstmtDS = null;
Connection conn = null;
ConnDriver connection = new ConnDriver();
String opprName = "", opprType = "", opprDate = "", sconCode = "", opprDescr = "", salesTeam = "",
......@@ -28,7 +35,7 @@ public class OpportunityStageInfo implements OpportunityStageInfoLocal,Opportuni
salesPersonAssign = "", probPercStart = "", probVolumeCurrent = "", stageCode = "", assDate = "",
commId = "", salesPers = "", opprId = "", prodPerc = "", volume = "", reqType = "", reqDescr = "",
remarks = "", probPercCurrent = "", spName = "", stageDescr = "", contactName = "", mobileNo = "",
emailAddr = "", sorgName = "", sorgCode = "",salesPersEmpCode="";
emailAddr = "", sorgName = "", sorgCode = "";
boolean noScrollRequired;
int count = 0;
String dbDateFormat = "",applDateFormat = "";
......@@ -39,23 +46,11 @@ public class OpportunityStageInfo implements OpportunityStageInfoLocal,Opportuni
E12GenericUtility genericUtility = new E12GenericUtility();
dbDateFormat = genericUtility.getDBDateFormat();
applDateFormat = genericUtility.getApplDateFormat();
sql = "select sales_pers from sales_pers where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginCode);
rs = pstmt.executeQuery();
while(rs.next()){
salesPersEmpCode = rs.getString("sales_pers");
}
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
if (empCode == null || empCode.trim().length() == 0)
{
empCode = loginCode;
}
sql = "SELECT opp.oppr_id,"
+ "opp.oppr_name,"
+ "opp.oppr_type,"
......@@ -74,7 +69,7 @@ public class OpportunityStageInfo implements OpportunityStageInfoLocal,Opportuni
+ "opp.prob_volume_current,"
+ "opp.stage_code,"
+ "opass.ass_date as new_ass_date,"
+ "opass.comm_id,"
+ "opass.comm_id,"
+ "opass.prod_perc,"
+ "opass.volume,"
+ "opass.req_type,"
......@@ -99,13 +94,25 @@ public class OpportunityStageInfo implements OpportunityStageInfoLocal,Opportuni
+ "INNER JOIN strg_org org "
+ "ON org.sorg_code = opp.sorg_code "
+ "where opass.ass_date >= ADD_MONTHS(trunc(SYSDATE) , -40) "
+ "and (opass.oppr_id , opass.ass_date) in (SELECT oppr_id,max(ass_date) FROM oppr_assesment opass1 where opass1.oppr_id = opass.oppr_id group by opass1.oppr_id)"
+ "AND opass.sales_pers = ?"
+ "order by oppr_date,ass_date";
+ "and (opass.oppr_id , opass.ass_date) in (SELECT oppr_id,max(ass_date) FROM oppr_assesment opass1 where opass1.oppr_id = opass.oppr_id group by opass1.oppr_id)" ;
dataSourceSql = new StringBuffer(sql);
pstmtDSInput = "";
if(empCode.equalsIgnoreCase("TEAM")){
dataSourceSql.append(" AND sales.emp_code in (select emp_code from employee start with emp_code = ? connect by prior emp_code = report_to) order by oppr_date,ass_date");
pstmtDSInput = loginCode;
}else{
dataSourceSql.append(" AND sales.emp_code = ? order by oppr_date,ass_date");
pstmtDSInput = empCode;
}
sql = dataSourceSql.toString();
pstmtDS = conn.prepareStatement(sql);
pstmtDS.setString(1, pstmtDSInput);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPersEmpCode);
rs = pstmt.executeQuery();
rs = pstmtDS.executeQuery();
while (rs.next()) {
count++;
......@@ -123,7 +130,6 @@ public class OpportunityStageInfo implements OpportunityStageInfoLocal,Opportuni
opprName = checkNull(rs.getString("oppr_name"));
opprType = checkNull(rs.getString("oppr_type"));
oppDate = rs.getDate("new_oppr_date");
System.out.println("oppDate ::: "+oppDate);
sconCode = checkNull(rs.getString("scon_code"));
sorgCode = checkNull(rs.getString("sorg_code"));
opprDescr = checkNull(rs.getString("oppr_descr"));
......@@ -133,13 +139,11 @@ public class OpportunityStageInfo implements OpportunityStageInfoLocal,Opportuni
salesProdGrp = checkNull(rs.getString("sales_prod_grp"));
profitPerc = checkNull(rs.getString("profit_perc"));
forecastCloserDate = rs.getDate("new_forecast_close_date");
System.out.println("forecastCloserDate ::: "+forecastCloserDate);
salesPersonAssign = checkNull(rs.getString("sales_person_assign"));
probPercStart = checkNull(rs.getString("prob_perc_start"));
probVolumeCurrent = checkNull(rs.getString("prob_volume_current"));
stageCode = checkNull(rs.getString("stage_code"));
asDate = rs.getDate("new_ass_date");
System.out.println("asDate ::"+asDate);
commId = checkNull(rs.getString("comm_id"));
prodPerc = checkNull(rs.getString("prod_perc"));
volume = checkNull(rs.getString("volume"));
......@@ -155,24 +159,8 @@ public class OpportunityStageInfo implements OpportunityStageInfoLocal,Opportuni
sorgName = checkNull(rs.getString("sorg_name"));
String newAsDate = (asDate != null)?genericUtility.getValidDateString(asDate.toString(),dbDateFormat,applDateFormat):null;
System.out.println("New As Date ::: " +newAsDate);
String newForecastCloserDate = (forecastCloserDate != null)?genericUtility.getValidDateString(forecastCloserDate.toString(),dbDateFormat,applDateFormat):null;
System.out.println("new For cast Date ::: "+newForecastCloserDate);
String newOppDate = (oppDate != null)?genericUtility.getValidDateString(oppDate.toString(),dbDateFormat,applDateFormat):null;
System.out.println(" New Opp Date ::: "+newOppDate);
// Modified by Vishal Thakur[22/05/2017][Change the inline CSS][START]
/*xmlString.append("<tr> <td class= 'cardHtmlTableBodyAlignLft' rowspan='5' style='border-top: 1px solid transparent;'>" + spName+ "</td>"
+ "<td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;'>" + contactName + "</td> "
+ "<td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;'>Opportunity Date:" + opprDate + "</td>"
+ "<td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;'>As on: " + assDate + "</td> </tr> <tr>"
+ "<td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;'><img src='../webitm/images/Standard/tele-1-1.ico' style='width:10px;height:10px;'> " + mobileNo + "</td> "
+ "<td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;'>Opportunity Name:" + opprName + "</td>"
+ "<td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;'>Stage:" + stageDescr + "</td> </tr> <tr> "
+ "<td class= 'cardHtmlTableBodyAlignLft' rowspan='3' style='vertical-align:top;border-top: 1px solid transparent;'>" + emailAddr + "</td>"
+ "<td class= 'cardHtmlTableBodyAlignLft' rowspan='3' style='vertical-align:top;border-top: 1px solid transparent;'>Opportunity Detail:" + opprDescr + "</td>"
+ "<td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;'>Forecast Close Date:" + forecastCloseDate + "</td> </tr>"
+ "<tr> <td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;'>Value:" + opprValue + "</td> </tr>"
+ "<tr> <td cddlass= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;'>Probabilty Percentage:" + prodPerc + "</td>" + "</tr>");*/
xmlString.append("<tr> <td class= 'cardHtmlTableBodyAlignLft' rowspan='5' style='text-align: center;'>" + spName+ "</td>"
+ "<td class= 'cardHtmlTableBodyAlignLft'>" + contactName + "</td> "
......@@ -187,8 +175,17 @@ public class OpportunityStageInfo implements OpportunityStageInfoLocal,Opportuni
+ "<tr> <td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;'>Value:" + opprValue + "</td> </tr>"
+ "<tr> <td cddlass= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;'>Probabilty Percentage:" + prodPerc + "</td>" + "</tr>");
// Modified by Vishal Thakur[22/05/2017][Change the inline CSS][END]
}if(count == 0)
}
if (rs != null) {
rs.close();
rs = null;
}
if (pstmtDS != null) {
pstmtDS.close();
pstmtDS = null;
}
if(count == 0)
{
xmlString = new StringBuffer("<table id='htmlTable' cellpadding='2'"
+"align='center'><tbody><tr><td align = 'center' class='gwt-ScrollTable'>"
......@@ -207,15 +204,6 @@ public class OpportunityStageInfo implements OpportunityStageInfoLocal,Opportuni
} finally {
try {
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (conn != null) {
conn.close();
......@@ -241,4 +229,4 @@ public class OpportunityStageInfo implements OpportunityStageInfoLocal,Opportuni
return str.trim();
}
}
}
}
\ No newline at end of file
......@@ -10,6 +10,6 @@ import org.json.simple.JSONObject;
@Local
public interface OpportunityStageInfoLocal {
public JSONObject getOpportunityStage(String dataSourceName,String loginCode)
public JSONObject getOpportunityStage(String dataSourceName,String loginCode,String empCode)
throws RemoteException, ITMException;
}
......@@ -10,7 +10,7 @@ import org.json.simple.JSONObject;
@Remote
public interface OpportunityStageInfoRemote {
public JSONObject getOpportunityStage(String dataSourceName,String loginCode)
public JSONObject getOpportunityStage(String dataSourceName,String loginCode,String empCode)
throws RemoteException, ITMException;
}
......@@ -19,14 +19,14 @@ OpportunityStageSummaryRemote {
@SuppressWarnings({ "unchecked"})
public JSONObject getOpportunityStageSummary(String dataSourceName,
String loginCode,String oppStageDescr)
String loginCode,String oppStageDescr,String empCode)
{
JSONObject rowDataBasicJsn = new JSONObject();
JSONObject rowData = null;
String sql = "";
String sql = "",pstmtDSInput = "";
StringBuffer dataSourceSql = null;
ResultSet rs = null;
PreparedStatement pstmt = null;
PreparedStatement pstmt = null, pstmtDS = null;
Connection conn = null;
ConnDriver connection = new ConnDriver();
String opprName = "", opprType = "", opprDate = "", sconCode = "", opprDescr = "", salesTeam = "",
......@@ -34,37 +34,24 @@ OpportunityStageSummaryRemote {
salesPersonAssign = "", probPercStart = "", probVolumeCurrent = "", stageCode = "",
assDate = "", commId = "", salesPers = "", opprId = "", prodPerc = "", volume = "", reqType = "",
reqDescr = "", remarks = "", probPercCurrent = "", spName = "", stageDescr = "", contactName = "",
mobileNo = "", emailAddr = "", sorgName = "", sorgCode = "", opprPrcnt = "", salesPersEmpCode = "";
int count = 0, countStageCode = 0, oppCountStageCode = 0;
double valueStageCode = 0, oppValueStageCode = 0 ;
mobileNo = "", emailAddr = "", sorgName = "", sorgCode = "", opprPrcnt = "";
int count = 0;
Date foreCastCloserDate = null,asDate = null;
String dbDateFormat= "",applDateFormat = "";
try {
conn = connection.getConnectDB(dataSourceName);
E12GenericUtility genericUtility = new E12GenericUtility();
dbDateFormat = genericUtility.getDBDateFormat();
applDateFormat = genericUtility.getApplDateFormat();
sql = "select sales_pers from sales_pers where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginCode);
rs = pstmt.executeQuery();
while(rs.next()){
salesPersEmpCode = rs.getString("sales_pers");
}
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
if (empCode == null || empCode.trim().length() == 0)
{
empCode = loginCode;
}
sql = "SELECT opp.oppr_id,"
sql = "SELECT opp.oppr_id,"
+ "opp.oppr_name,"
+ "opp.oppr_type,"
+ "opp.oppr_date as new_oppr_date,"
......@@ -76,12 +63,12 @@ OpportunityStageSummaryRemote {
+ "opp.oppr_value,"
+ "opp.sales_prod_grp,"
+ "opp.profit_perc,"
+ "opp.forecast_close_date as new_forecast_close_date,"
+ "opp.forecast_close_date as new_forecast_close_date,"
+ "opp.sales_person_assign,"
+ "opp.prob_perc_start,"
+ "opp.prob_volume_current,"
+ "opp.stage_code,"
+ "opass.ass_date as new_ass_date,"
+ "opass.ass_date as new_ass_date,"
+ "opass.comm_id,"
+ "opass.prod_perc,"
+ "opass.volume,"
......@@ -107,25 +94,38 @@ OpportunityStageSummaryRemote {
+ "INNER JOIN strg_org org "
+ "ON org.sorg_code = opp.sorg_code "
+ "where opass.ass_date >= ADD_MONTHS(trunc(SYSDATE) , -40) "
+ "and (opass.oppr_id , opass.ass_date) in (SELECT oppr_id,max(ass_date) FROM oppr_assesment opass1 where opass1.oppr_id = opass.oppr_id group by opass1.oppr_id) "
+ "AND stage.descr = ?"
+ "AND opass.sales_pers = ?"
+ "order by oppr_date,ass_date desc";
+ "and (opass.oppr_id , opass.ass_date) in (SELECT oppr_id,max(ass_date) FROM oppr_assesment opass1 where opass1.oppr_id = opass.oppr_id group by opass1.oppr_id)"
+ "AND stage.descr = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, oppStageDescr);
pstmt.setString(2, salesPersEmpCode);
rs = pstmt.executeQuery();
dataSourceSql = new StringBuffer(sql);
pstmtDSInput = "";
if(empCode.equalsIgnoreCase("TEAM")){
dataSourceSql.append(" AND sales.emp_code in (select emp_code from employee start with emp_code = ? connect by prior emp_code = report_to) order by oppr_date,ass_date");
pstmtDSInput = loginCode;
}else{
dataSourceSql.append(" AND sales.emp_code = ? order by oppr_date,ass_date");
pstmtDSInput = empCode;
}
sql = dataSourceSql.toString();
pstmtDS = conn.prepareStatement(sql);
pstmtDS.setString(1, oppStageDescr);
pstmtDS.setString(2, pstmtDSInput);
rs = pstmtDS.executeQuery();
while (rs.next()) {
foreCastCloserDate = rs.getDate("new_forecast_close_date");
asDate = rs.getDate("new_ass_date");
String newForecastDate ="",newAssDate="";
newForecastDate = (foreCastCloserDate != null )? genericUtility.getValidDateString(foreCastCloserDate.toString(), dbDateFormat, applDateFormat ):null;
newAssDate = (asDate != null )? genericUtility.getValidDateString(asDate.toString(), dbDateFormat, applDateFormat ):null;
rowData = new JSONObject();
rowData.put("sp_name", checkNull(rs.getString("sp_name")));
......@@ -137,25 +137,26 @@ OpportunityStageSummaryRemote {
rowData.put("oppr_name", checkNull(rs.getString("oppr_name")));
rowData.put("forecast_close_date",newForecastDate);
rowData.put("ass_date",newAssDate );
rowDataBasicJsn.put(count, rowData);
count++;
}
if (rs != null) {
rs.close();
rs = null;
}
if (pstmtDS != null) {
pstmtDS.close();
pstmtDS = null;
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("Exception in Opportunity Stage Summary :::: " + e.getMessage());
} finally {
try {
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (conn != null) {
conn.close();
......@@ -174,23 +175,24 @@ OpportunityStageSummaryRemote {
return rowDataBasicJsn;
}
@SuppressWarnings({ "unchecked", "unused" })
@SuppressWarnings({"unchecked" })
public JSONObject getOpportunityStageCount(String dataSourceName,
String loginCode) {
String loginCode, String empCode) {
JSONObject rowDataCountJsn = new JSONObject();
JSONObject rowData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
PreparedStatement pstmt = null, pstmtDS = null;
Connection conn = null;
ConnDriver connection = new ConnDriver();
StringBuffer dataSourceSql =null;
String opprName = "", opprType = "", opprDate = "", sconCode = "", opprDescr = "", salesTeam = "", currCode = "",
salesProdGrp = "", profitPerc = "", forecastCloseDate = "", salesPersonAssign = "", probPercStart = "",
probVolumeCurrent = "", stageCode = "", assDate = "", commId = "", salesPers = "", opprId = "", prodPerc = "",
volume = "", reqType = "", reqDescr = "", remarks = "", probPercCurrent = "", spName = "", stageDescr = "",
contactName = "", mobileNo = "", emailAddr = "", sorgName = "", sorgCode = "", opprValue = "", prvStageCode = "",
opprCount = "",salesPersEmpCode="";
opprCount = "", pstmtDSInput = "";
int count = 0, countStageDescr = 0, totalCount = 0, oppCountStageWise = 0;
double totalOppCount;
......@@ -198,15 +200,17 @@ OpportunityStageSummaryRemote {
try {
HashMap<String, Integer> stageDescrHMap = new HashMap<String, Integer>();
ArrayList<Double> totalCnt = new ArrayList<Double>();
ArrayList<Integer> oppCnt = new ArrayList<Integer>();
conn = connection.getConnectDB(dataSourceName);
sql = "SELECT opp.oppr_id,"
if (empCode == null || empCode.trim().length() == 0)
{
empCode = loginCode;
}
sql = "SELECT opp.oppr_id,"
+ "opp.oppr_name,"
+ "opp.oppr_type,"
+ "to_char(opp.oppr_date,'dd-MM-yyyy') as new_oppr_date,"
+ "opp.oppr_date as new_oppr_date,"
+ "opp.scon_code,"
+ "opp.sorg_code,"
+ "opp.oppr_descr,"
......@@ -215,12 +219,12 @@ OpportunityStageSummaryRemote {
+ "opp.oppr_value,"
+ "opp.sales_prod_grp,"
+ "opp.profit_perc,"
+ "to_char(opp.forecast_close_date,'dd-MM-yyyy') as new_forecast_close_date,"
+ "opp.forecast_close_date as new_forecast_close_date,"
+ "opp.sales_person_assign,"
+ "opp.prob_perc_start,"
+ "opp.prob_volume_current,"
+ "opp.stage_code,"
+ "to_char(opass.ass_date,'dd-MM-yyyy') as new_ass_date,"
+ "opass.ass_date as new_ass_date,"
+ "opass.comm_id,"
+ "opass.prod_perc,"
+ "opass.volume,"
......@@ -228,8 +232,8 @@ OpportunityStageSummaryRemote {
+ "opass.req_descr,"
+ "opass.remarks,"
+ "opass.prob_perc_current,"
+ "sales.sales_pers,"
+ "sales.sp_name,"
+ "sales.sales_pers,"
+ "stage.descr as stage_descr,"
+ "(contact.first_name||' '||case when contact.last_name is null or length(trim(contact.last_name)) = 0 then '' else trim(contact.last_name) end) as contact_name,"
+ "contact.mobile_no,"
......@@ -247,13 +251,25 @@ OpportunityStageSummaryRemote {
+ "INNER JOIN strg_org org "
+ "ON org.sorg_code = opp.sorg_code "
+ "where opass.ass_date >= ADD_MONTHS(trunc(SYSDATE) , -40) "
+ "and (opass.oppr_id , opass.ass_date) in (SELECT oppr_id,max(ass_date) FROM oppr_assesment opass1 where opass1.oppr_id = opass.oppr_id group by opass1.oppr_id) "
+ "AND opass.sales_pers = ? "
+ "order by oppr_date,ass_date";
+ "and (opass.oppr_id , opass.ass_date) in (SELECT oppr_id,max(ass_date) FROM oppr_assesment opass1 where opass1.oppr_id = opass.oppr_id group by opass1.oppr_id)" ;
dataSourceSql = new StringBuffer(sql);
pstmtDSInput = "";
if(empCode.equalsIgnoreCase("TEAM")){
dataSourceSql.append(" AND sales.emp_code in (select emp_code from employee start with emp_code = ? connect by prior emp_code = report_to) order by oppr_date,ass_date");
pstmtDSInput = loginCode;
}else{
dataSourceSql.append(" AND sales.emp_code = ? order by oppr_date,ass_date");
pstmtDSInput = empCode;
}
sql = dataSourceSql.toString();
pstmtDS = conn.prepareStatement(sql);
pstmtDS.setString(1, pstmtDSInput);
rs = pstmtDS.executeQuery();
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginCode);
rs = pstmt.executeQuery();
while (rs.next()) {
spName = checkNull(rs.getString("sp_name"));
......@@ -277,6 +293,16 @@ OpportunityStageSummaryRemote {
}
if (rs != null) {
rs.close();
rs = null;
}
if (pstmtDS != null) {
pstmtDS.close();
pstmtDS = null;
}
Set<Map.Entry<String, Integer>> entrySet1 = stageDescrHMap.entrySet();
Iterator<Entry<String, Integer>> entrySetIterator = entrySet1.iterator();
......@@ -284,10 +310,7 @@ OpportunityStageSummaryRemote {
Entry<String, Integer> entry = entrySetIterator.next();
oppCountStageWise = entry.getValue().intValue();
oppCnt.add(count,oppCountStageWise);
totalOppCount = (((double) oppCountStageWise / totalCount) * 100);
totalCnt.add(count, totalOppCount);
rowData = new JSONObject();
rowData.put("stage_descr",entry.getKey());
......@@ -303,15 +326,6 @@ OpportunityStageSummaryRemote {
System.out.println("Exception in Opportunity Stage Count :::: "+ e.getMessage());
} finally {
try {
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (conn != null) {
conn.close();
......@@ -330,14 +344,15 @@ OpportunityStageSummaryRemote {
return rowDataCountJsn;
}
@SuppressWarnings({ "unused", "unchecked" })
@SuppressWarnings({"unchecked" })
public JSONObject getOpportunityStageValue(String dataSourceName,
String loginCode) {
String loginCode, String empCode) {
JSONObject rowDataValueJsn = new JSONObject();
JSONObject rowData = null;
String sql = "";
String sql = "", pstmtDSInput = "";
StringBuffer dataSourceSql = null;
ResultSet rs = null;
PreparedStatement pstmt = null;
PreparedStatement pstmt = null, pstmtDS =null;
Connection conn = null;
ConnDriver connection = new ConnDriver();
String opprName = "", opprType = "", opprDate = "", sconCode = "", opprDescr = "", salesTeam = "",
......@@ -345,40 +360,24 @@ OpportunityStageSummaryRemote {
probPercStart = "", probVolumeCurrent = "", stageCode = "", assDate = "", commId = "", salesPers = "",
opprId = "", prodPerc = "", volume = "", reqType = "", reqDescr = "", remarks = "", probPercCurrent = "",
spName = "", stageDescr = "", contactName = "", mobileNo = "", emailAddr = "", sorgName = "", sorgCode = "",
opprValue = "",salesPersEmpCode="";
opprValue = "";
int count = 0;
double valueStageDescr = 0, totalValue = 0.0, oppValueStageWise = 0;
double totalOppValue = 0;
try {
HashMap<String, Double> stageDescrHMap = new HashMap<String, Double>();
ArrayList<Double> totalVal = new ArrayList<Double>();
ArrayList<Double> oppValue = new ArrayList<Double>();
conn = connection.getConnectDB(dataSourceName);
sql = "select sales_pers from sales_pers where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginCode);
rs = pstmt.executeQuery();
while(rs.next()){
salesPersEmpCode = rs.getString("sales_pers");
}
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
if (empCode == null || empCode.trim().length() == 0)
{
empCode = loginCode;
}
sql = "SELECT opp.oppr_id,"
sql = "SELECT opp.oppr_id,"
+ "opp.oppr_name,"
+ "opp.oppr_type,"
+ "to_char(opp.oppr_date,'dd-MM-yyyy') as new_oppr_date,"
+ "opp.oppr_date as new_oppr_date,"
+ "opp.scon_code,"
+ "opp.sorg_code,"
+ "opp.oppr_descr,"
......@@ -387,12 +386,12 @@ OpportunityStageSummaryRemote {
+ "opp.oppr_value,"
+ "opp.sales_prod_grp,"
+ "opp.profit_perc,"
+ "to_char(opp.forecast_close_date,'dd-MM-yyyy') as new_forecast_close_date,"
+ "opp.forecast_close_date as new_forecast_close_date,"
+ "opp.sales_person_assign,"
+ "opp.prob_perc_start,"
+ "opp.prob_volume_current,"
+ "opp.stage_code,"
+ "to_char(opass.ass_date,'dd-MM-yyyy') as new_ass_date,"
+ "opass.ass_date as new_ass_date,"
+ "opass.comm_id,"
+ "opass.prod_perc,"
+ "opass.volume,"
......@@ -400,8 +399,8 @@ OpportunityStageSummaryRemote {
+ "opass.req_descr,"
+ "opass.remarks,"
+ "opass.prob_perc_current,"
+ "sales.sales_pers,"
+ "sales.sp_name,"
+ "sales.sales_pers,"
+ "stage.descr as stage_descr,"
+ "(contact.first_name||' '||case when contact.last_name is null or length(trim(contact.last_name)) = 0 then '' else trim(contact.last_name) end) as contact_name,"
+ "contact.mobile_no,"
......@@ -418,14 +417,27 @@ OpportunityStageSummaryRemote {
+ "ON contact.scon_code = opp.scon_code "
+ "INNER JOIN strg_org org "
+ "ON org.sorg_code = opp.sorg_code "
+ "where opass.ass_date >= ADD_MONTHS(trunc(SYSDATE) , -40) "
+ "and (opass.oppr_id , opass.ass_date) in (SELECT oppr_id,max(ass_date) FROM oppr_assesment opass1 where opass1.oppr_id = opass.oppr_id group by opass1.oppr_id)"
+ "AND opass.sales_pers = ?"
+ "order by oppr_date,ass_date";
+ "where opass.ass_date >= ADD_MONTHS(trunc(SYSDATE) , -40) "
+ "and (opass.oppr_id , opass.ass_date) in (SELECT oppr_id,max(ass_date) FROM oppr_assesment opass1 where opass1.oppr_id = opass.oppr_id group by opass1.oppr_id)" ;
dataSourceSql = new StringBuffer(sql);
pstmtDSInput = "";
if(empCode.equalsIgnoreCase("TEAM")){
dataSourceSql.append(" AND sales.emp_code in (select emp_code from employee start with emp_code = ? connect by prior emp_code = report_to) order by oppr_date,ass_date");
pstmtDSInput = loginCode;
}else{
dataSourceSql.append(" AND sales.emp_code = ? order by oppr_date,ass_date");
pstmtDSInput = empCode;
}
sql = dataSourceSql.toString();
pstmtDS = conn.prepareStatement(sql);
pstmtDS.setString(1, pstmtDSInput);
rs = pstmtDS.executeQuery();
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPersEmpCode);
rs = pstmt.executeQuery();
while (rs.next()) {
spName = checkNull(rs.getString("sp_name"));
......@@ -437,7 +449,6 @@ OpportunityStageSummaryRemote {
if (stageDescrHMap.containsKey(stageDescr)) {
valueStageDescr = stageDescrHMap.get(stageDescr) + Double.parseDouble(opprValue);
totalValue = totalValue + Double.parseDouble(opprValue);
stageDescrHMap.put(stageDescr, valueStageDescr);
} else {
......@@ -457,11 +468,8 @@ OpportunityStageSummaryRemote {
Entry<String, Double> entry = entrySetIterator.next();
oppValueStageWise = entry.getValue();
oppValue.add(count, oppValueStageWise);
totalOppValue = ((oppValueStageWise / totalValue) * 100);
totalVal.add(count, totalOppValue);
rowData = new JSONObject();
rowData.put("stage_descr", entry.getKey());
......@@ -471,20 +479,21 @@ OpportunityStageSummaryRemote {
count++;
}
if (rs != null) {
rs.close();
rs = null;
}
if (pstmtDS != null) {
pstmtDS.close();
pstmtDS = null;
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("Exception in Opportunity Stage Value :::: " + e.getMessage());
} finally {
try {
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (conn != null) {
conn.close();
......@@ -504,7 +513,7 @@ OpportunityStageSummaryRemote {
return rowDataValueJsn;
}
@SuppressWarnings({ "unused", "unchecked" })
@SuppressWarnings({ "unchecked" })
public JSONObject getOrganizationStageCount(String dataSourceName,
String loginCode) {
......@@ -521,7 +530,7 @@ OpportunityStageSummaryRemote {
assDate = "", commId = "", salesPers = "", opprId = "", prodPerc = "", volume = "",
reqType = "", reqDescr = "", remarks = "", probPercCurrent = "", spName = "", stageDescr = "",
contactName = "", mobileNo = "", emailAddr = "", sorgName = "", sorgCode = "", opprValue = "",
prvStageCode = "", opprCount = "",salesPersEmpCode="";
prvStageCode = "", opprCount = "";
int count = 0, countStageCode = 0, totalCount = 0, orgCountStageWise = 0;
double totalOrgCount = 0;
......@@ -532,7 +541,7 @@ OpportunityStageSummaryRemote {
ArrayList<Double> orgCountPnct = new ArrayList<Double>();
conn = connection.getConnectDB(dataSourceName);
sql = "SELECT opp.oppr_id,"
+ "opp.oppr_name,"
+ "opp.oppr_type,"
......@@ -658,7 +667,7 @@ OpportunityStageSummaryRemote {
return rowDataCountJsn;
}
@SuppressWarnings({ "unused", "unchecked" })
@SuppressWarnings({"unchecked" })
public JSONObject getOrganizationStageValue(String dataSourceName,
String loginCode) {
......@@ -681,8 +690,6 @@ OpportunityStageSummaryRemote {
try {
HashMap<String, Double> stageCodeHMap = new HashMap<String, Double>();
ArrayList<Double> orgValue = new ArrayList<Double>();
ArrayList<Double> orgValuePnct = new ArrayList<Double>();
conn = connection.getConnectDB(dataSourceName);
......@@ -763,12 +770,8 @@ OpportunityStageSummaryRemote {
Entry<String, Double> entry = entrySetIterator.next();
orgValueStageWise = entry.getValue();
orgValue.add(count, orgValueStageWise);
totalOrgValue = ((orgValueStageWise / totalValue) * 100);
orgValuePnct.add(count, totalOrgValue);
rowData = new JSONObject();
rowData.put("stage_code", entry.getKey());
......@@ -817,4 +820,6 @@ OpportunityStageSummaryRemote {
return str.trim();
}
}
}
......@@ -6,9 +6,9 @@ import org.json.simple.JSONObject;
@Local
public interface OpportunityStageSummaryLocal {
public JSONObject getOpportunityStageSummary(String dataSourceName, String loginCode,String oppStageDescr);
public JSONObject getOpportunityStageCount(String dataSourceName, String loginCode);
public JSONObject getOpportunityStageValue(String dataSourceName, String loginCode);
public JSONObject getOpportunityStageSummary(String dataSourceName, String loginCode,String oppStageDescr, String empCode);
public JSONObject getOpportunityStageCount(String dataSourceName, String loginCode, String empCode);
public JSONObject getOpportunityStageValue(String dataSourceName, String loginCode, String empCode);
public JSONObject getOrganizationStageCount(String dataSourceName, String loginCode);
public JSONObject getOrganizationStageValue(String dataSourceName, String loginCode);
}
......@@ -6,9 +6,9 @@ import org.json.simple.JSONObject;
@Remote
public interface OpportunityStageSummaryRemote {
public JSONObject getOpportunityStageSummary(String dataSourceName, String loginCode,String oppStageDescr);
public JSONObject getOpportunityStageCount(String dataSourceName, String loginCode);
public JSONObject getOpportunityStageValue(String dataSourceName, String loginCode);
public JSONObject getOpportunityStageSummary(String dataSourceName, String loginCode,String oppStageDescr,String empCode);
public JSONObject getOpportunityStageCount(String dataSourceName, String loginCode, String empCode);
public JSONObject getOpportunityStageValue(String dataSourceName, String loginCode, String empCode);
public JSONObject getOrganizationStageCount(String dataSourceName, String loginCode);
public JSONObject getOrganizationStageValue(String dataSourceName, String loginCode);
}
......@@ -19,22 +19,23 @@ PendingCommunicationDashboardLocal, PendingCommunicationDashboardRemote {
@SuppressWarnings({ "unchecked"})
public JSONObject getPendingCommunicationDashboard(String dataSourceName,
String loginCode)
String loginCode, String empCode)
{
E12GenericUtility genericUtility = new E12GenericUtility();
JSONObject rowDataBasicJsn = new JSONObject();
JSONObject rowData = null;
String sql = "", sql1 = "", sql2 = "",sql3 = "";
ResultSet rs = null, rs1 = null, rs2 = null,rs3=null;
PreparedStatement pstmt = null, pstmt1 = null, pstmt2 = null,pstmt3=null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null,pstmtDS = null ;
Connection conn = null;
ConnDriver connection = new ConnDriver();
String salesPers = "", sconCode = "", commId = "" ;
String sconCode = "", pstmtDSInput = "";
Date commDate1 = null;
String dbDataFormat="",applDataFormat ="";
StringBuffer dataSourceSql = null;
int count = 0;
long millis = 0;
StringBuffer xmlString = new StringBuffer();
millis = System.currentTimeMillis();
java.sql.Date date = new java.sql.Date(millis);
......@@ -46,82 +47,104 @@ PendingCommunicationDashboardLocal, PendingCommunicationDashboardRemote {
dbDataFormat = genericUtility.getDBDateFormat();
applDataFormat = genericUtility.getApplDateFormat();
sql3="select sales_pers from sales_pers where emp_code = ?";
pstmt3 = conn.prepareStatement(sql3);
pstmt3.setString(1, loginCode);
rs3 = pstmt3.executeQuery();
while (rs3.next())
if(empCode == null || empCode.trim().length() == 0)
{
salesPers = rs3.getString("sales_pers");
empCode = loginCode;
}
if (rs3 != null) {
rs3.close();
rs3 = null;
sql = "SELECT cp.scon_code,cp.sales_pers,"+
" cp.comm_date,trim(sa.descr) AS activity_descr,"+
" CASE CP.CONTACT_TYPE"+
" WHEN '1'"+
" THEN 'an activity to call'"+
" WHEN '2'"+
" THEN 'an activity of sending mail'"+
" WHEN '3'"+
" THEN 'an activity to meet'"+
" WHEN '4'"+
" THEN 'an activity of video conferenc call'"+
" WHEN '5'"+
" THEN 'an activity' END AS DESCR ,"+
" (sc.first_name ||' ' || CASE"+
" WHEN sc.last_name IS NULL"+
" OR LENGTH(trim(sc.last_name)) = 0"+
" THEN ''"+
" ELSE trim(sc.last_name)"+
" END) AS contact_name,"+
" so.sorg_name,sp.sp_name "+
" FROM contact_comm_plan cp"+
" INNER JOIN strg_contact sc"+
" ON cp.scon_code = sc.scon_code "+
" LEFT OUTER JOIN strg_org so "+
" ON so.sorg_code = sc.sorg_code "+
" INNER JOIN sales_activity sa "+
" ON sa.activity_code = cp.activity_code "+
" INNER JOIN SALES_PERS SP " +
" ON CP.SALES_PERS = SP.SALES_PERS ";
dataSourceSql = new StringBuffer(sql);
pstmtDSInput = "";
if(empCode.equalsIgnoreCase("TEAM"))
{
dataSourceSql.append(" WHERE SP.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = ? CONNECT BY PRIOR EMP_CODE = REPORT_TO) AND CP.COMM_ID IS NULL AND CP.COMM_DATE < SYSDATE ORDER BY CP.COMM_DATE, CP.START_TIME");
pstmtDSInput = loginCode;
}
if (pstmt3 != null)
else
{
pstmt3.close();
pstmt3 = null;
dataSourceSql.append(" WHERE SP.EMP_CODE = ? AND CP.COMM_ID IS NULL AND CP.COMM_DATE < SYSDATE ORDER BY CP.COMM_DATE, CP.START_TIME ");
pstmtDSInput = empCode;
}
sql = "SELECT scon_code FROM contact_comm_plan WHERE comm_id is null and sales_pers = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, salesPers);
rs = pstmt.executeQuery();
sql = dataSourceSql.toString();
pstmtDS = conn.prepareStatement(sql);
pstmtDS.setString(1, pstmtDSInput);
rs = pstmtDS.executeQuery();
while (rs.next())
{
sconCode = rs.getString("scon_code");
sql1 = "SELECT MAX(cp.comm_date) as past_comm_date FROM contact_comm_plan cp inner join strg_contact sc on sc.scon_code = cp.scon_code WHERE cp.scon_code = ? "
+ " and cp.sales_pers = ? " ;
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, sconCode);
pstmt1.setString(2, salesPers);
rs1 = pstmt1.executeQuery();
while (rs1.next())
count++;
if(count == 1)
{
commDate1 = rs1.getDate("past_comm_date");
String newdate = (commDate1 != null )? genericUtility.getValidDateString(commDate1.toString(), dbDataFormat, applDataFormat ):null;
if (commDate1.before(date))
if(empCode.equalsIgnoreCase("TEAM"))
{
sql2 = "select trim(sa.descr) as activity_descr,"+
" CASE CP.CONTACT_TYPE WHEN '1' THEN 'Call' WHEN '2' THEN 'Mail' WHEN '3' THEN 'Meeting' WHEN '4'"+
" THEN 'Videoconferencing'WHEN '5' THEN 'Other' END AS DESCR ,"+
"(sc.first_name||' '||case when sc.last_name is null or length(trim(sc.last_name)) = 0 then '' else trim(sc.last_name) end) as contact_name,"+
" so.sorg_name "+
" from contact_comm_plan cp"+
" LEFT OUTER join strg_contact sc"+
" on sc.scon_code = cp.scon_code"+
" LEFT OUTER join strg_org so"+
" on so.sorg_code = sc.sorg_code"+
" LEFT OUTER join sales_activity sa"+
" on sa.activity_code = cp.activity_code"+
" where sc.scon_code=? and cp.sales_pers = ?";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1, sconCode);
pstmt2.setString(2, salesPers);
rs2 = pstmt2.executeQuery();
while (rs2.next())
{
System.out.println("Inside while @@@Pending communication Dashboard");
count++;
if(count == 1)
{
xmlString = new StringBuffer("<table class='mtBackgroundWhite' border=''><tbody><tr>"
+ "<th class='mtBackgroundWhite' style='width: 2%;'>Date</th>"
+"<th class='mtBackgroundWhite' style='width: 2%;'>Contact Person</th>"
+"<th class='mtBackgroundWhite' style='width: 2%;'>Contact mode</th>"
+"<th class='mtBackgroundWhite' style='width: 2%;'>Activity Description</th>"
+"</tr>");
}
xmlString.append("<tr><td rowspan ='2' class= 'cardHtmlTableBodyAlignLft' style='width: 2%;'>"+newdate+"</td>");
xmlString.append("<td class= 'cardHtmlTableBodyAlignLft' style='width: 2%;'>"+(rs2.getString("contact_name"))+"</td>");
xmlString.append("<td rowspan ='2' class= 'cardHtmlTableBodyAlignLft' style='width: 2%;'>"+checkNull(rs2.getString("DESCR"))+"</td>");
xmlString.append("<td rowspan ='2'class= 'cardHtmlTableBodyAlignLft' style='width: 2%;'>"+checkNull(rs2.getString("activity_descr"))+"</td></tr>");
xmlString.append("<tr><td class= 'cardHtmlTableBodyAlignLft' style='width: 2%;border-top: 1px solid transparent;vertical-align:top;'>"+checkNull(rs2.getString("sorg_name"))+"</td></tr>");
}
xmlString = new StringBuffer("<table class='mtBackgroundWhite' border='' style='width: 100%;'><tbody><tr>"
+ "<th class='mtBackgroundWhite' style='width: 2%;'>Sales Person</th>"
+ "<th class='mtBackgroundWhite' style='width: 1%;'>Date</th>"
+"<th class='mtBackgroundWhite' style='width: 3%;'>Contact Person</th>"
+"<th class='mtBackgroundWhite' style='width: 3%;'>Contact mode</th>"
+"<th class='mtBackgroundWhite' style='width: 2%;'>Activity Description</th>"
+"</tr>");
}
else
{
xmlString = new StringBuffer("<table class='mtBackgroundWhite' border='' style='width: 100%;'><tbody><tr>"
+ "<th class='mtBackgroundWhite' style='width: 1%;'>Date</th>"
+"<th class='mtBackgroundWhite' style='width: 3%;'>Contact Person</th>"
+"<th class='mtBackgroundWhite' style='width: 3%;'>Contact mode</th>"
+"<th class='mtBackgroundWhite' style='width: 2%;'>Activity Description</th>"
+"</tr>");
}
}
sconCode = rs.getString("scon_code");
commDate1 = rs.getDate("comm_date");
String newdate = (commDate1 != null )? genericUtility.getValidDateString(commDate1.toString(), dbDataFormat, applDataFormat ):null;
if (commDate1.before(date))
{
System.out.println("Inside while @@@Pending communication Dashboard");
if(empCode.equalsIgnoreCase("TEAM")){
xmlString.append("<tr><td rowspan ='2' class= 'cardHtmlTableBodyAlignLft' style='text-align: center;' >"+checkNull(rs.getString("sp_name"))+"</td>");
xmlString.append("<td rowspan ='2' class= 'cardHtmlTableBodyAlignLft' s>"+newdate+"</td>");
xmlString.append("<td class= 'cardHtmlTableBodyAlignLft' >"+(rs.getString("contact_name"))+"</td>");
xmlString.append("<td rowspan ='2' class= 'cardHtmlTableBodyAlignLft' >"+checkNull(rs.getString("DESCR"))+"</td>");
xmlString.append("<td rowspan ='2'class= 'cardHtmlTableBodyAlignLft' >"+checkNull(rs.getString("activity_descr"))+"</td></tr>");
xmlString.append("<tr><td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;vertical-align:top;'>"+checkNull(rs.getString("sorg_name"))+"</td></tr>");
}
else{
xmlString.append("<tr><td rowspan ='2' class= 'cardHtmlTableBodyAlignLft' >"+newdate+"</td>");
xmlString.append("<td class= 'cardHtmlTableBodyAlignLft' >"+(rs.getString("contact_name"))+"</td>");
xmlString.append("<td rowspan ='2' class= 'cardHtmlTableBodyAlignLft' >"+checkNull(rs.getString("DESCR"))+"</td>");
xmlString.append("<td rowspan ='2'class= 'cardHtmlTableBodyAlignLft' >"+checkNull(rs.getString("activity_descr"))+"</td></tr>");
xmlString.append("<tr><td class= 'cardHtmlTableBodyAlignLft' style='border-top: 1px solid transparent;vertical-align:top;'>"+checkNull(rs.getString("sorg_name"))+"</td></tr>");
}
}
......@@ -133,44 +156,28 @@ PendingCommunicationDashboardLocal, PendingCommunicationDashboardRemote {
}
}
if (rs != null) {
rs.close();
rs = null;
}
if (pstmtDS != null) {
pstmtDS.close();
pstmtDS = null;
}
System.out.println("xmlString ::::[ "+xmlString+" ]");
xmlString.append("</tbody></table>");
rowData =new JSONObject();
rowData.put("xmlString", xmlString.toString());
rowDataBasicJsn.put(0,rowData);
} catch (Exception e) {
e.printStackTrace();
System.out.println("Exception in Pending Communication Dashboard :::: "+ e.getMessage());
} finally {
try {
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (rs1 != null) {
rs1.close();
rs1 = null;
}
if (pstmt1 != null) {
pstmt1.close();
pstmt1 = null;
}
if (rs2 != null) {
rs2.close();
rs2 = null;
}
if (pstmt2 != null) {
pstmt2.close();
pstmt2 = null;
}
if (conn != null) {
conn.close();
conn = null;
......
......@@ -6,5 +6,5 @@ import org.json.simple.JSONObject;
@Local
public interface PendingCommunicationDashboardLocal {
public JSONObject getPendingCommunicationDashboard(String dataSourceName,String loginCode);
public JSONObject getPendingCommunicationDashboard(String dataSourceName,String loginCode, String empCode);
}
......@@ -6,5 +6,5 @@ import org.json.simple.JSONObject;
@Remote
public interface PendingCommunicationDashboardRemote {
public JSONObject getPendingCommunicationDashboard(String dataSourceName,String loginCode);
public JSONObject getPendingCommunicationDashboard(String dataSourceName,String loginCode, String empCode);
}
......@@ -9,7 +9,18 @@ values ('MKTG',1,1,'CRM','/ibase/dwh/GwtDashboardPage.html?metadataname=CRMDashb
Insert into dashboard_pages (USER_ID,PAGE_ID,TITLE,URI,IMAGE_URI,PAGE_TYPE,ENTITY_TYPE,ENTITY_CODE,COMP_TYPE,CHG_USER,CHG_TERM,CHG_DATE)
values ('MKTG',1,'CRM','/ibase/dwh/GwtDashboardPage.html?metadataname=CRMDashboard',null,'T','F','MKTG','DBR','Base','Base',to_date('11-05-17','DD-MM-RR'));
COMMIT;
--- Dashboard Name: CRM Dashboard.End ---
--- 30/05/2017.End ---
--- 09/05/2017 .Start ---
--- Dashboard POPHELP ---
Insert into POPHELP (FIELD_NAME,MOD_NAME,SQL_STR,MSG_TITLE,WIDTH,HEIGHT,CHG_DATE,CHG_USER,CHG_TERM,DIST_OPT,SQL_INPUT)
values ('EMP_CODE','W_CRMDASHBOARD','SELECT A.EMP_CODE AS CODE , A.EMP_FNAME||'' ''||A.EMP_LNAME AS EMP_NAME FROM EMPLOYEE A, SALES_PERS B WHERE A.EMP_CODE = B.EMP_CODE AND A.RELIEVE_DATE IS NULL START WITH A.EMP_CODE = ''?'' CONNECT BY PRIOR A.EMP_CODE = A.REPORT_TO UNION ALL SELECT ''TEAM'' AS CODE,''TEAM SUMMARY'' AS EMP_NAME FROM DUAL','EMPLOYEE CODE',0,0,sysdate,'BASE','BASE','0',':EMP_CODE');
--- 09/05/2017.End ---
COMMIT;
<?xml version='1.0'?>
<Root>
<?xml version='1.0'?>
<Root>
<filters display='N'>
<filter type='5'>
<default_value><![CDATA[]]></default_value>
<col_name><![CDATA[EMP_CODE]]></col_name>
<col_descr><![CDATA[Sales Persons]]></col_descr>
<col_id><![CDATA[EMP_CODE]]></col_id>
<field_name><![CDATA[EMP_CODE]]></field_name>
<mod_name><![CDATA[CRMDASHBOARD]]></mod_name>
<show_ontitle><![CDATA[0]]></show_ontitle>
<mandatory><![CDATA[N]]></mandatory>
</filter>
</filters>
<page_title><![CDATA[CRM]]></page_title>
<datasource id ='1' driverName='DriverITM'><![CDATA[PendingCommunicationDashboardServlet]]></datasource>
<datasource id ='2' driverName='DriverITM'><![CDATA[ContactCommDashboardServlet]]></datasource>
<datasource id ='3' driverName='DriverITM'><![CDATA[OpportunityStageInfoServlet]]></datasource>
<datasource id ='4' driverName='DriverITM'><![CDATA[OpportunityStageValueServlet]]></datasource>
<view id='1' name='Order'>
<component datasource='1' id='1' type='CARD'>
......
<?xml version='1.0'?>
<Root>
<filters display='N'>
......@@ -12,6 +11,17 @@
<show_ontitle><![CDATA[1]]></show_ontitle>
<mandatory><![CDATA[N]]></mandatory>
</filter>
<filter type='5'>
<default_value><![CDATA[]]></default_value>
<col_name><![CDATA[EMP_CODE]]></col_name>
<col_descr><![CDATA[Sales Persons]]></col_descr>
<col_id><![CDATA[EMP_CODE]]></col_id>
<field_name><![CDATA[EMP_CODE]]></field_name>
<mod_name><![CDATA[CRMDASHBOARD]]></mod_name>
<show_ontitle><![CDATA[0]]></show_ontitle>
<mandatory><![CDATA[N]]></mandatory>
</filter>
</filters>
<page_title><![CDATA[CRM]]></page_title>
......
......@@ -29,6 +29,7 @@ public class ContactCommDashboardServlet extends HttpServlet {
throws IOException, ServletException {
String dataSourceName = "";
String loginCode = "";// Modified by Anjali Rawankar on[10/05/2017][Start]
String empCode = "";
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
ContactCommDashboardRemote contactCommDashboardRemote = null;
......@@ -37,6 +38,8 @@ public class ContactCommDashboardServlet extends HttpServlet {
response.setContentType("application/xml");
dataSourceName = request.getParameter("dataSourceName");
empCode = request.getParameter("EMP_CODE");
/*
* Modified by Anjali Rawankar on[10/05/2017][Start]
* [Purpose : To get logincode ]
......@@ -69,7 +72,7 @@ public class ContactCommDashboardServlet extends HttpServlet {
*/
// JSONObject jsonObjData = (JSONObject)
// contactCommDashboardRemote.getCommunicationSchedule(dataSourceName);
JSONObject jsonObjData = (JSONObject) contactCommDashboardRemote.getCommunicationSchedule(dataSourceName, loginCode);
JSONObject jsonObjData = (JSONObject) contactCommDashboardRemote.getCommunicationSchedule(dataSourceName, loginCode, empCode);
/*
* [Purpose : Add parametere logincode in getcommunicationSchedule()]
* Modified by Anjali Rawankar on[10/05/2017][End]
......
......@@ -32,6 +32,7 @@ public class OpportunityStageCountServlet extends HttpServlet {
String dataSourceName = "";
String loginCode = "";
String empCode = "";
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
OpportunityStageSummaryRemote opportunityStageSummaryRemote = null;
......@@ -39,6 +40,8 @@ public class OpportunityStageCountServlet extends HttpServlet {
try {
response.setContentType("application/xml");
dataSourceName = request.getParameter("dataSourceName");
empCode = request.getParameter("EMP_CODE");
HttpSession session = request.getSession(true);
UserInfoBean userInfo = (UserInfoBean) session.getAttribute("USER_INFO");
......@@ -48,7 +51,7 @@ public class OpportunityStageCountServlet extends HttpServlet {
context = new InitialContext(appConnectParm.getProperty());
opportunityStageSummaryRemote = (OpportunityStageSummaryRemote) context.lookup("ibase/OpportunityStageSummary/remote");
JSONObject jsonObjData = (JSONObject) opportunityStageSummaryRemote.getOpportunityStageCount(dataSourceName, loginCode);
JSONObject jsonObjData = (JSONObject) opportunityStageSummaryRemote.getOpportunityStageCount(dataSourceName, loginCode, empCode);
ServletOutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
......
......@@ -30,8 +30,7 @@ public class OpportunityStageInfoServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String dataSourceName = "";
String loginCode = "";
String dataSourceName = "", loginCode = "", empCode = "";
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
OpportunityStageInfoRemote opportunityStageInfoRemote = null;
......@@ -40,6 +39,8 @@ public class OpportunityStageInfoServlet extends HttpServlet {
response.setContentType("application/xml");
dataSourceName = request.getParameter("dataSourceName");
empCode = request.getParameter("EMP_CODE");
HttpSession session = request.getSession(true);
UserInfoBean userInfo = (UserInfoBean) session.getAttribute("USER_INFO");
loginCode = userInfo.getEmpCode();
......@@ -48,7 +49,7 @@ public class OpportunityStageInfoServlet extends HttpServlet {
context = new InitialContext(appConnectParm.getProperty());
opportunityStageInfoRemote = (OpportunityStageInfoRemote) context.lookup("ibase/OpportunityStageInfo/remote");
JSONObject jsonObjData = (JSONObject) opportunityStageInfoRemote.getOpportunityStage(dataSourceName, loginCode);
JSONObject jsonObjData = (JSONObject) opportunityStageInfoRemote.getOpportunityStage(dataSourceName, loginCode, empCode);
ServletOutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
......
......@@ -30,8 +30,8 @@ public class OpportunityStageSummaryServlet extends HttpServlet{
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String dataSourceName = "",oppStageDescr = "";
String loginCode = "";
String dataSourceName = "", oppStageDescr = "";
String loginCode = "", empCode = "";
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
OpportunityStageSummaryRemote opportunityStageSummaryRemote = null;
......@@ -39,20 +39,21 @@ public class OpportunityStageSummaryServlet extends HttpServlet{
try {
response.setContentType("application/xml");
dataSourceName = request.getParameter("dataSourceName");
oppStageDescr = request.getParameter("stage_descr");
System.out.println("SERVLET Stage Code ::: "+oppStageDescr);
oppStageDescr = request.getParameter("stage_descr");
System.out.println("STAGE DESC :: "+oppStageDescr);
empCode = request.getParameter("EMP_CODE");
System.out.println("EMP CODE :: "+empCode);
HttpSession session = request.getSession(true);
UserInfoBean userInfo = (UserInfoBean) session.getAttribute("USER_INFO");
loginCode = userInfo.getEmpCode();
System.out.println("Login Code ::::[ " + loginCode + " ]");
System.out.println("Login Code [ " + loginCode + " ]");
context = new InitialContext(appConnectParm.getProperty());
opportunityStageSummaryRemote = (OpportunityStageSummaryRemote) context.lookup("ibase/OpportunityStageSummary/remote");
JSONObject jsonObjData = (JSONObject) opportunityStageSummaryRemote.getOpportunityStageSummary(dataSourceName, loginCode,oppStageDescr);
JSONObject jsonObjData = (JSONObject) opportunityStageSummaryRemote.getOpportunityStageSummary(dataSourceName, loginCode, oppStageDescr, empCode);
ServletOutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
......
......@@ -30,8 +30,7 @@ public class OpportunityStageValueServlet extends HttpServlet{
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String dataSourceName = "";
String loginCode = "";
String dataSourceName = "",loginCode = "", empCode = "";
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
OpportunityStageSummaryRemote opportunityStageSummaryRemote = null;
......@@ -40,6 +39,9 @@ public class OpportunityStageValueServlet extends HttpServlet{
response.setContentType("application/xml");
dataSourceName = request.getParameter("dataSourceName");
empCode = request.getParameter("EMP_CODE");
System.out.println("SERVLET ::[ " + empCode + " ]");
HttpSession session = request.getSession(true);
UserInfoBean userInfo = (UserInfoBean) session.getAttribute("USER_INFO");
loginCode = userInfo.getEmpCode();
......@@ -48,7 +50,7 @@ public class OpportunityStageValueServlet extends HttpServlet{
context = new InitialContext(appConnectParm.getProperty());
opportunityStageSummaryRemote = (OpportunityStageSummaryRemote) context.lookup("ibase/OpportunityStageSummary/remote");
JSONObject jsonObjData = (JSONObject) opportunityStageSummaryRemote.getOpportunityStageValue(dataSourceName, loginCode);
JSONObject jsonObjData = (JSONObject) opportunityStageSummaryRemote.getOpportunityStageValue(dataSourceName, loginCode, empCode);
ServletOutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
......
......@@ -30,8 +30,7 @@ public class OrganizationStageValueServlet extends HttpServlet{
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String dataSourceName = "";
String loginCode = "";
String dataSourceName = "", loginCode = "";
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
OpportunityStageSummaryRemote opportunityStageSummaryRemote = null;
......
......@@ -30,8 +30,7 @@ public class PendingCommunicationDashboardServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String dataSourceName = "";
String loginCode = "";
String dataSourceName = "", loginCode = "", empCode = "";
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
PendingCommunicationDashboardRemote pendingCommunicationDashboardRemote = null;
......@@ -40,6 +39,8 @@ public class PendingCommunicationDashboardServlet extends HttpServlet {
response.setContentType("application/xml");
dataSourceName = request.getParameter("dataSourceName");
empCode = request.getParameter("EMP_CODE");
HttpSession session = request.getSession(true);
UserInfoBean userInfo = (UserInfoBean) session.getAttribute("USER_INFO");
loginCode = userInfo.getEmpCode();
......@@ -48,7 +49,7 @@ public class PendingCommunicationDashboardServlet extends HttpServlet {
context = new InitialContext(appConnectParm.getProperty());
pendingCommunicationDashboardRemote = (PendingCommunicationDashboardRemote) context.lookup("ibase/PendingCommunicationDashboard/remote");
JSONObject jsonObjData = (JSONObject) pendingCommunicationDashboardRemote.getPendingCommunicationDashboard(dataSourceName, loginCode);
JSONObject jsonObjData = (JSONObject) pendingCommunicationDashboardRemote.getPendingCommunicationDashboard(dataSourceName, loginCode, empCode);
ServletOutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
......
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