/** * @param chargeId * @param originChargeCurrency * @param terminalId * @return */ public FOBChargesDOB getChargeDetails( String chargeId, String originChargeCurrency, String terminalId) { int i = 0; FOBChargesDOB custContrDtl = new FOBChargesDOB(); String UOW = null; // A String to store the UOW of a given contract String contractCurrency = null; // A String to store the contractCurrency of a given contract double[] lowerBound = null; // A int[] to store the lowerBound of a given contract double[] upperBound = null; // A int[] to store the upperBound of a given contract double[] rate = null; // A double[] to store the rate of a given contract String[] slab = null; // A String[] to store the slab of a given contract double convFactor = 0; String rateCalcFlag = null; Statement st = null; ResultSet charge = null; Connection connection = null; try { connection = getConnection(); st = connection.createStatement(); String sql = "SELECT UNITCHARGE,CURRENCYID,RATE_CALC_FLAG FROM " + "FS_FR_STD_CHARGES where CHARGEID='" + chargeId + "' AND TRML_ID='" + terminalId + "'"; charge = st.executeQuery(sql); while (charge.next()) { UOW = charge.getString("UNITCHARGE"); contractCurrency = charge.getString("CURRENCYID"); rateCalcFlag = charge.getString("RATE_CALC_FLAG"); } // End of while charge = null; sql = "SELECT CHARGESLAB " + "FROM " + "FS_FR_STD_CHARGES where CHARGEID='" + chargeId + "' AND TRML_ID='" + terminalId + "'"; charge = st.executeQuery(sql); while (charge.next()) { i++; } lowerBound = new double[i]; upperBound = new double[i]; rate = new double[i]; slab = new String[i]; charge = null; i = 0; sql = "SELECT LOWERBOUND,UPPERBOUND,TO_CHAR(CHARGERATE,999999.99) RATE , " + "CHARGESLAB " + "FROM " + "FS_FR_STD_CHARGES " + "WHERE CHARGEID='" + chargeId + "' AND TRML_ID='" + terminalId + "'"; charge = st.executeQuery(sql); while (charge.next()) { lowerBound[i] = charge.getDouble("LOWERBOUND"); upperBound[i] = charge.getDouble("UPPERBOUND"); rate[i] = charge.getDouble("RATE"); slab[i] = charge.getString("CHARGESLAB"); i++; } // End of while // method to get local currency custContrDtl.setUOW(UOW); custContrDtl.setContractCurrency(contractCurrency); custContrDtl.setInBound(lowerBound); custContrDtl.setUpBound(upperBound); custContrDtl.setRate(rate); custContrDtl.setSlab(slab); custContrDtl.setCurrencyId(originChargeCurrency); custContrDtl.setRateCalculationFlag(rateCalcFlag); if (originChargeCurrency.equalsIgnoreCase(contractCurrency)) { custContrDtl.setConvFactor(1); } else { String sql_Currency = "SELECT CONVERSIONFACTOR FROM FS_FR_CURRENCYMASTER " + "WHERE " + "CURRENCY1='" + contractCurrency + "' AND CURRENCY2 = '" + originChargeCurrency + "' "; charge = st.executeQuery(sql_Currency); while (charge.next()) { custContrDtl.setConvFactor(charge.getDouble("CONVERSIONFACTOR")); } } } catch (SQLException se) { Logger.error(FILE_NAME, "getChargeDetails()", se); } finally { try { if (charge != null) { charge.close(); } if (st != null) { st.close(); } if (connection != null) { connection.close(); } } catch (Exception ex) { Logger.error(FILE_NAME, "Exception in finally Block" + ex); } } return custContrDtl; }