Commit 0d805d79 authored by cmahajan's avatar cmahajan

Changes done for following issues :

-  Icon images are unavailable for login person.
- TLSD calculation is not correct (For single person It should display Final TLSD & if multiple person has selected then it should display sum of final TLSD).


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@101461 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9c0354f6
......@@ -5,6 +5,7 @@ import ibase.utility.CommonConstants;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.utility.CommonConstants;
import java.io.File;
import java.rmi.RemoteException;
......@@ -214,7 +215,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
appendSqlStr = " And SM.Sales_Pers In ("+salePerson+") ";
}
System.out.println("CommonConstants.TOMCAT_HOME = ["+CommonConstants.TOMCAT_HOME+"]" );
System.out.println("In getCurrentDayWorkSummaryDetail==>>currDate II = ["+date+"] salePerson = ["+salePerson+"]" );
sql = " Select " +
......@@ -261,9 +262,10 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
rowData.put("people",salesPersName);
File file = new File(userImagePath+salesPersCode+".png");
System.out.println("userImagePath :"+userImagePath+salesPersCode);
if(file.exists())
{
rowData.put("salesperson_code", "<img class='cardProdImg' src='../resource/images/users/"+salesPersCode+".png'/>");
rowData.put("salesperson_code", "<img class='cardProdImg' src='"+CommonConstants.TOMCAT_HOME+"/ibase/resource/images/users/"+salesPersCode+".png'/>");
}else
{
......@@ -519,7 +521,6 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
String skuImg = "";
String salesPersCode = "";
String userImagePath = CommonConstants.JBOSSHOME + File.separator +"server"+File.separator +"default"+File.separator +"deploy"+File.separator +"ibase.ear"+File.separator + "ibase.war" +File.separator + "resource" + File.separator + "images"+ File.separator + "users"+File.separator;
//String productImagePath = CommonConstants.JBOSSHOME + File.separator +"server"+File.separator +"default"+File.separator +"deploy"+File.separator +"ibase.ear"+File.separator + "ibase.war" +File.separator + "E12MOBILE" + File.separator + "FusionChart"+ File.separator + "images"+File.separator;
while (rs.next())
{
rowData = new JSONObject();
......@@ -540,7 +541,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
File file = new File(userImagePath+salesPersCode+".png");
if(file.exists())
{
rowData.put("salesperson_code", "<img class='cardProdImg' src='../resource/images/users/"+salesPersCode+".png'/>");
rowData.put("salesperson_code", "<img class='cardProdImg' src='"+CommonConstants.TOMCAT_HOME+"/ibase/resource/images/users/"+salesPersCode+".png'/>");
}else
{
String[] splited = salesPersnName.split(" ");
......@@ -571,12 +572,13 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
if(skuName.length() > 0)
{
String[] splited = skuName.split(" ");
System.out.println("splited[0].toLowerCase() :"+splited[0].toLowerCase());
System.out.println("splited[0].toLowerCase() getCurrentDayWorkSKUDtl :"+splited[0].toLowerCase());
String productImgName = splited[0].toLowerCase();
System.out.println("productImgName :"+productImgName);
File file = new File(userImagePath+productImgName+".png");
if(file.exists())
{
rowData.put("sku_img", "<img class='cardProdImg' src='FusionChart/images/"+productImgName+".png'/>");
rowData.put("sku_img", "<img class='cardProdImg' src='"+CommonConstants.TOMCAT_HOME+"/ibase/resource/images/users/"+productImgName+".png'/>");
}else
{
String[] splited1 = skuName.split(" ");
......@@ -638,16 +640,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
}
private String checkNull(String str)
{
if (str == null)
{
return "";
} else
{
return str;
}
}
@SuppressWarnings("unchecked")
@Override
......@@ -706,7 +699,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
" 0 as ECO ,nvl((select count(*) from STRG_MEET_ORDER SMO where SMO.dcr_id=SM.dcr_id and SMO.Quantity > 0),0) as TLSD , " +
" nvl((select sum(value) from STRG_MEET_ORDER SMO where SMO.dcr_id=SM.dcr_id and SMO.Quantity > 0),0) as Ord_Val , " +
" nvl((select count(distinct strg_code) from STRG_ITEM_DISPLAY SID where SID.dcr_id=SM.dcr_id),0) as Display , " +
" nvl(Sum(case when FA.Activity_Type = 'FW' Then 1 else 0 end),0) as Tot_FW_Days FROM Strg_Meet SM , " +
" nvl(COUNT(DISTINCT (case when FA.Activity_Type = 'FW' Then (SM.DCR_ID) end)),0) as Tot_FW_Days FROM Strg_Meet SM , " +
" Sales_Pers SP , " +
" FieldActivity FA " +
" Where SM.Sales_Pers = SP.Sales_Pers And FA.Activity_Code = SM.Event_Type " +
......@@ -835,14 +828,14 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
" SUM(Tot_Calls) Tot_Calls , " +
" SUM(Tot_PC) Tot_PC , " +
" SUM(ECO) ECO , " +
" round((Case When Sum(Tot_FW_Days) = 0 Then 0 Else SUM(TLSD)/Sum(Tot_FW_Days) End),0) as TLSD , " +
" round((Case When Sum(Tot_FW_Days) = 0 Then 0 Else SUM(TLSD)/Sum(Tot_FW_Days) End),2) as TLSD , " +
" SUM(Ord_Val) Ord_Val ,SUM(Display) Display " +
" From ( Select SM.Sales_Pers as SalesPerson_Code ,SP.SP_Name as SalesPerson_Name ,nvl(count(SM.strg_code),0) as Tot_Calls , " +
" nvl((select count(distinct strg_code) from STRG_MEET_ORDER SMO where SMO.dcr_id=SM.dcr_id and SMO.Quantity > 0),0) as Tot_PC , " +
" 0 as ECO ,nvl((select count(*) from STRG_MEET_ORDER SMO where SMO.dcr_id=SM.dcr_id and SMO.Quantity > 0),0) as TLSD , " +
" nvl((select sum(value) from STRG_MEET_ORDER SMO where SMO.dcr_id=SM.dcr_id and SMO.Quantity > 0),0) as Ord_Val , " +
" nvl((select count(distinct strg_code) from STRG_ITEM_DISPLAY SID where SID.dcr_id=SM.dcr_id),0) as Display , " +
" nvl(Sum(case when FA.Activity_Type = 'FW' Then 1 else 0 end),0) as Tot_FW_Days FROM Strg_Meet SM , " +
" nvl(COUNT(DISTINCT (case when FA.Activity_Type = 'FW' Then (SM.DCR_ID) end)),0) as Tot_FW_Days FROM Strg_Meet SM , " +
" Sales_Pers SP , " +
" FieldActivity FA " +
" Where SM.Sales_Pers = SP.Sales_Pers And FA.Activity_Code = SM.Event_Type " +
......@@ -885,7 +878,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
File file = new File(userImagePath+salesPersCode+".png");
if(file.exists())
{
rowData.put("salesperson_code", "<img class='cardProdImg' src='../resource/images/users/"+salesPersCode+".png'/>");
rowData.put("salesperson_code", "<img class='cardProdImg' src='"+CommonConstants.TOMCAT_HOME+"/ibase/resource/images/users/"+salesPersCode+".png'/>");
}else
{
......@@ -975,62 +968,44 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
year = ""+(cal.get(Calendar.YEAR));
System.out.println("In getMTDWorkDtlParent current ==>>month = ["+month+"] year = ["+year+"] salePers = ["+salePerson+"]" );
appendSqlStr = " And strg_meet.Sales_Pers In ( Select Emp_Code " +
appendSqlStr = " And sm.Sales_Pers In ( Select Emp_Code " +
" From Employee Start With Emp_code = (Select Emp_Code From Users Where Code = "+salePerson+") " +
" Connect By Prior Emp_Code =Report_To )";
}else
{
appendSqlStr = " And strg_meet.Sales_Pers In ("+salePerson+") ";
appendSqlStr = " And sm.Sales_Pers In ("+salePerson+") ";
}
month = dashboardUtility.getCommaSeparated(checkNull(month));
year = dashboardUtility.getCommaSeparated(checkNull(year));
System.out.println("In getMTDWorkDtlParent pophelp selected ==>>month = ["+month+"] year = ["+year+"] salePers = ["+salePerson+"]" );
sql = " Select Count(SalesPerson) as people, nvl(SUM(Tot_Calls),0) as Tot_Calls ,nvl(Sum(Tot_PC),0) as Tot_PC , " +
" nvl(Sum(TLSD),0) as TLSD, " +
sql = " Select Count(SalesPerson_Name) as people, nvl(SUM(Tot_Calls),0) as Tot_Calls ,nvl(Sum(Tot_PC),0) as Tot_PC , " +
" round(nvl(Sum(TLSD),0),2) as TLSD, " +
" nvl(Sum(ORD_VAL),0) as ORD_VAL " +
" from( " +
" Select " +
" SalesPerson, SUM(A.Tot_Calls) as Tot_Calls ,Sum(A.Tot_PC) as Tot_PC , " +
" Sum(A.TLSD) as TLSD, " +
" Sum(A.ORD_VAL) as ORD_VAL " +
" from( " +
" SELECT " +
" strg_meet.sales_pers AS sales_pers_code, " +
" sales_pers.sp_name AS SalesPerson, " +
" to_char(To_Date(strg_meet.Event_Date),'DD-MM-YYYY') as EVENT_DATE, " +
" Loc.Descr as Locality, " +
" Coalesce((select employee.name_prefix || ' ' || employee.emp_fname || ' ' || employee.emp_lname " +
" from employee " +
" where employee.emp_code = SALES_PERS1.sales_pers ),'Self') AS Visited_With, " +
" nvl(count(strg_meet.strg_code),0) as Tot_Calls , " +
" FN_R_TOT_PC(strg_meet.dcr_id,strg_meet.EVENT_DATE, " +
" strg_meet.sales_pers,strg_meet.Locality_Code) as Tot_PC , " +
" round((CASE When FN_R_FW_CUMM_DAYS(strg_meet.EVENT_DATE,strg_meet.sales_pers) = 0 then 0 " +
" else FN_R_CUMM_SMO(strg_meet.EVENT_DATE,strg_meet.sales_pers)/FN_R_FW_CUMM_DAYS(strg_meet.EVENT_DATE,strg_meet.sales_pers) end),2) as TLSD , " +
" FN_R_ORD_VAL(strg_meet.dcr_id,strg_meet.EVENT_DATE,strg_meet.sales_pers,strg_meet.Locality_Code) as Ord_Val " +
" FROM sales_pers " +
" INNER JOIN " +
" strg_meet ON sales_pers.sales_pers = strg_meet.sales_pers " +
" Inner Join locality loc on loc.Locality_Code = strg_meet.Locality_Code " +
" LEFT JOIN sprs_travel SPT on strg_meet.dcr_id = SPT.dcr_id " +
" and strg_meet.Sales_Pers = SPT.Sales_Pers and SPT.Locality_Code = strg_meet.Locality_Code " +
" LEFT JOIN " +
" sales_pers SALES_PERS1 " +
" ON SALES_PERS1.sales_pers = SPT.sprs_code__ww " +
" WHERE strg_meet.strg_type = 'C' " +
" "+appendSqlStr+ " " +
" and strg_meet.EVENT_DATE BETWEEN trunc(to_date("+month+"||"+year+",'MONYYYY'),'MON') " +
" AND last_day(to_date("+month+"||"+year+",'MONYYYY')) " +
" Group By strg_meet.sales_pers, " +
" sales_pers.sp_name, strg_meet.Event_Date, " +
" strg_meet.dcr_id, " +
" strg_meet.Locality_Code, " +
" Loc.Descr, " +
" SALES_PERS1.sales_pers " +
" ) A " +
" group by A.SalesPerson) ";
" SalesPerson_Code,SalesPerson_Name , " +
" SUM(Tot_Calls) Tot_Calls , " +
" SUM(Tot_PC) Tot_PC , " +
" SUM(ECO) ECO , " +
" (Case When Sum(Tot_FW_Days) = 0 Then 0 Else SUM(TLSD)/Sum(Tot_FW_Days) End) as TLSD , " +
" SUM(Ord_Val) Ord_Val ,SUM(Display) Display " +
" From ( Select SM.Sales_Pers as SalesPerson_Code ,SP.SP_Name as SalesPerson_Name ,nvl(count(SM.strg_code),0) as Tot_Calls , " +
" nvl((select count(distinct strg_code) from STRG_MEET_ORDER SMO where SMO.dcr_id=SM.dcr_id and SMO.Quantity > 0),0) as Tot_PC , " +
" 0 as ECO ,nvl((select count(*) from STRG_MEET_ORDER SMO where SMO.dcr_id=SM.dcr_id and SMO.Quantity > 0),0) as TLSD , " +
" nvl((select sum(value) from STRG_MEET_ORDER SMO where SMO.dcr_id=SM.dcr_id and SMO.Quantity > 0),0) as Ord_Val , " +
" nvl((select count(distinct strg_code) from STRG_ITEM_DISPLAY SID where SID.dcr_id=SM.dcr_id),0) as Display , " +
" nvl(COUNT(DISTINCT (case when FA.Activity_Type = 'FW' Then (SM.DCR_ID) end)),0) as Tot_FW_Days FROM Strg_Meet SM , " +
" Sales_Pers SP , " +
" FieldActivity FA " +
" Where SM.Sales_Pers = SP.Sales_Pers And FA.Activity_Code = SM.Event_Type " +
" And SM.event_date BETWEEN trunc(to_date("+month+" || "+year+", 'MONYYYY'), 'MON') AND last_day(to_date("+month+" || "+year+", 'MONYYYY')) " +
" "+appendSqlStr+ " " +
" Group By SM.Sales_Pers ,SP.SP_Name ,SM.dcr_id " +
" ) " +
" Group By " +
" SalesPerson_Name,SalesPerson_Code) ";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
......@@ -1183,7 +1158,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
File file = new File(userImagePath+salesPersCode+".png");
if(file.exists())
{
rowData.put("salesperson_code", "<img class='cardProdImg' src='../resource/images/users/"+salesPersCode+".png'/>");
rowData.put("salesperson_code", "<img class='cardProdImg' src='"+CommonConstants.TOMCAT_HOME+"/ibase/resource/images/users/"+salesPersCode+".png'/>");
}else
{
String[] splited = salesPersnName.split(" ");
......@@ -1319,7 +1294,16 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
return monthInChar;
}
private String checkNull(String str)
{
if (str == null)
{
return "";
} else
{
return str;
}
}
......
......@@ -51,7 +51,8 @@ public class CurrentDayWorkSKUDtlServlet extends HttpServlet
salePerson = (request.getParameter("aseName"));
System.out.println("salePerson :"+salePerson);
System.out.println("salePerson.lenght() :"+salePerson.length());
if(salePerson.length()== 0)
if(salePerson.length()== 0)
{
salePerson = loginUser;
}
......
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