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