Commit a1552f5d authored by ngadkari's avatar ngadkari

Changes in avg sales calculation in salesforecast detail

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@211396 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 358f0600
...@@ -457,30 +457,35 @@ public class BuildForecastPrc extends ProcessEJB ...@@ -457,30 +457,35 @@ public class BuildForecastPrc extends ProcessEJB
if ( li_check == 1 ) if ( li_check == 1 )
{ {
// all Integer parsing chnage to float
if ( defPerc != null && defPerc.length() > 0 ) if ( defPerc != null && defPerc.length() > 0 )
{ {
lc_def_perc = Integer.parseInt( defPerc ); //lc_def_perc = Integer.parseInt( defPerc );
lc_def_perc = Float.parseFloat( defPerc );
} }
} }
else if ( li_check == 2 ) else if ( li_check == 2 )
{ {
if ( defPerc2 != null && defPerc2.length() > 0 ) if ( defPerc2 != null && defPerc2.length() > 0 )
{ {
lc_def_perc = Integer.parseInt( defPerc2 ); //lc_def_perc = Integer.parseInt( defPerc2 );
lc_def_perc = Float.parseFloat( defPerc2 );
} }
} }
else if ( li_check == 3 ) else if ( li_check == 3 )
{ {
if ( defPerc3 != null && defPerc3.length() > 0 ) if ( defPerc3 != null && defPerc3.length() > 0 )
{ {
lc_def_perc = Integer.parseInt( defPerc3 ); //lc_def_perc = Integer.parseInt( defPerc3 );
lc_def_perc = Float.parseFloat( defPerc3 );
} }
} }
else if (li_check == 4) else if (li_check == 4)
{ {
if ( defPerc4 != null && defPerc4.length() > 0 ) if ( defPerc4 != null && defPerc4.length() > 0 )
{ {
lc_def_perc = Integer.parseInt( defPerc4 ); //lc_def_perc = Integer.parseInt( defPerc4 );
lc_def_perc = Float.parseFloat( defPerc4 );
} }
} }
...@@ -616,7 +621,7 @@ public class BuildForecastPrc extends ProcessEJB ...@@ -616,7 +621,7 @@ public class BuildForecastPrc extends ProcessEJB
return retString; return retString;
} }
private String insertSalesForecast( Document detailDom, Document detailAllDom, String tranId, String siteCode, String itemCode, String prdCodeFrom, String prdCodeTo, String period, Integer scanVal, String itemSer, String insert, String unit, String prdListStr, HashMap<Integer, ForecastBean> periodDataMap, Connection conn,Date fromDate ) throws ITMException //fromDate added by nandkumar gadkari on 30/10/19 private String insertSalesForecast( Document detailDom, Document detailAllDom, String tranId, String siteCode, String itemCode, String prdCodeFrom, String prdCodeTo, String period, int scanVal, String itemSer, String insert, String unit, String prdListStr, HashMap<Integer, ForecastBean> periodDataMap, Connection conn,Date fromDate ) throws ITMException //fromDate added by nandkumar gadkari on 30/10/19
{ {
String retString = ""; String retString = "";
...@@ -658,7 +663,7 @@ public class BuildForecastPrc extends ProcessEJB ...@@ -658,7 +663,7 @@ public class BuildForecastPrc extends ProcessEJB
pstm.close(); pstm.close();
pstm = null; pstm = null;
} }
qty = getQuantity( detailDom, detailAllDom, siteCode, itemCode, prdListStr, itemSer, conn ); qty = getQuantity( detailDom, detailAllDom, siteCode, itemCode, prdListStr, itemSer, conn ,scanVal);// scanVal parameter added by nandkumar gadkari on 06/11/19
BaseLogger.log( "3", null, null, "lc_qty ["+ qty +"]" ); BaseLogger.log( "3", null, null, "lc_qty ["+ qty +"]" );
for ( Map.Entry<Integer, ForecastBean> entry : periodDataMap.entrySet() ) for ( Map.Entry<Integer, ForecastBean> entry : periodDataMap.entrySet() )
...@@ -722,7 +727,7 @@ public class BuildForecastPrc extends ProcessEJB ...@@ -722,7 +727,7 @@ public class BuildForecastPrc extends ProcessEJB
cnt=0; cnt=0;
sql ="SELECT SUM(NVL(SALES_QTY,0)) QTY ,TO_CHAR(DOC_DATE,'YYYYMM') FROM DWH_SALES_SUM " sql ="SELECT SUM(NVL(SALES_QTY,0) - NVL(SALEABLE_RETURN_QTY,0)) QTY ,TO_CHAR(DOC_DATE,'YYYYMM') FROM DWH_SALES_SUM "
+ " WHERE ITEM_CODE = ? AND SITE_CODE = ? AND TO_CHAR(DOC_DATE,'YYYYMM') IN ( "+ prdListStr +" ) " + " WHERE ITEM_CODE = ? AND SITE_CODE = ? AND TO_CHAR(DOC_DATE,'YYYYMM') IN ( "+ prdListStr +" ) "
+ " AND ITEM_SER = ? GROUP BY TO_CHAR(DOC_DATE,'YYYYMM') ORDER BY TO_CHAR(DOC_DATE,'YYYYMM')"; + " AND ITEM_SER = ? GROUP BY TO_CHAR(DOC_DATE,'YYYYMM') ORDER BY TO_CHAR(DOC_DATE,'YYYYMM')";
pstm = conn.prepareStatement(sql); pstm = conn.prepareStatement(sql);
...@@ -991,7 +996,7 @@ public class BuildForecastPrc extends ProcessEJB ...@@ -991,7 +996,7 @@ public class BuildForecastPrc extends ProcessEJB
return (currAppdate); return (currAppdate);
} }
private float getQuantity( Document dom, Document detailAllDom, String siteCode, String itemCode, String prdListStr, String itemSer, Connection conn ) throws BaseException, RemoteException private float getQuantity( Document dom, Document detailAllDom, String siteCode, String itemCode, String prdListStr, String itemSer, Connection conn,int scanVal ) throws BaseException, RemoteException
{ {
BaseLogger.log("3", null, null, " gbf_quantity method called" ); BaseLogger.log("3", null, null, " gbf_quantity method called" );
PreparedStatement pstm = null; PreparedStatement pstm = null;
...@@ -1005,7 +1010,7 @@ public class BuildForecastPrc extends ProcessEJB ...@@ -1005,7 +1010,7 @@ public class BuildForecastPrc extends ProcessEJB
int li_ctr = 0; int li_ctr = 0;
String ls_consider_zero = checkNull( genericUtility.getColumnValue( "consider_zero", dom ) ); String ls_consider_zero = checkNull( genericUtility.getColumnValue( "consider_zero", dom ) );
String sql = "SELECT SUM(NVL(SALES_QTY,0)) QTY, COUNT(SALES_QTY) CTR FROM DWH_SALES_SUM " String sql = "SELECT SUM(NVL(SALES_QTY,0) - NVL(SALEABLE_RETURN_QTY,0)) QTY, COUNT(SALES_QTY) CTR FROM DWH_SALES_SUM "
+ "WHERE ITEM_CODE = ? AND SITE_CODE = ? AND TO_CHAR(DOC_DATE,'YYYYMM') IN ( "+ prdListStr +" ) AND ITEM_SER = ?"; + "WHERE ITEM_CODE = ? AND SITE_CODE = ? AND TO_CHAR(DOC_DATE,'YYYYMM') IN ( "+ prdListStr +" ) AND ITEM_SER = ?";
pstm = conn.prepareStatement(sql); pstm = conn.prepareStatement(sql);
pstm.setString(1, itemCode); pstm.setString(1, itemCode);
...@@ -1021,9 +1026,11 @@ public class BuildForecastPrc extends ProcessEJB ...@@ -1021,9 +1026,11 @@ public class BuildForecastPrc extends ProcessEJB
if ( ls_consider_zero.equalsIgnoreCase( "N" ) ) if ( ls_consider_zero.equalsIgnoreCase( "N" ) )
{ {
if ( li_ctr > 0 ) //if ( li_ctr > 0 )condition commented and scanVal by nandkumar gadkari on 06/11/19
if ( scanVal > 0 )
{ {
lc_sales_quantity = lc_sales_quantity / li_ctr; //lc_sales_quantity = lc_sales_quantity / li_ctr;
lc_sales_quantity = lc_sales_quantity / scanVal;
} }
else else
{ {
...@@ -1032,9 +1039,11 @@ public class BuildForecastPrc extends ProcessEJB ...@@ -1032,9 +1039,11 @@ public class BuildForecastPrc extends ProcessEJB
} }
else if ( ls_consider_zero.equalsIgnoreCase( "Y" ) ) else if ( ls_consider_zero.equalsIgnoreCase( "Y" ) )
{ {
if ( li_ctr > 0 ) //if ( li_ctr > 0 )condition commented and scanVal by nandkumar gadkari on 06/11/19
if ( scanVal > 0 )
{ {
lc_sales_quantity = lc_sales_quantity / li_ctr; //lc_sales_quantity = lc_sales_quantity / li_ctr;
lc_sales_quantity = lc_sales_quantity / scanVal;
} }
else else
{ {
......
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