Commit f6553206 authored by blad's avatar blad

pickRateRefnoWise() method added in Head for Sales order amendment Migrated code


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103142 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 67c55f55
......@@ -9954,4 +9954,973 @@ public class DistCommon
return(rate);
}
// added by cpatil on 10/oct/12 end
//Start added by chandrashekar on 10-aug-2016
public double pickRateRefnoWise(String priceList,String trDate,String itemCode,String aRefNo,String listType,double quantity,Connection conn)throws ITMException
{
PreparedStatement pstmt = null;
Statement stmt = null;
ResultSet rs = null;
ResultSet rs2 = null;
ResultSet rs3 = null;
ResultSet rs4 = null;
java.sql.Timestamp tranDate = null;
String sql = "";
String priceListParent = "";
String unit = "";
String siteCode = "";
String locCode = "";
String lotNo = "";
String lotSl = "";
String type = "";
double rate = 0.0;
double conv = 0;
int cnt = 0;
String tempDate = trDate;
String lsRefNo="";
String lsLotNoFrom="";
String lsCalcMethc="",lsMethAppl="",lsCalcPlist="",lsCalcMeth="",lsCalcMethp="";
type = getPriceListType(priceList,conn);
try
{
trDate = genericUtility.getValidDateString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
tranDate = java.sql.Timestamp.valueOf(trDate + " 00:00:00");
if (aRefNo.indexOf("~t") > 0)
{
String MulStr[] = aRefNo.split("~t");
siteCode = MulStr[0];
locCode = MulStr[1];
lotNo = MulStr[2];
lotSl = MulStr[3];
}
else
{
lsRefNo = aRefNo;
}
}
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("type----"+type);
if(type.trim().equals("L"))
{
rate = 0;
try
{
sql = "SELECT RATE,lot_no__from FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
+ "AND LIST_TYPE = 'L' "
+ "AND MIN_QTY <= "+quantity+" "
+ "AND MAX_QTY >= "+quantity+" "
+ "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery();
if(rs.next())
{
System.out.println("Pricelist found in pricelist master");
rate = rs.getDouble(1);
lsLotNoFrom = rs.getString(2);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
}
else
{
try
{//try 2
rs.close();
pstmt.close();
pstmt = null;
rs = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"'"
+ " AND LIST_TYPE = 'L'";
System.out.println("priceList_mst----"+priceList);
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
priceListParent = rs.getString(1);
System.out.println("priceListParent----"+priceListParent);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0))
{
priceListParent = "";
//System.out.println("The priceListParent if null .... "+priceListParent);
return -1;
}
if(priceListParent.trim().length() > 0)
{
try
{//try 3
sql = "SELECT RATE,lot_no__from FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
+ "AND MIN_QTY <= "+quantity+""
+ " AND MAX_QTY >= "+quantity+" "
+ "AND LIST_TYPE = 'L' "
+ "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery();
//System.out.println("The priceListParent sql .. "+sql);
if(rs2.next())
{
rate = rs2.getDouble(1);
lsLotNoFrom = rs2.getString(2);
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
System.out.println("get rate for priceListParent----"+rate);
}
else
{
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
// rate = pickRate(priceListParent,tempDate,itemCode,aLotNo,listType, quantity,conn);
return rate;
//return -1; //change done by kunal on 29/11/12 as per Manoj Sharma instruction
}
}//try 3
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if
}//try 2
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else if
//rs.close();
//pstmt.clearParameters();
//pstmt.close();
//pstmt = null;
}//try 1
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if(type.trim().equals("L"))
if(type.trim().equals("F")) //FIXED PRICE ON DATE
{
rate = 0;
try
{//try 1
sql = "SELECT RATE,lot_no__from FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
+ "AND LIST_TYPE = 'F' "
+ "AND MIN_QTY <= "+quantity+" "
+ "AND MAX_QTY >= "+quantity+" "
+ "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery();
//System.out.println("Rate sql ..."+sql);
if(rs.next())
{
rate = rs.getDouble(1);
lsLotNoFrom = rs.getString(2);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
}
else
{
try
{//try 2
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"'"
+ " AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
priceListParent = rs.getString(1);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0))
{
priceListParent = "";
//System.out.println("The priceListParent if null .... "+priceListParent);
return -1;
}
if(priceListParent.trim().length() > 0)
{
try
{//try 3
sql = "SELECT RATE,lot_no__from FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
+ "AND MIN_QTY <= "+quantity+" "
+ "AND MAX_QTY >= "+quantity+" "
+ "AND LIST_TYPE = 'F' "
+ "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery();
System.out.println("The priceListParent sql .. "+sql);
if(rs2.next())
{
rate = rs2.getDouble(1);
lsLotNoFrom = rs2.getString(2);
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
}
else
{
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
return -1;
}
}//try 3
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if
}//try 2
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else if
//rs.close();
//pstmt.clearParameters();
//pstmt.close();
//pstmt = null;
}//try 1
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if(type.trim().equals("F"))
if(type.trim().equals("D")) //DESPATCH
{
rate = 0;
try
{//try 1
sql = "SELECT RATE,lot_no__from FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
+ "AND LIST_TYPE = 'L' "
+ "AND MIN_QTY <= "+quantity+" "
+ "AND MAX_QTY >= "+quantity+" "
+ "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery();
//System.out.println("Rate sql ..."+sql);
if(rs.next())
{
rate = rs.getDouble(1);
lsLotNoFrom = rs.getString(2);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
}
else
{
try
{//try 2
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"'"
+ " AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
priceListParent = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0))
{
priceListParent = "";
return -1;
}
if(priceListParent.trim().length() > 0)
{
try
{//try 3
sql = "SELECT RATE,lot_no__from FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
+ "AND MIN_QTY <= "+quantity+" "
+ "AND MAX_QTY >= "+quantity+" "
+ "AND LIST_TYPE = 'L' "
+ "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery();
System.out.println("The priceListParent sql .. "+sql);
if(rs2.next())
{
rate = rs2.getDouble(1);
lsLotNoFrom = rs2.getString(2);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
}
else
{
rate = 0;
try
{//try 4
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
sql = "SELECT RATE,lot_no__from FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
+ "AND LIST_TYPE = 'B'"
+ " and ref_no = '"+lsRefNo+"' "
+ "AND MIN_QTY <= "+quantity+" "
+ "AND MAX_QTY >= "+quantity+" "
+ "AND LOT_NO__FROM <= '"+lotNo+"' "
+ "AND LOT_NO__TO >= '"+lotNo+"' "
+ "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery();
if (rs2.next())
{
rate = rs2.getDouble(1);
lsLotNoFrom = rs2.getString(2);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
}
else
{
try
{//try 5
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"'"
+ " AND LIST_TYPE = 'B'";
pstmt = conn.prepareStatement(sql);
rs2 = pstmt.executeQuery();
if (rs2.next())
{
priceListParent = rs2.getString(1);
//System.out.println("The priceListParent is .... "+priceListParent);
}
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0))
{
priceListParent = "";
System.out.println("The priceListParent if null .... "+priceListParent);
return -1;
}
if(priceListParent.trim().length() > 0)
{
try
{//try 6
sql = "SELECT RATE,lot_no__from FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
+ "AND LIST_TYPE = 'B'"
+ " and ref_no = '"+lsRefNo+"' "
+ "AND MIN_QTY <= "+quantity+" "
+ "AND MAX_QTY >= "+quantity+" "
+ "AND LOT_NO__FROM <= '"+lotNo+"' "
+ "AND LOT_NO__TO >= '"+lotNo+"' "
+ "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate);
rs3 = pstmt.executeQuery();
System.out.println("The priceListParent sql .. "+sql);
if(rs3.next())
{
rate = rs3.getDouble(1);
lsLotNoFrom = rs3.getString(2);
rs3.close();
rs3 = null;
pstmt.close();
pstmt = null;
}
else
{
rs3.close();
rs3 = null;
pstmt.close();
pstmt = null;
return -1;
}
}//try 6
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if
}//try 5
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else if
}//try 4
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else if
//rs2.close();
}//try 3
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if
}//try 2
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else if
//rs.close();
//pstmt.clearParameters();
//pstmt.close();
//pstmt = null;
}//try 1
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if(type.trim().equals("D"))
if(type.trim().equals("B")) //BATCH PRICE
{
rate = 0;
try
{//try 1
sql = "SELECT RATE,lot_no__from FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
+ "AND LIST_TYPE = 'B'"
+ " and ref_no ='"+lsRefNo+"' "
+ "AND MIN_QTY <= "+quantity+" "
+ "AND MAX_QTY >= "+quantity+" "
// + "AND LOT_NO__FROM <= '"+lotNo+"' "
// + "AND LOT_NO__TO >= '"+lotNo+"' "
+ "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery();
if (rs.next())
{
rate = rs.getDouble(1);
lsLotNoFrom = rs.getString(2);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else
{
try
{//try 2
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"'"
+ " AND LIST_TYPE = 'B'";
pstmt = conn.prepareStatement(sql);
rs2 = pstmt.executeQuery();
if (rs2.next())
{
priceListParent = rs2.getString(1);
}
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0))
{
priceListParent = "";
System.out.println("The priceListParent if null .... "+priceListParent);
return -1;
}
if(priceListParent.trim().length() > 0)
{
try
{//try 3
sql = "SELECT RATE,lot_no__from FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
+ "AND LIST_TYPE = 'B'"
+ " and ref_no ='"+lsRefNo+"' "
+ "AND MIN_QTY <= "+quantity+" "
+ "AND MAX_QTY >= "+quantity+" "
// + "AND LOT_NO__FROM <= '"+lotNo+"' "
// + "AND LOT_NO__TO >= '"+lotNo+"' "
+ "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery();
//System.out.println("The priceListParent sql .. "+sql);
if(rs2.next())
{
rate = rs2.getDouble(1);
lsLotNoFrom = rs2.getString(2);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
}
else
{
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
return -1;
}
}//try 3
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if
}//try 2
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else if
//rs.close();
//pstmt.clearParameters();
//pstmt.close();
//pstmt = null;
}//try1
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if(type.trim().equals("B"))
type = listType;
if((type.trim().equals("M")) || (type.trim().equals("N"))) // Discount PRICE
{
rate = 0;
System.out.println("Inside type ::-<M><N>-::");
try
{//try 1
sql = "SELECT RATE,lot_no__from FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
+ "AND LIST_TYPE = '"+type+"' "
+ "AND MIN_QTY <= "+quantity+" "
+ "AND MAX_QTY >= "+quantity+" "
+ "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery();
//System.out.println("Rate sql ..."+sql);
if(rs.next())
{
rate = rs.getDouble(1);
lsLotNoFrom = rs.getString(2);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else
{
type = getPriceListType(priceList,conn);
try
{//try 2
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"'"
+ " AND LIST_TYPE = '"+type+"'";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
priceListParent = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0))
{
priceListParent = "";
System.out.println("The priceListParent if null .... "+priceListParent);
return -1;
}
if(priceListParent.trim().length() > 0)
{
type = getPriceListType(priceList,conn);
try
{//try 3
sql = "SELECT RATE,lot_no__from FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
+ "AND LIST_TYPE = '"+type+"' "
+ "AND MIN_QTY <= "+quantity+" "
+ "AND MAX_QTY >= "+quantity+" "
+ "AND EFF_FROM <= ? "
+ "AND VALID_UPTO >= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery();
System.out.println("The priceListParent sql .. "+sql);
if(rs2.next())
{
rate = rs2.getDouble(1);
lsLotNoFrom = rs2.getString(2);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
}
else
{
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
return -1;
}
}//try 3
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if
}//try 2
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else
//rs.close();
//pstmt.clearParameters();
//pstmt.close();
//pstmt = null;
}//try 1
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if((type.trim().equals("M")) || (type.trim().equals("N")))
// if(rate>0)
// {
// if(priceList!=null && priceList.trim().length()>0)
// {
// try
// {
// sql = "select calc_method from pricelist_mst where price_list =?";
// pstmt = conn.prepareStatement(sql);
// pstmt.setString(1, priceList);
// rs = pstmt.executeQuery();
// if (rs.next())
// {
// lsCalcMethc = rs.getString("calc_method");
// //System.out.println("Rate is .*...."+rate);
// }
// rs.close();
// rs = null;
// pstmt.close();
// pstmt = null;
//
//
// sql = "select method_applicable from pricelist_mst where price_list = ?";
// pstmt = conn.prepareStatement(sql);
// pstmt.setString(1, priceListParent);
// rs = pstmt.executeQuery();
// if (rs.next())
// {
// lsMethAppl = rs.getString("method_applicable");
// //System.out.println("Rate is .*...."+rate);
// }
// rs.close();
// rs = null;
// pstmt.close();
// pstmt = null;
//
// } catch (SQLException e)
// {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
// else
// {
// try
// {
// sql = "select calc_method, method_applicable from pricelist_mst where price_list =?";
// pstmt = conn.prepareStatement(sql);
// pstmt.setString(1, priceList);
// rs = pstmt.executeQuery();
// if (rs.next())
// {
// lsCalcMethc = rs.getString("calc_method");
// lsMethAppl = rs.getString("method_applicable");
// //System.out.println("Rate is .*...."+rate);
// }
// rs.close();
// rs = null;
// pstmt.close();
// pstmt = null;
// } catch (SQLException e)
// {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
//
// if(!lsMethAppl.equalsIgnoreCase("N"))
// {
// if(lsMethAppl.equalsIgnoreCase("C"))
// {
// lsCalcPlist=priceList;
// lsCalcMeth=lsCalcMethc;
// }
// else if(lsMethAppl.equalsIgnoreCase("P"))
// {
// if(priceList!=null && priceList.trim().length()>0)
// {
// try
// {
// sql = "select calc_method from pricelist_mst where price_list =?";
// pstmt = conn.prepareStatement(sql);
// pstmt.setString(1, priceList);
// rs = pstmt.executeQuery();
// if (rs.next())
// {
// lsCalcMethp = rs.getString("calc_method");
// rs.close();
// rs = null;
// pstmt.close();
// pstmt = null;
// }
// else
// {
// if(lsCalcMethp==null || lsCalcMethp.trim().length()==0)
// {
// lsCalcPlist=priceList;
// lsCalcMeth=lsCalcMethc;
// }
// else
// {
// lsCalcPlist=priceListParent;
// lsCalcMeth=lsCalcMethp;
// }
// }
// } catch (SQLException e)
// {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
// else
// {
// lsCalcPlist=priceList;
// lsCalcMeth=lsCalcMethc;
// }
// }
//
// if(lsCalcMeth!=null && lsCalcMeth.trim().length()>0)
// {
// //
// }
// }
// }
// if(type.trim().equals("I")) //Inventory
// {
// rate = 0;
// if ((lotSl == null) || (lotSl.trim().length() == 0))
// {
// System.out.println("Inside type ::-<I>-::");
// try
// {//try 1
// sql = "SELECT RATE FROM STOCK "
// + "WHERE ITEM_CODE = '"+itemCode+"' "
// + "AND SITE_CODE = '"+siteCode+"' "
// + "AND LOC_CODE = '"+locCode+"' "
// + "AND LOT_NO = '"+lotNo+"'";
// pstmt = conn.prepareStatement(sql);
// rs = pstmt.executeQuery();
// if (rs.next())
// {
// rate = rs.getDouble(1);
// //System.out.println("Rate is .*...."+rate);
// }
// rs.close();
// rs = null;
// pstmt.close();
// pstmt = null;
// }//try
// catch(Exception e)
// {
// System.out.println("Exception...[pickRate] "+sql+e.getMessage());
// e.printStackTrace();
// throw new ITMException(e);
// }
// }//if
// else
// {
// try
// {//try 1
// sql = "SELECT RATE FROM STOCK "
// + "WHERE ITEM_CODE = '"+itemCode+"' "
// + "AND SITE_CODE = '"+siteCode+"' "
// + "AND LOC_CODE = '"+locCode+"' "
// + "AND LOT_NO = '"+lotNo+"' "
// + "AND LOT_SL = '"+lotSl+"'";
// pstmt = conn.prepareStatement(sql);
// rs = pstmt.executeQuery();
// if (rs.next())
// {
// rate = rs.getDouble(1);
// //System.out.println("Rate is .*...."+rate);
// }
// rs.close();
// rs = null;
// pstmt.close();
// pstmt = null;
// }//try
// catch(Exception e)
// {
// System.out.println("Exception...[pickRate] "+sql+e.getMessage());
// e.printStackTrace();
// throw new ITMException(e);
// }
// }//else
// }//if(type.trim().equals("I")) //Inventory
//System.out.println("Rate From DisCommon***:::::["+rate+"]");
return(rate);
}
//End added by chandrashekar on 10-aug-2016
}//class
\ No newline at end of file
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