Commit e5e4001c authored by kshinde's avatar kshinde

Sales Order group scheme update

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@176919 ce508802-f39f-4f6c-b175-0d175dae99d5
parent fe40280a
...@@ -9745,10 +9745,21 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -9745,10 +9745,21 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
{ {
lsItemDesc = mDescr; lsItemDesc = mDescr;
} }
// setNodeValue( dom, "sch_attr", getAbsString("Y"));
String schAttr = checkNull(genericUtility.getColumnValue("sch_attr", dom));
System.out.println("9750::schAttr["+schAttr+"]");
if(schAttr != null && "N".equalsIgnoreCase(schAttr))
{
System.out.println("lsItemDesc["+lsItemDesc+"]");
valueXmlString.append("<item_descr>").append("<![CDATA[" + lsItemDesc + "]]>").append("</item_descr>");
setNodeValue( dom, "item_descr", getAbsString( lsItemDesc));
}
/*
System.out.println("lsItemDesc["+lsItemDesc+"]"); System.out.println("lsItemDesc["+lsItemDesc+"]");
valueXmlString.append("<item_descr>").append("<![CDATA[" + lsItemDesc + "]]>").append("</item_descr>"); valueXmlString.append("<item_descr>").append("<![CDATA[" + lsItemDesc + "]]>").append("</item_descr>");
setNodeValue( dom, "item_descr", getAbsString( lsItemDesc)); setNodeValue( dom, "item_descr", getAbsString( lsItemDesc));
*/
if (lsUnitSal == null || lsUnitSal.trim().length() == 0) if (lsUnitSal == null || lsUnitSal.trim().length() == 0)
{ {
lsUnitSal = uom; lsUnitSal = uom;
...@@ -12973,18 +12984,20 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -12973,18 +12984,20 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
//pstmt1.setString(2, lsItemCodeOrd); //pstmt1.setString(2, lsItemCodeOrd);
//System.out.println("lsItemCodeOrd in side @@@@"+sql+"]"); //System.out.println("lsItemCodeOrd in side @@@@"+sql+"]");
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
int countSch = 0;
if (rs1.next()) if (rs1.next())
{ {
cnt = rs1.getInt("cnt"); countSch = rs1.getInt("cnt");
} }
rs1.close(); rs1.close();
rs1 = null; rs1 = null;
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
System.out.println("prod_sch@@@@@@@["+sql+"]"); System.out.println("countSch@@@@@@@["+countSch+"]");
System.out.println("lsSchemeCode before "+lsSchemeCode+"]"); System.out.println("lsSchemeCode before "+lsSchemeCode+"]");
if(cnt>0) if(countSch>0)
{ {
System.out.println("lsCurscheme"+lsCurscheme+"]"); System.out.println("lsCurscheme"+lsCurscheme+"]");
/*if (rs.next()) /*if (rs.next())
{*/ {*/
...@@ -12994,7 +13007,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -12994,7 +13007,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
//lsCurscheme = rs.getString("scheme_code"); //lsCurscheme = rs.getString("scheme_code");
System.out.println("lsCurscheme"+lsCurscheme+"]"); System.out.println("lsCurscheme"+lsCurscheme+"]");
sql = "Select count(*) as cnt From scheme_applicability A,bom b " /*sql = "Select count(*) as cnt From scheme_applicability A,bom b "
+ "Where A.scheme_code = b.bom_code And B.bom_code= ?" + "Where A.scheme_code = b.bom_code And B.bom_code= ?"
+" And (? between case when b.min_qty is null then 0 else b.min_qty end" +" And (? between case when b.min_qty is null then 0 else b.min_qty end"
+ " And case when b.max_qty is null then 0 else b.max_qty end)" + " And case when b.max_qty is null then 0 else b.max_qty end)"
...@@ -13012,7 +13025,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -13012,7 +13025,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("before cnt1 "+cnt+"]"); System.out.println("before cnt1 "+cnt+"]");*/
if(cnt > 0) if(cnt > 0)
{ {
...@@ -13074,8 +13087,8 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -13074,8 +13087,8 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
valueXmlString.append("<sch_descr>").append("<![CDATA[" + descr + "]]>").append("</sch_descr>"); valueXmlString.append("<item_descr>").append("<![CDATA[" + descr + "]]>").append("</item_descr>");
setNodeValue( dom, "sch_descr", getAbsString( descr ) ); setNodeValue( dom, "item_descr", getAbsString( descr ) );
// valueXmlString.append("<item_code>").append("<![CDATA[" + lsSchemeCode + "]]>").append("</item_code>"); // valueXmlString.append("<item_code>").append("<![CDATA[" + lsSchemeCode + "]]>").append("</item_code>");
// setNodeValue( dom, "item_code", getAbsString(lsSchemeCode)); // setNodeValue( dom, "item_code", getAbsString(lsSchemeCode));
System.out.println("descr SCH_GROUP_DEF"+descr+"]"); System.out.println("descr SCH_GROUP_DEF"+descr+"]");
...@@ -13088,6 +13101,9 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -13088,6 +13101,9 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
} }
}else
{
} }
...@@ -13098,6 +13114,12 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -13098,6 +13114,12 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
rs = pstmt.executeQuery()*/ rs = pstmt.executeQuery()*/
} }
if(countSch > 0)
{
lsSchemeCode = "";
schecnt=0;
}
} }
else else
{ {
...@@ -16312,4 +16334,4 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -16312,4 +16334,4 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
return errCode; return errCode;
} }
} }
\ No newline at end of file
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver; //import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB; import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.sys.UtilMethods; import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
...@@ -16,97 +14,81 @@ import java.sql.SQLException; ...@@ -16,97 +14,81 @@ import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import javax.ejb.Stateless; import javax.ejb.Stateless;
@Stateless @Stateless
public class SorderGroupSchemeAct extends ActionHandlerEJB implements SorderGroupSchemeActRemote, SorderGroupSchemeActLocal public class SorderGroupSchemeAct extends ActionHandlerEJB implements SorderGroupSchemeActRemote, SorderGroupSchemeActLocal
{ {
E12GenericUtility genericUtility= new E12GenericUtility(); E12GenericUtility genericUtility= new E12GenericUtility();
FinCommon finCommon = new FinCommon();
DistCommon disCommon= new DistCommon();
UtilMethods utilMethod = new UtilMethods(); UtilMethods utilMethod = new UtilMethods();
public String actionHandler(String saleOrder, String xtraParams, String forcedFlag)throws RemoteException, ITMException public String actionHandler(String saleOrder, String xtraParams, String forcedFlag)throws RemoteException, ITMException
{ {
StringBuffer msgAppStrinrg = new StringBuffer(""); StringBuffer msgAppStrinrg = new StringBuffer("");
StringBuffer msgNotAppString = new StringBuffer(""); StringBuffer msgNotAppString = new StringBuffer("");
System.out.println(">>>>>>>>>>>>>>>>>>SorderGroupSchemeAct called>>>>>>>>>>>>>>>>>>>"); System.out.println(">>>>>>>>>>>>>>>>>>SorderGroupSchemeAct called>>>>>>>>>>>>>>>>>>>");
Connection conn = null; Connection conn = null;
String sql="", sql1="" , sql2="", sql3="", sql4="", sql5=""; String sql="", sql1="" , sql2="", sql3="";
PreparedStatement pstmt = null, pstmt1 = null, pstmt2 = null, pstmt3 = null, pstmt4 = null, pstmt5 = null; String sql4="", sql5="";
ResultSet rs = null, rs1 = null, rs2 = null, rs3 = null, rs4 = null; PreparedStatement pstmt = null, pstmt1 = null, pstmt2 = null;
int cnt = 0, cnt1 = 0, cnt2 = 0, count = 0; PreparedStatement pstmt3 = null, pstmt4 = null, pstmt5 = null;
ResultSet rs = null, rs1 = null, rs2 = null, rs3 = null; // rs4 = null;
int count = 0, count1 = 0, count2 = 0, count3 = 0;
String errString = null; String errString = null;
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
double qty = 0.0, rate; double qty = 0.0, rate=0.0;
String schAttr = "" , itemCodeOrd="" ,nature = "" , schAttr1 = "", ordType = "", custCode = "", schmDesc = "", schmCode = "";
String ordtype = "", schemeCode="", itemCodeParent="" , curScheme = "", prevScheme = "", custSchemeCode = ""; String schLineNo = "", schItemCode = "", schNature = "", schScheme = "", schFalg = "";
String siteCode="", StateCodeDlv = "", CountCodeDlv="", lstype = "", lineNo = ""; double schQty = 0.0, schRate=0.0;
String itemCodeOrd = "" ,nature = "" , schAttr1 = "", ordType = "", custCode = "", schmDesc = "", lineNo = "";
String ordtype = "", schemeCode="", schemeCode1="",itemCodeParent="" , curScheme = "", prevScheme = "", custSchemeCode = "";
String siteCode="", StateCodeDlv = "", CountCodeDlv="", lstype = "";
Timestamp ordDate = null; Timestamp ordDate = null;
String applyCustList = "", noApplyCustList = "" , applicableOrdTypes = "", mainStr="", msgApplied="", msgNotApplied="", itemCode1=""; String applyCustList = "", noApplyCustList = "" , applicableOrdTypes = "", mainStr="", msgApplied="", msgNotApplied="", itemCode1="";
boolean proceed = false; boolean proceed = false;
String lineNo1 = "", nature1 = ""; String lineNo1 = "", nature1="";
double qty1 = 0.0, totalQty = 0.0, chargeAmt = 0.0 , freeDiscount = 0.0; double qty1 = 0.0, totalQty = 0.0, chargeAmt = 0.0 , freeDiscount = 0.0;
int no=0; int no=0;
ArrayList<HashMap> itemList =new ArrayList<HashMap>();
String schemeType = "";
int PurcBase = 0, SchAllowence = 0;
double freeQty = 0.0;
try try
{ {
ConnDriver connDriver = null;
//connDriver = new ConnDriver();
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection(); conn = getConnection();
conn.setAutoCommit(false); conn.setAutoCommit(false);
System.out.println("saleOrder...["+saleOrder+"]"); System.out.println("saleOrder...["+saleOrder+"]");
if (saleOrder != null && saleOrder.trim().length() > 0) if (saleOrder != null && saleOrder.trim().length() > 0)
{ {
//sql = " select SCH_ATTR from SORDDET where sale_order = ?;"; sql = "SELECT B.LINE_NO, B.ITEM_CODE__ORD, B.QUANTITY, B.RATE, B.NATURE, B.SCH_ATTR, A.ORDER_TYPE, A.ORDER_DATE, B.SITE_CODE, A.STATE_CODE__DLV, A.COUNT_CODE__DLV, A.CUST_CODE " +
/*sql = " select count(*) from SORDDET where sale_order = ? and sch_attr = 'Y'"; "FROM SORDER A, SORDDET B " +
pstmt = conn.prepareStatement(sql); "WHERE A.SALE_ORDER = B.SALE_ORDER AND B.SALE_ORDER = ? AND B.SCH_ATTR = 'Y' ";
pstmt.setString(1, saleOrder);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
//System.out.println("schAttr..["+schAttr+"]");
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("@@70..cnt is..["+cnt+"]");
if (cnt == 0)
{
errString = itmDBAccessLocal.getErrorString("", "VTNOSCHEME", "");
return errString;
}
*/
sql = " SELECT A.ITEM_CODE__ORD, A.QUANTITY, A.NATURE, A.SCH_ATTR, B.ORDER_TYPE, B.ORDER_DATE, A.SITE_CODE, B.STATE_CODE__DLV, B.COUNT_CODE__DLV, B.ORDER_TYPE, B.CUST_CODE, A.LINE_NO, A.RATE " +
"FROM SORDDET A, SORDER B " +
"WHERE A.SALE_ORDER = B.SALE_ORDER and A.SALE_ORDER = ? and A.SCH_ATTR = 'Y' and A.NATURE = 'C' AND (CASE WHEN A.SPEC_REASON IS NULL THEN ' ' ELSE TRIM(A.SPEC_REASON) END) != 'P'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, saleOrder); pstmt.setString(1, saleOrder);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
itemCodeOrd = checkNull(rs.getString(1)); lineNo = checkNull(rs.getString(1));
qty = rs.getDouble(2); itemCodeOrd = checkNull(rs.getString(2));
nature = checkNull(rs.getString(3)); qty = rs.getDouble(3);
schAttr1 = checkNull(rs.getString(4)); rate = rs.getDouble(4);
ordtype = checkNull(rs.getString(5)); nature = checkNull(rs.getString(5));
ordDate = rs.getTimestamp(6); schAttr1 = checkNull(rs.getString(6));
siteCode = checkNull(rs.getString(7)); ordtype = checkNull(rs.getString(7));
StateCodeDlv = checkNull(rs.getString(8)); ordDate = rs.getTimestamp(8);
CountCodeDlv = checkNull(rs.getString(9)); siteCode = checkNull(rs.getString(9));
ordType = checkNull(rs.getString(10)); StateCodeDlv = checkNull(rs.getString(10));
custCode = checkNull(rs.getString(11)); CountCodeDlv = checkNull(rs.getString(11));
lineNo = checkNull(rs.getString(12)); custCode = checkNull(rs.getString(12));
rate = rs.getDouble(13);
System.out.println("lineNo["+lineNo+"]");
System.out.println("itemCodeOrd["+itemCodeOrd+"]"); System.out.println("itemCodeOrd["+itemCodeOrd+"]");
System.out.println("qty["+qty+"]"); System.out.println("qty["+qty+"]");
System.out.println("rate["+rate+"]");
System.out.println("nature["+nature+"]"); System.out.println("nature["+nature+"]");
System.out.println("schAttr1["+schAttr1+"]"); System.out.println("schAttr1["+schAttr1+"]");
System.out.println("ordtype["+ordtype+"]"); System.out.println("ordtype["+ordtype+"]");
...@@ -114,224 +96,254 @@ public class SorderGroupSchemeAct extends ActionHandlerEJB implements SorderGrou ...@@ -114,224 +96,254 @@ public class SorderGroupSchemeAct extends ActionHandlerEJB implements SorderGrou
System.out.println("siteCode["+siteCode+"]"); System.out.println("siteCode["+siteCode+"]");
System.out.println("StateCodeDlv["+StateCodeDlv+"]"); System.out.println("StateCodeDlv["+StateCodeDlv+"]");
System.out.println("CountCodeDlv["+CountCodeDlv+"]"); System.out.println("CountCodeDlv["+CountCodeDlv+"]");
System.out.println("ordType["+ordType+"]"); System.out.println("custCode["+custCode+"]");
System.out.println("lineNo["+lineNo+"]");
sql2 = "SELECT COUNT(*) FROM SORDDET WHERE LINE_NO = ? AND SALE_ORDER = ? AND NATURE = 'F'"; //checks the schemes of items from sorddet lineNo wise.
pstmt2 = conn.prepareStatement(sql2); sql1 = "SELECT A.SCHEME_CODE FROM SCHEME_APPLICABILITY A, SCHEME_APPLICABILITY_DET B " +
pstmt2.setString(1, lineNo); "WHERE A.SCHEME_CODE = B.SCHEME_CODE AND (A.ITEM_CODE = ? OR A.PROD_SCH = 'Y') " +
pstmt2.setString(2, saleOrder); "AND A.APP_FROM <= ? AND A.VALID_UPTO >= ? " +
rs2 = pstmt2.executeQuery(); "AND (B.SITE_CODE = ? OR B.STATE_CODE = ? OR B.COUNT_CODE = ? ) ";
if (rs2.next()) pstmt1 = conn.prepareStatement(sql1);
{ pstmt1.setString(1, itemCodeOrd);
cnt = rs2.getInt(1); pstmt1.setTimestamp(2, ordDate);
} pstmt1.setTimestamp(3, ordDate);
rs2.close(); pstmt1.setString(4, siteCode);
rs2 = null; pstmt1.setString(5, StateCodeDlv);
pstmt2.close(); pstmt1.setString(6, CountCodeDlv);
pstmt2 = null; rs1 = pstmt1.executeQuery();
System.out.println("128## cnt...["+cnt+"]"); while (rs1.next())
if(cnt > 0)
{ {
continue; schemeCode = checkNull(rs1.getString("scheme_code"));
} System.out.println("schemeCode...["+schemeCode+"]");
sql2 = "select bom_code,item_stru from item where item_code = ?";
pstmt2 = conn.prepareStatement(sql2); if (schemeCode != null && schemeCode.trim().length() > 0)
pstmt2.setString(1, itemCodeOrd); {
rs2 = pstmt2.executeQuery(); //-----------------------------------------------------------------------------------
if (rs2.next()) /* sql2 = "select item_code__parent from item where item_code =?";
{ pstmt2 = conn.prepareStatement(sql2);
schemeCode = checkNull(rs2.getString("bom_code")); pstmt2.setString(1, itemCodeOrd);
lstype = checkNull(rs2.getString("item_stru")); rs2 = pstmt2.executeQuery();
} if (rs2.next())
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
System.out.println("schemeCode[BOM]::["+schemeCode+"] lstype::["+lstype+"]");
if (!"C".equalsIgnoreCase(lstype))
{
sql3 = "select a.scheme_code from scheme_applicability a,scheme_applicability_det b"
+ " where a.scheme_code= b.scheme_code and (a.item_code= ? or (a.item_code in (select (case when product_code is null then ' ' else product_code end ) from item where item_code = ? )))"
+ " and a.app_from<= ? and a.valid_upto>= ?"
+ " and (b.site_code= ? or b.state_code= ? or b.count_code =? ) and a.PROD_SCH = 'Y' ";
pstmt3 = conn.prepareStatement(sql3);
pstmt3.setString(1, itemCodeOrd);
pstmt3.setString(2, itemCodeOrd);
pstmt3.setTimestamp(3, ordDate);
pstmt3.setTimestamp(4, ordDate);
pstmt3.setString(5, siteCode);
pstmt3.setString(6, StateCodeDlv);
pstmt3.setString(7, CountCodeDlv);
rs3 = pstmt3.executeQuery();
while (rs3.next())
{
curScheme = checkNull(rs3.getString("scheme_code"));
System.out.println("curScheme...["+curScheme+"]");
if (curScheme != null || curScheme.trim().length() == 0)
{ {
sql1 = "select item_code__parent from item where item_code =?"; itemCodeParent = checkNull(rs2.getString("item_code__parent"));
pstmt1 = conn.prepareStatement(sql1); }
pstmt1.setString(1, itemCodeOrd); rs2.close();
rs1 = pstmt1.executeQuery(); rs2 = null;
if (rs1.next()) pstmt2.close();
{ pstmt2 = null;
itemCodeParent = checkNull(rs1.getString("item_code__parent")); int no12 = 0;
} System.out.println("itemCodeParent::["+itemCodeParent+"]");
rs1.close(); if (itemCodeParent == null || itemCodeParent.trim().length() == 0)
rs1 = null; {
pstmt1.close(); sql3 = "select count(1) as cnt from item where item_code__parent =?";
pstmt1 = null; pstmt3 = conn.prepareStatement(sql3);
pstmt3.setString(1, itemCodeOrd);
System.out.println("itemCodeParent::["+itemCodeParent+"]"); rs3 = pstmt3.executeQuery();
if (itemCodeParent == null || itemCodeParent.trim().length() == 0) if (rs3.next())
{
sql1 = "select count(1) as cnt from item where item_code__parent =?";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, itemCodeOrd);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
cnt1 = rs1.getInt("cnt");
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
}
System.out.println("cnt1 is..["+cnt1+"]");
if (cnt1 > 0)
{ {
break; no12 = rs3.getInt("cnt");
} }
rs3.close();
rs3 = null;
pstmt3.close();
pstmt3 = null;
} }
sql1 = "Select count(1) as cnt From scheme_applicability A, bom b Where A.scheme_code = b.bom_code And B.bom_code= ?" + " And(? between case when b.min_qty is null then 0 else b.min_qty end" + " And case when b.max_qty is null then 0 else b.max_qty end) and B.promo_term is null"; System.out.println("no12 is..["+no12+"]");
pstmt1 = conn.prepareStatement(sql1); if (no12 > 0)
pstmt1.setString(1, curScheme);
pstmt1.setDouble(2, qty);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{ {
cnt1 = rs1.getInt("cnt"); break;
} }
rs1.close();
rs1 = null; }
pstmt1.close(); int no12 = 0 ;
pstmt1 = null; sql2 = "Select count(1) as cnt From scheme_applicability A, bom b Where A.scheme_code = b.bom_code And B.bom_code= ?" + " And(? between case when b.min_qty is null then 0 else b.min_qty end" + " And case when b.max_qty is null then 0 else b.max_qty end) and B.promo_term is null";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1, schemeCode);
pstmt2.setDouble(2, qty);
rs2 = pstmt2.executeQuery();
if (rs1.next())
{
no12 = rs1.getInt("cnt");
}
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
System.out.println("cnt1 from scheme_applicability..["+cnt1+"]"); System.out.println("no12 from scheme_applicability..["+no12+"]");
if(cnt1 == 0) if(no12 == 0)
continue; continue;*/
sql2 = "select (case when apply_cust_list is null then ' ' else apply_cust_list end) as ls_apply_cust_list, "
+ " (case when noapply_cust_list is null then ' ' else noapply_cust_list end) as ls_noapply_cust_list, order_type "
+ " from scheme_applicability where scheme_code = ? ";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1, schemeCode);
rs2 = pstmt2.executeQuery();
if (rs2.next())
{
applyCustList = checkNull(rs2.getString("ls_apply_cust_list"));
noApplyCustList = checkNull(rs2.getString("ls_noapply_cust_list"));
applicableOrdTypes = checkNull(rs2.getString("order_type"));
}
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
System.out.println("applyCustList["+applyCustList+"]noApplyCustList["+noApplyCustList+"][applicableOrdTypes["+applicableOrdTypes+"]");
System.out.println("ordType..["+ordType+"]");
if ("NE".equalsIgnoreCase(ordtype) && (applicableOrdTypes == null || applicableOrdTypes.trim().length() == 0))
{
// goto Nextrec
}
else if (applicableOrdTypes != null && applicableOrdTypes.trim().length() > 0)
{
System.out.println("PAVAN R Inside If *****applicableOrdTypes***");
proceed = false;
String applicableOrdTypesArr[] = applicableOrdTypes.split(",");
System.out.println("applicableOrdTypesArr Length::["+applicableOrdTypesArr.length+"]");
ArrayList<String> appliOrdTyplist= new ArrayList<String>(Arrays.asList(applicableOrdTypesArr));
sql1 = "select (case when apply_cust_list is null then ' ' else apply_cust_list end) as ls_apply_cust_list, " if(appliOrdTyplist.contains(ordType))
+ " (case when noapply_cust_list is null then ' ' else noapply_cust_list end) as ls_noapply_cust_list, order_type "
+ " from scheme_applicability where scheme_code = ? ";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, curScheme);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{ {
applyCustList = checkNull(rs1.getString("ls_apply_cust_list")); System.out.println("lbProceed"+proceed);
noApplyCustList = checkNull(rs1.getString("ls_noapply_cust_list")); proceed = true;
applicableOrdTypes = checkNull(rs1.getString("order_type")); //break;
} }
rs1.close(); if (!proceed)
rs1 = null;
pstmt1.close();
pstmt1 = null;
System.out.println("applyCustList["+applyCustList+"]noApplyCustList["+noApplyCustList+"][applicableOrdTypes["+applicableOrdTypes+"]");
System.out.println("ordType..["+ordType+"]");
if ("NE".equalsIgnoreCase(ordType) && (applicableOrdTypes == null || applicableOrdTypes.trim().length() == 0))
{ {
System.out.println("Inside lbproceed");
continue;
// goto Nextrec // goto Nextrec
} else if (applicableOrdTypes != null && applicableOrdTypes.trim().length() > 0)
{ System.out.println("PAVAN R Inside If *****applicableOrdTypes***");
proceed = false;
String applicableOrdTypesArr[] = applicableOrdTypes.split(",");
System.out.println("applicableOrdTypesArr Length::["+applicableOrdTypesArr.length+"]");
ArrayList<String> appliOrdTyplist= new ArrayList<String>(Arrays.asList(applicableOrdTypesArr));
if(appliOrdTyplist.contains(ordType))
{
System.out.println("lbProceed"+proceed);
proceed = true;
//break;
}
if (!proceed)
{
System.out.println("Inside lbproceed");
continue;
// goto Nextrec
}
}
prevScheme = schemeCode;
schemeCode = curScheme;
System.out.println("250@@@ schemeCode["+schemeCode+"]curScheme["+curScheme+"]");
if (applyCustList.trim().length() > 0)
{
schemeCode = null;
System.out.println("schemeCode:::::::1"+schemeCode);
//lsCustCode = checkNull(genericUtility.getColumnValue("cust_code", dom1));
System.out.println("custCode"+custCode);
String noapplyCustListArr[] = applyCustList.split(",");
ArrayList<String> applyCustList1 = new ArrayList<String>(Arrays.asList(noapplyCustListArr));
if(applyCustList1.contains(custCode.trim()))
{
System.out.println("Inside applycustList1.........");
schemeCode = curScheme;
custSchemeCode = curScheme;
System.out.println("schemeCode::"+schemeCode+" custSchemeCode::"+curScheme);
// break;
}
System.out.println("applyCustList1...["+applyCustList1+"]");
} }
if (noApplyCustList.trim().length() > 0 && schemeCode != null) }
schemeCode1 = schemeCode;
schemeCode = schemeCode1;
System.out.println("250@@@ schemeCode["+schemeCode+"]");
if (applyCustList.trim().length() > 0)
{
schemeCode = null;
System.out.println("schemeCode:::::::1"+schemeCode);
//lsCustCode = checkNull(genericUtility.getColumnValue("cust_code", dom1));
System.out.println("custCode"+custCode);
String noapplyCustListArr[] = applyCustList.split(",");
ArrayList<String> applyCustList1 = new ArrayList<String>(Arrays.asList(noapplyCustListArr));
if(applyCustList1.contains(custCode.trim()))
{ {
//custCode12 = checkNull(genericUtility.getColumnValue("cust_code", dom)); System.out.println("Inside applycustList1.........");
String noApplyCustListArr[] = noApplyCustList.split(","); schemeCode = curScheme;
ArrayList<String> noapplyCustList= new ArrayList<String>(Arrays.asList(noApplyCustListArr)); custSchemeCode = curScheme;
if(noapplyCustList.contains(custCode))//cusstCode12 from dom System.out.println("schemeCode::"+schemeCode+" custSchemeCode::"+curScheme);
{
schemeCode = ""; // break;
break;
}
} }
cnt1 = 0; System.out.println("applyCustList1...["+applyCustList1+"]");
if (schemeCode != null) }
{ if (noApplyCustList.trim().length() > 0 && schemeCode != null)
cnt2++; {
} else if (cnt2 == 1) //custCode12 = checkNull(genericUtility.getColumnValue("cust_code", dom));
String noApplyCustListArr[] = noApplyCustList.split(",");
ArrayList<String> noapplyCustList= new ArrayList<String>(Arrays.asList(noApplyCustListArr));
if(noapplyCustList.contains(custCode))//cusstCode12 from dom
{ {
schemeCode = prevScheme; schemeCode = "";
System.out.println("lsSchemeCode:::::::2"+schemeCode); break;
} }
}
if ( schemeCode != null)
{
count3 ++;
} else if (count3 == 1)
{
schemeCode = schemeCode1;
System.out.println("lsSchemeCode264:::::::"+schemeCode);
} }
rs3.close(); // Nextrec:
rs3 = null; // fetch next curscheme into :ls_curscheme;
pstmt3.close();
pstmt3 = null;
System.out.println("outside while..schemeCode..["+schemeCode+"]");
/*if (cnt2 > 1) //-----------------------------------------------------
}else
{ {
schemeCode = ""; System.out.println("Scheme not found for Item::["+itemCodeOrd+"]");
} else*/ }
if (custSchemeCode.trim().length() > 0)
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
System.out.println("outside while..schemeCode..["+schemeCode+"]");
if (count3 > 1)
{
schemeCode = "";
}
//---IF SCHEME CODE IS GREATER THAN 0 START
if(schemeCode!= null && schemeCode.trim().length() > 0)
{
//To check free item against SchemeCode
sql2 = "SELECT COUNT(*) FROM SCH_OFFER_ITEMS WHERE SCHEME_CODE = ? and ITEM_CODE = ?";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1, schemeCode);
pstmt2.setString(2, itemCodeOrd);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
count2 = rs2.getInt(1);
System.out.println("sch _off-1 count2--["+count2+"]");
}
System.out.println("sch _off-2 count2--["+count2+"]");
if (count2 > 0)
{
HashMap schemItemMap = new HashMap();
schemItemMap.put("lineNo", lineNo);
schemItemMap.put("itemCode", itemCodeOrd);
schemItemMap.put("scheme", schemeCode);
schemItemMap.put("qty", qty);
schemItemMap.put("rate", rate);
schemItemMap.put("nature", nature);
schemItemMap.put("schemeNature", "F");
itemList.add(schemItemMap);
}
count2 = 0;
sql2 = "SELECT COUNT(*) FROM SCH_PUR_ITEMS WHERE SCHEME_CODE = ? AND ITEM_CODE = ?";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1, schemeCode);
pstmt2.setString(2, itemCodeOrd);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{ {
System.out.println("lsSchemeCode:::::::3"+schemeCode); count2 = rs2.getInt(1);
schemeCode = custSchemeCode; System.out.println("sch_pur--1 count2--["+count2+"]");
} }
String schemeType = ""; System.out.println("sch_pur--2 count2--["+count2+"]");
int PurcBase = 0, SchAllowence = 0; if (count2 > 0)
double freeQty = 0.0; {
//To Get Offer aginst scheme HashMap schemItemMap = new HashMap();
schemItemMap.put("lineNo", lineNo);
schemItemMap.put("itemCode", itemCodeOrd);
schemItemMap.put("scheme", schemeCode);
schemItemMap.put("qty", qty);
schemItemMap.put("rate", rate);
schemItemMap.put("nature", nature);
schemItemMap.put("schemeNature", "C");
itemList.add(schemItemMap);
}
}
//--------------------------------------
/*//To Get Offer aginst scheme
sql3 = "SELECT DESCR, SCHEME_TYPE, PURC_BASE, SCH_ALLOWENCE FROM SCH_GROUP_DEF where SCHEME_CODE= ?"; sql3 = "SELECT DESCR, SCHEME_TYPE, PURC_BASE, SCH_ALLOWENCE FROM SCH_GROUP_DEF where SCHEME_CODE= ?";
pstmt3 = conn.prepareStatement(sql3); pstmt3 = conn.prepareStatement(sql3);
pstmt3.setString(1, schemeCode); pstmt3.setString(1, schemeCode);
...@@ -347,94 +359,160 @@ public class SorderGroupSchemeAct extends ActionHandlerEJB implements SorderGrou ...@@ -347,94 +359,160 @@ public class SorderGroupSchemeAct extends ActionHandlerEJB implements SorderGrou
rs3 = null; rs3 = null;
pstmt3.close(); pstmt3.close();
pstmt3 = null; pstmt3 = null;
System.out.println("schmDesc"+schmDesc+"]"); System.out.println("schmDesc"+schmDesc+"]"); */
//abouve sql added in if schNature='F'
sql3 ="select count (*) as cnt from sch_pur_items where SCHEME_CODE =? and item_code=?"; /* sql3 ="select count (*) as cnt from sch_pur_items where SCHEME_CODE =? and item_code=?";
pstmt3 = conn.prepareStatement(sql3); pstmt3 = conn.prepareStatement(sql3);
pstmt3.setString(1, schemeCode); pstmt3.setString(1, schemeCode);
pstmt3.setString(2, itemCodeOrd); pstmt3.setString(2, itemCodeOrd);
int count5 = 0;
rs3 = pstmt3.executeQuery(); rs3 = pstmt3.executeQuery();
if (rs3.next()) if (rs3.next())
{ {
cnt2 = rs3.getInt(1); count5 = rs3.getInt(1);
} }
rs3.close(); rs3.close();
rs3 = null; rs3 = null;
pstmt3.close(); pstmt3.close();
pstmt3 = null; pstmt3 = null;
if (cnt2 == 0) if (count5 == 0)
{ {
schemeCode = ""; schemeCode = "";
continue;
} }*/
/*
if(!("Y".equalsIgnoreCase(schAttr)))
{
errString = itmDBAccessLocal.getErrorString("", "VTMCONF20", "");
return errString;
}else if(!"P".equalsIgnoreCase(""))
{
errString = itmDBAccessLocal.getErrorString("", "VTSOSTAT", "Sales order is not in pending status");
return errString;
} */
} //sorder/sorddet while end
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//ArrayList<String>
System.out.println("itemList::[~"+itemList+"~]");
double freeTotQty = 0.0, chrgbleTotQty = 0.0;
for (HashMap schemItemMap: itemList)
{
schLineNo = (String)schemItemMap.get("lineNo");
schItemCode = (String)schemItemMap.get("itemCode");
schScheme = (String)schemItemMap.get("scheme");
schQty = (Double)schemItemMap.get("qty");
schRate = (Double)schemItemMap.get("rate");
schNature = (String)schemItemMap.get("nature");
schFalg = (String)schemItemMap.get("schemeNature");
System.out.println("schemItemMap[-"+schLineNo+"-"+schFalg+"-"+schItemCode+"-"+schScheme+"-"+schQty+"-"+schRate+"-"+schNature);
if ("F".equalsIgnoreCase(schFalg))
{
//To Check offer againts Scheme code... freeTotQty = freeTotQty+schQty;
//sql3 = "SELECT count(1) FROM SCH_OFFER_ITEMS where SCHEME_CODE= ?";
sql3 = "SELECT count(*) FROM SORDDET WHERE ITEM_CODE IN " + }else if("C".equalsIgnoreCase(schFalg)){
"(SELECT ITEM_CODE FROM SCH_OFFER_ITEMS WHERE SCHEME_CODE=?) AND SCH_ATTR = 'Y' AND RATE != 0 AND SALE_ORDER = ? "; chrgbleTotQty = chrgbleTotQty + schQty;
pstmt3 = conn.prepareStatement(sql3); }
pstmt3.setString(1, schemeCode); System.out.println("freeTotQty["+freeTotQty+"]--chrgbleTotQty["+chrgbleTotQty+"]");
pstmt3.setString(2, saleOrder); }
rs3 = pstmt3.executeQuery();
if (rs3.next()) //Check If Items are chargable but offer item not selected then Error Msg
{ if(chrgbleTotQty > 0 && freeTotQty== 0)
count = rs3.getInt(1); {
} for (HashMap schemItemMap: itemList)
rs3.close(); {
rs3 = null; schLineNo = (String)schemItemMap.get("lineNo");
pstmt3.close(); schItemCode = (String)schemItemMap.get("itemCode");
pstmt3 = null; schScheme = (String)schemItemMap.get("scheme");
System.out.println("count...["+count+"]"); schQty = (Double)schemItemMap.get("qty");
if (count == 0) schRate = (Double)schemItemMap.get("rate");
schNature = (String)schemItemMap.get("nature");
schFalg = (String)schemItemMap.get("schemeNature");
System.out.println("schemItemMap[-"+schLineNo+"-"+schFalg+"-"+schItemCode+"-"+schScheme+"-"+schQty+"-"+schRate+"-"+schNature);
if ("F".equalsIgnoreCase(schFalg))
{ {
mainStr="Line No:"+lineNo+" Item Code:"+itemCodeOrd+" Scheme:"+schemeCode; //+" Description:"+schmDesc;
msgNotAppString = msgNotAppString.append(mainStr);
System.out.println("--msgNotAppString--"+msgNotAppString);
}else freeTotQty = freeTotQty+schQty;
{
sql3 = "SELECT LINE_NO, QUANTITY, NATURE, ITEM_CODE FROM SORDDET WHERE ITEM_CODE IN " + }else if("C".equalsIgnoreCase(schFalg)){
"(SELECT ITEM_CODE FROM SCH_OFFER_ITEMS WHERE SCHEME_CODE = ?) AND SALE_ORDER = ? AND SCH_ATTR = 'Y'AND RATE != 0 "; chrgbleTotQty = chrgbleTotQty + schQty;
pstmt3 = conn.prepareStatement(sql3); }
pstmt3.setString(1, schemeCode); System.out.println("freeTotQty["+freeTotQty+"]--chrgbleTotQty["+chrgbleTotQty+"]");
pstmt3.setString(2, saleOrder); }
rs3 = pstmt3.executeQuery(); //Scheme applied msg
mainStr="Line No:"+schLineNo+" Item Code:"+schItemCode+" Scheme:"+schScheme;
msgNotAppString = msgNotAppString.append(mainStr);
System.out.println("--msgNotAppString--"+msgNotAppString);
}
//Checks scheme type and description
sql3 = "SELECT DESCR, SCHEME_TYPE, PURC_BASE, SCH_ALLOWENCE FROM SCH_GROUP_DEF where SCHEME_CODE= ?";
pstmt3 = conn.prepareStatement(sql3);
pstmt3.setString(1, schScheme);
rs3 = pstmt3.executeQuery();
if (rs3.next())
{
schmDesc = checkNull(rs3.getString(1));
schemeType = checkNull(rs3.getString(2));
PurcBase = rs3.getInt(3);
SchAllowence = rs3.getInt(4);
}
rs3.close();
rs3 = null;
pstmt3.close();
pstmt3 = null;
System.out.println("schmDesc"+schmDesc+"]");
//update value from map
for (HashMap schemItemMap: itemList)
{
schLineNo = (String)schemItemMap.get("lineNo");
schItemCode = (String)schemItemMap.get("itemCode");
schScheme = (String)schemItemMap.get("scheme");
schQty = (Double)schemItemMap.get("qty");
schRate = (Double)schemItemMap.get("rate");
schNature = (String)schemItemMap.get("nature");
schFalg = (String)schemItemMap.get("schemeNature");
System.out.println("schemItemMap[-"+schLineNo+"-"+schFalg+"-"+schItemCode+"-"+schScheme+"-"+schQty+"-"+schRate+"-"+schNature);
if ("F".equalsIgnoreCase(schFalg))
{
freeTotQty = freeTotQty+schQty;
if("0".equalsIgnoreCase(schemeType)) if("0".equalsIgnoreCase(schemeType))
{ {
freeQty = ((qty * SchAllowence) / PurcBase); //freeQty = ((qty * SchAllowence) / PurcBase);
freeQty = ((chrgbleTotQty * SchAllowence) / PurcBase);
} }
else if("1".equalsIgnoreCase(schemeType)) else if("1".equalsIgnoreCase(schemeType))
{ {
chargeAmt = (qty * rate); chargeAmt = (chrgbleTotQty * rate);
if(chargeAmt >= PurcBase) if(chargeAmt >= PurcBase)
{ {
freeQty = roundValue(((((qty * rate)* SchAllowence) / PurcBase)), 0); freeQty = roundValue(((((chrgbleTotQty * rate)* SchAllowence) / PurcBase)), 0);
} }
}else if("2".equalsIgnoreCase(schemeType)) }else if("2".equalsIgnoreCase(schemeType))
{ {
chargeAmt = (qty * rate); chargeAmt = (chrgbleTotQty * rate);
if(chargeAmt >= PurcBase) if(chargeAmt >= PurcBase)
{ {
freeDiscount = SchAllowence; freeDiscount = SchAllowence;
} }
} }
while (rs3.next())
{
lineNo1 = checkNull(rs3.getString(1));
qty1 = rs3.getDouble(2);
nature1 = checkNull(rs3.getString(3));
itemCode1 = checkNull(rs3.getString(4));
if("2".equalsIgnoreCase(schemeType)) if("2".equalsIgnoreCase(schemeType))
{ {
sql4 = "UPDATE SORDDET SET DISCOUNT = ? WHERE SALE_ORDER = ? AND LINE_NO = ?"; sql4 = "UPDATE SORDDET SET DISCOUNT = ? WHERE SALE_ORDER = ? AND LINE_NO = ?";
pstmt4 = conn.prepareStatement(sql4); pstmt4 = conn.prepareStatement(sql4);
pstmt4.setDouble(1, freeDiscount); pstmt4.setDouble(1, freeDiscount);
pstmt4.setString(2, saleOrder); pstmt4.setString(2, saleOrder);
pstmt4.setString(2, lineNo1); pstmt4.setString(3, lineNo1);
no = pstmt4.executeUpdate(); no = pstmt4.executeUpdate();
System.out.println("419...no...1..["+no+"]"); System.out.println("419...no...1..["+no+"]");
pstmt4.close(); pstmt4.close();
...@@ -453,44 +531,29 @@ public class SorderGroupSchemeAct extends ActionHandlerEJB implements SorderGrou ...@@ -453,44 +531,29 @@ public class SorderGroupSchemeAct extends ActionHandlerEJB implements SorderGrou
System.out.println("totalQty::["+totalQty+"]"); System.out.println("totalQty::["+totalQty+"]");
//Scheme applied msg //Scheme applied msg
mainStr="\nLine No"+lineNo+" Item Code:"+itemCodeOrd+" Scheme:"+schemeCode; //+" Description:"+schmDesc; mainStr="\nLine No"+lineNo+" Item Code:"+itemCodeOrd+" Scheme:"+schScheme; //+" Description:"+schmDesc;
msgAppStrinrg = msgAppStrinrg.append(mainStr); msgAppStrinrg = msgAppStrinrg.append(mainStr);
System.out.println("--msgString--"+msgAppStrinrg); System.out.println("--msgString--"+msgAppStrinrg);
} }
} }
if(qty1 <= freeQty && totalQty <= freeQty) System.out.println("schQty:["+schQty+"]<= freeQty["+freeQty+"]");
System.out.println("totalQty:["+totalQty+"]<= freeQty["+freeQty+"]");
if(schQty <= freeQty && totalQty < freeQty)
{ {
sql4 = "UPDATE SORDDET SET NATURE = 'F', RATE = 0, RATE__STDUOM = 0 WHERE SALE_ORDER = ? AND LINE_NO = ?"; sql4 = "UPDATE SORDDET SET NATURE = 'F', RATE = 0, RATE__STDUOM = 0 WHERE SALE_ORDER = ? AND LINE_NO = ?";
pstmt4 = conn.prepareStatement(sql4); pstmt4 = conn.prepareStatement(sql4);
pstmt4.setString(1, saleOrder); pstmt4.setString(1, saleOrder);
pstmt4.setString(2, lineNo1); pstmt4.setString(2, schLineNo);
no = pstmt4.executeUpdate(); no = pstmt4.executeUpdate();
System.out.println("471...no...["+no+"]"); System.out.println("471...no...["+no+"]");
pstmt4.close(); pstmt4.close();
pstmt4 = null; pstmt4 = null;
if(no > 0)
{
sql5 = "UPDATE SORDDET SET SPEC_REASON='P' WHERE SALE_ORDER = ? AND LINE_NO = ?";
pstmt5 = conn.prepareStatement(sql5);
pstmt5.setString(1, saleOrder);
pstmt5.setString(2, lineNo);
int nos2 = pstmt5.executeUpdate();
System.out.println("430...nos2...["+nos2+"]");
pstmt5.close();
pstmt5 = null;
System.out.println("totalQty::["+totalQty+"]");
//Scheme applied msg
mainStr="Line No:"+lineNo+" Item Code:"+itemCodeOrd+" Scheme:"+schemeCode; //+"// Description:"+schmDesc;
msgAppStrinrg = msgAppStrinrg.append(mainStr);
System.out.println("**msgString**"+msgAppStrinrg);
}
} }
totalQty = totalQty + qty1; totalQty = totalQty + schQty;
System.out.println("@@@516 ToatlQty:"+totalQty);
if(totalQty == freeQty) if(totalQty == freeQty)
{ {
break; //break;
} }
System.out.println("totalQty::["+totalQty+"]"); System.out.println("totalQty::["+totalQty+"]");
...@@ -498,41 +561,53 @@ public class SorderGroupSchemeAct extends ActionHandlerEJB implements SorderGrou ...@@ -498,41 +561,53 @@ public class SorderGroupSchemeAct extends ActionHandlerEJB implements SorderGrou
String mainStr="Line No:"+lineNo+" Item Code:"+itemCodeOrd+" Scheme:"+schemeCode+" Description:"+schmDesc; String mainStr="Line No:"+lineNo+" Item Code:"+itemCodeOrd+" Scheme:"+schemeCode+" Description:"+schmDesc;
msgString = msgString.append(mainStr); msgString = msgString.append(mainStr);
System.out.println("--msgString--"+msgString); System.out.println("--msgString--"+msgString);
*/ */
if(totalQty == freeQty) if(totalQty == freeQty)
{ {
continue; //continue;
} }
}
rs3.close();
rs3 = null;
pstmt3.close();
pstmt3 = null;
//errString = msgString+"\n~~~Scheme Item But Offer Not Selected.~~~\n"+msgString; }else if("C".equalsIgnoreCase(schFalg)){
chrgbleTotQty = chrgbleTotQty + schQty;
} }
} }
/* //upadate value from map end
if(!("Y".equalsIgnoreCase(schAttr))) //To Check offer againts Scheme code...
{ /*sql3 = "SELECT count(*) FROM SORDDET WHERE ITEM_CODE IN " +
errString = itmDBAccessLocal.getErrorString("", "VTMCONF20", ""); "(SELECT ITEM_CODE FROM SCH_OFFER_ITEMS WHERE SCHEME_CODE = ?) AND SCH_ATTR = 'Y' AND RATE != 0 AND SALE_ORDER = ? ";
return errString; pstmt3 = conn.prepareStatement(sql3);
}else if(!"P".equalsIgnoreCase("")) pstmt3.setString(1, schScheme);
{ pstmt3.setString(2, saleOrder);
errString = itmDBAccessLocal.getErrorString("", "VTSOSTAT", "Sales order is not in pending status"); rs3 = pstmt3.executeQuery();
return errString; if (rs3.next())
} */ {
} count = rs3.getInt(1);
rs.close(); }
rs = null; rs3.close();
pstmt.close(); rs3 = null;
pstmt = null; pstmt3.close();
pstmt3 = null;
System.out.println("schemeType::417::["+schemeType+"]");
System.out.println("count...["+count+"]");
if (count == 0)
{
mainStr="Line No:"+lineNo+" Item Code:"+itemCodeOrd+" Scheme:"+schScheme;
msgNotAppString = msgNotAppString.append(mainStr);
System.out.println("--msgNotAppString--"+msgNotAppString);
}
else
{*/
//errString = msgString+"\n~~~Scheme Item But Offer Not Selected.~~~\n"+msgString;
//errString = msgString+"\n~~~Scheme Item But Offer Not Selected.~~~\n"+msgString;
//errString = msgString+"\n~~~Scheme Item But Offer Not Selected.~~~\n"+msgString;
//mainStr="Scheme Not Applied On Following item:\nLine No:"+lineNo+" Item Code:"+itemCodeOrd+" Scheme:"+schemeCode+" Description:"+schmDesc; //mainStr="Scheme Not Applied On Following item:\nLine No:"+lineNo+" Item Code:"+itemCodeOrd+" Scheme:"+schemeCode+" Description:"+schmDesc;
errString = itmDBAccessLocal.getErrorString("", "VTNOOFSCH", ""); errString = itmDBAccessLocal.getErrorString("", "VTNOOFSCH", "");
String begPart = errString.substring( 0, errString.indexOf("<trace>") + 7 ); String begPart = errString.substring( 0, errString.indexOf("<trace>") + 7 );
...@@ -632,3 +707,4 @@ public class SorderGroupSchemeAct extends ActionHandlerEJB implements SorderGrou ...@@ -632,3 +707,4 @@ public class SorderGroupSchemeAct extends ActionHandlerEJB implements SorderGrou
} }
} }
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