Commit a353bd14 authored by cpatil's avatar cpatil

*** empty log message ***


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91963 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a584c3d5
......@@ -7883,20 +7883,6 @@ public class DistCommon
public double pickRate(String priceList,String trDate,String itemCode,String aLotNo,Connection conn)throws ITMException,SQLException
{
System.out.println("@@@@@--------------[pickRate]--[(String priceList,String trDate,String itemCode,String aLotNo,Connection conn)]-called------------------------------");
//System.out.println("DP[priceList/trDate/itemCode/tranType/aLotNo/listType/conn]");
//if(priceList!=null)
System.out.println("Price List:-["+priceList+"]");
//if(trDate!=null)
//System.out.println("Tran Date:-["+trDate+"]");
//if(itemCode!=null)
//System.out.println("Item Code:-["+itemCode+"]");
//if(aLotNo!=null)
//System.out.println("Lot No:-["+aLotNo+"]");
//if(listType!=null)
//System.out.println("List Type:-["+listType+"]");
//if(conn!=null)
//System.out.println("Connection Found["+conn+"]");
//System.out.println("-----------------------------------------------");
PreparedStatement pstmt = null;
ResultSet rs = null;
......@@ -7912,8 +7898,6 @@ public class DistCommon
String listType = "";
double rate = 0.0;
//type = getPriceListType(priceList,conn);
//System.out.println("List Type From Price List:::["+type+"]");
try
{
sql = " select list_type from pricelist_mst where price_list = ? " ;
......@@ -7931,7 +7915,6 @@ public class DistCommon
trDate = genericUtility.getValidDateString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
tranDate = java.sql.Timestamp.valueOf(trDate + " 00:00:00");
//System.out.println("Date in pickRate...."+tranDate);
if(listType.equalsIgnoreCase("I")) // replace listType instead of list by cpatil on 10-oct-12
{
......@@ -7943,18 +7926,13 @@ public class DistCommon
lotNo = MulStr[2];
lotSl = MulStr[3];
//System.out.println("siteCode..**..*>"+siteCode);
//System.out.println("locCode..**..*>"+locCode);
//System.out.println("lotNo..**..*>"+lotNo);
//System.out.println("lotSl..**..*>"+lotSl);
}
}
else
{
lotNo = aLotNo;
//System.out.println("lotNo..**..*>"+lotNo);
}
}//try
}
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
......@@ -7978,11 +7956,9 @@ public class DistCommon
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
rs = pstmt.executeQuery();
//System.out.println("Rate sql ..."+sql);
if(rs.next())
{
rate = rs.getDouble(1);
//System.out.println("The rate for type (L) is.... "+rate);
rs.close();
pstmt.close();
rs = null;
......@@ -7992,7 +7968,7 @@ public class DistCommon
{
try
{//try 2
{
rs.close();
pstmt.close();
rs = null;
......@@ -8008,7 +7984,7 @@ public class DistCommon
if(priceListParent.trim().length() > 0)
{
try
{//try 3
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -8020,11 +7996,9 @@ public class DistCommon
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
rs2 = pstmt.executeQuery();
//System.out.println("The priceListParent sql .. "+sql);
if(rs2.next())
{
rate = rs2.getDouble(1);
//System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
rs2 =null;
......@@ -8042,7 +8016,6 @@ public class DistCommon
if(rate > 0)
{
priceList = priceListParent ;
//break ;
}
else
{
......@@ -8050,15 +8023,15 @@ public class DistCommon
priceListParent = "";
}
}//try 3
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if
// end of code
}
}
if (rs != null && !rs.isClosed())
......@@ -8072,14 +8045,14 @@ public class DistCommon
pstmt = null;
}
}//try 2
}
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else
}
if (rs != null && !rs.isClosed())
{
......@@ -8093,19 +8066,19 @@ public class DistCommon
}
}//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(listType.trim().equals("F")) // replace listType instead of list by cpatil on 10-oct-12
{
System.out.println("Inside type ::-<F>-::");
try
{//try 1
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -8117,7 +8090,7 @@ public class DistCommon
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
rs = pstmt.executeQuery();
//System.out.println("Rate sql ..."+sql);
if(rs.next())
{
rate = rs.getDouble(1);
......@@ -8131,20 +8104,19 @@ public class DistCommon
{
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);
//System.out.println("The priceListParent is .... "+priceListParent);
}
rs.close();
pstmt.close();
......@@ -8153,13 +8125,12 @@ public class DistCommon
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 FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -8171,11 +8142,9 @@ public class DistCommon
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
rs2 = pstmt.executeQuery();
//System.out.println("The priceListParent sql .. "+sql);
if(rs2.next())
{
rate = rs2.getDouble(1);
//System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
rs2 = null;
......@@ -8189,22 +8158,22 @@ public class DistCommon
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 != null && !rs.isClosed())
{
......@@ -8216,20 +8185,20 @@ public class DistCommon
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(listType.trim().equals("D")) //DISPATCH // replace listType instead of list by cpatil on 10-oct-12
{
rate = 0;
try
{//try 1
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -8244,24 +8213,22 @@ public class DistCommon
if(rs.next())
{
rate = rs.getDouble(1);
//System.out.println("The rate for type (L) is.... "+rate);
rs.close();
pstmt.close();
rs = null;
pstmt = null;
}
else
{//else if 1
{
try
{//try 2
{
rs.close();
pstmt.close();
rs = null;
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())
......@@ -8276,13 +8243,12 @@ public class DistCommon
if((priceListParent == null) || (priceListParent.trim().length() == 0))
{
priceListParent = "";
//System.out.println("The priceListParent if null .... "+priceListParent);
return -1;
}
if(priceListParent.trim().length() > 0)//1
{
try
{//try 3
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -8297,17 +8263,16 @@ public class DistCommon
if(rs2.next())
{
rate = rs2.getDouble(1);
//System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
rs2 = null;
pstmt = null;
}
else
{//else if 2
{
try
{//try 4
{
rs2.close();
pstmt.close();
rs2 = null;
......@@ -8335,38 +8300,34 @@ public class DistCommon
}
else
{//else if 3
//rs2.close();
{
try
{//try 5
{
rs2.close();
pstmt.close();
rs2 = null;
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 for <D> is .... "+priceListParent);
}
rs2.close();
pstmt.close(); // 22/06/09 manoharan
rs2 = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
pstmt.close();
rs2 = null;
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)//2
if(priceListParent.trim().length() > 0)
{
try
{//try 6
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -8380,11 +8341,9 @@ public class DistCommon
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
rs3 = pstmt.executeQuery();
//System.out.println("The priceListParent sql .. "+sql);
if(rs3.next())
{
rate = rs3.getDouble(1);
//System.out.println("The rate inside priceListParent for <D> is ..."+rate);
rs3.close();
pstmt.close();
rs3 = null;
......@@ -8398,49 +8357,44 @@ public class DistCommon
pstmt = null;
return -1;
}
}//try 6
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if(priceListParent.trim().length() > 0)2
}//try 5
}
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else if 3
//rs2.close();
}//try 4
}
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else if 2
//rs2.close();
}//try 3
}
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if(priceListParent.trim().length() > 0)//1
}
}//try 2
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else if 1
}
if(rs != null && !rs.isClosed())
{
rs.close();
......@@ -8452,21 +8406,20 @@ public class DistCommon
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(listType.trim().equals("B"))//BATCH PRICE // replace listType instead of list by cpatil on 10-oct-12
{
rate = 0;
try
{//try 1
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -8483,7 +8436,6 @@ public class DistCommon
if(rs.next())
{
rate = rs.getDouble(1);
//System.out.println("The rate inside priceListParent for <B> is ..."+rate);
rs.close();
rs = null;
pstmt.close();
......@@ -8492,14 +8444,13 @@ public class DistCommon
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);
rs = pstmt.executeQuery();
if (rs.next())
......@@ -8513,12 +8464,11 @@ public class DistCommon
if((priceListParent == null) || (priceListParent.trim().length() == 0))
{
priceListParent = "";
//return -1;
}
if(priceListParent.trim().length() > 0)
{
try
{//try 3
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -8532,7 +8482,6 @@ public class DistCommon
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
rs2 = pstmt.executeQuery();
//System.out.println("The priceListParent sql .. "+sql);
if(rs2.next())
{
rate = rs2.getDouble(1);
......@@ -8540,11 +8489,9 @@ public class DistCommon
rs2 = null;
pstmt.close();
pstmt = null;
//System.out.println("The rate inside priceListParent for <B> is ..."+rate);
}
else
{
//rate = rs2.getDouble(1);
rs2.close();
rs2 = null;
pstmt.close();
......@@ -8554,42 +8501,38 @@ public class DistCommon
if(rate > 0)
{
priceList = priceListParent ;
//break ;
}
else
{
priceList = priceListParent ;
priceListParent = "";
}
}//try 3
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if
}// end of loop
//rs.close();
}//try 2
}
}
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else
//rs.close();
}//try 1
}
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if(type.trim().equals("B"))//BATCH PRICE
}
//type = listType; // replace listType instead of list by cpatil on 10-oct-12
//type = listType; // commented and replace listType instead of list by cpatil on 10-oct-12
if((listType.trim().equals("M")) || (listType.trim().equals("N"))) // Discount PRICE // replace listType instead of list by cpatil on 10-oct-12
......@@ -8613,7 +8556,6 @@ public class DistCommon
if(rs.next())
{
rate = rs.getDouble(1);
//System.out.println("The rate for type (F) is.... "+rate);
rs.close();
pstmt.close();
rs = null;
......@@ -8622,20 +8564,18 @@ public class DistCommon
else
{
try
{//try 2
{
rs.close();
pstmt.close();
rs = null;
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.trim()+"'";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
priceListParent = rs.getString(1);
//System.out.println("The priceListParent is .... "+priceListParent);
}
rs.close();
pstmt.close();
......@@ -8644,12 +8584,10 @@ public class DistCommon
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); // commented by cpatil on 10-oct-12
sql = "SELECT LIST_TYPE FROM PRICELIST_MST WHERE PRICE_LIST = '"+priceListParent+"' ";
pstmt = conn.prepareStatement(sql);
rs2 = pstmt.executeQuery();
......@@ -8663,7 +8601,7 @@ public class DistCommon
}
try
{//try 3
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -8679,7 +8617,6 @@ public class DistCommon
if(rs2.next())
{
rate = rs2.getDouble(1);
//System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
rs2 = null;
......@@ -8693,34 +8630,31 @@ public class DistCommon
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(listType.trim().equals("I")) //Inventory // replace listType instead of list by cpatil on 10-oct-12
......@@ -8730,7 +8664,7 @@ public class DistCommon
{
System.out.println("Inside type ::-<I>-::");
try
{//try 1
{
sql = "SELECT RATE FROM STOCK "
+ "WHERE ITEM_CODE = '"+itemCode+"' "
+ "AND SITE_CODE = '"+siteCode+"' "
......@@ -8747,18 +8681,18 @@ public class DistCommon
pstmt.close();
rs = null;
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+"' "
......@@ -8770,38 +8704,27 @@ public class DistCommon
if (rs.next())
{
rate = rs.getDouble(1);
//System.out.println("Rate is .*...."+rate);
}
rs.close();
pstmt.close();
rs = null;
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);
}
public double pickRate(String priceList,String trDate,String itemCode,Connection conn)throws ITMException,SQLException
{
System.out.println("@@@@@--------------[pickRate]--[(String priceList,String trDate,String itemCode,Connection conn)]-called------------------------------");
//System.out.println("DP[priceList/trDate/itemCode/tranType/aLotNo/listType/conn]");
//if(priceList!=null)
System.out.println("Price List:-["+priceList+"]");
//if(trDate!=null)
System.out.println("Tran Date:-["+trDate+"]");
//if(itemCode!=null)
System.out.println("Item Code:-["+itemCode+"]");
//if(conn!=null)
//System.out.println("Connection Found["+conn+"]");
//System.out.println("-----------------------------------------------");
PreparedStatement pstmt = null;
ResultSet rs = null;
......@@ -8812,13 +8735,10 @@ public class DistCommon
String priceListParent = "";
String siteCode = "";
String locCode = "";
//String lotNo = "";
String lotSl = "";
String listType = "";
double rate = 0.0;
//type = getPriceListType(priceList,conn);
//System.out.println("List Type From Price List:::["+type+"]");
try
{
sql = " select list_type from pricelist_mst where price_list = ? " ;
......@@ -8837,32 +8757,8 @@ public class DistCommon
trDate = genericUtility.getValidDateString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
tranDate = java.sql.Timestamp.valueOf(trDate + " 00:00:00");
//System.out.println("Date in pickRate...."+tranDate);
/*
if(listType.equalsIgnoreCase("I")) // replace listType instead of list by cpatil on 10-oct-12
{
if (aLotNo.indexOf("~t") > 0)
{
String MulStr[] = aLotNo.split("~t");
siteCode = MulStr[0];
locCode = MulStr[1];
lotNo = MulStr[2];
lotSl = MulStr[3];
//System.out.println("siteCode..**..*>"+siteCode);
//System.out.println("locCode..**..*>"+locCode);
//System.out.println("lotNo..**..*>"+lotNo);
//System.out.println("lotSl..**..*>"+lotSl);
}
}
else
{
lotNo = aLotNo;
//System.out.println("lotNo..**..*>"+lotNo);
}
*/
}//try
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
......@@ -8886,11 +8782,9 @@ public class DistCommon
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
rs = pstmt.executeQuery();
//System.out.println("Rate sql ..."+sql);
if(rs.next())
{
rate = rs.getDouble(1);
//System.out.println("The rate for type (L) is.... "+rate);
rs.close();
pstmt.close();
rs = null;
......@@ -8900,14 +8794,13 @@ public class DistCommon
{
try
{//try 2
{
rs.close();
pstmt.close();
rs = null;
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())
......@@ -8916,7 +8809,7 @@ public class DistCommon
if(priceListParent.trim().length() > 0)
{
try
{//try 3
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -8928,11 +8821,9 @@ public class DistCommon
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
rs2 = pstmt.executeQuery();
//System.out.println("The priceListParent sql .. "+sql);
if(rs2.next())
{
rate = rs2.getDouble(1);
//System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
rs2 =null;
......@@ -8950,7 +8841,6 @@ public class DistCommon
if(rate > 0)
{
priceList = priceListParent ;
//break ;
}
else
{
......@@ -8958,15 +8848,14 @@ public class DistCommon
priceListParent = "";
}
}//try 3
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if
// end of code
}
}
if (rs != null && !rs.isClosed())
......@@ -8980,14 +8869,14 @@ public class DistCommon
pstmt = null;
}
}//try 2
}
catch(Exception e)
{
System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else
}
if (rs != null && !rs.isClosed())
{
......@@ -9000,20 +8889,20 @@ public class DistCommon
pstmt = null;
}
//pstmt.clearParameters();
}//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(listType.trim().equals("F")) // replace listType instead of list by cpatil on 10-oct-12
{
System.out.println("Inside type ::-<F>-::");
try
{//try 1
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -9025,11 +8914,9 @@ public class DistCommon
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
rs = pstmt.executeQuery();
//System.out.println("Rate sql ..."+sql);
if(rs.next())
{
rate = rs.getDouble(1);
//System.out.println("The rate for type (F) is.... "+rate);
rs.close();
rs = null;
pstmt.close();
......@@ -9039,20 +8926,18 @@ public class DistCommon
{
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);
//System.out.println("The priceListParent is .... "+priceListParent);
}
rs.close();
pstmt.close();
......@@ -9061,13 +8946,12 @@ public class DistCommon
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 FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -9079,11 +8963,9 @@ public class DistCommon
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
rs2 = pstmt.executeQuery();
//System.out.println("The priceListParent sql .. "+sql);
if(rs2.next())
{
rate = rs2.getDouble(1);
//System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
rs2 = null;
......@@ -9097,22 +8979,22 @@ public class DistCommon
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 != null && !rs.isClosed())
{
......@@ -9124,23 +9006,20 @@ public class DistCommon
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(listType.trim().equals("D")) //DISPATCH // replace listType instead of list by cpatil on 10-oct-12
{
rate = 0;
//System.out.println("Inside type ::-<D>-::");
//First selecting rate from pricelist for L,if not found
//picking up from batch
try
{//try 1
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -9155,24 +9034,22 @@ public class DistCommon
if(rs.next())
{
rate = rs.getDouble(1);
//System.out.println("The rate for type (L) is.... "+rate);
rs.close();
pstmt.close();
rs = null;
pstmt = null;
}
else
{//else if 1
{
try
{//try 2
{
rs.close();
pstmt.close();
rs = null;
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())
......@@ -9187,13 +9064,12 @@ public class DistCommon
if((priceListParent == null) || (priceListParent.trim().length() == 0))
{
priceListParent = "";
//System.out.println("The priceListParent if null .... "+priceListParent);
return -1;
}
if(priceListParent.trim().length() > 0)//1
{
try
{//try 3
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -9208,17 +9084,16 @@ public class DistCommon
if(rs2.next())
{
rate = rs2.getDouble(1);
//System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
rs2 = null;
pstmt = null;
}
else
{//else if 2
{
try
{//try 4
{
rs2.close();
pstmt.close();
rs2 = null;
......@@ -9243,26 +9118,23 @@ public class DistCommon
pstmt.close();
rs2 = null;
pstmt = null;
//System.out.println("The rate inside priceListParent for <D> is ..."+rate);
}
else
{//else if 3
//rs2.close();
{
try
{//try 5
{
rs2.close();
pstmt.close();
rs2 = null;
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 for <D> is .... "+priceListParent);
}
rs2.close();
pstmt.close();
......@@ -9271,13 +9143,12 @@ public class DistCommon
if((priceListParent == null) || (priceListParent.trim().length() == 0))
{
priceListParent = "";
//System.out.println("The priceListParent if null .... "+priceListParent);
return -1;
}
if(priceListParent.trim().length() > 0)//2
{
try
{//try 6
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -9291,11 +9162,9 @@ public class DistCommon
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
rs3 = pstmt.executeQuery();
//System.out.println("The priceListParent sql .. "+sql);
if(rs3.next())
{
rate = rs3.getDouble(1);
//System.out.println("The rate inside priceListParent for <D> is ..."+rate);
rs3.close();
pstmt.close();
rs3 = null;
......@@ -9309,49 +9178,44 @@ public class DistCommon
pstmt = null;
return -1;
}
}//try 6
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if(priceListParent.trim().length() > 0)2
}//try 5
}
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else if 3
//rs2.close();
}//try 4
}
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else if 2
//rs2.close();
}//try 3
}
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if(priceListParent.trim().length() > 0)//1
}
}//try 2
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else if 1
}
if(rs != null && !rs.isClosed())
{
rs.close();
......@@ -9363,21 +9227,20 @@ public class DistCommon
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(listType.trim().equals("B"))//BATCH PRICE // replace listType instead of list by cpatil on 10-oct-12
{
rate = 0;
try
{//try 1
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -9402,14 +9265,13 @@ public class DistCommon
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);
rs = pstmt.executeQuery();
if (rs.next())
......@@ -9422,12 +9284,11 @@ public class DistCommon
if((priceListParent == null) || (priceListParent.trim().length() == 0))
{
priceListParent = "";
//return -1;
}
if(priceListParent.trim().length() > 0)
{
try
{//try 3
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -9441,7 +9302,6 @@ public class DistCommon
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
rs2 = pstmt.executeQuery();
//System.out.println("The priceListParent sql .. "+sql);
if(rs2.next())
{
rate = rs2.getDouble(1);
......@@ -9449,11 +9309,9 @@ public class DistCommon
rs2 = null;
pstmt.close();
pstmt = null;
//System.out.println("The rate inside priceListParent for <B> is ..."+rate);
}
else
{
//rate = rs2.getDouble(1);
rs2.close();
rs2 = null;
pstmt.close();
......@@ -9463,42 +9321,39 @@ public class DistCommon
if(rate > 0)
{
priceList = priceListParent ;
//break ;
}
else
{
priceList = priceListParent ;
priceListParent = "";
}
}//try 3
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if
}// end of loop
//rs.close();
}//try 2
}
}
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//else
//rs.close();
}//try 1
}
}
catch(Exception e)
{
//System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}//if(type.trim().equals("B"))//BATCH PRICE
}
//type = listType; // replace listType instead of list by cpatil on 10-oct-12
//type = listType; // commented and replace listType instead of list by cpatil on 10-oct-12
if((listType.trim().equals("M")) || (listType.trim().equals("N"))) // Discount PRICE // replace listType instead of list by cpatil on 10-oct-12
......@@ -9506,7 +9361,7 @@ public class DistCommon
rate = 0;
System.out.println("Inside type ::-<M><N>-::");
try
{//try 1
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -9522,7 +9377,6 @@ public class DistCommon
if(rs.next())
{
rate = rs.getDouble(1);
//System.out.println("The rate for type (F) is.... "+rate);
rs.close();
pstmt.close();
rs = null;
......@@ -9531,20 +9385,18 @@ public class DistCommon
else
{
try
{//try 2
{
rs.close();
pstmt.close();
rs = null;
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.trim()+"'";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
priceListParent = rs.getString(1);
//System.out.println("The priceListParent is .... "+priceListParent);
}
rs.close();
pstmt.close();
......@@ -9553,7 +9405,6 @@ public class DistCommon
if((priceListParent == null) || (priceListParent.trim().length() == 0))
{
priceListParent = "";
//System.out.println("The priceListParent if null .... "+priceListParent);
return -1;
}
if(priceListParent.trim().length() > 0)
......@@ -9572,7 +9423,7 @@ public class DistCommon
}
try
{//try 3
{
sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' "
......@@ -9588,7 +9439,6 @@ public class DistCommon
if(rs2.next())
{
rate = rs2.getDouble(1);
//System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
rs2 = null;
......@@ -9602,34 +9452,31 @@ public class DistCommon
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(listType.trim().equals("I")) //Inventory // replace listType instead of list by cpatil on 10-oct-12
......@@ -9639,7 +9486,7 @@ public class DistCommon
{
System.out.println("Inside type ::-<I>-::");
try
{//try 1
{
sql = "SELECT RATE FROM STOCK "
+ "WHERE ITEM_CODE = '"+itemCode+"' "
+ "AND SITE_CODE = '"+siteCode+"' "
......@@ -9656,18 +9503,18 @@ public class DistCommon
pstmt.close();
rs = null;
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+"' "
......@@ -9679,25 +9526,21 @@ public class DistCommon
if (rs.next())
{
rate = rs.getDouble(1);
//System.out.println("Rate is .*...."+rate);
}
rs.close();
pstmt.close();
rs = null;
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);
}
// added by cpatil on 10/oct/12 end
}//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