Commit 9b709b8b authored by rzore's avatar rzore

changes made for getting rate slab no wise

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@200255 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1a66b2d5
...@@ -10922,18 +10922,14 @@ public class DistCommon { ...@@ -10922,18 +10922,14 @@ public class DistCommon {
{ {
rate = 0; rate = 0;
try {// try 1 try {// try 1
// added by rupali on 30/04/19 for getting rate slab_no wise if ref_no is geting blank [start]
if(lsRefNo == null || lsRefNo.trim().length() == 0) if(lsRefNo == null || lsRefNo.trim().length() == 0)
{ {
String slabNo = getMaxSlabNo(priceList, tempDate, itemCode, lsRefNo, listType,quantity, conn); String slabNo = getMaxSlabNo(priceList, tempDate, itemCode, lsRefNo, listType,quantity, conn);
sql = "SELECT RATE,lot_no__from FROM PRICELIST " sql = "SELECT RATE,LOT_NO__FROM FROM PRICELIST WHERE PRICE_LIST = '" + priceList + "' AND ITEM_CODE = '" + itemCode + "' AND LIST_TYPE = 'B'" + " and slab_no ='" + slabNo + "' " + "AND MIN_QTY <= " + quantity + " AND MAX_QTY >= " + quantity + " AND EFF_FROM <= ? " + "AND VALID_UPTO >= ?";
+ "WHERE PRICE_LIST = '" + priceList + "' "
+ "AND ITEM_CODE = '" + itemCode + "' "
+ "AND LIST_TYPE = 'B'" + " and slab_no ='" + slabNo
+ "' " + "AND MIN_QTY <= " + quantity + " "
+ "AND MAX_QTY >= " + quantity + " "
+ "AND EFF_FROM <= ? " + "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
} }
// added by rupali on 30/04/19 for getting rate slab_no wise if ref_no is geting blank [end]
else else
{ {
sql = "SELECT RATE,lot_no__from FROM PRICELIST " sql = "SELECT RATE,lot_no__from FROM PRICELIST "
...@@ -10985,30 +10981,14 @@ public class DistCommon { ...@@ -10985,30 +10981,14 @@ public class DistCommon {
} }
if (priceListParent.trim().length() > 0) { if (priceListParent.trim().length() > 0) {
try {// try 3 try {// try 3
// added by rupali on 30/04/19 for getting rate slab_no wise if ref_no is geting blank [start]
if(lsRefNo == null || lsRefNo.trim().length() == 0) if(lsRefNo == null || lsRefNo.trim().length() == 0)
{ {
String slabNo = getMaxSlabNo(priceList, tempDate, itemCode, lsRefNo, listType,quantity, conn); String slabNo = getMaxSlabNo(priceList, tempDate, itemCode, lsRefNo, listType,quantity, conn);
sql = "SELECT RATE,lot_no__from FROM PRICELIST " sql = "SELECT RATE,LOT_NO__FROM FROM PRICELIST WHERE PRICE_LIST = '" + priceListParent + "' AND ITEM_CODE = '" + itemCode + "' AND LIST_TYPE = 'B' AND SLAB_NO = '" + slabNo + "' AND MIN_QTY <= " + quantity + " AND MAX_QTY >= " + quantity + " AND EFF_FROM <= ? AND VALID_UPTO >= ?";
+ "WHERE PRICE_LIST = '"
+ priceListParent
+ "' "
+ "AND ITEM_CODE = '"
+ itemCode
+ "' "
+ "AND LIST_TYPE = 'B'"
+ " and slab_no ='"
+ slabNo
+ "' "
+ "AND MIN_QTY <= "
+ quantity
+ " "
+ "AND MAX_QTY >= "
+ quantity
+ " "
+ "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
} }
// added by rupali on 30/04/19 for getting rate slab_no wise if ref_no is geting blank [end]
else else
{ {
sql = "SELECT RATE,lot_no__from FROM PRICELIST " sql = "SELECT RATE,lot_no__from FROM PRICELIST "
...@@ -12294,61 +12274,62 @@ public class DistCommon { ...@@ -12294,61 +12274,62 @@ public class DistCommon {
} }
//Added by Anjali R. on[13/04/2018][To parse string value into double][End] //Added by Anjali R. on[13/04/2018][To parse string value into double][End]
private String getMaxSlabNo(String priceList, String trDate, String itemCode, String aRefNo, String listType, double quantity, Connection conn) // added by rupali on 30/04/19 for getting rate slab_no wise if ref_no is geting blank [start]
throws Exception private String getMaxSlabNo(String priceList, String trDate, String itemCode, String aRefNo, String listType, double quantity, Connection conn) throws Exception
{ {
String slabNumber = ""; String slabNumber = "";
String sql = ""; String sql = "";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
String lsUnit = ""; String lsUnit = "";
sql = "select unit from item where item_code = ?"; sql = "select unit from item where item_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
lsUnit = rs.getString("unit"); lsUnit = rs.getString("unit");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
sql = "select max(slab_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 (slab_no is not null)"; sql = "select max(slab_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 (slab_no is not null)";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, priceList); pstmt.setString(1, priceList);
pstmt.setString(2, itemCode); pstmt.setString(2, itemCode);
pstmt.setString(3, lsUnit); pstmt.setString(3, lsUnit);
pstmt.setString(4, listType); pstmt.setString(4, listType);
pstmt.setTimestamp(5, Timestamp.valueOf(genericUtility.getValidDateTimeString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()))); pstmt.setTimestamp(5, Timestamp.valueOf(genericUtility.getValidDateTimeString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())));
pstmt.setTimestamp(6, Timestamp.valueOf(genericUtility.getValidDateTimeString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()))); pstmt.setTimestamp(6, Timestamp.valueOf(genericUtility.getValidDateTimeString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())));
pstmt.setDouble(7, quantity); pstmt.setDouble(7, quantity);
pstmt.setDouble(8, quantity); pstmt.setDouble(8, quantity);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
slabNumber = checkNull(rs.getString(1)); slabNumber = checkNull(rs.getString(1));
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println("PriceListGenEJB.getDoubleValue()[" + e.getMessage() + "]"); System.out.println("PriceListGenEJB.getDoubleValue()[" + e.getMessage() + "]");
throw e; throw e;
} }
return slabNumber; return slabNumber;
} }
// added by rupali on 30/04/19 for getting rate slab_no wise if ref_no is geting blank [end]
}// class }// class
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