Example usage for java.sql ResultSet getDouble

List of usage examples for java.sql ResultSet getDouble

Introduction

In this page you can find the example usage for java.sql ResultSet getDouble.

Prototype

double getDouble(String columnLabel) throws SQLException;

Source Link

Document

Retrieves the value of the designated column in the current row of this ResultSet object as a double in the Java programming language.

Usage

From source file:rems.Global.java

public static double getAccntDailyCrdtBals(int accntID, String balsDate) {
    try {//w ww  .jav a 2s .  c o  m
        SimpleDateFormat frmtr = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
        SimpleDateFormat frmtr1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        balsDate = frmtr1.format(frmtr.parse(balsDate));
        balsDate = balsDate.substring(0, 10);
        String strSql = "SELECT a.crdt_bal " + "FROM accb.accb_accnt_daily_bals a "
                + "WHERE(to_timestamp(a.as_at_date,'YYYY-MM-DD') =  to_timestamp('" + balsDate
                + "','YYYY-MM-DD') and a.accnt_id = " + accntID + ")";
        ResultSet dtst = Global.selectDataNoParams(strSql);
        while (dtst.next()) {
            return dtst.getDouble(1);
        }
        return 0.00;
    } catch (SQLException ex) {
        return 0.00;
    } catch (ParseException ex) {
        return 0.00;
    }
}

From source file:rems.Global.java

public static double get_COA_CRLSum(int orgID) {
    double sumRes = 0.00;
    try {/*from w  w  w  .ja v  a  2 s .c  o  m*/
        String strSql = "SELECT SUM(a.net_balance) " + "FROM accb.accb_chart_of_accnts a "
                + "WHERE ((a.org_id = " + orgID + ") and "
                + "(a.is_net_income = '0') and (a.control_account_id <=0) "
                + "and (a.accnt_type IN ('EQ','R', 'L')))";
        //(a.is_retained_earnings = '0') and 
        ResultSet dtst = Global.selectDataNoParams(strSql);
        while (dtst.next()) {
            sumRes = dtst.getDouble(1);
            return (double) (Math.round(sumRes * 100) / 100);
        }
        return sumRes;
    } catch (SQLException ex) {
        return sumRes;
    }
}

From source file:rems.Global.java

public static double[] getGLIntrfcIDAmntSum(String intrfcids, String tblNme, int accntID) {
    double[] res = { 0, 0 };
    try {/*from  w ww . j  a  va 2 s  . co m*/
        String strSql = "SELECT COALESCE(SUM(a.dbt_amount),0), COALESCE(SUM(a.crdt_amount),0) FROM " + tblNme
                + " a WHERE (a.accnt_id = " + accntID + " and '" + intrfcids
                + "'  like '%,' || a.interface_id || ',%') ";
        ResultSet dtst = Global.selectDataNoParams(strSql);

        while (dtst.next()) {
            res[0] = dtst.getDouble(1);
            res[1] = dtst.getDouble(2);
        }
        return res;
    } catch (SQLException ex) {
        return res;
    }
}

From source file:rems.Global.java

public static double getAccntDailyNetBals(int accntID, String balsDate) {
    try {/* ww w  .  j a va 2s. c o  m*/
        SimpleDateFormat frmtr = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
        SimpleDateFormat frmtr1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        balsDate = frmtr1.format(frmtr.parse(balsDate));
        balsDate = balsDate.substring(0, 10);

        String strSql = "SELECT a.net_balance " + "FROM accb.accb_accnt_daily_bals a "
                + "WHERE(to_timestamp(a.as_at_date,'YYYY-MM-DD') =  to_timestamp('" + balsDate
                + "','YYYY-MM-DD') and a.accnt_id = " + accntID + ")";

        ResultSet dtst = Global.selectDataNoParams(strSql);
        while (dtst.next()) {
            return dtst.getDouble(1);
        }
        return 0.00;
    } catch (SQLException ex) {
        return 0.00;
    } catch (ParseException ex) {
        return 0.00;
    }
}

From source file:rems.Global.java

public static double getAccntLstDailyNetBals(int accntID, String balsDate) {
    try {//from w w  w.j ava 2s.  c om
        SimpleDateFormat frmtr = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
        SimpleDateFormat frmtr1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        balsDate = frmtr1.format(frmtr.parse(balsDate));
        balsDate = balsDate.substring(0, 10);
        String strSql = "SELECT a.net_balance " + "FROM accb.accb_accnt_daily_bals a "
                + "WHERE(to_timestamp(a.as_at_date,'YYYY-MM-DD') <=  to_timestamp('" + balsDate
                + "','YYYY-MM-DD') and a.accnt_id = " + accntID
                + ") ORDER BY to_timestamp(a.as_at_date,'YYYY-MM-DD') DESC LIMIT 1 OFFSET 0";

        ResultSet dtst = Global.selectDataNoParams(strSql);
        while (dtst.next()) {
            return dtst.getDouble(1);
        }
        return 0.00;
    } catch (SQLException ex) {
        return 0.00;
    } catch (ParseException ex) {
        return 0.00;
    }
}

From source file:rems.Global.java

public static double getAccntDailyDbtBals(int accntID, String balsDate) {
    try {//w w w  .  j a v a2  s. com
        SimpleDateFormat frmtr = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
        SimpleDateFormat frmtr1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        balsDate = frmtr1.format(frmtr.parse(balsDate));
        balsDate = balsDate.substring(0, 10);

        String strSql = "SELECT a.dbt_bal " + "FROM accb.accb_accnt_daily_bals a "
                + "WHERE(to_timestamp(a.as_at_date,'YYYY-MM-DD') =  to_timestamp('" + balsDate
                + "','YYYY-MM-DD') and a.accnt_id = " + accntID + ")";

        ResultSet dtst = Global.selectDataNoParams(strSql);
        while (dtst.next()) {
            return dtst.getDouble(1);
        }
        return 0.00;
    } catch (SQLException ex) {
        return 0.00;
    } catch (ParseException ex) {
        return 0.00;
    }
}

From source file:rems.Global.java

public static double get_COA_AESum(int orgID) {
    double sumRes = 0.00;
    try {// www . j  a va  2  s. c  o m
        String strSql = "";
        strSql = "SELECT SUM(a.net_balance) " + "FROM accb.accb_chart_of_accnts a " + "WHERE ((a.org_id = "
                + orgID + ") and " + "(a.is_net_income = '0') and (a.control_account_id <=0) "
                + "and (a.accnt_type IN ('A','EX')))";
        //(a.is_retained_earnings = '0') 
        ResultSet dtst = Global.selectDataNoParams(strSql);

        while (dtst.next()) {
            sumRes = dtst.getDouble(1);
            return (double) (Math.round(sumRes * 100) / 100);
        }
        return sumRes;
    } catch (SQLException ex) {
        return sumRes;
    }
}

From source file:rems.Global.java

public static double getAccntLstDailyCrdtBals(int accntID, String balsDate) {
    try {// ww w .  j av a 2s  . co m
        SimpleDateFormat frmtr = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
        SimpleDateFormat frmtr1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        balsDate = frmtr1.format(frmtr.parse(balsDate));
        balsDate = balsDate.substring(0, 10);

        String strSql = "SELECT a.crdt_bal " + "FROM accb.accb_accnt_daily_bals a "
                + "WHERE(to_timestamp(a.as_at_date,'YYYY-MM-DD') <=  to_timestamp('" + balsDate
                + "','YYYY-MM-DD') and a.accnt_id = " + accntID
                + ") ORDER BY to_timestamp(a.as_at_date,'YYYY-MM-DD') DESC LIMIT 1 OFFSET 0";

        ResultSet dtst = Global.selectDataNoParams(strSql);
        while (dtst.next()) {
            return dtst.getDouble(1);
        }
        return 0.00;
    } catch (SQLException ex) {
        return 0.00;
    } catch (ParseException ex) {
        return 0.00;
    }
}

From source file:rems.Global.java

public static double getAccntLstDailyDbtBals(int accntID, String balsDate) {
    try {/*from   w ww  .  j a v a2  s.c  o m*/
        SimpleDateFormat frmtr = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
        SimpleDateFormat frmtr1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        balsDate = frmtr1.format(frmtr.parse(balsDate));
        balsDate = balsDate.substring(0, 10);

        String strSql = "SELECT a.dbt_bal " + "FROM accb.accb_accnt_daily_bals a "
                + "WHERE(to_timestamp(a.as_at_date,'YYYY-MM-DD') <=  to_timestamp('" + balsDate
                + "','YYYY-MM-DD') and a.accnt_id = " + accntID
                + ") ORDER BY to_timestamp(a.as_at_date,'YYYY-MM-DD') DESC LIMIT 1 OFFSET 0";

        ResultSet dtst = Global.selectDataNoParams(strSql);
        while (dtst.next()) {
            return dtst.getDouble(1);
        }
        return 0.00;
    } catch (SQLException ex) {
        return 0.00;
    } catch (ParseException ex) {
        return 0.00;
    }
}

From source file:rems.Global.java

public static double getAccntLstDailyNetCurrBals(int accntID, String balsDate) {
    try {/* w  w  w.j a va  2 s  .c om*/
        SimpleDateFormat frmtr = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
        SimpleDateFormat frmtr1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        balsDate = frmtr1.format(frmtr.parse(balsDate));
        balsDate = balsDate.substring(0, 10);

        String strSql = "SELECT a.net_balance " + "FROM accb.accb_accnt_crncy_daily_bals a "
                + "WHERE(to_timestamp(a.as_at_date,'YYYY-MM-DD') <=  to_timestamp('" + balsDate
                + "','YYYY-MM-DD') and a.accnt_id = " + accntID
                + ") ORDER BY to_timestamp(a.as_at_date,'YYYY-MM-DD') DESC LIMIT 1 OFFSET 0";

        ResultSet dtst = Global.selectDataNoParams(strSql);
        while (dtst.next()) {
            return dtst.getDouble(1);
        }
        return 0.00;
    } catch (SQLException ex) {
        return 0.00;
    } catch (ParseException ex) {
        return 0.00;
    }
}