Commit aebf9c10 authored by dkasliwal's avatar dkasliwal

update ejb


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97959 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1a2e3a75
......@@ -3689,10 +3689,10 @@ public class SalesPerformance extends ValidatorEJB implements SalesPerformanceRe
sql =" SELECT b.DIV_NO, b.DIV_DESCR,( CASE WHEN SUBSTR('"+month+"' ,5,2) =3 THEN ROUND(0 ,1) WHEN SUBSTR('"+month+"' ,5,2) <3 THEN ROUND(SUM(a.hotrgt_annual_cy-a.sale_ytd_cy)/(12- SUBSTR('"+month+"' ,5,2)-9) /10000000,1) ELSE ROUND(SUM(a.hotrgt_annual_cy-a.sale_ytd_cy)/(12- SUBSTR('"+month+"' ,5,2)+3) /10000000,1) END ) AS REQD_MTHLY,ROUND(SUM(a.sale_ytd_cy)/ (CASE WHEN SUBSTR('"+month+"' ,5,2)<4 THEN SUBSTR('"+month+"' ,5,2)+9 ELSE SUBSTR('"+month+"' ,5,2)-3 END)/10000000,1) AS AVG_MTHLY,ROUND(SUM(a.sale_mth_cy)/10000000,1) AS MTH_CY_SALES,ROUND(SUM(a.sale_mth_ly)/10000000,1) AS MTH_LY_SALES,ROUND(SUM(a.hotrgt_mth_cy)/10000000,1) AS MTH_HO_TRGT,"
+" (CASE WHEN SUM(a.sale_mth_ly)<>0 THEN ROUND(SUM(a.sale_mth_cy - a.sale_mth_ly)/SUM(a.sale_mth_ly)*100,1) ELSE ROUND(9.99*100,1) END) AS MTH_GR,"
+ "( CASE WHEN SUM (a.hotrgt_mth_cy) =0 THEN 0 ELSE "
+" (CASE WHEN ROUND (SUM (a.sale_mth_cy) / SUM (a.hotrgt_mth_cy) * 100, 1) <-200 THEN -200 "
+" WHEN ROUND (SUM (a.sale_mth_cy) / SUM (a.hotrgt_mth_cy) * 100, 1) >200 THEN 200 ELSE "
+" ROUND (SUM (a.sale_mth_cy) / SUM (a.hotrgt_mth_cy) * 100, 1) END) end) AS MTH_ACH_PER, "
+ "( CASE WHEN SUM (a.hotrgt_mth_cy) =0 THEN 0 ELSE "
+" (CASE WHEN ROUND (SUM (a.sale_mth_cy) / SUM (a.hotrgt_mth_cy) * 100, 1) <-200 THEN -200 "
+" WHEN ROUND (SUM (a.sale_mth_cy) / SUM (a.hotrgt_mth_cy) * 100, 1) >200 THEN 200 ELSE "
+" ROUND (SUM (a.sale_mth_cy) / SUM (a.hotrgt_mth_cy) * 100, 1) END) end) AS MTH_ACH_PER, "
+" ROUND(SUM(a.sale_ytd_cy)/10000000,1) AS YTD_CY_SALES,ROUND(SUM(a.sale_ytd_ly)/10000000,1) AS YTD_LY_SALES,ROUND(SUM(a.hotrgt_ytd_cy)/10000000,1) AS YTD_HO_TRGT, (CASE WHEN SUM(a.sale_ytd_ly)<>0 THEN ROUND(SUM(a.sale_ytd_cy - a.sale_ytd_ly)/SUM(a.sale_ytd_ly)*100,1) ELSE ROUND(9.99*100,1) END) AS YTD_GR, ROUND(SUM(a.sale_Qrt1_cy)/10000000,1) AS Q1,ROUND(SUM(a.sale_Qrt2_cy)/10000000,1) AS Q2,ROUND(SUM(a.sale_Qrt3_cy)/10000000,1) AS Q3,ROUND(SUM(a.sale_Qrt4_cy)/10000000,1) AS Q4,ROUND(SUM(a.sale_ytd_cy)/100000/SUM(c.psr)/ (CASE WHEN SUBSTR('"+month+"' ,5,2)<4 THEN SUBSTR('"+month+"' ,5,2)+9 ELSE SUBSTR('"+month+"' ,5,2)-3 END) ,2) AS PMPM,round(SUM(b.pmpm_ly),2) AS PMPM_LY,ROUND(SUM(a.sale_ytd_cy)/100000/SUM(c.psr)/(CASE WHEN SUBSTR('"+month+"' ,5,2)<4 THEN SUBSTR('"+month+"' ,5,2)+9 ELSE SUBSTR('"+month+"' ,5,2)-3 END),2) - round(SUM(b.pmpm_ly),2) AS INC_PMPM,ROUND(SUM(a.sale_ytd_cy-a.hotrgt_ytd_cy)/10000000,1) AS YTD_ACH_EXTRA,(CASE WHEN SUM(a.sale_ytd_cy)<>0 THEN ROUND(SUM(a.retu_ytd_cy)/SUM(a.sale_ytd_cy)*100,1) ELSE ROUND(9.99*100,1) END) AS RETU_YTD_PRCT,sum(b.bud_inc_pmpm) as bud_inc_pmpm FROM (SELECT dwh.fin_year , dwh.item_ser,SUM(sale_mth_cy) AS sale_mth_cy,SUM(sale_mth_ly) AS sale_mth_ly,SUM(trgt_mth_cy * (100+ NVL(brnd.HO_TRGT_INCR_PRCNT,0)) /100) AS hotrgt_mth_cy,SUM(sale_YTD_cy) AS sale_YTD_cy,SUM(sale_YTD_ly) AS sale_YTD_ly,SUM(trgt_YTD_cy * (100+ NVL(brnd.HO_TRGT_INCR_PRCNT,0)) /100) AS hotrgt_ytd_cy,SUM(sale_Qrt1_cy) AS sale_Qrt1_cy, "
+" SUM(sale_Qrt2_cy) AS sale_Qrt2_cy,SUM(sale_Qrt3_cy) AS sale_Qrt3_cy,SUM(sale_Qrt4_cy) AS sale_Qrt4_cy,SUM(trgt_annual_cy * (100+ NVL(brnd.HO_TRGT_INCR_PRCNT,0)) /100) AS hotrgt_annual_cy,SUM(retu_ytd_cy) AS retu_ytd_cy FROM(SELECT fin_year , SM_SALES_SUMM_WIDE.item_ser, "
+" sales_item.item_sub_group AS sub_grp, (CASE WHEN SUBSTR('"+month+"' ,5,2) ='04' THEN SUM(CY_SALE_MTH_APR) WHEN SUBSTR('"+month+"' ,5,2) ='05' THEN SUM(CY_SALE_MTH_MAY) WHEN SUBSTR('"+month+"' ,5,2) ='06' THEN SUM(CY_SALE_MTH_JUN)WHEN SUBSTR('"+month+"' ,5,2) ='07' THEN SUM(CY_SALE_MTH_JUL) WHEN SUBSTR('"+month+"' ,5,2) ='08' THEN SUM(CY_SALE_MTH_AUG) WHEN SUBSTR('"+month+"' ,5,2) ='09' THEN SUM(CY_SALE_MTH_SEP) WHEN SUBSTR('"+month+"' ,5,2) ='10' THEN SUM(CY_SALE_MTH_OCT) WHEN SUBSTR('"+month+"' ,5,2) ='11' THEN SUM(CY_SALE_MTH_NOV) WHEN SUBSTR('"+month+"' ,5,2) ='12' THEN SUM(CY_SALE_MTH_DEC) WHEN SUBSTR('"+month+"' ,5,2) ='01' THEN SUM(CY_SALE_MTH_JAN) WHEN SUBSTR('"+month+"' ,5,2) ='02' THEN SUM(CY_SALE_MTH_FEB) WHEN SUBSTR('"+month+"' ,5,2) ='03' THEN SUM(CY_SALE_MTH_MAR) END ) AS sale_mth_cy, "
......@@ -3773,6 +3773,99 @@ public class SalesPerformance extends ValidatorEJB implements SalesPerformanceRe
}
/*** end of method getMnthSalesDivWiseGraphData() **/
/* Start Code for Globle child grid on 14/04/2015 -Dhanendra*/
@Override
public JSONObject getGlobleChildGridDet(String dataSourceName,String month, String parameters, String linkMetadate) throws RemoteException,ITMException
{
JSONObject rawDataGlobleChildGridJson = new JSONObject();
JSONObject rowData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
String brandName="";
try
{
System.out.println("linkMetadate------>"+linkMetadate);
if(month!=null && month.trim().length()>0 && parameters!=null)
{
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
if(linkMetadate.equals("topbrandgridchild"))
{
String[] splitArr = parameters.trim().split("\\s+");
System.out.println(" month======" + month);
System.out.println(" brandName======" + splitArr[0]);
brandName = splitArr[0];
sql ="SELECT cust_name||' ('||cust_code||')' AS party, ROUND(cmth_val/100000,1) AS cy_mth," +
"ROUND(lmth_val/100000,1) AS ly_mth, ( CASE WHEN lmth_val=0 THEN 0 WHEN " +
"ROUND( (cmth_val-lmth_val)/ lmth_val *100,1) >200 THEN 200 WHEN " +
"ROUND( (cmth_val-lmth_val)/ lmth_val *100,1) <-200 THEN -200 ELSE " +
"ROUND( (cmth_val-lmth_val)/ lmth_val *100,1) END ) AS mth_gr, " +
"ROUND(cytd_val/100000,1) AS cy_ytd, ROUND(lytd_val/100000,1) AS ly_ytd," +
" ( CASE WHEN lytd_val=0 THEN 0 WHEN ROUND( (cytd_val-lytd_val)/ lytd_val *100,1) >200 " +
"THEN 200 WHEN ROUND( (cytd_val-lytd_val)/ lytd_val *100,1) <-200 THEN -200 " +
"ELSE ROUND( (cytd_val-lytd_val)/ lytd_val *100,1) END ) AS ytd_gr, " +
"ROUND(lfull_val/100000,1) AS ly_fullyr FROM brand_cus WHERE prd_code='"+month+"'" +
" AND trim(brand)='"+brandName+"' ORDER BY cytd_val DESC ";
//sql = "select 1 as PARTY, 2 as CY_MTH, 2 as LY_MTH, 2 as MTH_GR,2 as CY_YTD,2 as LY_YTD,2 as YTD_GR,2 as LY_FULLYR from dual";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
int count = 0;
while (rs.next())
{
rowData = new JSONObject();
rowData.put("party", checkNull(rs.getString("PARTY")));
rowData.put("cy_mth", rs.getString("CY_MTH"));
rowData.put("ly_mth", rs.getString("LY_MTH"));
rowData.put("mth_gr", rs.getString("MTH_GR"));
rowData.put("cy_ytd", rs.getString("CY_YTD"));
rowData.put("ly_ytd", rs.getString("LY_YTD"));
rowData.put("ytd_gr", rs.getString("YTD_GR"));
rowData.put("ly_fullyr", rs.getString("LY_FULLYR"));
rawDataGlobleChildGridJson.put(count, rowData);
count++;
}
}
}
System.out.println("fetch Data for Mnth Sales Div Wise Graph rawjson====" + rawDataGlobleChildGridJson.toString());
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
} finally
{
try
{
if (conn != null)
{
if (rs != null)
rs.close();
rs = null;
if (pstmt != null)
pstmt.close();
pstmt = null;
conn.close();
conn = null;
}
conn = null;
} catch (Exception d)
{
d.printStackTrace();
System.out.println("Exception in :SalesPersonSales:getMnthSalesDivWiseGraphData:" + d.getMessage());
throw new ITMException(d);
}
}
return rawDataGlobleChildGridJson;
}
/* End Code for Globle child grid on 14/04/2015 -Dhanendra*/
private String checkNull(String str)
......@@ -3787,5 +3880,4 @@ public class SalesPerformance extends ValidatorEJB implements SalesPerformanceRe
}
}
}
......@@ -24,4 +24,5 @@ public interface SalesPerformanceLocal extends ValidatorLocal
public JSONObject getBrandWiseZoneDetail(String dataSourceName,String month,String brandName) throws RemoteException, ITMException;
public JSONObject getBrandZoneWiseMetroDetail(String dataSourceName,String month,String brandName,String zoneDescr,String divDescr) throws RemoteException, ITMException;
public JSONObject getTopBrandMTH(String dataSourceName,String month,String divCode) throws RemoteException, ITMException;
public JSONObject getGlobleChildGridDet(String dataSourceName,String month,String parameters, String linkMetadata) throws RemoteException, ITMException;
}
......@@ -18,9 +18,11 @@ public interface SalesPerformanceRemote extends ValidatorRemote
public JSONObject getMnthSalesDivWiseGraphData(String dataSourceName,String month) throws RemoteException, ITMException;
public JSONObject getDivisionWiseGraph(String dataSourceName,String month,String divGrp) throws RemoteException, ITMException ;
public JSONObject getTopBrandYTD(String dataSourceName,String month,String divCode) throws RemoteException, ITMException;
public JSONObject getZoneWiseDetail(String dataSourceName,String month,String divCode) throws RemoteException, ITMException;
public JSONObject getZoneWiseMetroDetail(String dataSourceName, String month, String divGrp,String divCode, String zoneDescr) throws RemoteException, ITMException;
public JSONObject getTopBrandMTH(String dataSourceName,String month,String divCode) throws RemoteException, ITMException;
public JSONObject getBrandWiseZoneDetail(String dataSourceName,String month,String brandName) throws RemoteException, ITMException;
public JSONObject getBrandZoneWiseMetroDetail(String dataSourceName,String month,String brandName,String zoneDescr,String divDescr) throws RemoteException, ITMException;
public JSONObject getZoneWiseDetail(String dataSourceName,String month,String divCode) throws RemoteException, ITMException;
public JSONObject getZoneWiseMetroDetail(String dataSourceName, String month, String divGrp,String divCode, String zoneDescr) throws RemoteException, ITMException;
public JSONObject getTopBrandMTH(String dataSourceName,String month,String divCode) throws RemoteException, ITMException;
public JSONObject getBrandWiseZoneDetail(String dataSourceName,String month,String brandName) throws RemoteException, ITMException;
public JSONObject getBrandZoneWiseMetroDetail(String dataSourceName,String month,String brandName,String zoneDescr,String divDescr) throws RemoteException, ITMException;
public JSONObject getGlobleChildGridDet(String dataSourceName,String month,String parameters, String linkMetadata) throws RemoteException, ITMException;
}
This diff is collapsed.
package ibase.dashboard.scm.ejb;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local;
import org.json.simple.JSONObject;
@Local
public interface StateWiseStockLocal extends ValidatorLocal
{
public JSONObject getIndiaMap(String dataSourceName,String month,String brand,String division,String viewOptionSelectd) throws RemoteException, ITMException;
}
package ibase.dashboard.scm.ejb;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
import org.json.simple.JSONObject;
@Remote
public interface StateWiseStockRemote extends ValidatorRemote
{
public JSONObject getIndiaMap(String dataSourceName,String month,String brand,String division,String viewOptionSelectd) throws RemoteException, ITMException;
}
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