Commit 4c8e7c43 authored by mnair's avatar mnair

Added changes to the method getPriceListOrderType

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@177757 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9df68b33
...@@ -13289,7 +13289,6 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -13289,7 +13289,6 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
return contractNo; return contractNo;
} }
// gbf_get_pricelist_for_ordertype // gbf_get_pricelist_for_ordertype
public String getPriceListOrderType(Timestamp orderDate, Document dom, Document dom1, Document dom2, public String getPriceListOrderType(Timestamp orderDate, Document dom, Document dom1, Document dom2,
Connection conn) throws ITMException { Connection conn) throws ITMException {
...@@ -13302,21 +13301,36 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -13302,21 +13301,36 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
int cnt = 0; int cnt = 0;
Timestamp orderDate1 = null; Timestamp orderDate1 = null;
// SimpleDateFormat sdf; // SimpleDateFormat sdf;
try { try
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yy"); {
//SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yy");
// SimpleDateFormat dateFormat=new // SimpleDateFormat dateFormat=new
// SimpleDateFormat(genericUtility.getDBDateFormat()); // SimpleDateFormat(genericUtility.getDBDateFormat());
String orderDateInStr = dateFormat.format(orderDate); //String orderDateInStr = dateFormat.format(orderDate);
System.out.println("orderDateInStr*****" + orderDateInStr); //System.out.println("orderDateInStr*****" + orderDateInStr);
//Changes by mayur on 08-JAN-18--[START]
String orderDateInStr = "";
if(orderDateInStr.trim().length() > 0)
{
orderDateInStr = genericUtility.getValidDateString(orderDateInStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat());
orderDate = Timestamp.valueOf(orderDateInStr + " 00:00:00");
}
orderType = checkNull(genericUtility.getColumnValue("order_type", dom)); orderType = checkNull(genericUtility.getColumnValue("order_type", dom));
System.out.println("orderType==" + orderType); System.out.println("orderType==" + orderType);
sql = "select count(1) from pricelist where eff_from <= ? and valid_upto >= ? and order_type <> null"; sql = "select count(1) from pricelist where eff_from <= ? and valid_upto >= ? and order_type <> null";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, orderDateInStr);
pstmt.setString(2, orderDateInStr); pstmt.setTimestamp(1,orderDate);
pstmt.setTimestamp(2,orderDate);
//pstmt.setString(1, orderDateInStr);
//pstmt.setString(2, orderDateInStr);
//Changes by mayur on 08-JAN-18--[END]
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
{
cnt = rs.getInt(1); cnt = rs.getInt(1);
System.out.println("Count is-----" + cnt); System.out.println("Count is-----" + cnt);
} }
...@@ -13324,27 +13338,34 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -13324,27 +13338,34 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if (cnt > 0) { if (cnt > 0)
{
sql = "select distinct price_list , order_type from pricelist where eff_from <=? and valid_upto >= ? and order_type <> null"; sql = "select distinct price_list , order_type from pricelist where eff_from <=? and valid_upto >= ? and order_type <> null";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, orderDateInStr); //Changes by mayur on 08-JAN-18--[START]
pstmt.setString(2, orderDateInStr); pstmt.setTimestamp(1, orderDate);
pstmt.setTimestamp(2, orderDate);
//Changes by mayur on 08-JAN--[END]
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) { while (rs.next())
{
priceList1 = checkNull(rs.getString("price_list")); priceList1 = checkNull(rs.getString("price_list"));
orderTypeList = rs.getString("order_type"); orderTypeList = rs.getString("order_type");
if (orderTypeList.trim().length() > 0) { if (orderTypeList.trim().length() > 0)
do { {
do
{
orderType1 = distCommon.getToken(orderTypeList, ","); orderType1 = distCommon.getToken(orderTypeList, ",");
if (orderType1.trim().length() == orderType.trim().length()) { if (orderType1.trim().length() == orderType.trim().length())
{
priceList = priceList1; priceList = priceList1;
lsExit = "T"; lsExit = "T";
break; break;
} }
} while (orderTypeList.trim().length() > 0); } while (orderTypeList.trim().length() > 0);
} }
if (lsExit == "T") { if (lsExit == "T")
{
break; break;
} }
} }
...@@ -13353,7 +13374,8 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -13353,7 +13374,8 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} catch (Exception e) { } catch (Exception e)
{
e.printStackTrace(); e.printStackTrace();
System.out.println("Exception ::" + e.getMessage()); System.out.println("Exception ::" + e.getMessage());
throw new ITMException(e); throw new ITMException(e);
...@@ -13361,6 +13383,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal ...@@ -13361,6 +13383,7 @@ public class SalesOrderIC extends ValidatorEJB implements SalesOrderICLocal, Sal
return priceList; return priceList;
} }
//Changes done by mayur on 08-JAN-18---[END]
// gbf_exchrate_protect // gbf_exchrate_protect
public String exchangeRateProtect(String currCode, String siteCode, String exchangeRateCol, Connection conn) public String exchangeRateProtect(String currCode, String siteCode, String exchangeRateCol, Connection conn)
......
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