Commit 8de1006c authored by msinkar's avatar msinkar

Changes in MTD dashboard

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@196864 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4d8938b1
...@@ -53,6 +53,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS ...@@ -53,6 +53,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
dashboardUtility = new DashboardUtility(); dashboardUtility = new DashboardUtility();
salePerson = dashboardUtility.getCommaSeparated(salePerson); salePerson = dashboardUtility.getCommaSeparated(salePerson);
System.out.println("Date getCurrentDayWorkSummary :"+date); System.out.println("Date getCurrentDayWorkSummary :"+date);
String dbDate ="";
System.out.println("Date.length getCurrentDayWorkSummary :"+date.length()); System.out.println("Date.length getCurrentDayWorkSummary :"+date.length());
if(date.length() == 0 || date == null) if(date.length() == 0 || date == null)
{ {
...@@ -60,7 +61,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS ...@@ -60,7 +61,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
DateFormat dtFormat = new SimpleDateFormat(getApplDateFormat()); DateFormat dtFormat = new SimpleDateFormat(getApplDateFormat());
java.util.Date currentDate = Calendar.getInstance().getTime(); java.util.Date currentDate = Calendar.getInstance().getTime();
date = dtFormat.format( currentDate ); date = dtFormat.format( currentDate );
date = genericUtility.getValidDateTimeString( date, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat() ); dbDate = genericUtility.getValidDateTimeString( date, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat() );
appendSqlStr = " And SM.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+") " + " From Employee Start With Emp_code = (Select Emp_Code From Users Where Code = "+salePerson+") " +
...@@ -69,14 +70,14 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS ...@@ -69,14 +70,14 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
else else
{ {
System.out.println("in else date getCurrentDayWorkSummary"); System.out.println("in else date getCurrentDayWorkSummary");
date = genericUtility.getValidDateTimeString( date, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat() ); dbDate = genericUtility.getValidDateTimeString( date, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat() );
appendSqlStr = " And SM.Sales_Pers In ("+salePerson+") "; appendSqlStr = " And SM.Sales_Pers In ("+salePerson+") ";
} }
System.out.println("In getCurrentDayWorkSummary==>>currDate II = ["+date+"] salePerson = ["+salePerson+"]" ); System.out.println("In getCurrentDayWorkSummary==>>currDate II = ["+date+"] salePerson = ["+salePerson+"]" );
// comment and added by mrunalini sinkar on 07-02-2019(start)
sql = " Select count(SalesPerson_Code)as people, nvl(Sum(Tot_calls),0) as TC, " + /*sql = " Select count(SalesPerson_Code)as people, nvl(Sum(Tot_calls),0) as TC, " +
" nvl(Sum(TOT_PC),0) as PC, nvl(sum(call_bal),0) as CallBAL, nvl(sum(TLSD),0) as TLSD, " + " nvl(Sum(TOT_PC),0) as PC, nvl(sum(call_bal),0) as CallBAL, nvl(sum(TLSD),0) as TLSD, " +
" nvl(Sum(ORD_val),0) as ordval, nvl(sum(display),0) as display " + " nvl(Sum(ORD_val),0) as ordval, nvl(sum(display),0) as display " +
" from( " + " from( " +
...@@ -107,12 +108,46 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS ...@@ -107,12 +108,46 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
" " + appendSqlStr + " " + " " + appendSqlStr + " " +
" Group By SM.Sales_Pers ," + " Group By SM.Sales_Pers ," +
" SP.SP_Name ,SM.dcr_id ) " + " SP.SP_Name ,SM.dcr_id ) " +
" Group By SalesPerson_Name, SalesPerson_Code Order By SalesPerson_Name)"; " Group By SalesPerson_Name, SalesPerson_Code Order By SalesPerson_Name)";*/
sql = " Select count(SalesPerson_Code)as people, nvl(Sum(Tot_calls),0) as TC, " +
" nvl(Sum(TOT_PC),0) as PC, nvl(sum(call_bal),0) as CallBAL, nvl(sum(TLSD),0) as TLSD, " +
" nvl(Sum(ORD_val),0) as ordval, nvl(sum(display),0) as display " +
" from( " +
" Select " +
" ? as show_Date , " +
" SalesPerson_Code , " +
" SalesPerson_Name , SUM(Tot_Calls) Tot_Calls , SUM(Tot_PC) Tot_PC , " +
" (To_Calls - Tot_Dist_Calls) Call_Bal , SUM(TLSD) 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(strg_code),0) as Tot_Calls , nvl(count(Distinct strg_code),0) as Tot_Dist_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 ," +
" NVL((Select count(sc_code) From Strg_Series Where Sales_Pers = SM.Sales_Pers " +
" And Sc_Code in (Select sC_cODE From STRG_Customer_Retail " +
" Where Locality_Code In (Select locality_Code From sPRS_TRAVEL " +
" Where Sales_Pers = SM.Sales_Pers " +
"AND travel_date = ? " +
" )) ),0) AS To_Calls , " +
" 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 " +
" FROM Strg_Meet SM ,Sales_Pers SP Where SM.Sales_Pers = SP.Sales_Pers " +
" And SM.Event_Date = ? " +
" " + appendSqlStr + " " +
" Group By SM.Sales_Pers ," +
" SP.SP_Name ,SM.dcr_id ) " +
" Group By SalesPerson_Name, SalesPerson_Code Order By SalesPerson_Name)";
// comment and added by mrunalini sinkar on 07-02-2019(end)
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, java.sql.Timestamp.valueOf(date)); pstmt.setTimestamp(1, java.sql.Timestamp.valueOf(dbDate));
pstmt.setTimestamp(2, java.sql.Timestamp.valueOf(date)); pstmt.setTimestamp(2, java.sql.Timestamp.valueOf(dbDate));
pstmt.setTimestamp(3, java.sql.Timestamp.valueOf(date)); pstmt.setTimestamp(3, java.sql.Timestamp.valueOf(dbDate));
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -196,14 +231,14 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS ...@@ -196,14 +231,14 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
System.out.println("Date getCurrentDayWorkSummaryDetail:"+date); System.out.println("Date getCurrentDayWorkSummaryDetail:"+date);
System.out.println("Date.length getCurrentDayWorkSummaryDetail:"+date.length()); System.out.println("Date.length getCurrentDayWorkSummaryDetail:"+date.length());
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 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 dbDate="";
if(date.length() == 0 || date == null) if(date.length() == 0 || date == null)
{ {
System.out.println("in if date "); System.out.println("in if date ");
DateFormat dtFormat = new SimpleDateFormat(getApplDateFormat()); DateFormat dtFormat = new SimpleDateFormat(getApplDateFormat());
java.util.Date currentDate = Calendar.getInstance().getTime(); java.util.Date currentDate = Calendar.getInstance().getTime();
date = dtFormat.format( currentDate ); date = dtFormat.format( currentDate );
date = genericUtility.getValidDateTimeString( date, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat() ); dbDate = genericUtility.getValidDateTimeString( date, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat() );
appendSqlStr = " And SM.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+") " + " From Employee Start With Emp_code = (Select Emp_Code From Users Where Code = "+salePerson+") " +
...@@ -212,7 +247,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS ...@@ -212,7 +247,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
else else
{ {
System.out.println("in else date "); System.out.println("in else date ");
date = genericUtility.getValidDateTimeString( date, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat() ); dbDate = genericUtility.getValidDateTimeString( date, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat() );
appendSqlStr = " And SM.Sales_Pers In ("+salePerson+") "; appendSqlStr = " And SM.Sales_Pers In ("+salePerson+") ";
} }
...@@ -234,7 +269,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS ...@@ -234,7 +269,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
" And Sc_Code in (Select sC_cODE From STRG_Customer_Retail " + " And Sc_Code in (Select sC_cODE From STRG_Customer_Retail " +
" Where Locality_Code In (Select locality_Code From sPRS_TRAVEL " + " Where Locality_Code In (Select locality_Code From sPRS_TRAVEL " +
" Where Sales_Pers = SM.Sales_Pers " + " Where Sales_Pers = SM.Sales_Pers " +
"AND travel_date = TO_DATE(To_CHAR(TRUNC(?),'DD-MM-YYYY'),'DD-MM-YYYY') " + "AND travel_date = ? " +
" )) ),0) AS To_Calls , " + " )) ),0) AS To_Calls , " +
" nvl((select count(*) from STRG_MEET_ORDER SMO " + " nvl((select count(*) from STRG_MEET_ORDER SMO " +
" where SMO.dcr_id=SM.dcr_id and SMO.Quantity > 0),0) as TLSD , " + " where SMO.dcr_id=SM.dcr_id and SMO.Quantity > 0),0) as TLSD , " +
...@@ -243,15 +278,15 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS ...@@ -243,15 +278,15 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
" nvl((select count(distinct strg_code) from STRG_ITEM_DISPLAY SID " + " nvl((select count(distinct strg_code) from STRG_ITEM_DISPLAY SID " +
" where SID.dcr_id=SM.dcr_id),0) as Display " + " where SID.dcr_id=SM.dcr_id),0) as Display " +
" FROM Strg_Meet SM ,Sales_Pers SP Where SM.Sales_Pers = SP.Sales_Pers " + " FROM Strg_Meet SM ,Sales_Pers SP Where SM.Sales_Pers = SP.Sales_Pers " +
" And SM.Event_Date = TO_DATE(To_CHAR(TRUNC(?),'DD-MM-YYYY'),'DD-MM-YYYY')" + " And SM.Event_Date = ?" +
" " + appendSqlStr + " " + " " + appendSqlStr + " " +
" Group By SM.Sales_Pers ," + " Group By SM.Sales_Pers ," +
" SP.SP_Name ,SM.dcr_id ) " + " SP.SP_Name ,SM.dcr_id ) " +
" Group By SalesPerson_Name, To_Calls, SalesPerson_Code Order By SalesPerson_Name"; " Group By SalesPerson_Name, To_Calls, SalesPerson_Code Order By SalesPerson_Name";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, java.sql.Timestamp.valueOf(date)); pstmt.setTimestamp(1, java.sql.Timestamp.valueOf(dbDate));
pstmt.setTimestamp(2, java.sql.Timestamp.valueOf(date)); pstmt.setTimestamp(2, java.sql.Timestamp.valueOf(dbDate));
//pstmt.setTimestamp(3, java.sql.Timestamp.valueOf(date)); //pstmt.setTimestamp(3, java.sql.Timestamp.valueOf(date));
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -393,7 +428,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS ...@@ -393,7 +428,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
" And SM.Strg_Code = SMO.Strg_Code " + " And SM.Strg_Code = SMO.Strg_Code " +
" And SM.Dcr_Id = SMO.DCR_Id " + " And SM.Dcr_Id = SMO.DCR_Id " +
" And I.Item_Code = SMO.Item_Code " + " And I.Item_Code = SMO.Item_Code " +
" And SM.Event_Date = TO_DATE(To_CHAR(TRUNC(?),'DD-MM-YYYY'),'DD-MM-YYYY') " + " And SM.Event_Date = ? " +
" " + appendSqlStr + " " + " " + appendSqlStr + " " +
" And (SMO.Quantity) > 0 " + " And (SMO.Quantity) > 0 " +
" Group By " + " Group By " +
...@@ -511,7 +546,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS ...@@ -511,7 +546,7 @@ public class CurrentDayWrkSummary extends ValidatorEJB implements CurrentDayWrkS
" And SM.Dcr_Id = SMO.DCR_Id " + " And SM.Dcr_Id = SMO.DCR_Id " +
" And I.Item_Code = SMO.Item_Code " + " And I.Item_Code = SMO.Item_Code " +
//" And SM.Strg_Type = 'C' " + //commented by mrunalini sinkar to show outlet same as main dashbaord on 16-01-2019 //" And SM.Strg_Type = 'C' " + //commented by mrunalini sinkar to show outlet same as main dashbaord on 16-01-2019
" And SM.Event_Date = TO_DATE(To_CHAR(TRUNC(?),'DD-MM-YYYY'),'DD-MM-YYYY')" + " And SM.Event_Date = ? " +
" " + appendSqlStr + " " + " " + appendSqlStr + " " +
" And (SMO.Quantity) > 0 " + " And (SMO.Quantity) > 0 " +
" Group By " + " Group By " +
......
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