Commit 4b0c674a authored by vbhosale's avatar vbhosale

changes in plan vs actual to pass values to obj link

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@178888 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c938a5ef
......@@ -18,8 +18,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import java.util.Calendar;
import java.util.Date;
import javax.ejb.Stateless;
@Stateless
......@@ -780,13 +778,10 @@ public class PlanVsActual extends ValidatorEJB implements PlanVsActualLocal,Plan
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
DashboardUtility dashboardUtility = null;
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yy");
Date date = new Date();
String sysDate = sdf.format(date);
int count = 0;
String salesPersonCode = "", salesPersonName = "", salesPerson_image = "" ;
String salesPersonCode = "", salesPersonName = "", salesPerson_image = "", salesTranID = "" ;
String customerCode = "", customerName = "" , customer_Image = "";
StringBuffer rowBuffer = new StringBuffer();
StringBuffer listedBuffer = new StringBuffer();
......@@ -817,11 +812,12 @@ public class PlanVsActual extends ValidatorEJB implements PlanVsActualLocal,Plan
/*----------Planned doctors visited-----Planned--------*/
// ADDED ROWNUM < 10 REMOVE WHILE RELEASE AND SYSDATE <= CHANGE TO =
// new sql query provided by sagar
sql ="SELECT SM.EVENT_DATE, SM.SALES_PERS, SP.SP_NAME, SM.STRG_CODE, (SC.FIRST_NAME ||' '||SC.LAST_NAME)AS NAME "
sql ="SELECT SM.EVENT_DATE, SM.TRAN_ID , SM.SALES_PERS, SP.SP_NAME, SM.STRG_CODE, (SC.FIRST_NAME ||' '||SC.LAST_NAME)AS NAME "
+ " FROM STRG_MEET SM INNER JOIN SALES_PERS SP ON SP.SALES_PERS = SM.SALES_PERS INNER JOIN STRG_CUSTOMER SC ON SC.SC_CODE=SM.STRG_CODE "
+ " INNER JOIN SPRS_PLAN_HDR SPH ON SPH.SPRS_CODE__PLAN = SM.SALES_PERS AND SPH.PLAN_DATE=SM.EVENT_DATE "
+ " WHERE SM.EVENT_DATE = '"+sysDate+"' AND SM.SALES_PERS= SP.SALES_PERS "
+ " WHERE SM.EVENT_DATE = sysdate AND SM.SALES_PERS= SP.SALES_PERS "
+ " AND NOT EXISTS (SELECT SPC.SC_CODE FROM SPRS_PLAN_CUST SPC "
+ " WHERE SPC.SC_CODE=SM.STRG_CODE AND SPC.PLAN_ID = SPH.PLAN_ID) ";
......@@ -841,17 +837,17 @@ public class PlanVsActual extends ValidatorEJB implements PlanVsActualLocal,Plan
rowBuffer.append("<table cellspacing='0' cellpadding='0' width='100%' ><tr rowspan='2'><td class='defaultTitle'>Planned</td></tr>");
while(rs.next())
{
salesPersonCode = checkNull(rs.getString("SC_CODE"));
salesPersonName = checkNull(rs.getString("NAME"));
salesPersonCode = checkNull(rs.getString("SALES_PERS"));
salesPersonName = checkNull(rs.getString("SP_NAME"));
salesTranID = checkNull(rs.getString("TRAN_ID"));
String object = "images"+ File.separator + "users";
plannedDocImagePath = "/ibase/CustomMenuImageServlet?fldValue="+salesPersonCode+"&object="+object+"&objName="+object+"&ALT_FLD_VALUE="+salesPersonName;
salesPerson_image = "<img class='cardProdImg2' src='"+plannedDocImagePath+"'/>";
rowBuffer.append("<tr><td><table cellspacing='0' cellpadding='0' " +
"style='border-bottom:1px solid #E8E8E8;' width='100%'><tr>" +
"<td width='2%'>"+salesPerson_image+"</td>" +
"<td style = 'width:80%;' id='"+salesPersonCode+"' onclick='getRowWisePkValue(this.id)' >"+salesPersonName.toUpperCase()+"</td>" +
"<td class = 'dashboardEditImg'></td>" +
"</tr></table></td></tr>"); }
"<td style = 'width:80%;' id='"+salesTranID+"' onclick='getRowWisePkValue(this.id)' >"+checkNull(rs.getString("SP_NAME"))+"</td></tr></table></td></tr>");
}
rowBuffer.append("</table>");
}
rs.close();
......@@ -860,10 +856,13 @@ public class PlanVsActual extends ValidatorEJB implements PlanVsActualLocal,Plan
pstmt = null;
/*----------Unplanned doctors visited.--*/
// sql for unplanned by sagar
sql = " SELECT SM.EVENT_DATE, SM.SALES_PERS, SP.SP_NAME, SM.STRG_CODE, (SC.FIRST_NAME ||' '||SC.LAST_NAME)AS NAME "
sql = " SELECT SM.EVENT_DATE, SM.TRAN_ID , SM.SALES_PERS, SP.SP_NAME, SM.STRG_CODE, (SC.FIRST_NAME ||' '||SC.LAST_NAME)AS NAME "
+ " FROM STRG_MEET SM INNER JOIN SALES_PERS SP ON SP.SALES_PERS = SM.SALES_PERS INNER JOIN STRG_CUSTOMER SC ON SC.SC_CODE=SM.STRG_CODE INNER JOIN SPRS_PLAN_HDR SPH ON SPH.SPRS_CODE__PLAN = SM.SALES_PERS AND SPH.PLAN_DATE=SM.EVENT_DATE "
+ " WHERE SM.EVENT_DATE = '"+sysDate+"' AND SM.SALES_PERS = SP.SALES_PERS AND NOT EXISTS (SELECT SPC.SC_CODE FROM SPRS_PLAN_CUST SPC WHERE SPC.SC_CODE=SM.STRG_CODE AND SPC.PLAN_ID = SPH.PLAN_ID) ";
+ " WHERE SM.EVENT_DATE = sysdate AND SM.SALES_PERS = SP.SALES_PERS AND NOT EXISTS (SELECT SPC.SC_CODE FROM SPRS_PLAN_CUST SPC WHERE SPC.SC_CODE=SM.STRG_CODE AND SPC.PLAN_ID = SPH.PLAN_ID) ";
pstmt = conn.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
......@@ -878,17 +877,16 @@ public class PlanVsActual extends ValidatorEJB implements PlanVsActualLocal,Plan
rowBuffer.append("<table cellspacing='0' cellpadding='0' width='100%' ><tr rowspan='2'><td class='defaultTitle'>Unplanned</td></tr>");
while(rs.next())
{
salesPersonCode = checkNull(rs.getString("STRG_CODE"));
salesPersonName = checkNull(rs.getString("NAME"));
salesPersonCode = checkNull(rs.getString("SALES_PERS"));
salesPersonName = checkNull(rs.getString("SP_NAME"));
salesTranID = checkNull(rs.getString("TRAN_ID"));
String object = "images"+ File.separator + "users";
unplannedDocImagePath = "/ibase/CustomMenuImageServlet?fldValue="+salesPersonCode+"&object="+object+"&objName="+object+"&ALT_FLD_VALUE="+salesPersonName;
salesPerson_image = "<img class='cardProdImg2' src='"+unplannedDocImagePath+"'/>";
rowBuffer.append("<tr><td><table cellspacing='0' cellpadding='0' " +
"style='border-bottom:1px solid #E8E8E8;' width='100%'><tr>" +
"<td width='2%'>"+salesPerson_image+"</td>" +
"<td style = 'width:80%;' id='"+salesPersonCode+"' onclick='getRowWisePkValue(this.id)' >"+salesPersonName.toUpperCase()+"</td>" +
"<td class = 'dashboardEditImg'></td>" +
"</tr></table></td></tr>");
"<td style = 'width:80%;' id='"+salesTranID+"' onclick='getRowWisePkValue(this.id)' >"+checkNull(rs.getString("SP_NAME"))+"</td></tr></table></td></tr>");
}
rowBuffer.append("</table>");
}
......@@ -900,17 +898,10 @@ public class PlanVsActual extends ValidatorEJB implements PlanVsActualLocal,Plan
/*----------Listed doctors visited.--*/
/*sql = "SELECT sm.tran_id, TO_CHAR(sm.event_date, 'dd-mon-yyyy') AS Event_Date, "
+ "sm.strg_code, sm.sales_pers, sp.sc_code, SS.SP_NAME "
+ "FROM SALES_PERS SS INNER JOIN STRG_MEET SM ON SS.SALES_PERS=SM.SALES_PERS "
+ "INNER JOIN strg_series SP ON sp.sales_pers = sm.sales_pers "
+ "WHERE sm.strg_code =sp.sc_code AND sm.event_date <= sysdate "+localSQL+" and ROWNUM <10 ";*/
//Listed Query by SAGAR
sql = "SELECT SM.EVENT_DATE, SM.SALES_PERS, SP.SP_NAME ,SM.STRG_CODE ,(SC.FIRST_NAME ||' '||SC.LAST_NAME)AS NAME "
sql = "SELECT SM.EVENT_DATE, SM.TRAN_ID , SM.SALES_PERS, SP.SP_NAME ,SM.STRG_CODE ,(SC.FIRST_NAME ||' '||SC.LAST_NAME)AS NAME "
+ " FROM STRG_SERIES SS INNER JOIN STRG_MEET SM ON SM.STRG_CODE=SS.SC_CODE AND SM.SALES_PERS=SS.SALES_PERS INNER JOIN SALES_PERS SP ON SP.SALES_PERS=SS.SALES_PERS INNER JOIN STRG_CUSTOMER SC ON SC.SC_CODE=SM.STRG_CODE "
+ " WHERE SM.SALES_PERS = SP.SALES_PERS AND SM.EVENT_DATE = '"+sysDate+"' AND SS.STATUS='Y' ";
+ " WHERE SM.SALES_PERS = SP.SALES_PERS AND SM.EVENT_DATE = sysdate AND SS.STATUS='Y' ";
pstmt = conn.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs = pstmt.executeQuery();
......@@ -928,15 +919,14 @@ public class PlanVsActual extends ValidatorEJB implements PlanVsActualLocal,Plan
//salesPersonName = checkNull(rs.getString("SP_NAME")) ;
customerCode = checkNull(rs.getString("STRG_CODE"));
customerName = checkNull(rs.getString("NAME"));
salesTranID = checkNull(rs.getString("TRAN_ID"));
String object = "images"+ File.separator + "users";
listedDocImagePath = "/ibase/CustomMenuImageServlet?fldValue="+customerCode+"&object="+object+"&objName="+object+"&ALT_FLD_VALUE="+customerName;
customer_Image = "<img class='cardProdImg2' src='"+listedDocImagePath+"'/>";
listedBuffer.append("<tr><td><table cellspacing='0' cellpadding='0' " +
"style='border-bottom:1px solid #E8E8E8;' width='100%'><tr>" +
"<td width='2%'>"+customer_Image+"</td>" +
"<td style = 'width:80%;' id='"+customerCode+"' onclick='getRowWisePkValue(this.id) >"+customerName.toUpperCase()+"</td>" +
"<td class = 'dashboardEditImg'></td>" +
"</tr></table></td></tr>");
"<td style = 'width:80%;' id='"+salesTranID+"' onclick='getRowWisePkValue(this.id)' >"+customerName.toUpperCase()+"</td></tr></table></td></tr>");
}
listedBuffer.append("</table>");
}
......@@ -948,16 +938,10 @@ public class PlanVsActual extends ValidatorEJB implements PlanVsActualLocal,Plan
/*----------Unlisted doctors visited.--*/
/*sql = "SELECT sm.tran_id, TO_CHAR(sm.event_date, 'dd-mon-yyyy') AS Event_Date, "
+ "sm.strg_code, sm.sales_pers, sp.sc_code, SS.SP_NAME "
+ "FROM SALES_PERS SS INNER JOIN STRG_MEET SM ON SS.SALES_PERS=SM.SALES_PERS "
+ "INNER JOIN strg_series SP ON sp.sales_pers = sm.sales_pers "
+ "WHERE sm.strg_code !=sp.sc_code AND sm.event_date <= sysdate "+localSQL+" and ROWNUM <10 ";*/
// Unlisted query by Sagar
sql = "SELECT SM.EVENT_DATE ,SP.SALES_PERS ,SP.SP_NAME,SM.STRG_CODE,SM.STRG_NAME "
sql = "SELECT SM.EVENT_DATE , SM.TRAN_ID , SP.SALES_PERS ,SP.SP_NAME,SM.STRG_CODE,SM.STRG_NAME "
+ " FROM STRG_MEET SM INNER JOIN SALES_PERS SP ON SP.SALES_PERS=SM.SALES_PERS "
+ " WHERE SM.SALES_PERS= SP.SALES_PERS AND SM.EVENT_DATE = '"+sysDate+"' AND NOT EXISTS (SELECT SC_CODE FROM STRG_CUSTOMER SC WHERE SC.SC_CODE = SM.STRG_CODE) ";
+ " WHERE SM.SALES_PERS= SP.SALES_PERS AND SM.EVENT_DATE = sysdate AND NOT EXISTS (SELECT SC_CODE FROM STRG_CUSTOMER SC WHERE SC.SC_CODE = SM.STRG_CODE) ";
pstmt = conn.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs = pstmt.executeQuery();
......@@ -971,17 +955,16 @@ public class PlanVsActual extends ValidatorEJB implements PlanVsActualLocal,Plan
listedBuffer.append("<table cellspacing='0' cellpadding='0' width='100%' ><tr rowspan='2'><td class='defaultTitle'>Unlisted</td></tr>");
while(rs.next())
{
salesPersonCode = checkNull(rs.getString("STRG_CODE")) ;
salesPersonName = checkNull(rs.getString("NAME")) ;
salesPersonCode = checkNull(rs.getString("SALES_PERS")) ;
salesPersonName = checkNull(rs.getString("SP_NAME")) ;
salesTranID = checkNull(rs.getString("TRAN_ID"));
String object = "images"+ File.separator + "users";
unlistedDocImagePath = "/ibase/CustomMenuImageServlet?fldValue="+salesPersonCode+"&object="+object+"&objName="+object+"&ALT_FLD_VALUE="+salesPersonName;
salesPerson_image = "<img class='cardProdImg2' src='"+unlistedDocImagePath+"'/>";
listedBuffer.append("<tr><td><table cellspacing='0' cellpadding='0' " +
"style='border-bottom:1px solid #E8E8E8;' width='100%'><tr>" +
"<td width='2%'>"+salesPerson_image+"</td>" +
"<td style = 'width:80%;' id='"+salesPersonCode+"' onclick='getRowWisePkValue(this.id) >"+salesPersonName.toUpperCase()+"</td>" +
"<td class = 'dashboardEditImg'></td>" +
"</tr></table></td></tr>");
"<td style = 'width:80%;' id='"+salesTranID+"' onclick='getRowWisePkValue(this.id)' >"+salesPersonName.toUpperCase()+"</td></tr></table></td></tr>");
}
listedBuffer.append("</table>");
}
......
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