double para29 = 0.0;
double para30 = 0.0;
double b1 = 0.0;
Cell cell = ObjectUtil.findNewCell(row, "TAXI", "TAXBASEAMT1");
b1 = getDouble(cell.getColumnValue());
double b2 = 0.0;
cell = ObjectUtil.findNewCell(row, "TAXI", "TAXBASEAMT2");
b2 = getDouble(cell.getColumnValue());
String taxt = null;
cell = ObjectUtil.findNewCell(row, "TAX", "TAXT");
taxt = (String)cell.getColumnValue();
DAO dao = DAO.getInstance();
dao.query(Resources.SELECT_FROM_TAXT_SQL);
dao.setObject(1, taxt);
try {
ResultSet rs = dao.executeQuery();
if (rs.next()) {
formula = rs.getString("FORMULA");
para1 = rs.getDouble("PARA1");
para2 = rs.getDouble("PARA2");
para3 = rs.getDouble("PARA3");
para4 = rs.getDouble("PARA4");
para5 = rs.getDouble("PARA5");
para6 = rs.getDouble("PARA6");
para7 = rs.getDouble("PARA7");
para8 = rs.getDouble("PARA8");
para9 = rs.getDouble("PARA9");
para10 = rs.getDouble("PARA10");
para11 = rs.getDouble("PARA11");
para12 = rs.getDouble("PARA12");
para13 = rs.getDouble("PARA13");
para14 = rs.getDouble("PARA14");
para15 = rs.getDouble("PARA15");
para16 = rs.getDouble("PARA16");
para17 = rs.getDouble("PARA17");
para18 = rs.getDouble("PARA18");
para19 = rs.getDouble("PARA19");
para20 = rs.getDouble("PARA20");
para21 = rs.getDouble("PARA21");
para22 = rs.getDouble("PARA22");
para23 = rs.getDouble("PARA23");
para24 = rs.getDouble("PARA24");
para25 = rs.getDouble("PARA25");
para26 = rs.getDouble("PARA26");
para27 = rs.getDouble("PARA27");
para28 = rs.getDouble("PARA28");
para29 = rs.getDouble("PARA29");
para30 = rs.getDouble("PARA30");
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
StringTokenizer st = new StringTokenizer(formula,"[]");
int n = 0;
if (formula.indexOf("[") == 0)
n = 1;
Vector paras = new Vector();
while (st.hasMoreElements()) {
String element = (String)st.nextElement();
if (n%2 == 1) {
paras.add(element);
}
n++;
}
StringBuffer sb = new StringBuffer(formula);
Iterator parasIter = paras.iterator();
while (parasIter.hasNext()) {
String para = (String)parasIter.next();
int fromIndex = sb.indexOf("[" + para + "]");
if (para.equals("B1"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(b1));
else if (para.equals("B2"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(b2));
else if (para.equals("P1"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para1));
else if (para.equals("P2"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para2));
else if (para.equals("P3"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para3));
else if (para.equals("P4"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para4));
else if (para.equals("P5"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para5));
else if (para.equals("P6"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para6));
else if (para.equals("P7"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para7));
else if (para.equals("P8"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para8));
else if (para.equals("P9"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para9));
else if (para.equals("P10"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para10));
else if (para.equals("P11"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para11));
else if (para.equals("P12"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para12));
else if (para.equals("P13"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para13));
else if (para.equals("P14"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para14));
else if (para.equals("P15"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para15));
else if (para.equals("P16"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para16));
else if (para.equals("P17"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para17));
else if (para.equals("P18"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para18));
else if (para.equals("P19"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para19));
else if (para.equals("P20"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para20));
else if (para.equals("P21"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para21));
else if (para.equals("P22"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para22));
else if (para.equals("P23"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para23));
else if (para.equals("P24"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para24));
else if (para.equals("P25"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para25));
else if (para.equals("P26"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para26));
else if (para.equals("P27"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para27));
else if (para.equals("P28"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para28));
else if (para.equals("P29"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para29));
else if (para.equals("P30"))
sb.replace(fromIndex, fromIndex + ("[" + para + "]").length(), Double.toString(para30));
}
formula = sb.toString();
String sql = "CALL " + formula;
dao.query(sql);
try {
ResultSet rs = dao.executeQuery();
if (rs.next()) {
cell = ObjectUtil.findNewCell(row, "TAXI", "TAMT");
cell.setColumnValue(rs.getObject(1));
}
rs.close();
result = true;
} catch (Exception e) {
result =false;