Commit ccbdd695 authored by manohar's avatar manohar

pick rate many connection/statment/resultset closed


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91129 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d3daaed3
...@@ -18,6 +18,8 @@ import ibase.webitm.utility.*; ...@@ -18,6 +18,8 @@ import ibase.webitm.utility.*;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.webitm.ejb.fin.FinCommon; import ibase.webitm.ejb.fin.FinCommon;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar;//import java.util.Date;
import ibase.webitm.ejb.sys.UtilMethods;
public class DistCommon public class DistCommon
{ {
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
...@@ -1065,6 +1067,8 @@ public class DistCommon ...@@ -1065,6 +1067,8 @@ public class DistCommon
} }
rs.close(); rs.close();
stmt.close(); stmt.close();
rs = null;
stmt = null;
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -1083,7 +1087,7 @@ public class DistCommon ...@@ -1083,7 +1087,7 @@ public class DistCommon
sql = "SELECT LIST_TYPE FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"'"; sql = "SELECT LIST_TYPE FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"'";
stmt = conn.createStatement(); stmt = conn.createStatement();
rs = stmt.executeQuery(sql); rs = stmt.executeQuery(sql);
System.out.println("LIST_TYPE... sql..."+sql); //System.out.println("LIST_TYPE... sql..."+sql);
//25052007 //25052007
if (rs.next()) if (rs.next())
{ {
...@@ -1092,7 +1096,8 @@ public class DistCommon ...@@ -1092,7 +1096,8 @@ public class DistCommon
rs.close(); rs.close();
rs = null; rs = null;
stmt.close(); stmt.close();
System.out.println("listType...................."+listType); stmt = null;
//System.out.println("listType...................."+listType);
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -1107,21 +1112,21 @@ public class DistCommon ...@@ -1107,21 +1112,21 @@ public class DistCommon
public double pickRate(String priceList,String trDate,String itemCode,String aLotNo,String listType,Connection conn)throws ITMException public double pickRate(String priceList,String trDate,String itemCode,String aLotNo,String listType,Connection conn)throws ITMException
{ {
System.out.println("--------------[pickRate]---------------------------------"); //System.out.println("--------------[pickRate]---------------------------------");
System.out.println("DP[priceList/trDate/itemCode/tranType/aLotNo/listType/conn]"); //System.out.println("DP[priceList/trDate/itemCode/tranType/aLotNo/listType/conn]");
if(priceList!=null) //if(priceList!=null)
System.out.println("Price List:-["+priceList+"]"); //System.out.println("Price List:-["+priceList+"]");
if(trDate!=null) //if(trDate!=null)
System.out.println("Tran Date:-["+trDate+"]"); //System.out.println("Tran Date:-["+trDate+"]");
if(itemCode!=null) //if(itemCode!=null)
System.out.println("Item Code:-["+itemCode+"]"); //System.out.println("Item Code:-["+itemCode+"]");
if(aLotNo!=null) //if(aLotNo!=null)
System.out.println("Lot No:-["+aLotNo+"]"); //System.out.println("Lot No:-["+aLotNo+"]");
if(listType!=null) //if(listType!=null)
System.out.println("List Type:-["+listType+"]"); //System.out.println("List Type:-["+listType+"]");
if(conn!=null) //if(conn!=null)
System.out.println("Connection Found["+conn+"]"); //System.out.println("Connection Found["+conn+"]");
System.out.println("-----------------------------------------------"); //System.out.println("-----------------------------------------------");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -1138,22 +1143,22 @@ public class DistCommon ...@@ -1138,22 +1143,22 @@ public class DistCommon
double rate = 0.0; double rate = 0.0;
type = getPriceListType(priceList,conn); type = getPriceListType(priceList,conn);
System.out.println("List Type From Price List:::["+type+"]"); //System.out.println("List Type From Price List:::["+type+"]");
try try
{ {
trDate = genericUtility.getValidDateString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()); trDate = genericUtility.getValidDateString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
tranDate = java.sql.Timestamp.valueOf(trDate + " 00:00:00"); tranDate = java.sql.Timestamp.valueOf(trDate + " 00:00:00");
System.out.println("Date in pickRate...."+tranDate); //System.out.println("Date in pickRate...."+tranDate);
// 25052007 // 25052007
if(type.equalsIgnoreCase("I")) if(type.equalsIgnoreCase("I"))
{ {
if (aLotNo.indexOf("~t") > 0) if (aLotNo.indexOf("~t") > 0)
{ {
String MulStr[] = aLotNo.split("~t"); String MulStr[] = aLotNo.split("~t");
System.out.println("First String ["+MulStr[0]+"]"); //System.out.println("First String ["+MulStr[0]+"]");
System.out.println("Second String ["+MulStr[1]+"]"); //System.out.println("Second String ["+MulStr[1]+"]");
System.out.println("Third String ["+MulStr[2]+"]"); //System.out.println("Third String ["+MulStr[2]+"]");
System.out.println("Four String ["+MulStr[3]+"]"); //System.out.println("Four String ["+MulStr[3]+"]");
/* siteCode = getTokenList(aLotNo,"~t"); /* siteCode = getTokenList(aLotNo,"~t");
locCode = getTokenList(aLotNo,"~t"); locCode = getTokenList(aLotNo,"~t");
lotNo = getTokenList(aLotNo,"~t"); lotNo = getTokenList(aLotNo,"~t");
...@@ -1163,16 +1168,16 @@ public class DistCommon ...@@ -1163,16 +1168,16 @@ public class DistCommon
lotNo = MulStr[2]; lotNo = MulStr[2];
lotSl = MulStr[3]; lotSl = MulStr[3];
System.out.println("siteCode..**..*>"+siteCode); //System.out.println("siteCode..**..*>"+siteCode);
System.out.println("locCode..**..*>"+locCode); //System.out.println("locCode..**..*>"+locCode);
System.out.println("lotNo..**..*>"+lotNo); //System.out.println("lotNo..**..*>"+lotNo);
System.out.println("lotSl..**..*>"+lotSl); //System.out.println("lotSl..**..*>"+lotSl);
} }
} }
else else
{ {
lotNo = aLotNo; lotNo = aLotNo;
System.out.println("lotNo..**..*>"+lotNo); //System.out.println("lotNo..**..*>"+lotNo);
} }
}//try }//try
catch(Exception e) catch(Exception e)
...@@ -1197,11 +1202,15 @@ public class DistCommon ...@@ -1197,11 +1202,15 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
System.out.println("Rate sql ..."+sql); //System.out.println("Rate sql ..."+sql);
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
System.out.println("The rate for type (L) is.... "+rate); //System.out.println("The rate for type (L) is.... "+rate);
rs.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
} }
else else
{ {
...@@ -1209,12 +1218,15 @@ public class DistCommon ...@@ -1209,12 +1218,15 @@ public class DistCommon
try try
{//try 2 {//try 2
rs.close(); rs.close();
pstmt.close(); // 22/06/09 manoharan
rs = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'L'"; //+ "AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1) == null ?"":rs.getString(1); priceListParent = rs.getString(1) == null ?"":rs.getString(1);
//System.out.println("The priceListParent is .... "+priceListParent); //System.out.println("The priceListParent is .... "+priceListParent);
...@@ -1239,20 +1251,29 @@ public class DistCommon ...@@ -1239,20 +1251,29 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery(); rs2 = pstmt.executeQuery();
System.out.println("The priceListParent sql .. "+sql); //System.out.println("The priceListParent sql .. "+sql);
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs2 =null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
} }
else else
{ {
rs2.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs2 =null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
return -1; return -1;
} }
if(rate > 0) if(rate > 0)
{ {
priceList = priceListParent ; priceList = priceListParent ;
break ; //break ;
} }
else else
{ {
...@@ -1263,14 +1284,25 @@ public class DistCommon ...@@ -1263,14 +1284,25 @@ public class DistCommon
}//try 3 }//try 3
catch(Exception e) catch(Exception e)
{ {
System.out.println("Exception...[pickRate] "+sql+e.getMessage()); //System.out.println("Exception...[pickRate] "+sql+e.getMessage());
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
}//if }//if
// end of code // end of code
} }
rs.close(); // 22/06/09 manoharan
if (rs != null && !rs.isClosed())
{
rs.close();
rs = null;
}
if (pstmt != null && !pstmt.isClosed())
{
pstmt.close();
pstmt = null;
}
// end 22/06/09 manoharan
/*if((priceListParent == null) || (priceListParent.trim().length() == 0)) /*if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -1319,7 +1351,18 @@ public class DistCommon ...@@ -1319,7 +1351,18 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else }//else
// 22/06/09 manoharan
if (rs != null && !rs.isClosed())
{
rs.close();
rs = null;
}
if (pstmt != null && !pstmt.isClosed())
{
pstmt.close();
pstmt = null;
}
// end 22/06/09 manoharan
//pstmt.clearParameters(); //pstmt.clearParameters();
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
...@@ -1344,33 +1387,43 @@ public class DistCommon ...@@ -1344,33 +1387,43 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
System.out.println("Rate sql ..."+sql); //System.out.println("Rate sql ..."+sql);
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
System.out.println("The rate for type (F) is.... "+rate); //System.out.println("The rate for type (F) is.... "+rate);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
try try
{//try 2 {//try 2
rs.close(); rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'L'"; //+ "AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
System.out.println("The priceListParent is .... "+priceListParent); //System.out.println("The priceListParent is .... "+priceListParent);
} }
rs.close(); rs.close();
pstmt.close(); // 22/06/09 manoharan
rs = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
System.out.println("The priceListParent if null .... "+priceListParent); //System.out.println("The priceListParent if null .... "+priceListParent);
return -1; return -1;
} }
if(priceListParent.trim().length() > 0) if(priceListParent.trim().length() > 0)
...@@ -1387,14 +1440,22 @@ public class DistCommon ...@@ -1387,14 +1440,22 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery(); rs2 = pstmt.executeQuery();
System.out.println("The priceListParent sql .. "+sql); //System.out.println("The priceListParent sql .. "+sql);
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs2 = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
} }
else else
{ {
rs2.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs2 = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
return -1; return -1;
} }
}//try 3 }//try 3
...@@ -1413,10 +1474,17 @@ public class DistCommon ...@@ -1413,10 +1474,17 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else }//else
rs.close(); // 22/06/09 manoharan
pstmt.clearParameters(); if (rs != null && !rs.isClosed())
pstmt.close(); {
pstmt = null; rs.close();
rs = null;
}
if (pstmt != null && !pstmt.isClosed())
{
pstmt.close();
pstmt = null;
}
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -1429,7 +1497,7 @@ public class DistCommon ...@@ -1429,7 +1497,7 @@ public class DistCommon
if(type.trim().equals("D")) //DISPATCH if(type.trim().equals("D")) //DISPATCH
{ {
rate = 0; rate = 0;
System.out.println("Inside type ::-<D>-::"); //System.out.println("Inside type ::-<D>-::");
//First selecting rate from pricelist for L,if not found //First selecting rate from pricelist for L,if not found
//picking up from batch //picking up from batch
try try
...@@ -1447,29 +1515,39 @@ public class DistCommon ...@@ -1447,29 +1515,39 @@ public class DistCommon
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
System.out.println("The rate for type (L) is.... "+rate); //System.out.println("The rate for type (L) is.... "+rate);
rs.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
} }
else else
{//else if 1 {//else if 1
try try
{//try 2 {//try 2
rs.close(); rs.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'L'"; //+ "AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
System.out.println("The priceListParent is .... "+priceListParent); System.out.println("The priceListParent is .... "+priceListParent);
} }
rs.close(); rs.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
System.out.println("The priceListParent if null .... "+priceListParent); //System.out.println("The priceListParent if null .... "+priceListParent);
return -1; return -1;
} }
if(priceListParent.trim().length() > 0)//1 if(priceListParent.trim().length() > 0)//1
...@@ -1489,14 +1567,21 @@ public class DistCommon ...@@ -1489,14 +1567,21 @@ public class DistCommon
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs2 = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
} }
else else
{//else if 2 {//else if 2
try try
{//try 4 {//try 4
rs2.close(); rs2.close();
pstmt.close(); // 22/06/09 manoharan
rs2 = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
sql = "SELECT RATE FROM PRICELIST " sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' " + "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' " + "AND ITEM_CODE = '"+itemCode+"' "
...@@ -1512,29 +1597,39 @@ public class DistCommon ...@@ -1512,29 +1597,39 @@ public class DistCommon
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
System.out.println("The rate inside priceListParent for <D> is ..."+rate); rs2.close();
pstmt.close(); // 22/06/09 manoharan
rs2 = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
//System.out.println("The rate inside priceListParent for <D> is ..."+rate);
} }
else else
{//else if 3 {//else if 3
rs2.close(); //rs2.close();
try try
{//try 5 {//try 5
rs2.close(); rs2.close();
pstmt.close(); // 22/06/09 manoharan
rs2 = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'B'"; //+ "AND LIST_TYPE = 'B'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs2 = pstmt.executeQuery(); rs2 = pstmt.executeQuery();
while (rs2.next()) if (rs2.next())
{ {
priceListParent = rs2.getString(1); priceListParent = rs2.getString(1);
System.out.println("The priceListParent for <D> is .... "+priceListParent); //System.out.println("The priceListParent for <D> is .... "+priceListParent);
} }
rs2.close(); rs2.close();
pstmt.close(); // 22/06/09 manoharan
rs2 = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
System.out.println("The priceListParent if null .... "+priceListParent); //System.out.println("The priceListParent if null .... "+priceListParent);
return -1; return -1;
} }
if(priceListParent.trim().length() > 0)//2 if(priceListParent.trim().length() > 0)//2
...@@ -1558,9 +1653,17 @@ public class DistCommon ...@@ -1558,9 +1653,17 @@ public class DistCommon
{ {
rate = rs3.getDouble(1); rate = rs3.getDouble(1);
//System.out.println("The rate inside priceListParent for <D> is ..."+rate); //System.out.println("The rate inside priceListParent for <D> is ..."+rate);
} rs3.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs3 = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
}
else else
{ {
rs3.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs3 = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
return -1; return -1;
} }
}//try 6 }//try 6
...@@ -1579,7 +1682,7 @@ public class DistCommon ...@@ -1579,7 +1682,7 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if 3 }//else if 3
rs2.close(); //rs2.close();
}//try 4 }//try 4
catch(Exception e) catch(Exception e)
{ {
...@@ -1588,7 +1691,7 @@ public class DistCommon ...@@ -1588,7 +1691,7 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if 2 }//else if 2
rs2.close(); //rs2.close();
}//try 3 }//try 3
catch(Exception e) catch(Exception e)
{ {
...@@ -1606,10 +1709,17 @@ public class DistCommon ...@@ -1606,10 +1709,17 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if 1 }//else if 1
rs.close(); if(rs != null && !rs.isClosed())
pstmt.clearParameters(); {
pstmt.close(); rs.close();
pstmt = null; rs = null;
}
if (pstmt != null && !pstmt.isClosed())
{
pstmt.clearParameters();
pstmt.close();
pstmt = null;
}
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -1639,21 +1749,32 @@ public class DistCommon ...@@ -1639,21 +1749,32 @@ public class DistCommon
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
System.out.println("The rate inside priceListParent for <B> is ..."+rate); //System.out.println("The rate inside priceListParent for <B> is ..."+rate);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
try try
{ //try 2 { //try 2
rs.close(); rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'B'"; //+ "AND LIST_TYPE = 'B'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//System.out.println("GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG"+priceListParent); //System.out.println("GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG"+priceListParent);
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
...@@ -1680,16 +1801,25 @@ public class DistCommon ...@@ -1680,16 +1801,25 @@ public class DistCommon
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
//System.out.println("The rate inside priceListParent for <B> is ..."+rate); //System.out.println("The rate inside priceListParent for <B> is ..."+rate);
} }
else else
{ {
rate = rs2.getDouble(1);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
return -1; return -1;
} }
if(rate > 0) if(rate > 0)
{ {
priceList = priceListParent ; priceList = priceListParent ;
break ; //break ;
} }
else else
{ {
...@@ -1705,7 +1835,7 @@ public class DistCommon ...@@ -1705,7 +1835,7 @@ public class DistCommon
} }
}//if }//if
}// end of loop }// end of loop
rs.close(); //rs.close();
}//try 2 }//try 2
catch(Exception e) catch(Exception e)
{ {
...@@ -1714,7 +1844,7 @@ public class DistCommon ...@@ -1714,7 +1844,7 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else }//else
rs.close(); //rs.close();
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -1745,28 +1875,38 @@ public class DistCommon ...@@ -1745,28 +1875,38 @@ public class DistCommon
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
System.out.println("The rate for type (F) is.... "+rate); //System.out.println("The rate for type (F) is.... "+rate);
rs.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
} }
else else
{ {
try try
{//try 2 {//try 2
rs.close(); rs.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = '"+type.trim()+"'"; //+ "AND LIST_TYPE = '"+type.trim()+"'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
System.out.println("The priceListParent is .... "+priceListParent); //System.out.println("The priceListParent is .... "+priceListParent);
} }
rs.close(); rs.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
System.out.println("The priceListParent if null .... "+priceListParent); //System.out.println("The priceListParent if null .... "+priceListParent);
return -1; return -1;
} }
if(priceListParent.trim().length() > 0) if(priceListParent.trim().length() > 0)
...@@ -1788,10 +1928,18 @@ public class DistCommon ...@@ -1788,10 +1928,18 @@ public class DistCommon
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs2 = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
} }
else else
{ {
rs2.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs2 = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
return -1; return -1;
} }
}//try 3 }//try 3
...@@ -1810,10 +1958,10 @@ public class DistCommon ...@@ -1810,10 +1958,10 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else }//else
rs.close(); //rs.close();
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -1838,12 +1986,15 @@ public class DistCommon ...@@ -1838,12 +1986,15 @@ public class DistCommon
+ "AND LOT_NO = '"+lotNo+"'"; + "AND LOT_NO = '"+lotNo+"'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
System.out.println("Rate is .*...."+rate); System.out.println("Rate is .*...."+rate);
} }
rs.close(); rs.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
}//try }//try
catch(Exception e) catch(Exception e)
{ {
...@@ -1867,9 +2018,12 @@ public class DistCommon ...@@ -1867,9 +2018,12 @@ public class DistCommon
if (rs.next()) if (rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
System.out.println("Rate is .*...."+rate); //System.out.println("Rate is .*...."+rate);
} }
rs.close(); rs.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
}//try }//try
catch(Exception e) catch(Exception e)
{ {
...@@ -1879,7 +2033,7 @@ public class DistCommon ...@@ -1879,7 +2033,7 @@ public class DistCommon
} }
}//else }//else
}//if(type.trim().equals("I")) //Inventory }//if(type.trim().equals("I")) //Inventory
System.out.println("Rate From DisCommon***:::::["+rate+"]"); //System.out.println("Rate From DisCommon***:::::["+rate+"]");
return(rate); return(rate);
}//pickRate() }//pickRate()
...@@ -1905,24 +2059,24 @@ public class DistCommon ...@@ -1905,24 +2059,24 @@ public class DistCommon
}//getTokenList() }//getTokenList()
public double pickRate(String priceList,String trDate,String itemCode,String aLotNo,String listType,double quantity,String aunit,Connection conn)throws ITMException public double pickRate(String priceList,String trDate,String itemCode,String aLotNo,String listType,double quantity,String aunit,Connection conn)throws ITMException
{ {
System.out.println("--------------[pickRate]---------------------------------"); //System.out.println("--------------[pickRate]---------------------------------");
System.out.println("DP[priceList/trDate/itemCode/tranType/aLotNo/listType/quantity/unit/conn]"); //System.out.println("DP[priceList/trDate/itemCode/tranType/aLotNo/listType/quantity/unit/conn]");
if(priceList!=null) //if(priceList!=null)
System.out.println("Price List:-["+priceList+"]"); //System.out.println("Price List:-["+priceList+"]");
if(trDate!=null) //if(trDate!=null)
System.out.println("Tran Date:-["+trDate+"]"); //System.out.println("Tran Date:-["+trDate+"]");
if(itemCode!=null) //if(itemCode!=null)
System.out.println("Item Code:-["+itemCode+"]"); //System.out.println("Item Code:-["+itemCode+"]");
if(aLotNo!=null) //if(aLotNo!=null)
System.out.println("Lot No:-["+aLotNo+"]"); //System.out.println("Lot No:-["+aLotNo+"]");
if(listType!=null) //if(listType!=null)
System.out.println("List Type:-["+listType+"]"); //System.out.println("List Type:-["+listType+"]");
System.out.println("Quantity:-["+quantity+"]"); //System.out.println("Quantity:-["+quantity+"]");
if(aunit!=null) //if(aunit!=null)
System.out.println("Unit:-["+aunit+"]"); //System.out.println("Unit:-["+aunit+"]");
if(conn!=null) //if(conn!=null)
System.out.println("Connection Found["+conn+"]"); //System.out.println("Connection Found["+conn+"]");
System.out.println("-----------------------------------------------"); //System.out.println("-----------------------------------------------");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
Statement stmt = null; Statement stmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -1947,16 +2101,16 @@ public class DistCommon ...@@ -1947,16 +2101,16 @@ public class DistCommon
{ {
trDate = genericUtility.getValidDateString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()); trDate = genericUtility.getValidDateString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
tranDate = java.sql.Timestamp.valueOf(trDate + " 00:00:00"); tranDate = java.sql.Timestamp.valueOf(trDate + " 00:00:00");
System.out.println("Date in pickRate...."+tranDate); //System.out.println("Date in pickRate...."+tranDate);
if (aLotNo.indexOf("~t") > 0) if (aLotNo.indexOf("~t") > 0)
{ {
String sepStr[] = aLotNo.split("~t"); String sepStr[] = aLotNo.split("~t");
System.out.println(sepStr[0]); //System.out.println(sepStr[0]);
System.out.println(sepStr[1]); //System.out.println(sepStr[1]);
System.out.println(sepStr[2]); //System.out.println(sepStr[2]);
System.out.println(sepStr[3]); //System.out.println(sepStr[3]);
siteCode =sepStr[0]; siteCode =sepStr[0];
locCode =sepStr[1]; locCode =sepStr[1];
...@@ -1967,17 +2121,17 @@ public class DistCommon ...@@ -1967,17 +2121,17 @@ public class DistCommon
locCode = getTokenList(aLotNo,"~t"); locCode = getTokenList(aLotNo,"~t");
lotNo = getTokenList(aLotNo,"~t"); lotNo = getTokenList(aLotNo,"~t");
lotSl = getTokenList(aLotNo,"~t");*/ lotSl = getTokenList(aLotNo,"~t");*/
System.out.println("Separated String :---------------------->"); //System.out.println("Separated String :---------------------->");
System.out.println("siteCode..**..*>"+siteCode); //System.out.println("siteCode..**..*>"+siteCode);
System.out.println("locCode..**..*>"+locCode); //System.out.println("locCode..**..*>"+locCode);
System.out.println("lotNo..**..*>"+lotNo); //System.out.println("lotNo..**..*>"+lotNo);
System.out.println("lotSl..**..*>"+lotSl); //System.out.println("lotSl..**..*>"+lotSl);
} }
else else
{ {
lotNo = aLotNo; lotNo = aLotNo;
System.out.println("lotNo..**..*>"+lotNo); //System.out.println("lotNo..**..*>"+lotNo);
} }
}//try }//try
catch(Exception e) catch(Exception e)
...@@ -2038,13 +2192,20 @@ public class DistCommon ...@@ -2038,13 +2192,20 @@ public class DistCommon
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
unit = rs.getString(2); unit = rs.getString(2);
System.out.println("The rate for type (L) is.... "+rate); //System.out.println("The rate for type (L) is.... "+rate);
rs.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
} }
else else
{ {
try try
{//try 2 {//try 2
rs.close(); rs.close(); // 22/06/09 manoharan
pstmt.close(); // 22/06/09 manoharan
rs = null; // 22/06/09 manoharan
pstmt = null; // 22/06/09 manoharan
sql = "SELECT RATE,UNIT FROM PRICELIST " sql = "SELECT RATE,UNIT FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' " + "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' " + "AND ITEM_CODE = '"+itemCode+"' "
...@@ -2057,31 +2218,33 @@ public class DistCommon ...@@ -2057,31 +2218,33 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
unit = rs.getString(2); unit = rs.getString(2);
System.out.println("The rate for type (L) is.... "+rate); //System.out.println("The rate for type (L) is.... "+rate);
rs.close();
pstmt.close();
pstmt = null;
rs=null;
} }
rs.close(); else
pstmt.close();
pstmt = null;
rs=null;
if(!rs.next())
{ {
try try
{//try 3 {//try 3
rs.close(); rs.close();
pstmt.close();
pstmt = null;
rs=null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'L'"; //+ "AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
System.out.println("The priceListParent is .... "+priceListParent); //System.out.println("The priceListParent is .... "+priceListParent);
} }
rs.close(); rs.close();
pstmt.close(); pstmt.close();
...@@ -2115,13 +2278,20 @@ public class DistCommon ...@@ -2115,13 +2278,20 @@ public class DistCommon
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
unit = rs2.getString(2); unit = rs2.getString(2);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
} }
else else
{ {
try try
{//try 5 {//try 5
rs2.close(); rs2.close();
pstmt.close();
pstmt = null;
rs2=null;
sql = "SELECT RATE,UNIT FROM PRICELIST " sql = "SELECT RATE,UNIT FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' " + "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' " + "AND ITEM_CODE = '"+itemCode+"' "
...@@ -2139,10 +2309,18 @@ public class DistCommon ...@@ -2139,10 +2309,18 @@ public class DistCommon
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
unit = rs2.getString(2); unit = rs2.getString(2);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
pstmt = null;
rs2=null;
} }
else else
{ {
rs2.close();
pstmt.close();
pstmt = null;
rs2=null;
return -1; return -1;
} }
}//try 5 }//try 5
...@@ -2153,10 +2331,10 @@ public class DistCommon ...@@ -2153,10 +2331,10 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs2.close(); //rs2.close();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
rs2=null; //rs2=null;
}//try 4 }//try 4
catch(Exception e) catch(Exception e)
{ {
...@@ -2181,10 +2359,10 @@ public class DistCommon ...@@ -2181,10 +2359,10 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs.close(); //rs.close();
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -2218,13 +2396,20 @@ public class DistCommon ...@@ -2218,13 +2396,20 @@ public class DistCommon
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
unit = rs.getString(2); unit = rs.getString(2);
System.out.println("The rate for type (L) is.... "+rate); //System.out.println("The rate for type (L) is.... "+rate);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
} }
else else
{ {
try try
{//try 2 {//try 2
rs.close(); rs.close();
pstmt.close();
pstmt = null;
rs = null;
sql = "SELECT RATE,UNIT FROM PRICELIST " sql = "SELECT RATE,UNIT FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' " + "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' " + "AND ITEM_CODE = '"+itemCode+"' "
...@@ -2237,28 +2422,38 @@ public class DistCommon ...@@ -2237,28 +2422,38 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
unit = rs.getString(2); unit = rs.getString(2);
System.out.println("The rate for type (F) is.... "+rate); //System.out.println("The rate for type (F) is.... "+rate);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
} }
if(!(rs.next()) || (unit == null)) else
{ {
try try
{//try 3 {//try 3
rs.close(); rs.close();
pstmt.close();
pstmt = null;
rs = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'L'"; //+ "AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
} }
rs.close(); rs.close();
rs = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -2287,13 +2482,20 @@ public class DistCommon ...@@ -2287,13 +2482,20 @@ public class DistCommon
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
unit = rs2.getString(2); unit = rs2.getString(2);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
} }
else else
{ {
try try
{//try 5 {//try 5
rs2.close(); rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
sql = "SELECT RATE,UNIT FROM PRICELIST " sql = "SELECT RATE,UNIT FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' " + "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' " + "AND ITEM_CODE = '"+itemCode+"' "
...@@ -2307,14 +2509,22 @@ public class DistCommon ...@@ -2307,14 +2509,22 @@ public class DistCommon
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery(); rs2 = pstmt.executeQuery();
System.out.println("The priceListParent sql .. "+sql); System.out.println("The priceListParent sql .. "+sql);
while(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
unit = rs2.getString(2); unit = rs2.getString(2);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
} }
if(!rs2.next()) else
{ {
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
return -1; return -1;
} }
}//try 5 }//try 5
...@@ -2324,7 +2534,7 @@ public class DistCommon ...@@ -2324,7 +2534,7 @@ public class DistCommon
e.printStackTrace(); e.printStackTrace();
} }
}//else if }//else if
rs2.close(); //rs2.close();
}//try 4 }//try 4
catch(Exception e) catch(Exception e)
{ {
...@@ -2349,11 +2559,11 @@ public class DistCommon ...@@ -2349,11 +2559,11 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs.close(); //rs.close();
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
rs=null; //rs=null;
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -2383,18 +2593,25 @@ public class DistCommon ...@@ -2383,18 +2593,25 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
System.out.println("Rate sql ..."+sql); //System.out.println("Rate sql ..."+sql);
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
unit = rs.getString(2); unit = rs.getString(2);
System.out.println("The rate for type (L) is.... "+rate); //System.out.println("The rate for type (L) is.... "+rate);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
} }
else else
{ {
try try
{//try 2 {//try 2
rs.close(); rs.close();
pstmt.close();
pstmt = null;
rs = null;
sql = "SELECT RATE,UNIT FROM PRICELIST " sql = "SELECT RATE,UNIT FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' " + "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' " + "AND ITEM_CODE = '"+itemCode+"' "
...@@ -2411,24 +2628,34 @@ public class DistCommon ...@@ -2411,24 +2628,34 @@ public class DistCommon
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
unit = rs.getString(2); unit = rs.getString(2);
System.out.println("The rate for type (L) is.... "+rate); //System.out.println("The rate for type (L) is.... "+rate);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
} }
else else
{ {
try try
{//try 3 {//try 3
rs.close(); rs.close();
pstmt.close();
pstmt = null;
rs = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'L'"; //+ "AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
System.out.println("The priceListParent is .... "+priceListParent); //System.out.println("The priceListParent is .... "+priceListParent);
} }
rs.close(); rs.close();
pstmt.close();
pstmt = null;
rs = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -2457,13 +2684,20 @@ public class DistCommon ...@@ -2457,13 +2684,20 @@ public class DistCommon
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
unit = rs2.getString(2); unit = rs2.getString(2);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
} }
else else
{ {
try try
{//try 5 {//try 5
rs2.close(); rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
sql = "SELECT RATE,UNIT FROM PRICELIST " sql = "SELECT RATE,UNIT FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' " + "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' " + "AND ITEM_CODE = '"+itemCode+"' "
...@@ -2476,15 +2710,23 @@ public class DistCommon ...@@ -2476,15 +2710,23 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery(); rs2 = pstmt.executeQuery();
System.out.println("The priceListParent sql .. "+sql); //System.out.println("The priceListParent sql .. "+sql);
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
unit = rs2.getString(2); unit = rs2.getString(2);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
} }
else else
{ {
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
return -1; return -1;
} }
}//try 5 }//try 5
...@@ -2495,7 +2737,7 @@ public class DistCommon ...@@ -2495,7 +2737,7 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs2.close(); // rs2.close();
}//try 4 }//try 4
catch(Exception e) catch(Exception e)
{ {
...@@ -2524,18 +2766,25 @@ public class DistCommon ...@@ -2524,18 +2766,25 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs3 = pstmt.executeQuery(); rs3 = pstmt.executeQuery();
System.out.println("Sql .. "+sql); //System.out.println("Sql .. "+sql);
if(rs3.next()) if(rs3.next())
{ {
rate = rs3.getDouble(1); rate = rs3.getDouble(1);
unit = rs3.getString(2); unit = rs3.getString(2);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs3.close();
pstmt.close();
pstmt = null;
rs3 = null;
} }
else else
{ {
try try
{//try 7 {//try 7
rs3.close(); rs3.close();
pstmt.close();
pstmt = null;
rs3 = null;
sql = "SELECT RATE,UNIT FROM PRICELIST " sql = "SELECT RATE,UNIT FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' " + "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' " + "AND ITEM_CODE = '"+itemCode+"' "
...@@ -2550,28 +2799,39 @@ public class DistCommon ...@@ -2550,28 +2799,39 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs3 = pstmt.executeQuery(); rs3 = pstmt.executeQuery();
System.out.println("Sql .. "+sql); //System.out.println("Sql .. "+sql);
if(rs3.next()) if(rs3.next())
{ {
rate = rs3.getDouble(1); rate = rs3.getDouble(1);
unit = rs3.getString(2); unit = rs3.getString(2);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs3.close();
pstmt.close();
pstmt = null;
rs3 = null;
} }
else else
{ {
try try
{//try 8 {//try 8
rs3.close(); rs3.close();
pstmt.close();
pstmt = null;
rs3 = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'B'"; //+ "AND LIST_TYPE = 'B'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs3 = pstmt.executeQuery(); rs3 = pstmt.executeQuery();
while (rs3.next()) if (rs3.next())
{ {
priceListParent = rs3.getString(1); priceListParent = rs3.getString(1);
System.out.println("The priceListParent is .... "+priceListParent); //System.out.println("The priceListParent is .... "+priceListParent);
} }
rs3.close();
pstmt.close();
pstmt = null;
rs3 = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -2597,16 +2857,23 @@ public class DistCommon ...@@ -2597,16 +2857,23 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs4 = pstmt.executeQuery(); rs4 = pstmt.executeQuery();
System.out.println("Sql .. "+sql); //System.out.println("Sql .. "+sql);
if(rs4.next()) if(rs4.next())
{ {
rate = rs4.getDouble(1); rate = rs4.getDouble(1);
unit = rs4.getString(2); unit = rs4.getString(2);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs4.close();
pstmt.close();
pstmt = null;
rs4 = null;
} }
else else
{ {
rs4.close(); rs4.close();
pstmt.close();
pstmt = null;
rs4 = null;
try try
{//try 10 {//try 10
sql = "SELECT RATE,UNIT FROM PRICELIST " sql = "SELECT RATE,UNIT FROM PRICELIST "
...@@ -2623,15 +2890,23 @@ public class DistCommon ...@@ -2623,15 +2890,23 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs4 = pstmt.executeQuery(); rs4 = pstmt.executeQuery();
System.out.println("Sql .. "+sql); //System.out.println("Sql .. "+sql);
if(rs4.next()) if(rs4.next())
{ {
rate = rs4.getDouble(1); rate = rs4.getDouble(1);
unit = rs4.getString(2); unit = rs4.getString(2);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs4.close();
pstmt.close();
pstmt = null;
rs4 = null;
} }
else else
{ {
rs4.close();
pstmt.close();
pstmt = null;
rs4 = null;
return -1; return -1;
} }
}//try 10 }//try 10
...@@ -2642,7 +2917,7 @@ public class DistCommon ...@@ -2642,7 +2917,7 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs4.close(); //rs4.close();
}//try 9 }//try 9
catch(Exception e) catch(Exception e)
{ {
...@@ -2659,7 +2934,7 @@ public class DistCommon ...@@ -2659,7 +2934,7 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs3.close(); //rs3.close();
}//try 7 }//try 7
catch(Exception e) catch(Exception e)
{ {
...@@ -2668,7 +2943,7 @@ public class DistCommon ...@@ -2668,7 +2943,7 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs3.close(); //rs3.close();
}//try 6 }//try 6
catch(Exception e) catch(Exception e)
{ {
...@@ -2685,8 +2960,8 @@ public class DistCommon ...@@ -2685,8 +2960,8 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else }//else
rs.close(); //rs.close();
rs=null; //rs=null;
}//try 2 }//try 2
catch(Exception e) catch(Exception e)
{ {
...@@ -2695,10 +2970,10 @@ public class DistCommon ...@@ -2695,10 +2970,10 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs.close(); // rs.close();
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -2733,13 +3008,20 @@ public class DistCommon ...@@ -2733,13 +3008,20 @@ public class DistCommon
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
unit = rs.getString(2); unit = rs.getString(2);
System.out.println("The rate for type (B) is.... "+rate); //System.out.println("The rate for type (B) is.... "+rate);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
} }
else else
{ {
try try
{//try 2 {//try 2
rs.close(); rs.close();
pstmt.close();
pstmt = null;
rs = null;
sql = "SELECT RATE,UNIT FROM PRICELIST " sql = "SELECT RATE,UNIT FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' " + "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' " + "AND ITEM_CODE = '"+itemCode+"' "
...@@ -2758,23 +3040,34 @@ public class DistCommon ...@@ -2758,23 +3040,34 @@ public class DistCommon
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
unit = rs.getString(2); unit = rs.getString(2);
System.out.println("The rate for type (L) is.... "+rate); //System.out.println("The rate for type (L) is.... "+rate);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
} }
else else
{ {
try try
{//try 3 {//try 3
rs.close(); rs.close();
pstmt.close();
pstmt = null;
rs = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'B'"; //+ "AND LIST_TYPE = 'B'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
System.out.println("The priceListParent is .... "+priceListParent); //System.out.println("The priceListParent is .... "+priceListParent);
} }
rs.close();
pstmt.close();
pstmt = null;
rs = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -2805,13 +3098,20 @@ public class DistCommon ...@@ -2805,13 +3098,20 @@ public class DistCommon
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
unit = rs2.getString(2); unit = rs2.getString(2);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
} }
else else
{ {
try try
{//try 5 {//try 5
rs2.close(); rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
sql = "SELECT RATE,UNIT FROM PRICELIST " sql = "SELECT RATE,UNIT FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' " + "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' " + "AND ITEM_CODE = '"+itemCode+"' "
...@@ -2826,15 +3126,23 @@ public class DistCommon ...@@ -2826,15 +3126,23 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery(); rs2 = pstmt.executeQuery();
System.out.println("The priceListParent sql .. "+sql); //System.out.println("The priceListParent sql .. "+sql);
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
unit = rs2.getString(2); unit = rs2.getString(2);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
} }
else else
{ {
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
return -1; return -1;
} }
}//try 5 }//try 5
...@@ -2845,7 +3153,7 @@ public class DistCommon ...@@ -2845,7 +3153,7 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs.close(); //rs.close();
}//try 4 }//try 4
catch(Exception e) catch(Exception e)
{ {
...@@ -2870,11 +3178,11 @@ public class DistCommon ...@@ -2870,11 +3178,11 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs.close(); //rs.close();
rs=null; //rs=null;
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -2890,7 +3198,7 @@ public class DistCommon ...@@ -2890,7 +3198,7 @@ public class DistCommon
rate = convQtyFactor(aunit,unit,itemCode,conv,conn); rate = convQtyFactor(aunit,unit,itemCode,conv,conn);
} }
} }
System.out.println("Rate From DisCommon***:::::["+rate+"]"); //System.out.println("Rate From DisCommon***:::::["+rate+"]");
return(rate); return(rate);
}//pickRate() }//pickRate()
...@@ -2920,22 +3228,22 @@ public class DistCommon ...@@ -2920,22 +3228,22 @@ public class DistCommon
{ {
trDate = genericUtility.getValidDateString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()); trDate = genericUtility.getValidDateString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
tranDate = java.sql.Timestamp.valueOf(trDate + " 00:00:00"); tranDate = java.sql.Timestamp.valueOf(trDate + " 00:00:00");
System.out.println("Date in pickRate...."+tranDate); //System.out.println("Date in pickRate...."+tranDate);
if (aLotNo.indexOf("~t") > 0) if (aLotNo.indexOf("~t") > 0)
{ {
siteCode = getTokenList(aLotNo,"~t"); siteCode = getTokenList(aLotNo,"~t");
locCode = getTokenList(aLotNo,"~t"); locCode = getTokenList(aLotNo,"~t");
lotNo = getTokenList(aLotNo,"~t"); lotNo = getTokenList(aLotNo,"~t");
lotSl = getTokenList(aLotNo,"~t"); lotSl = getTokenList(aLotNo,"~t");
System.out.println("siteCode..**..*>"+siteCode); ///System.out.println("siteCode..**..*>"+siteCode);
System.out.println("locCode..**..*>"+locCode); //System.out.println("locCode..**..*>"+locCode);
System.out.println("lotNo..**..*>"+lotNo); //System.out.println("lotNo..**..*>"+lotNo);
System.out.println("lotSl..**..*>"+lotSl); //System.out.println("lotSl..**..*>"+lotSl);
} }
else else
{ {
lotNo = aLotNo; lotNo = aLotNo;
System.out.println("lotNo..**..*>"+lotNo); //System.out.println("lotNo..**..*>"+lotNo);
} }
}//try }//try
catch(Exception e) catch(Exception e)
...@@ -2947,7 +3255,7 @@ public class DistCommon ...@@ -2947,7 +3255,7 @@ public class DistCommon
if(type.trim().equals("L")) //LIST PRICE if(type.trim().equals("L")) //LIST PRICE
{ {
rate = 0; rate = 0;
System.out.println("Inside type ::-<L>-::"); //System.out.println("Inside type ::-<L>-::");
try try
{//try 1 {//try 1
sql = "SELECT RATE FROM PRICELIST " sql = "SELECT RATE FROM PRICELIST "
...@@ -2962,29 +3270,40 @@ public class DistCommon ...@@ -2962,29 +3270,40 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
System.out.println("Rate sql ..."+sql); //System.out.println("Rate sql ..."+sql);
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
} }
else else
{ {
try try
{//try 2 {//try 2
rs.close(); rs.close();
pstmt.close();
pstmt = null;
rs = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'L'"; //+ "AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
} }
rs.close();
pstmt.close();
pstmt = null;
rs = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
System.out.println("The priceListParent if null .... "+priceListParent); //System.out.println("The priceListParent if null .... "+priceListParent);
return -1; return -1;
} }
if(priceListParent.trim().length() > 0) if(priceListParent.trim().length() > 0)
...@@ -3003,13 +3322,21 @@ public class DistCommon ...@@ -3003,13 +3322,21 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery(); rs2 = pstmt.executeQuery();
System.out.println("The priceListParent sql .. "+sql); //System.out.println("The priceListParent sql .. "+sql);
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
} }
else else
{ {
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
return -1; return -1;
} }
}//try 3 }//try 3
...@@ -3028,10 +3355,10 @@ public class DistCommon ...@@ -3028,10 +3355,10 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs.close(); //rs.close();
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -3058,31 +3385,41 @@ public class DistCommon ...@@ -3058,31 +3385,41 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
System.out.println("Rate sql ..."+sql); //System.out.println("Rate sql ..."+sql);
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
} }
else else
{ {
try try
{//try 2 {//try 2
rs.close(); rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'L'"; //+ "AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
} }
rs.close(); rs.close();
pstmt.close();
pstmt = null;
rs = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
System.out.println("The priceListParent if null .... "+priceListParent); //System.out.println("The priceListParent if null .... "+priceListParent);
return -1; return -1;
} }
if(priceListParent.trim().length() > 0) if(priceListParent.trim().length() > 0)
...@@ -3105,9 +3442,17 @@ public class DistCommon ...@@ -3105,9 +3442,17 @@ public class DistCommon
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
} }
else else
{ {
rs2.close();
pstmt.close();
pstmt = null;
rs2 = null;
return -1; return -1;
} }
}//try 3 }//try 3
...@@ -3126,10 +3471,10 @@ public class DistCommon ...@@ -3126,10 +3471,10 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs.close(); //rs.close();
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -3156,26 +3501,37 @@ public class DistCommon ...@@ -3156,26 +3501,37 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
System.out.println("Rate sql ..."+sql); //System.out.println("Rate sql ..."+sql);
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
} }
else else
{ {
try try
{//try 2 {//try 2
rs.close(); rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'L'"; //+ "AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -3201,6 +3557,10 @@ public class DistCommon ...@@ -3201,6 +3557,10 @@ public class DistCommon
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
...@@ -3208,7 +3568,10 @@ public class DistCommon ...@@ -3208,7 +3568,10 @@ public class DistCommon
try try
{//try 4 {//try 4
rs2.close(); rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
sql = "SELECT RATE FROM PRICELIST " sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' " + "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' " + "AND ITEM_CODE = '"+itemCode+"' "
...@@ -3226,22 +3589,33 @@ public class DistCommon ...@@ -3226,22 +3589,33 @@ public class DistCommon
if (rs2.next()) if (rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
try try
{//try 5 {//try 5
rs2.close(); rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'B'"; //+ "AND LIST_TYPE = 'B'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs2 = pstmt.executeQuery(); rs2 = pstmt.executeQuery();
while (rs2.next()) if (rs2.next())
{ {
priceListParent = rs2.getString(1); priceListParent = rs2.getString(1);
System.out.println("The priceListParent is .... "+priceListParent); //System.out.println("The priceListParent is .... "+priceListParent);
} }
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -3270,9 +3644,17 @@ public class DistCommon ...@@ -3270,9 +3644,17 @@ public class DistCommon
if(rs3.next()) if(rs3.next())
{ {
rate = rs3.getDouble(1); rate = rs3.getDouble(1);
rs3.close();
rs3 = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
rs3.close();
rs3 = null;
pstmt.close();
pstmt = null;
return -1; return -1;
} }
}//try 6 }//try 6
...@@ -3299,7 +3681,7 @@ public class DistCommon ...@@ -3299,7 +3681,7 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs2.close(); //rs2.close();
}//try 3 }//try 3
catch(Exception e) catch(Exception e)
{ {
...@@ -3316,10 +3698,10 @@ public class DistCommon ...@@ -3316,10 +3698,10 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs.close(); //rs.close();
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -3351,23 +3733,33 @@ public class DistCommon ...@@ -3351,23 +3733,33 @@ public class DistCommon
if (rs.next()) if (rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
try try
{//try 2 {//try 2
rs.close(); rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'B'"; //+ "AND LIST_TYPE = 'B'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs2 = pstmt.executeQuery(); rs2 = pstmt.executeQuery();
while (rs2.next()) if (rs2.next())
{ {
priceListParent = rs2.getString(1); priceListParent = rs2.getString(1);
System.out.println("The priceListParent is .... "+priceListParent); //System.out.println("The priceListParent is .... "+priceListParent);
} }
rs2.close(); rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -3392,13 +3784,21 @@ public class DistCommon ...@@ -3392,13 +3784,21 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs2 = pstmt.executeQuery(); rs2 = pstmt.executeQuery();
System.out.println("The priceListParent sql .. "+sql); //System.out.println("The priceListParent sql .. "+sql);
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
return -1; return -1;
} }
}//try 3 }//try 3
...@@ -3417,10 +3817,10 @@ public class DistCommon ...@@ -3417,10 +3817,10 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
rs.close(); //rs.close();
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try1 }//try1
catch(Exception e) catch(Exception e)
{ {
...@@ -3449,28 +3849,38 @@ public class DistCommon ...@@ -3449,28 +3849,38 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
System.out.println("Rate sql ..."+sql); //System.out.println("Rate sql ..."+sql);
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
type = getPriceListType(priceList,conn); type = getPriceListType(priceList,conn);
try try
{//try 2 {//try 2
rs.close(); rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = '"+type+"'"; //+ "AND LIST_TYPE = '"+type+"'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
System.out.println("The priceListParent is .... "+priceListParent); //System.out.println("The priceListParent is .... "+priceListParent);
} }
rs.close(); rs.close();
rs = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -3498,10 +3908,18 @@ public class DistCommon ...@@ -3498,10 +3908,18 @@ public class DistCommon
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
System.out.println("The rate inside priceListParent is ..."+rate); //System.out.println("The rate inside priceListParent is ..."+rate);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
return -1; return -1;
} }
}//try 3 }//try 3
...@@ -3519,11 +3937,11 @@ public class DistCommon ...@@ -3519,11 +3937,11 @@ public class DistCommon
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
}//else }//else
rs.close(); //rs.close();
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -3548,12 +3966,15 @@ public class DistCommon ...@@ -3548,12 +3966,15 @@ public class DistCommon
+ "AND LOT_NO = '"+lotNo+"'"; + "AND LOT_NO = '"+lotNo+"'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
System.out.println("Rate is .*...."+rate); //System.out.println("Rate is .*...."+rate);
} }
rs.close(); rs.close();
rs = null;
pstmt.close();
pstmt = null;
}//try }//try
catch(Exception e) catch(Exception e)
{ {
...@@ -3577,9 +3998,12 @@ public class DistCommon ...@@ -3577,9 +3998,12 @@ public class DistCommon
if (rs.next()) if (rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
System.out.println("Rate is .*...."+rate); //System.out.println("Rate is .*...."+rate);
} }
rs.close(); rs.close();
rs = null;
pstmt.close();
pstmt = null;
}//try }//try
catch(Exception e) catch(Exception e)
{ {
...@@ -3589,7 +4013,7 @@ public class DistCommon ...@@ -3589,7 +4013,7 @@ public class DistCommon
} }
}//else }//else
}//if(type.trim().equals("I")) //Inventory }//if(type.trim().equals("I")) //Inventory
System.out.println("Rate From DisCommon***:::::["+rate+"]"); //System.out.println("Rate From DisCommon***:::::["+rate+"]");
return(rate); return(rate);
}//pickRate() }//pickRate()
...@@ -3617,22 +4041,22 @@ public class DistCommon ...@@ -3617,22 +4041,22 @@ public class DistCommon
{ {
trDate = genericUtility.getValidDateString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()); trDate = genericUtility.getValidDateString(trDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
tranDate = java.sql.Timestamp.valueOf(trDate + " 00:00:00"); tranDate = java.sql.Timestamp.valueOf(trDate + " 00:00:00");
System.out.println("Date in pickRate...."+tranDate); //System.out.println("Date in pickRate...."+tranDate);
if (aLotNo.indexOf("~t") > 0) if (aLotNo.indexOf("~t") > 0)
{ {
siteCode = getTokenList(aLotNo,"~t"); siteCode = getTokenList(aLotNo,"~t");
locCode = getTokenList(aLotNo,"~t"); locCode = getTokenList(aLotNo,"~t");
lotNo = getTokenList(aLotNo,"~t"); lotNo = getTokenList(aLotNo,"~t");
lotSl = getTokenList(aLotNo,"~t"); lotSl = getTokenList(aLotNo,"~t");
System.out.println("siteCode..**..*>"+siteCode); //System.out.println("siteCode..**..*>"+siteCode);
System.out.println("locCode..**..*>"+locCode); //System.out.println("locCode..**..*>"+locCode);
System.out.println("lotNo..**..*>"+lotNo); //System.out.println("lotNo..**..*>"+lotNo);
System.out.println("lotSl..**..*>"+lotSl); //System.out.println("lotSl..**..*>"+lotSl);
} }
else else
{ {
lotNo = aLotNo; lotNo = aLotNo;
System.out.println("lotNo..**..*>"+lotNo); //System.out.println("lotNo..**..*>"+lotNo);
} }
}//try }//try
catch(Exception e) catch(Exception e)
...@@ -3647,7 +4071,7 @@ public class DistCommon ...@@ -3647,7 +4071,7 @@ public class DistCommon
if(type.trim().equals("L")) //LIST PRICE if(type.trim().equals("L")) //LIST PRICE
{ {
rate = 0; rate = 0;
System.out.println("Inside type ::-<L>-::"); //System.out.println("Inside type ::-<L>-::");
try try
{//try 1 {//try 1
sql = "SELECT RATE FROM PRICELIST " sql = "SELECT RATE FROM PRICELIST "
...@@ -3666,24 +4090,36 @@ public class DistCommon ...@@ -3666,24 +4090,36 @@ public class DistCommon
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
try try
{//try 2 {//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) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'L'"; //+ "AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
System.out.println("The priceListParent if null .... "+priceListParent); //System.out.println("The priceListParent if null .... "+priceListParent);
return -1; return -1;
} }
if(priceListParent.trim().length() > 0) if(priceListParent.trim().length() > 0)
...@@ -3706,9 +4142,17 @@ public class DistCommon ...@@ -3706,9 +4142,17 @@ public class DistCommon
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
return -1; return -1;
} }
}//try 3 }//try 3
...@@ -3727,9 +4171,9 @@ public class DistCommon ...@@ -3727,9 +4171,9 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -3760,21 +4204,33 @@ public class DistCommon ...@@ -3760,21 +4204,33 @@ public class DistCommon
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
try try
{//try 2 {//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) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'L'"; //+ "AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -3801,9 +4257,17 @@ public class DistCommon ...@@ -3801,9 +4257,17 @@ public class DistCommon
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
return -1; return -1;
} }
}//try 3 }//try 3
...@@ -3822,9 +4286,9 @@ public class DistCommon ...@@ -3822,9 +4286,9 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -3851,25 +4315,37 @@ public class DistCommon ...@@ -3851,25 +4315,37 @@ public class DistCommon
pstmt.setTimestamp(1,tranDate); pstmt.setTimestamp(1,tranDate);
pstmt.setTimestamp(2,tranDate); pstmt.setTimestamp(2,tranDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
System.out.println("Rate sql ..."+sql); //System.out.println("Rate sql ..."+sql);
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
try try
{//try 2 {//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) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'L'"; //+ "AND LIST_TYPE = 'L'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -3895,12 +4371,20 @@ public class DistCommon ...@@ -3895,12 +4371,20 @@ public class DistCommon
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
rate = 0; rate = 0;
try try
{//try 4 {//try 4
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
sql = "SELECT RATE FROM PRICELIST " sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceList+"' " + "WHERE PRICE_LIST = '"+priceList+"' "
+ "AND ITEM_CODE = '"+itemCode+"' " + "AND ITEM_CODE = '"+itemCode+"' "
...@@ -3918,21 +4402,33 @@ public class DistCommon ...@@ -3918,21 +4402,33 @@ public class DistCommon
if (rs2.next()) if (rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
try try
{//try 5 {//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) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'B'"; //+ "AND LIST_TYPE = 'B'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs2 = pstmt.executeQuery(); rs2 = pstmt.executeQuery();
while (rs2.next()) if (rs2.next())
{ {
priceListParent = rs2.getString(1); priceListParent = rs2.getString(1);
System.out.println("The priceListParent is .... "+priceListParent); //System.out.println("The priceListParent is .... "+priceListParent);
} }
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -3943,6 +4439,10 @@ public class DistCommon ...@@ -3943,6 +4439,10 @@ public class DistCommon
{ {
try try
{//try 6 {//try 6
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
sql = "SELECT RATE FROM PRICELIST " sql = "SELECT RATE FROM PRICELIST "
+ "WHERE PRICE_LIST = '"+priceListParent+"' " + "WHERE PRICE_LIST = '"+priceListParent+"' "
+ "AND ITEM_CODE = '"+itemCode+"' " + "AND ITEM_CODE = '"+itemCode+"' "
...@@ -3961,9 +4461,17 @@ public class DistCommon ...@@ -3961,9 +4461,17 @@ public class DistCommon
if(rs3.next()) if(rs3.next())
{ {
rate = rs3.getDouble(1); rate = rs3.getDouble(1);
rs3.close();
rs3 = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
rs3.close();
rs3 = null;
pstmt.close();
pstmt = null;
return -1; return -1;
} }
}//try 6 }//try 6
...@@ -4006,9 +4514,9 @@ public class DistCommon ...@@ -4006,9 +4514,9 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -4040,21 +4548,33 @@ public class DistCommon ...@@ -4040,21 +4548,33 @@ public class DistCommon
if (rs.next()) if (rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
try try
{//try 2 {//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) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = 'B'"; //+ "AND LIST_TYPE = 'B'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs2 = pstmt.executeQuery(); rs2 = pstmt.executeQuery();
while (rs2.next()) if (rs2.next())
{ {
priceListParent = rs2.getString(1); priceListParent = rs2.getString(1);
System.out.println("The priceListParent is .... "+priceListParent); //System.out.println("The priceListParent is .... "+priceListParent);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -4083,9 +4603,17 @@ public class DistCommon ...@@ -4083,9 +4603,17 @@ public class DistCommon
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
return -1; return -1;
} }
}//try 3 }//try 3
...@@ -4104,9 +4632,9 @@ public class DistCommon ...@@ -4104,9 +4632,9 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else if }//else if
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try1 }//try1
catch(Exception e) catch(Exception e)
{ {
...@@ -4139,22 +4667,34 @@ public class DistCommon ...@@ -4139,22 +4667,34 @@ public class DistCommon
if(rs.next()) if(rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
else else
{ {
type = getPriceListType(priceList,conn); type = getPriceListType(priceList,conn);
try try
{//try 2 {//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) " sql = "SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) "
+ "FROM PRICELIST WHERE PRICE_LIST = '"+priceList+"' " + "FROM pricelist_mst WHERE PRICE_LIST = '"+priceList+"' ";
+ "AND LIST_TYPE = '"+type+"'"; //+ "AND LIST_TYPE = '"+type+"'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
priceListParent = rs.getString(1); priceListParent = rs.getString(1);
System.out.println("The priceListParent is .... "+priceListParent); System.out.println("The priceListParent is .... "+priceListParent);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if((priceListParent == null) || (priceListParent.trim().length() == 0)) if((priceListParent == null) || (priceListParent.trim().length() == 0))
{ {
priceListParent = ""; priceListParent = "";
...@@ -4182,10 +4722,18 @@ public class DistCommon ...@@ -4182,10 +4722,18 @@ public class DistCommon
if(rs2.next()) if(rs2.next())
{ {
rate = rs2.getDouble(1); rate = rs2.getDouble(1);
System.out.println("The rate inside priceListParent is ..."+rate); rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
//System.out.println("The rate inside priceListParent is ..."+rate);
} }
else else
{ {
rs2.close();
rs2 = null;
pstmt.close();
pstmt = null;
return -1; return -1;
} }
}//try 3 }//try 3
...@@ -4204,9 +4752,9 @@ public class DistCommon ...@@ -4204,9 +4752,9 @@ public class DistCommon
throw new ITMException(e); throw new ITMException(e);
} }
}//else }//else
pstmt.clearParameters(); //pstmt.clearParameters();
pstmt.close(); //pstmt.close();
pstmt = null; //pstmt = null;
}//try 1 }//try 1
catch(Exception e) catch(Exception e)
{ {
...@@ -4231,10 +4779,14 @@ public class DistCommon ...@@ -4231,10 +4779,14 @@ public class DistCommon
+ "AND LOT_NO = '"+lotNo+"'"; + "AND LOT_NO = '"+lotNo+"'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) if (rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
System.out.println("Rate is .*...."+rate); //System.out.println("Rate is .*...."+rate);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
}//try }//try
catch(Exception e) catch(Exception e)
...@@ -4259,8 +4811,12 @@ public class DistCommon ...@@ -4259,8 +4811,12 @@ public class DistCommon
if (rs.next()) if (rs.next())
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
System.out.println("Rate is .*...."+rate); //System.out.println("Rate is .*...."+rate);
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}//try }//try
catch(Exception e) catch(Exception e)
{ {
...@@ -4305,7 +4861,10 @@ public class DistCommon ...@@ -4305,7 +4861,10 @@ public class DistCommon
count = rs.getInt("COUNT"); count = rs.getInt("COUNT");
System.out.println("Count........1 "+count); System.out.println("Count........1 "+count);
} }
rs.close();
pstmt.close(); pstmt.close();
rs = null;
pstmt = null;
}//try }//try
catch(Exception e) catch(Exception e)
{ {
...@@ -4328,10 +4887,12 @@ public class DistCommon ...@@ -4328,10 +4887,12 @@ public class DistCommon
if(rs.next()) if(rs.next())
{ {
count = rs.getInt("COUNT"); count = rs.getInt("COUNT");
System.out.println("Count........2 "+count); //System.out.println("Count........2 "+count);
} }
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
rs.close();
rs = null;
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -4362,6 +4923,8 @@ public class DistCommon ...@@ -4362,6 +4923,8 @@ public class DistCommon
roundTo = rs.getDouble(3); roundTo = rs.getDouble(3);
System.out.println("fact........"+fact); System.out.println("fact........"+fact);
} }
rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
...@@ -4393,6 +4956,8 @@ public class DistCommon ...@@ -4393,6 +4956,8 @@ public class DistCommon
roundTo = rs.getDouble(3); roundTo = rs.getDouble(3);
System.out.println("fact........"+fact); System.out.println("fact........"+fact);
} }
rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
...@@ -4461,6 +5026,7 @@ public class DistCommon ...@@ -4461,6 +5026,7 @@ public class DistCommon
else else
{ {
sql="SELECT FACT, ROUND, ROUND_TO FROM UOMCONV WHERE UNIT__FR='"+toUom.trim()+"' AND UNIT__TO='"+frUom.trim()+"' AND ITEM_CODE='"+forItem.trim()+"'"; sql="SELECT FACT, ROUND, ROUND_TO FROM UOMCONV WHERE UNIT__FR='"+toUom.trim()+"' AND UNIT__TO='"+frUom.trim()+"' AND ITEM_CODE='"+forItem.trim()+"'";
conRs.close();
conRs = null; conRs = null;
conRs = stmt.executeQuery(sql); conRs = stmt.executeQuery(sql);
if (conRs.next()) if (conRs.next())
...@@ -4472,7 +5038,7 @@ public class DistCommon ...@@ -4472,7 +5038,7 @@ public class DistCommon
} }
else else
{ {
conRs.close();
conRs = null; conRs = null;
sql="SELECT FACT, ROUND, ROUND_TO FROM UOMCONV WHERE UNIT__FR='"+frUom.trim()+"' AND UNIT__TO='"+toUom.trim()+"' AND ITEM_CODE='X'"; sql="SELECT FACT, ROUND, ROUND_TO FROM UOMCONV WHERE UNIT__FR='"+frUom.trim()+"' AND UNIT__TO='"+toUom.trim()+"' AND ITEM_CODE='X'";
conRs = stmt.executeQuery(sql); conRs = stmt.executeQuery(sql);
...@@ -4486,6 +5052,7 @@ public class DistCommon ...@@ -4486,6 +5052,7 @@ public class DistCommon
else else
{ {
conRs.close();
conRs = null; conRs = null;
sql="SELECT FACT, ROUND, ROUND_TO FROM UOMCONV WHERE UNIT__FR='"+toUom.trim()+"' AND UNIT__TO='"+frUom.trim()+"' AND ITEM_CODE='X'"; sql="SELECT FACT, ROUND, ROUND_TO FROM UOMCONV WHERE UNIT__FR='"+toUom.trim()+"' AND UNIT__TO='"+frUom.trim()+"' AND ITEM_CODE='X'";
conRs = stmt.executeQuery(sql); conRs = stmt.executeQuery(sql);
...@@ -4506,6 +5073,10 @@ public class DistCommon ...@@ -4506,6 +5073,10 @@ public class DistCommon
} }
} }
} }
conRs.close();
conRs = null;
stmt.close();
stmt = null;
// Check whether conversion factor need to be assigned // Check whether conversion factor need to be assigned
if (fact == 0) if (fact == 0)
{ {
...@@ -4812,7 +5383,10 @@ public class DistCommon ...@@ -4812,7 +5383,10 @@ public class DistCommon
count = rs.getInt("COUNT"); count = rs.getInt("COUNT");
System.out.println("Count........1 "+count); System.out.println("Count........1 "+count);
} }
rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null;
}//try }//try
catch(Exception e) catch(Exception e)
{ {
...@@ -4837,6 +5411,8 @@ public class DistCommon ...@@ -4837,6 +5411,8 @@ public class DistCommon
count = rs.getInt("COUNT"); count = rs.getInt("COUNT");
System.out.println("Count........2 "+count); System.out.println("Count........2 "+count);
} }
rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
...@@ -4881,6 +5457,8 @@ public class DistCommon ...@@ -4881,6 +5457,8 @@ public class DistCommon
roundTo = rs.getDouble(3); roundTo = rs.getDouble(3);
System.out.println("fact........"+fact); System.out.println("fact........"+fact);
} }
rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
...@@ -4912,6 +5490,8 @@ public class DistCommon ...@@ -4912,6 +5490,8 @@ public class DistCommon
roundTo = rs.getDouble(3); roundTo = rs.getDouble(3);
System.out.println("fact........"+fact); System.out.println("fact........"+fact);
} }
rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
...@@ -5419,6 +5999,186 @@ public class DistCommon ...@@ -5419,6 +5999,186 @@ public class DistCommon
{ {
switch(type) switch(type)
{ {
case 'B' :
double lcRemainder = 0.0;
double lcCapacity = 0.0;
sql = "select (case when capacity is null then 0 else capacity end) lc_capacity "
+" from packing "
+" where pack_code = ? "; //:as_pack_code;
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, packCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
lcCapacity = rs.getDouble( "lc_capacity" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
double lcReoQty = 0.0;
sql = "select ( case when reo_qty is null then 0 else reo_qty end ) lc_reo_qty "
+" from siteitem "
+" where site_code = ? "//:as_site_code
+" and item_code = ? "; //:as_item_code;
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, siteCode );
pstmt.setString( 2, itemCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
lcReoQty = rs.getDouble( "lc_reo_qty" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( lcReoQty == 0 )
{
sql = " select ( case when reo_qty is null then 0 else reo_qty end ) lc_reo_qty "
+" from item "
+" where item_code = ? "; //:as_item_code;
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, itemCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
lcReoQty = rs.getDouble( "lc_reo_qty" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
double lcShipperQty = 0.0;
if( lcCapacity > 0 )
{
lcShipperQty = lcCapacity;
}
else
{
lcShipperQty = lcReoQty;
}
double modResult = 0.0;
if( lcShipperQty > 0 )
{
sql = "select mod(?,?) result from dual";
pstmt = conn.prepareStatement( sql );
pstmt.setDouble( 1, acQty );
pstmt.setDouble( 2, lcShipperQty );
rs = pstmt.executeQuery();
if( rs.next() )
{
modResult = rs.getDouble( "result" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
liNoArt1 = (acQty - modResult ) / lcShipperQty;
lcRemainder = modResult;
}
int integralQty = 0;
sql = "select ( case when integral_qty is null then 0 else integral_qty end ) lc_integral_qty "
+" from customeritem "
+" where cust_code = ? " //:as_cust_code
+" and item_code = ? ";//:as_item_code;
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, custCode );
pstmt.setString( 2, itemCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
integralQty = rs.getInt( "lc_integral_qty" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if ( integralQty == 0 )
{
sql = " select ( case when integral_qty is null then 0 else integral_qty end ) lc_integral_qty "
+" from siteitem "
+" where site_code = ? "//:as_site_code
+" and item_code = ? ";//:as_item_code;
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, siteCode );
pstmt.setString( 2, itemCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
integralQty = rs.getInt( "lc_integral_qty" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( integralQty == 0 )
{
sql = "select (case when integral_qty is null then 0 else integral_qty end) lc_integral_qty "
+" from item "
+" where item_code = ? ";//:as_item_code;
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, itemCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
integralQty = rs.getInt( "lc_integral_qty" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
if( lcIntegralQty > 0 )
{
sql = "select mod(?,?) result from dual";
pstmt = conn.prepareStatement( sql );
pstmt.setDouble( 1, lcRemainder );
pstmt.setDouble( 2, lcIntegralQty );
rs = pstmt.executeQuery();
if( rs.next() )
{
modResult = rs.getDouble( "result" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
liNoArt2 = ( lcRemainder - modResult / lcIntegralQty );
}
if( liNoArt2 > 0 )
{
liNoArt2 = 1;
}
liNoArt = liNoArt1 + liNoArt2;
break;
case 'S': case 'S':
sql="select (case when capacity is null then 0 else capacity end) " sql="select (case when capacity is null then 0 else capacity end) "
+"from packing " +"from packing "
...@@ -7080,8 +7840,22 @@ public String getTaxChap(String itemCode,String itemSer, String suppOrCustCode,S ...@@ -7080,8 +7840,22 @@ public String getTaxChap(String itemCode,String itemSer, String suppOrCustCode,S
} }
return taxChap ; return taxChap ;
} }
public java.sql.Timestamp CalcExpiry(java.sql.Timestamp date, double shelfLife) throws Exception
{
// end of getTaxchap UtilMethods utilMethods = UtilMethods.getInstance();
java.sql.Timestamp expDate = null;
int lastDay = 0, iShelfLife = 0;
iShelfLife = (int)shelfLife;
expDate = utilMethods.AddMonths(date, iShelfLife);
Calendar cal = Calendar.getInstance();
cal.setTime(expDate);
lastDay = cal.getMaximum(Calendar.DAY_OF_MONTH);
cal.set(Calendar.DAY_OF_MONTH,lastDay);
java.util.Date newDate = cal.getTime();
SimpleDateFormat sdt = new SimpleDateFormat("yyyy-MM-dd");
expDate = java.sql.Timestamp.valueOf(sdt.format(newDate) + " 00:00:00.000");
utilMethods = null;
return expDate;
}
}//class }//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