Replace ApprovedRate.java

parent 4eec9c40
......@@ -33,10 +33,10 @@ public class ApprovedRate extends ValidatorEJB {
ResultSet rs = null;
LinkedHashMap<String, ArrayList<String>> quotationRatesMap = new LinkedHashMap<>();
int count = 0;
String customerCode = "" , quotNo = "" , addDate = "" ,aprvRate = "";
String sql = "SELECT sq.cust_code,sqdet.quot_no, sq.add_date,sqdet.item_code,sqdet.aprv_rate FROM sales_quot sq LEFT JOIN sales_quotdet sqdet ON sq.quot_no = sqdet.quot_no WHERE sq.status = 'A' AND sqdet.item_code = ? AND sq.add_date IS NOT NULL ORDER BY sq.add_date DESC limit 3";
String customerCode = "" , quotNo = "" , addDate = "" ,aprvRate = "" , quantity="";
String sql = "select cust_code , quot_no , created_date , item_code , approved_rate , quantity from item_rate_hist where item_code= ? AND created_date IS NOT NULL ORDER BY created_date desc limit 5";
try {
BaseLogger.log("3", getUserInfo(), null, "Fetching last 3 quotation rates for item_code: " + itemCode);
BaseLogger.log("3", getUserInfo(), null, "Fetching last 5 quotation rates for item_code: " + itemCode);
conn = getConnection();
pstmt = conn.prepareStatement(sql);
......@@ -48,9 +48,10 @@ public class ApprovedRate extends ValidatorEJB {
ArrayList<String> quotationDetails = new ArrayList<>();
customerCode = checkNull(rs.getString("cust_code"));
quotNo = checkNull(rs.getString("quot_no"));
addDate = checkNull(rs.getString("add_date"));
addDate = checkNull(rs.getString("created_date"));
itemCode = checkNull(rs.getString("item_code"));
aprvRate = checkNull(rs.getString("aprv_rate"));
aprvRate = checkNull(rs.getString("approved_rate"));
quantity = checkNull(rs.getString("quantity"));
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat());
java.util.Date addDateUtil = simpleDateFormat.parse(addDate);
......@@ -62,7 +63,7 @@ public class ApprovedRate extends ValidatorEJB {
quotationDetails.add(formattedAddDate);
quotationDetails.add(itemCode);
quotationDetails.add(aprvRate);
quotationDetails.add(quantity);
quotationRatesMap.put(String.valueOf(count), quotationDetails);
count++;
......@@ -71,7 +72,7 @@ public class ApprovedRate extends ValidatorEJB {
}
catch (Exception e)
{
BaseLogger.log("3", getUserInfo(), null, "Exception in getLastThreeQuotationRates: " + e.getMessage());
BaseLogger.log("3", getUserInfo(), null, "Exception in getLastFiveQuotationRates: " + e.getMessage());
throw new ITMException(e);
}
finally
......
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