Commit efb10092 authored by steurwadkar's avatar steurwadkar

Changes made for Group scheme in Sales Order html wizard screen

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@179808 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a1e33b94
...@@ -449,7 +449,7 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde ...@@ -449,7 +449,7 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
//Working on Scheme Applicability... //Working on Scheme Applicability...
System.out.println("Scheme Applicability...."+getSchemeItemList.size()); System.out.println("Scheme Applicability...."+getSchemeItemList.size());
if(getSchemeItemList.size() > 0) if(finalApplicableSchemeSet.size() > 0)
{ {
sql = "select scheme_code,descr,scheme_type,purc_base,sch_allowence,discount from sch_group_def where scheme_code in ("+s1+")"; sql = "select scheme_code,descr,scheme_type,purc_base,sch_allowence,discount from sch_group_def where scheme_code in ("+s1+")";
System.out.println("sql >> ["+sql+"]"); System.out.println("sql >> ["+sql+"]");
...@@ -470,6 +470,7 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde ...@@ -470,6 +470,7 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
if("0".equalsIgnoreCase(schemeType)) if("0".equalsIgnoreCase(schemeType))
{ {
double xmlQty = 0.0;
System.out.println("Applied Scheme Type is ::"+schemeType); System.out.println("Applied Scheme Type is ::"+schemeType);
itemCodeListScheme = getSchemeItemList.get(schemeCode); itemCodeListScheme = getSchemeItemList.get(schemeCode);
System.out.println("Purchased Item Code for Scheme Type 0 is "+itemCodeListScheme); System.out.println("Purchased Item Code for Scheme Type 0 is "+itemCodeListScheme);
...@@ -479,11 +480,10 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde ...@@ -479,11 +480,10 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
for(int cntr=0; cntr<itemCodeListScheme.size();cntr++) for(int cntr=0; cntr<itemCodeListScheme.size();cntr++)
{ {
itemCodeSchm = itemCodeListScheme.get(cntr); itemCodeSchm = itemCodeListScheme.get(cntr);
System.out.println("itemCodeSchm ::::"+itemCodeSchm); xmlQty += itemQuantityMap.get(itemCodeSchm);
if(itemQuantityMap.containsKey(itemCodeSchm)) freeItemListApplcbleType0.add(itemCodeSchm);
{ }
double xmlQty = itemQuantityMap.get(itemCodeSchm);
//finRate = itemQuantityMap.get(itemCodeSchm);
System.out.println("Quantity in XML is ::["+xmlQty+"]" + "\t" + "Quantity Applicable for Scheme is ::["+purcBase+"]"); System.out.println("Quantity in XML is ::["+xmlQty+"]" + "\t" + "Quantity Applicable for Scheme is ::["+purcBase+"]");
if(xmlQty >= purcBase) if(xmlQty >= purcBase)
...@@ -491,7 +491,6 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde ...@@ -491,7 +491,6 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
double freeQty = (int)(xmlQty / purcBase); System.out.println("freeQty is ::["+freeQty+"]"); double freeQty = (int)(xmlQty / purcBase); System.out.println("freeQty is ::["+freeQty+"]");
freeQty = freeQty * schAllowence1; freeQty = freeQty * schAllowence1;
System.out.println("Items Applicable for Free Schemes :::"+itemCodeSchm + "free quantity"+(int)freeQty);//Added by sarita on 15JAN2018 System.out.println("Items Applicable for Free Schemes :::"+itemCodeSchm + "free quantity"+(int)freeQty);//Added by sarita on 15JAN2018
freeItemListApplcbleType0.add(itemCodeSchm);
itemValues = getItemCode(freeItemListApplcbleType0); itemValues = getItemCode(freeItemListApplcbleType0);
System.out.println("Item Values for Scheme Type 0 is :::["+itemValues+"]"); System.out.println("Item Values for Scheme Type 0 is :::["+itemValues+"]");
//sql = "SELECT S.item_code FROM SCH_PUR_ITEMS P ,SCH_OFFER_ITEMS S WHERE P.SCHEME_CODE=S.SCHEME_CODE AND P.ITEM_CODE='"+itemCodeSchm+"'"; //sql = "SELECT S.item_code FROM SCH_PUR_ITEMS P ,SCH_OFFER_ITEMS S WHERE P.SCHEME_CODE=S.SCHEME_CODE AND P.ITEM_CODE='"+itemCodeSchm+"'";
...@@ -524,7 +523,7 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde ...@@ -524,7 +523,7 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
finalFreeItems = freeItemInfoMap.get(itemCodeSchm); finalFreeItems = freeItemInfoMap.get(itemCodeSchm);
System.out.println("Final List of Free Items for ::::Scheme Type 0 is "+finalFreeItems); System.out.println("Final List of Free Items for ::::Scheme Type 0 is "+finalFreeItems);
//s12 = returnFinalFreeItemDataUsingList(finalFreeItems, conn,schemeType,schemeCode,schemeDescr); //s12 = returnFinalFreeItemDataUsingList(finalFreeItems, conn,schemeType,schemeCode,schemeDescr);
s12 = returnFinalFreeItemDataUsingList(finalFreeItems, conn,schemeType,schemeCode,schemeDescr,discount,freeQty,itemCodeSchm,detai1ValueMap); s12 = returnFinalFreeItemDataUsingList(freeItemList, conn,schemeType,schemeCode,schemeDescr,discount,freeQty,itemCodeSchm,detai1ValueMap);
//System.out.println("***********"+s12); //System.out.println("***********"+s12);
valueXmlString.append(s12); valueXmlString.append(s12);
} }
...@@ -533,8 +532,6 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde ...@@ -533,8 +532,6 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
System.out.println("Scheme is NOT applicable for ::"+itemCodeSchm + "Purchased Item quantity::"+xmlQty +"is NOT greater than or equal to applicable quantity"+purcBase+"for scheme "+schemeCode); System.out.println("Scheme is NOT applicable for ::"+itemCodeSchm + "Purchased Item quantity::"+xmlQty +"is NOT greater than or equal to applicable quantity"+purcBase+"for scheme "+schemeCode);
} }
} }
}
}
}//end of if block for type0 }//end of if block for type0
if("1".equalsIgnoreCase(schemeType)) if("1".equalsIgnoreCase(schemeType))
{ {
...@@ -544,10 +541,17 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde ...@@ -544,10 +541,17 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
System.out.println("Total Purchased Item for Scheme Type 1 is "+itemCodeListScheme.size()); System.out.println("Total Purchased Item for Scheme Type 1 is "+itemCodeListScheme.size());
if(itemCodeListScheme.size() > 0) if(itemCodeListScheme.size() > 0)
{ {
double purcAmt = 0.0;
for(int cntr=0; cntr<itemCodeListScheme.size();cntr++) for(int cntr=0; cntr<itemCodeListScheme.size();cntr++)
{ {
double xmlQty = 0.0;
itemCodeSchm = itemCodeListScheme.get(cntr); itemCodeSchm = itemCodeListScheme.get(cntr);
System.out.println("itemCodeSchm ::::"+itemCodeSchm); finRate = itemRateMap.get(itemCodeSchm);
xmlQty = itemQuantityMap.get(itemCodeSchm);
freeItemListApplcbleType1.add(itemCodeSchm);
purcAmt += (finRate * xmlQty);
}
if(itemQuantityMap.containsKey(itemCodeSchm)) if(itemQuantityMap.containsKey(itemCodeSchm))
{ {
...@@ -555,17 +559,16 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde ...@@ -555,17 +559,16 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
//finRate = itemQuantityMap.get(itemCodeSchm); //finRate = itemQuantityMap.get(itemCodeSchm);
//ContractNo=salesOrderIC.getContract(detai1ValueMap.get("site_code"), detai1ValueMap.get("cust_code"), getTimeStamp(detai1ValueMap.get("order_date")), itemCodeSchm, "", "", conn); //ContractNo=salesOrderIC.getContract(detai1ValueMap.get("site_code"), detai1ValueMap.get("cust_code"), getTimeStamp(detai1ValueMap.get("order_date")), itemCodeSchm, "", "", conn);
//SalesPriceList = distCommon.getSalesPriceList(detai1ValueMap.get("cust_code"),detai1ValueMap.get("cust_code__dlv"),detai1ValueMap.get("site_code"),ContractNo,itemCodeSchm,detai1ValueMap.get("order_date"),conn); //SalesPriceList = distCommon.getSalesPriceList(detai1ValueMap.get("cust_code"),detai1ValueMap.get("cust_code__dlv"),detai1ValueMap.get("site_code"),ContractNo,itemCodeSchm,detai1ValueMap.get("order_date"),conn);
finRate = itemRateMap.get(itemCodeSchm); System.out.println("Applicable Rate for Scheme Type 1 is ==["+finRate+"]"+"Quantity in XML is ::["+purcAmt+"]" + "\t" +"Purchased Items ["+itemCodeSchm+"]"+ "Quantity Applicable for Scheme is ::["+purcBase+"]" + " Scheme Allowence for Scheme is ::["+schAllowence1+"]");
System.out.println("Applicable Rate for Scheme Type 1 is ==["+finRate+"]"+"Quantity in XML is ::["+xmlQty+"]" + "\t" +"Purchased Items ["+itemCodeSchm+"]"+ "Quantity Applicable for Scheme is ::["+purcBase+"]" + " Scheme Allowence for Scheme is ::["+schAllowence1+"]");
if(xmlQty >= purcBase) if(purcAmt >= purcBase)
{ {
//double freeQty = (int)(xmlQty / purcBase); System.out.println("freeQty is ::["+freeQty+"]"); //double freeQty = (int)(xmlQty / purcBase); System.out.println("freeQty is ::["+freeQty+"]");
//freeQty = freeQty * schAllowence1; //freeQty = freeQty * schAllowence1;
//Added by sarita on 02FEB2018 //Added by sarita on 02FEB2018
double chargedQty = (finRate * xmlQty); //double chargedQty = (finRate * xmlQty);
double freeQty = (chargedQty * schAllowence1)/purcBase; int freeQty = (int) ((purcAmt * schAllowence1)/purcBase);
System.out.println("chargedQty ["+chargedQty+"]" + "freeQty ["+freeQty+"]"); System.out.println("purcAmt ["+purcAmt+"]" + "freeQty ["+freeQty+"]");
System.out.println("Items Applicable for Free Schemes :::"+itemCodeSchm + "free quantity"+(int)freeQty); System.out.println("Items Applicable for Free Schemes :::"+itemCodeSchm + "free quantity"+(int)freeQty);
freeItemListApplcbleType1.add(itemCodeSchm); freeItemListApplcbleType1.add(itemCodeSchm);
itemValues = getItemCode(freeItemListApplcbleType1); itemValues = getItemCode(freeItemListApplcbleType1);
...@@ -607,7 +610,6 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde ...@@ -607,7 +610,6 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
} }
} }
} }
}
}//end of if block for type1//Added by sarita on 15JAN2018 }//end of if block for type1//Added by sarita on 15JAN2018
if("2".equalsIgnoreCase(schemeType)) if("2".equalsIgnoreCase(schemeType))
...@@ -618,10 +620,17 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde ...@@ -618,10 +620,17 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
System.out.println("Total Purchased Item for Scheme Type 2 is "+itemCodeListScheme.size()); System.out.println("Total Purchased Item for Scheme Type 2 is "+itemCodeListScheme.size());
if(itemCodeListScheme.size() > 0) if(itemCodeListScheme.size() > 0)
{ {
double purcAmt = 0.0;
for(int cntr=0; cntr<itemCodeListScheme.size();cntr++) for(int cntr=0; cntr<itemCodeListScheme.size();cntr++)
{ {
double xmlQty = 0.0;
itemCodeSchm = itemCodeListScheme.get(cntr); itemCodeSchm = itemCodeListScheme.get(cntr);
//System.out.println("itemCodeSchm ::::"+itemCodeSchm); finRate = itemRateMap.get(itemCodeSchm);
xmlQty = itemQuantityMap.get(itemCodeSchm);
freeItemListApplcbleType2.add(itemCodeSchm);
purcAmt += (finRate * xmlQty);
}
if(itemQuantityMap.containsKey(itemCodeSchm)) if(itemQuantityMap.containsKey(itemCodeSchm))
{ {
...@@ -629,14 +638,14 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde ...@@ -629,14 +638,14 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
finRate = itemRateMap.get(itemCodeSchm); finRate = itemRateMap.get(itemCodeSchm);
System.out.println("Applicable Rate for Scheme Type 2 is ==["+finRate+"]"+"Quantity in XML is ::["+xmlQty+"]" + "\t" +"Purchased Items ["+itemCodeSchm+"]"+ "Quantity Applicable for Scheme is ::["+purcBase+"]"); System.out.println("Applicable Rate for Scheme Type 2 is ==["+finRate+"]"+"Quantity in XML is ::["+xmlQty+"]" + "\t" +"Purchased Items ["+itemCodeSchm+"]"+ "Quantity Applicable for Scheme is ::["+purcBase+"]");
if(xmlQty >= purcBase) if(purcAmt >= purcBase)
{ {
//double freeQty = (int)(xmlQty / purcBase); System.out.println("freeQty is ::["+freeQty+"]"); //double freeQty = (int)(xmlQty / purcBase); System.out.println("freeQty is ::["+freeQty+"]");
//freeQty = freeQty * schAllowence1; //freeQty = freeQty * schAllowence1;
//Added by sarita on 2FEB2018 //Added by sarita on 2FEB2018
double chargedQty = (finRate * xmlQty); //double chargedQty = (finRate * xmlQty);
double freeQty = (chargedQty * schAllowence1)/purcBase; int freeQty = (int) ((purcAmt * schAllowence1)/purcBase);
System.out.println("chargedQty ["+chargedQty+"]" + "freeQty ["+freeQty+"]"); System.out.println("purcAmt ["+purcAmt+"]" + "freeQty ["+freeQty+"]");
System.out.println("Items Applicable for Free Schemes :::"+itemCodeSchm + "free quantity"+(int)freeQty); System.out.println("Items Applicable for Free Schemes :::"+itemCodeSchm + "free quantity"+(int)freeQty);
freeItemListApplcbleType2.add(itemCodeSchm); freeItemListApplcbleType2.add(itemCodeSchm);
itemValues = getItemCode(freeItemListApplcbleType2); itemValues = getItemCode(freeItemListApplcbleType2);
...@@ -679,7 +688,6 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde ...@@ -679,7 +688,6 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
} }
} }
} }
}
}//end of while loop }//end of while loop
if(pstmt != null) if(pstmt != null)
...@@ -865,7 +873,7 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde ...@@ -865,7 +873,7 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
if("0".equalsIgnoreCase(schemeType) || "1".equalsIgnoreCase(schemeType)) if("0".equalsIgnoreCase(schemeType) || "1".equalsIgnoreCase(schemeType))
{ {
nature="F"; nature="F";
discount=0.0; //discount=0.0;
//finRate=0.0; //finRate=0.0;
System.out.println("Nature is "+nature); System.out.println("Nature is "+nature);
} }
......
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