Commit cec045f0 authored by dkasliwal's avatar dkasliwal

modify source code as per client requirment


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98016 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3b33d396
......@@ -78,7 +78,7 @@ public class Attrition extends ValidatorEJB implements AttritionRemote, Attritio
+" WHEN SUBSTR( '"+month+"' ,5,2)=1 THEN NVL(attr_apr,0)+NVL(attr_may,0)+NVL(attr_jun,0)+NVL(attr_jul,0)+NVL(attr_aug,0)+NVL(attr_sep,0)+NVL(attr_oct,0)+NVL(attr_nov,0)+NVL(attr_dec,0)+NVL(attr_jan,0)"
+" WHEN SUBSTR( '"+month+"' ,5,2)=2 THEN NVL(attr_apr,0)+NVL(attr_may,0)+NVL(attr_jun,0)+NVL(attr_jul,0)+NVL(attr_aug,0)+NVL(attr_sep,0)+NVL(attr_oct,0)+NVL(attr_nov,0)+NVL(attr_dec,0)+NVL(attr_jan,0)+NVL(attr_feb,0)"
+" WHEN SUBSTR( '"+month+"' ,5,2)=3 THEN NVL(attr_apr,0)+NVL(attr_may,0)+NVL(attr_jun,0)+NVL(attr_jul,0)+NVL(attr_aug,0)+NVL(attr_sep,0)+NVL(attr_oct,0)+NVL(attr_nov,0)+NVL(attr_dec,0)+NVL(attr_jan,0)+NVL(attr_feb,0)+NVL(attr_mar,0) END ) AS Ytd_attr"
+" FROM SM_SALES_DIV_MST mst WHERE trim(mst.fin_year)= (CASE WHEN SUBSTR( '"+month+"' ,5,2)<4 THEN SUBSTR( '"+month+"' -100 ,1,4)||'-'||SUBSTR( '"+month+"' ,3,2) ELSE SUBSTR( '"+month+"' ,1,4)||'-' || SUBSTR( '"+month+"' +100,3,2) END) AND '"+month+"' = '"+month+"' ) GROUP BY fin_year,SUBSTR('"+month+"' ,5,2) ORDER BY div_no ";
+" FROM SM_SALES_DIV_MST mst WHERE trim(mst.fin_year)= (CASE WHEN SUBSTR( '"+month+"' ,5,2)<4 THEN SUBSTR( '"+month+"' -100 ,1,4)||'-'||SUBSTR( '"+month+"' ,3,2) ELSE SUBSTR( '"+month+"' ,1,4)||'-' || SUBSTR( '"+month+"' +100,3,2) END) AND '"+month+"' = '"+month+"' ) GROUP BY fin_year,SUBSTR('"+month+"' ,5,2) ORDER BY div_code desc ";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
......
......@@ -79,7 +79,7 @@ public class SalesInventory extends ValidatorEJB implements SalesInventoryRemote
" GROUP BY item_code UNION ALL SELECT item_code, SUM(cl_stk_qty) AS cl_stk FROM sun.inventory_spl WHERE inv_date= LAST_DAY(TO_DATE('"+month+"','yyyymm')) AND loc_code " +
" IN ( SELECT loc_code FROM LOC_SALABLE) GROUP BY item_code ) GROUP BY item_code ) CLSTK WHERE Sl.item_code= i.item_code AND ('"+month+"' = '"+month+"') AND i.item_sub_group NOT " +
" IN ('CU','BJ') AND sl.item_code=clstk.item_code(+) GROUP BY sl.item_ser, trim(i.item_sub_group_descr) HAVING SUM(sl.ytdsl)>0 ) GROUP BY item_ser,brand,ytdsl,ytdach,cl_stk,nomn HAVING " +
" ( ROUND(cl_stk/(ytdsl/nomn),1) "+nomns +") ) A , ITEMSER WHERE a.item_ser=ITEMSER.item_ser AND a.brand NOT LIKE 'DUMMY%'";
" ( ROUND(cl_stk/(ytdsl/nomn),1) "+nomns +") ) A , ITEMSER WHERE a.item_ser=ITEMSER.item_ser AND a.brand NOT LIKE 'DUMMY%' order by noofmth_invtry desc ";
//" ( ROUND(cl_stk/(ytdsl/nomn),1) >= '"+from_mns+"' and ROUND(cl_stk/(ytdsl/nomn),1) <= '"+to_mns+"' ) ) A , ITEMSER WHERE a.item_ser=ITEMSER.item_ser AND a.brand NOT LIKE 'DUMMY%'";
pstmt = conn.prepareStatement(sql);
......
......@@ -1477,7 +1477,7 @@ public class SalesPerformance extends ValidatorEJB implements SalesPerformanceRe
+ "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.hotrgt_ytd_cy)= 0 THEN 0 ELSE "
+ " (CASE WHEN SUM (a.hotrgt_ytd_cy)= 0 THEN 0 ELSE "
+" (CASE WHEN ROUND(SUM (a.sale_ytd_cy)/SUM (a.hotrgt_ytd_cy)* 100,1) <-200 THEN -200 "
+" WHEN ROUND(SUM (a.sale_ytd_cy)/SUM (a.hotrgt_ytd_cy)* 100,1) >200 THEN 200 ELSE "
+" ROUND(SUM (a.sale_ytd_cy)/SUM (a.hotrgt_ytd_cy)* 100,1) END) end) AS YTD_ACH_PER, "
......@@ -1763,7 +1763,7 @@ public class SalesPerformance extends ValidatorEJB implements SalesPerformanceRe
+" 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 (CASE WHEN ROUND(SUM(a.sale_ytd_cy - a.sale_ytd_ly)/SUM(a.sale_ytd_ly)*100,1) <-200 THEN -200 "
+ " THEN (CASE WHEN ROUND(SUM(a.sale_ytd_cy - a.sale_ytd_ly)/SUM(a.sale_ytd_ly)*100,1) <-200 THEN -200 "
+" WHEN ROUND(SUM(a.sale_ytd_cy - a.sale_ytd_ly)/SUM(a.sale_ytd_ly)*100,1) >200 THEN 200 ELSE "
+" ROUND(SUM(a.sale_ytd_cy - a.sale_ytd_ly)/SUM(a.sale_ytd_ly)*100,1) END )"
+" ELSE ROUND(0*100,1) END) AS YTD_GR,ROUND(SUM(a.sale_Qrt1_cy)/10000000,1) AS Q1, "
......@@ -1913,7 +1913,7 @@ public class SalesPerformance extends ValidatorEJB implements SalesPerformanceRe
+" WHERE trim(a.item_ser)=trim(b.div_code) AND b.fin_year=a.fin_year "
+" AND trim(a.item_ser)=trim(c.table_no) "
+" AND c.finyr = SUBSTR(a.fin_year,3,2)||SUBSTR(a.fin_year,6,2) "
+" AND b.div_group <> 'OTHERS' AND b.div_group ='"+ divGrp + "' GROUP BY b.div_group,b.div_code,B.DIV_DESCR ORDER BY div_group,b.div_code";
+" AND b.div_group <> 'OTHERS' AND b.div_group ='"+ divGrp + "' GROUP BY b.div_group,b.div_code,B.DIV_DESCR ORDER BY ROUND(SUM(a.sale_ytd_cy)/10000000,1) desc";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
int count = 0;
......@@ -2033,7 +2033,6 @@ public class SalesPerformance extends ValidatorEJB implements SalesPerformanceRe
+" WHEN ROUND(sale_YTD_cy/hotrgt_ytd_cy * 100,1) >200 THEN 200 ELSE "
+" ROUND(sale_YTD_cy/hotrgt_ytd_cy * 100,1) END) END AS ho_ach_prcnt, "
+ "(CASE WHEN NVL(sale_YTD_ly,0) <> 0 "
+" THEN (CASE WHEN ROUND((sale_YTD_cy -sale_YTD_ly)/ sale_YTD_ly* 100,1) <-200 THEN -200 "
+" WHEN ROUND((sale_YTD_cy -sale_YTD_ly)/ sale_YTD_ly* 100,1) >200 THEN 200 ELSE "
+" ROUND((sale_YTD_cy -sale_YTD_ly)/ sale_YTD_ly* 100,1) END )"
......@@ -2650,7 +2649,7 @@ public class SalesPerformance extends ValidatorEJB implements SalesPerformanceRe
+ " AND b.div_group <> 'OTHERS' "
+ " AND trim(b.div_descr) =trim('"+divDescr +"')"
+ " GROUP BY b.div_group, b.div_code,CASE WHEN A.ZONE_DESCR IS NULL THEN 'xOTHERS' ELSE A.ZONE_DESCR END "
+ " ORDER BY div_group, b.div_code,CASE WHEN A.ZONE_DESCR IS NULL THEN 'xOTHERS' ELSE A.ZONE_DESCR END ";
+ " ORDER BY ROUND(SUM(a.sale_ytd_cy)/10000000,1) desc , CASE WHEN A.ZONE_DESCR IS NULL THEN 'xOTHERS' ELSE A.ZONE_DESCR END ";
pstmt = conn.prepareStatement(sql);
......@@ -2961,7 +2960,7 @@ public class SalesPerformance extends ValidatorEJB implements SalesPerformanceRe
+ " AND TRIM(b.div_DESCR) =trim('"+ divDescr + "')"
+ " AND TRIM(A.ZONE_descr) = TRIM('" + zoneDescr + "')"
+ " GROUP BY b.div_group, b.div_code,B.DIV_DESCR,A.ZONE_CODE,A.ZONE_DESCR,CASE WHEN A.METRO_DSCR IS NULL THEN 'xOTHERS' ELSE A.METRO_DSCR END "
+ " ORDER BY div_group, b.div_code,A.ZONE_CODE ,CASE WHEN A.METRO_DSCR IS NULL THEN 'xOTHERS' ELSE A.METRO_DSCR END ";
+ " ORDER BY ROUND(SUM(a.sale_ytd_cy)/10000000,1) desc,CASE WHEN A.METRO_DSCR IS NULL THEN 'xOTHERS' ELSE A.METRO_DSCR END ";
......@@ -3268,7 +3267,7 @@ public class SalesPerformance extends ValidatorEJB implements SalesPerformanceRe
+ " AND trim(a.brand_name) =TRIM('"+brandName + "')"
+ " GROUP BY b.div_group,CASE WHEN A.ZONE_DESCR IS NULL THEN 'xOTHERS' ELSE A.ZONE_DESCR END,BRAND_NAME,BRAND_CODE "
+ " HAVING (ROUND (SUM (a.sale_mth_cy) / 10000000, 1) + ROUND (SUM (a.sale_ytd_cy) / 10000000, 1)) <>0 "
+ " ORDER BY div_group, CASE WHEN A.ZONE_DESCR IS NULL THEN 'xOTHERS' ELSE A.ZONE_DESCR END ,BRAND_NAME,BRAND_CODE ";
+ " ORDER BY ROUND(SUM(a.sale_ytd_cy)/10000000,1) desc, CASE WHEN A.ZONE_DESCR IS NULL THEN 'xOTHERS' ELSE A.ZONE_DESCR END ,BRAND_NAME,BRAND_CODE ";
pstmt = conn.prepareStatement(sql);
......@@ -3580,7 +3579,7 @@ public class SalesPerformance extends ValidatorEJB implements SalesPerformanceRe
+ " AND TRIM(b.div_descr) =TRIM('"+ divDescr + "')"
+ " AND TRIM(A.ZONE_descr) = TRIM('" +zoneDescr + "')"
+ " GROUP BY b.div_group, b.div_code,b.div_descr,A.ZONE_CODE,A.ZONE_DESCR,BRAND_NAME,BRAND_CODE,CASE WHEN A.METRO_DSCR IS NULL THEN 'xOTHERS' ELSE A.METRO_DSCR END "
+ " ORDER BY div_group, b.div_code,b.div_descr,A.ZONE_CODE ,BRAND_NAME,BRAND_CODE,CASE WHEN A.METRO_DSCR IS NULL THEN 'xOTHERS' ELSE A.METRO_DSCR END";
+ " ORDER BY ROUND(SUM(a.sale_ytd_cy)/10000000,1) desc,CASE WHEN A.METRO_DSCR IS NULL THEN 'xOTHERS' ELSE A.METRO_DSCR END";
pstmt = conn.prepareStatement(sql);
......
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