public BigDecimal getOfferDiscAmt(String compCode,String promoCode,BigDecimal invAmt){
String sql = "select Pos_Invoice_Pkg.Get_Offer_DiscAmt(?,?,?) from dual";
Object[] params = new Object[]{compCode,promoCode,invAmt};
Object cnt = getValueFromDb(sql,params);
BigDecimal value = new BigDecimal(0);
if(cnt instanceof BigDecimal){
value = (BigDecimal)cnt;
//count = temp.intValue();
}
System.out.println("Value Of Disc Amount:"+value);
return value;
}
public Object getValueFromDb(String functionName, Object[] params) {
Object count = null;
PreparedStatement preparedStatement = CommonCode.getAM().getDBTransaction().createPreparedStatement(functionName, 0);
ResultSet rs = null;
try {
if(params!=null){
for(int i=0;i<params.length;i++){
preparedStatement.setObject(i+1, params[i]);
}
}
rs = preparedStatement.executeQuery();
if(rs != null){
rs.next();
count = rs.getObject(1);
}
System.out.println("^&%***Value from Db:"+count);
} catch (SQLException sqle) {
sqle.printStackTrace();
}finally {
if (preparedStatement != null) {
try {
if(rs != null)
rs.close();
preparedStatement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
return count;
}
String sql = "select Pos_Invoice_Pkg.Get_Offer_DiscAmt(?,?,?) from dual";
Object[] params = new Object[]{compCode,promoCode,invAmt};
Object cnt = getValueFromDb(sql,params);
BigDecimal value = new BigDecimal(0);
if(cnt instanceof BigDecimal){
value = (BigDecimal)cnt;
//count = temp.intValue();
}
System.out.println("Value Of Disc Amount:"+value);
return value;
}
public Object getValueFromDb(String functionName, Object[] params) {
Object count = null;
PreparedStatement preparedStatement = CommonCode.getAM().getDBTransaction().createPreparedStatement(functionName, 0);
ResultSet rs = null;
try {
if(params!=null){
for(int i=0;i<params.length;i++){
preparedStatement.setObject(i+1, params[i]);
}
}
rs = preparedStatement.executeQuery();
if(rs != null){
rs.next();
count = rs.getObject(1);
}
System.out.println("^&%***Value from Db:"+count);
} catch (SQLException sqle) {
sqle.printStackTrace();
}finally {
if (preparedStatement != null) {
try {
if(rs != null)
rs.close();
preparedStatement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
return count;
}
Comments
Post a Comment