Commit 72bd7108 authored by ngadkari's avatar ngadkari

new scheme_balance changes in wfValData neture column

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@191706 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 72dd9f7b
...@@ -2486,8 +2486,9 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -2486,8 +2486,9 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
// ------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------
double totFreeQty = 0, unConfTotFreeQty = 0 , freeQty = 0, prvFreeQty = 0, rate1 = 0,qty=0.0,mRate = 0.00,value=0.0,valueAmount=0.0; double totFreeQty = 0, unConfTotFreeQty = 0 , freeQty = 0, prvFreeQty = 0, rate1 = 0,qty=0.0,mRate = 0.00,value=0.0,valueAmount=0.0;
String lineNo = "", browItemCode = "", currLineNo = "",ldtDateStr = "",lsPriceList = "",retlSchmRateBase=""; String lineNo = "", browItemCode = "", currLineNo = "",ldtDateStr = "",lsPriceList = "",retlSchmRateBase="",lsUnit="",lsListType="",lsRefNo="";
Timestamp ldtPlDate = null,ldPlistDate = null; Timestamp ldtPlDate = null,ldPlistDate = null;
int llPlcount=0;
nature = checkNullandTrim(genericUtility.getColumnValue("nature", dom)); nature = checkNullandTrim(genericUtility.getColumnValue("nature", dom));
itemCodeOrd = checkNull(genericUtility.getColumnValue("item_code__ord", dom)); itemCodeOrd = checkNull(genericUtility.getColumnValue("item_code__ord", dom));
...@@ -2515,7 +2516,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -2515,7 +2516,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
if ("V".equalsIgnoreCase(nature.trim())) if ("V".equalsIgnoreCase(nature.trim()))
{ {
retlSchmRateBase = checkNullandTrim(distCommon.getDisparams( "999999", "RETL_SCHM_RATE_BASE", conn )); retlSchmRateBase = checkNullandTrim(distCommon.getDisparams( "999999", "PUR01", conn ));
//---------------------------------------------------- //----------------------------------------------------
...@@ -2536,24 +2537,75 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -2536,24 +2537,75 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
} }
ldPlistDate = orderDate; ldPlistDate = orderDate;
if("S".equalsIgnoreCase(retlSchmRateBase))
{
lsPriceList = checkNull(genericUtility.getColumnValue("price_list", dom1));
}
if("M".equalsIgnoreCase(retlSchmRateBase)) if("M".equalsIgnoreCase(retlSchmRateBase))
{ {
lsPriceList = checkNullandTrim(distCommon.getDisparams( "999999", "MRP", conn )); lsPriceList = checkNullandTrim(distCommon.getDisparams( "999999", "MRP", conn ));
lsUnit = checkNull(genericUtility.getColumnValue("unit", dom));
lsListType = distCommon.getPriceListType(lsPriceList, conn);
sql = "select count(1) as llPlcount from pricelist where price_list=?"
+ " and item_code= ? and unit= ? and list_type=? and eff_from<=? and valid_upto >=? and min_qty<=? and max_qty>= ?"
+ " and (ref_no is not null)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsPriceList);
pstmt.setString(2, itemCodeOrd);
pstmt.setString(3, lsUnit);
pstmt.setString(4, lsListType);
pstmt.setTimestamp(5, orderDate);
pstmt.setTimestamp(6, orderDate);
pstmt.setDouble(7, qty);
pstmt.setDouble(8, qty);
rs = pstmt.executeQuery();
if (rs.next()) {
llPlcount = rs.getInt("llPlcount");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (llPlcount >= 1) {
sql = "select max(ref_no)from pricelist where price_list =? and item_code= ? and unit=? and list_type= ?"
+ " and eff_from<=? and valid_upto>=? and min_qty<=? and max_qty>=? and (ref_no is not null)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsPriceList);
pstmt.setString(2, itemCodeOrd);
pstmt.setString(3, lsUnit);
pstmt.setString(4, lsListType);
pstmt.setTimestamp(5, orderDate);
pstmt.setTimestamp(6, orderDate);
pstmt.setDouble(7, qty);
pstmt.setDouble(8, qty);
rs = pstmt.executeQuery();
if (rs.next()) {
lsRefNo = rs.getString("ref_no");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
mRate = distCommon.pickRateRefnoWise(lsPriceList, ldtDateStr, itemCodeOrd, lsRefNo, "L", qty,
conn);
}
if (mRate <= 0) {
mRate = distCommon.pickRateRefnoWise(lsPriceList, ldtDateStr, itemCodeOrd, lsRefNo, "L", qty,
conn);
}
} }
else
if (lsPriceList != null || lsPriceList.trim().length() > 0)
{ {
mRate = distCommon.pickRate(lsPriceList, ldtDateStr, itemCodeOrd, "", "L", qty, conn); lsPriceList = checkNull(genericUtility.getColumnValue("price_list", dom1));
System.out.print("mRate gbfICquantity++++++++" + mRate); if (lsPriceList != null || lsPriceList.trim().length() > 0)
System.out.print("mqty++++++++" + qty); {
mRate = distCommon.pickRate(lsPriceList, ldtDateStr, itemCodeOrd, "", "L", qty, conn);
System.out.print("mRate gbfICquantity++++++++" + mRate);
System.out.print("mqty++++++++" + qty);
}
} }
valueAmount= qty * mRate; valueAmount= qty * mRate;
//--------------------------------------------------- //---------------------------------------------------
...@@ -2579,7 +2631,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -2579,7 +2631,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
pstmt = null; pstmt = null;
if(freeQty > 0) if(freeQty > 0)
{ {
sql = " select a.price_list,a.pl_date,b.quantity , a.order_date" + sql = " select a.price_list,a.pl_date,b.quantity , a.order_date,b.unit " +
" from sorder a,sorddet b where a.sale_order = b.sale_order and a.site_code = ? " " from sorder a,sorddet b where a.sale_order = b.sale_order and a.site_code = ? "
+ " and a.cust_code = ? and a.sale_order <> ? and a.order_date between ? and ?" + " and a.cust_code = ? and a.sale_order <> ? and a.order_date between ? and ?"
+ " and (case when a.confirmed is null then 'N' else a.confirmed end )= 'N' and b.nature in ('V')"; + " and (case when a.confirmed is null then 'N' else a.confirmed end )= 'N' and b.nature in ('V')";
...@@ -2597,6 +2649,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -2597,6 +2649,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
ldtPlDate = rs1.getTimestamp(2); ldtPlDate = rs1.getTimestamp(2);
qty = rs1.getDouble(3); qty = rs1.getDouble(3);
orderDate = rs1.getTimestamp(4); orderDate = rs1.getTimestamp(4);
lsUnit = rs1.getString(5);
...@@ -2610,23 +2663,72 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -2610,23 +2663,72 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
} }
ldPlistDate = orderDate; ldPlistDate = orderDate;
if("S".equalsIgnoreCase(retlSchmRateBase))
{
lsPriceList = checkNull(genericUtility.getColumnValue("price_list", dom1));
}
if("M".equalsIgnoreCase(retlSchmRateBase)) if("M".equalsIgnoreCase(retlSchmRateBase))
{ {
lsPriceList = checkNullandTrim(distCommon.getDisparams( "999999", "MRP", conn )); lsPriceList = checkNullandTrim(distCommon.getDisparams( "999999", "MRP", conn ));
lsListType = distCommon.getPriceListType(lsPriceList, conn);
}
sql = "select count(1) as llPlcount from pricelist where price_list=?"
+ " and item_code= ? and unit= ? and list_type=? and eff_from<=? and valid_upto >=? and min_qty<=? and max_qty>= ?"
+ " and (ref_no is not null)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsPriceList);
pstmt.setString(2, itemCodeOrd);
pstmt.setString(3, lsUnit);
pstmt.setString(4, lsListType);
pstmt.setTimestamp(5, orderDate);
pstmt.setTimestamp(6, orderDate);
pstmt.setDouble(7, qty);
pstmt.setDouble(8, qty);
rs = pstmt.executeQuery();
if (rs.next()) {
llPlcount = rs.getInt("llPlcount");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (llPlcount >= 1) {
sql = "select max(ref_no)from pricelist where price_list =? and item_code= ? and unit=? and list_type= ?"
+ " and eff_from<=? and valid_upto>=? and min_qty<=? and max_qty>=? and (ref_no is not null)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsPriceList);
pstmt.setString(2, itemCodeOrd);
pstmt.setString(3, lsUnit);
pstmt.setString(4, lsListType);
pstmt.setTimestamp(5, orderDate);
pstmt.setTimestamp(6, orderDate);
pstmt.setDouble(7, qty);
pstmt.setDouble(8, qty);
rs = pstmt.executeQuery();
if (rs.next()) {
lsRefNo = rs.getString("ref_no");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (lsPriceList != null || lsPriceList.trim().length() > 0) mRate = distCommon.pickRateRefnoWise(lsPriceList, ldtDateStr, itemCodeOrd, lsRefNo, "L", qty,
conn);
}
if (mRate <= 0) {
mRate = distCommon.pickRateRefnoWise(lsPriceList, ldtDateStr, itemCodeOrd, lsRefNo, "L", qty,
conn);
}
}
else
{ {
mRate = distCommon.pickRate(lsPriceList, ldtDateStr, itemCodeOrd, "", "L", qty, conn);
System.out.print("mRate gbfICquantity++++++++" + mRate); if (lsPriceList != null || lsPriceList.trim().length() > 0)
System.out.print("mqty++++++++" + qty); {
mRate = distCommon.pickRate(lsPriceList, ldtDateStr, itemCodeOrd, "", "L", qty, conn);
System.out.print("mRate gbfICquantity++++++++" + mRate);
System.out.print("mqty++++++++" + qty);
}
} }
value= qty * mRate; value= qty * mRate;
unConfTotFreeQty= unConfTotFreeQty + value; unConfTotFreeQty= unConfTotFreeQty + value;
...@@ -2652,6 +2754,10 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -2652,6 +2754,10 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
int noOfDetails = detailList1.getLength(); int noOfDetails = detailList1.getLength();
lsPriceList = checkNull(genericUtility.getColumnValue("price_list", dom1)); lsPriceList = checkNull(genericUtility.getColumnValue("price_list", dom1));
orderDate = Timestamp.valueOf(
genericUtility.getValidDateString(genericUtility.getColumnValue("order_date", dom1),
genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())
+ " 00:00:00.0");
if (genericUtility.getColumnValue("pl_date", dom1) != null if (genericUtility.getColumnValue("pl_date", dom1) != null
&& genericUtility.getColumnValue("pl_date", dom1).trim().length() > 0) { && genericUtility.getColumnValue("pl_date", dom1).trim().length() > 0) {
ldtPlDate = Timestamp ldtPlDate = Timestamp
...@@ -2675,8 +2781,8 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -2675,8 +2781,8 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
lineNo = checkNullandTrim(genericUtility.getColumnValueFromNode("line_no", currDetail1)); lineNo = checkNullandTrim(genericUtility.getColumnValueFromNode("line_no", currDetail1));
nature = checkNull(genericUtility.getColumnValueFromNode("nature", currDetail1)); nature = checkNull(genericUtility.getColumnValueFromNode("nature", currDetail1));
browItemCode = checkNull(genericUtility.getColumnValueFromNode("item_code", currDetail1)); browItemCode = checkNull(genericUtility.getColumnValueFromNode("item_code", currDetail1));
quantity = checkDoubleNull(genericUtility.getColumnValueFromNode("ord_value", currDetail1)); quantity = checkDoubleNull(genericUtility.getColumnValueFromNode("quantity", currDetail1));
lsUnit = checkNullandTrim(genericUtility.getColumnValueFromNode("unit", currDetail1));
System.out.println("rate1: ====" + rate1 + "]lineNo" + lineNo + "quantity"+quantity); System.out.println("rate1: ====" + rate1 + "]lineNo" + lineNo + "quantity"+quantity);
System.out.println("currLineNo: ====" + currLineNo + "]lineNo" + lineNo + ""); System.out.println("currLineNo: ====" + currLineNo + "]lineNo" + lineNo + "");
...@@ -2688,14 +2794,68 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -2688,14 +2794,68 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
if("M".equalsIgnoreCase(retlSchmRateBase)) if("M".equalsIgnoreCase(retlSchmRateBase))
{ {
lsPriceList = checkNullandTrim(distCommon.getDisparams( "999999", "MRP", conn )); lsPriceList = checkNullandTrim(distCommon.getDisparams( "999999", "MRP", conn ));
lsListType = distCommon.getPriceListType(lsPriceList, conn);
sql = "select count(1) as llPlcount from pricelist where price_list=?"
+ " and item_code= ? and unit= ? and list_type=? and eff_from<=? and valid_upto >=? and min_qty<=? and max_qty>= ?"
+ " and (ref_no is not null)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsPriceList);
pstmt.setString(2, browItemCode);
pstmt.setString(3, lsUnit);
pstmt.setString(4, lsListType);
pstmt.setTimestamp(5, orderDate);
pstmt.setTimestamp(6, orderDate);
pstmt.setDouble(7, quantity);
pstmt.setDouble(8, quantity);
rs = pstmt.executeQuery();
if (rs.next()) {
llPlcount = rs.getInt("llPlcount");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (llPlcount >= 1) {
sql = "select max(ref_no)from pricelist where price_list =? and item_code= ? and unit=? and list_type= ?"
+ " and eff_from<=? and valid_upto>=? and min_qty<=? and max_qty>=? and (ref_no is not null)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsPriceList);
pstmt.setString(2, browItemCode);
pstmt.setString(3, lsUnit);
pstmt.setString(4, lsListType);
pstmt.setTimestamp(5, orderDate);
pstmt.setTimestamp(6, orderDate);
pstmt.setDouble(7, quantity);
pstmt.setDouble(8, quantity);
rs = pstmt.executeQuery();
if (rs.next()) {
lsRefNo = rs.getString("ref_no");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
mRate = distCommon.pickRateRefnoWise(lsPriceList, ldtDateStr, browItemCode, lsRefNo, "L", quantity,
conn);
}
if (mRate <= 0) {
mRate = distCommon.pickRateRefnoWise(lsPriceList, ldtDateStr, browItemCode, lsRefNo, "L", quantity,
conn);
}
} }
else
if (lsPriceList != null || lsPriceList.trim().length() > 0)
{ {
mRate = distCommon.pickRate(lsPriceList, ldtDateStr, browItemCode, "", "L", quantity, conn);
System.out.print("mRate gbfICquantity++++++++" + mRate); if (lsPriceList != null || lsPriceList.trim().length() > 0)
System.out.print("mqty++++++++" + quantity); {
mRate = distCommon.pickRate(lsPriceList, ldtDateStr, browItemCode, "", "L", quantity, conn);
System.out.print("mRate gbfICquantity++++++++" + mRate);
System.out.print("mqty++++++++" + quantity);
}
} }
value =quantity * mRate; value =quantity * mRate;
prvFreeQty =prvFreeQty + value; prvFreeQty =prvFreeQty + value;
...@@ -10961,18 +11121,27 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -10961,18 +11121,27 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
conn)); conn));
//Nandkumar Gadkari on 04/10/18---------------------- //Nandkumar Gadkari on 04/10/18----------------------
double mRate= 0.0; double mVal= 0.0;
String nature=""; String nature="";
nature = checkNull(genericUtility.getColumnValue("nature", dom)); nature = checkNull(genericUtility.getColumnValue("nature", dom));
if ("V".equalsIgnoreCase(nature) || "I".equalsIgnoreCase(nature)) if ("V".equalsIgnoreCase(nature) || "I".equalsIgnoreCase(nature))
{ {
valueXmlString.append("<rate>").append("<![CDATA[" + mRate + "]]>").append("</rate>"); valueXmlString.append("<rate>").append("<![CDATA[" + mVal + "]]>").append("</rate>");
setNodeValue(dom, "rate", getAbsString(String.valueOf(mRate))); setNodeValue(dom, "rate", getAbsString(String.valueOf(mVal)));
valueXmlString.append("<rate__stduom>").append("<![CDATA[" + mRate + "]]>") valueXmlString.append("<rate__stduom>").append("<![CDATA[" + mVal + "]]>")
.append("</rate__stduom>"); .append("</rate__stduom>");
} valueXmlString.append("<amount>").append("<![CDATA[" + mVal + "]]>")
.append("</amount>");
valueXmlString.append("<ord_value>").append("<![CDATA[" + mVal + "]]>")
.append("</ord_value>");
}
else
{
valueXmlString = (gbfIcQuantity(valueXmlString, dom, dom1, dom2, editFlag, xtraParams, objContext,
conn));
}
//Nandkumar Gadkari on 04/10/18---------------------- //Nandkumar Gadkari on 04/10/18----------------------
......
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