Package realcix20.utils

Examples of realcix20.utils.DAO


            String p = ObjectUtil.findNewCell(pRow, "P", "P").getColumnValue().toString();
            RegClass reg = (RegClass)ClassManager.createClass(510);
            StringBuffer sb = new StringBuffer(reg.getBasicSQL());
            sb.append(" WHERE RI.NS=? AND RI.P=?");
            String sql = sb.toString();
            DAO dao = DAO.getInstance();
            dao.query(sql);
            dao.setObject(1, ns);
            dao.setObject(2, p);
            ResultSet rs = dao.executeQuery();
            try {
                if ( (rs.next()) && (ns.equals(rs.getObject("NS"))) && (p.equals(rs.getObject("P"))) ) {
                    result = true;
                }
                rs.close();
View Full Code Here


if(object.getClsId()==520){
    RelationManager relationManager = container.getRelationManager();
    Vector parameters = relationManager.getParameters_Defvalue(componentExt);
    if (parameters != null) {
        String sql = relationManager.getSQL_Defvalue(componentExt, parameters);
        DAO dao = DAO.getInstance();
        dao.query(sql);
        for (int i = 0; i < parameters.size(); i++) {
            String parameter = (String)parameters.get(i);
            StringTokenizer st = new StringTokenizer(parameter, ".");
            String tableName = (String)st.nextElement();
            String columnName = (String)st.nextElement();
            ComponentExt tempComponentExt = relationManager.findComponentExt(tableName, columnName);
            JComponent tempComponent = tempComponentExt.getComponent();                                   
            dao.setObject(i+1, ComponentManager.getValue(tempComponent));
        }
        ResultSet rs = dao.executeQuery();
        try {
            if (rs.next()) {
                ResultSetMetaData rsmd = rs.getMetaData();
                for (int i = 1; i <= rsmd.getColumnCount(); i++) {
                    ComponentExt tempComponentExt = relationManager.findComponentExt(column.getTableName(), rsmd.getColumnName(i));
                    boolean isThisObjectColumn = (tempComponentExt != null);
                    if (isThisObjectColumn) {
                        if (rs.getObject(i) != null) {
                            ComponentManager.setValue(rs.getObject(i), tempComponentExt.getComponent());
                        }
                    }
                }
            }
            rs.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    } 
}
                        ComponentManager.setValue(getValue(componentExt.getColumn(), selectedRow), componentExt.getComponent());                       
                    } else if (action.equals("Add")) {                       
                        RelationManager relationManager = container.getRelationManager();
                        Vector parameters = relationManager.getParameters_Defvalue(componentExt);
                        if (parameters != null) {
                            String sql = relationManager.getSQL_Defvalue(componentExt, parameters);
                            DAO dao = DAO.getInstance();
                            dao.query(sql);
                            for (int i = 0; i < parameters.size(); i++) {
                                String parameter = (String)parameters.get(i);
                                StringTokenizer st = new StringTokenizer(parameter, ".");
                                String tableName = (String)st.nextElement();
                                String columnName = (String)st.nextElement();
                                ComponentExt tempComponentExt = relationManager.findComponentExt(tableName, columnName);
                                JComponent tempComponent = tempComponentExt.getComponent();                                   
                                dao.setObject(i+1, ComponentManager.getValue(tempComponent));
                            }
                            ResultSet rs = dao.executeQuery();
                            try {
                                if (rs.next()) {
                                    ResultSetMetaData rsmd = rs.getMetaData();
                                    for (int i = 1; i <= rsmd.getColumnCount(); i++) {
                                        ComponentExt tempComponentExt = relationManager.findComponentExt(column.getTableName(), rsmd.getColumnName(i));
View Full Code Here

                (ObjectUtil.findNewCell(regItemRow, "RI", "RI").getColumnValue() == null) ) {
            return false;
        }
        int r = Integer.parseInt(ObjectUtil.findNewCell(regItemRow, "RI", "R").getColumnValue().toString());
        int ri = Integer.parseInt(ObjectUtil.findNewCell(regItemRow, "RI", "RI").getColumnValue().toString());
        DAO dao = DAO.getInstance();
        dao.query(Resources.SELECT_FROM_TAXI_BY_R_RI_SQL);
        dao.setInt(1, r);
        dao.setInt(2, ri);
        ResultSet rs = dao.executeQuery();
        try {
            if (rs.next()) {
                result = true;                   
            }
            rs.close();
View Full Code Here

   
    public static boolean isTaxtUsedInTax(Row taxTypeRow) {       
        boolean result = false;
        String taxt = ObjectUtil.findNewCell(taxTypeRow, "TAXT", "TAXT").getColumnValue().toString();
        TaxClass tax = (TaxClass)ClassManager.createClass(530);
        DAO dao = DAO.getInstance();
        dao.query(tax.getBasicSQL());
        ResultSet rs = dao.executeQuery();
        try {
            ResultSetMetaData rsmd = rs.getMetaData();
            int i;
            for (i = 1; i <= rsmd.getColumnCount(); i++) {
                if ( (rsmd.getTableName(i).equals("TAX")) && (rsmd.getColumnName(i).equals("TAXT")) )
View Full Code Here

       
    }
   
    public void clearRITAXI(String taxt, int tax) {
       
            DAO dao = DAO.getInstance();
            dao.update(Resources.CLEAR_RITAXI_BY_TAXT_TAX_SQL);
            dao.setString(1, taxt);
            dao.setInt(2, tax);
            dao.executeUpdate();
       
    }
View Full Code Here

           
            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();
View Full Code Here

           
            String taxt = null;
            Cell 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()) {
                    result = rs.getDouble(1);
                }
                rs.close();
            } catch (Exception e) {
View Full Code Here

            if (result) {
               
                int newR = 0;
                int newRi = 1;

                DAO dao = DAO.getInstance();
                dao.query(Resources.SELECT_MAX_R_FROM_R_SQL);
                ResultSet rs = dao.executeQuery();
                try {
                    if (rs.next())
                        newR = rs.getInt(1) + 1;
                    rs.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
                               
                boolean hasNewRow = false;
                boolean firstNewRow = true;
                rowsIter = rows.iterator();
                while (rowsIter.hasNext()) {
                    Row row = (Row)rowsIter.next();
                    Cell cell1 = ObjectUtil.findNewCell(row, "TAXI", "R");
                    Cell cell2 = ObjectUtil.findNewCell(row, "TAXI", "RI");
                    boolean isAdd = false;
                    if ( (cell1.getColumnValue() != null) && (cell2.getColumnValue() != null) ) {
                        try {
                            if ( (cell1.getColumnValue() instanceof Number) && (cell2.getColumnValue() instanceof Number) ) {
                                isAdd = false;
                            } else if ( (cell1.getColumnValue() instanceof String) && (cell2.getColumnValue() instanceof String) ) {
                                Integer.parseInt((String)cell1.getColumnValue());
                                Integer.parseInt((String)cell2.getColumnValue());
                                isAdd = false;
                            }                           
                        } catch (Exception e) {
                            isAdd = true;
                            e.printStackTrace();
                        }                       
                    } else {
                        isAdd = true;                                                                       
                    }
                   
//                    System.err.println("isAdd = " + isAdd);
                    //LD
                    String ld = "";
                    String user = GlobalValueManager.getValue("SESSION.LOGINUSER");
                    Cell taxtCell = ObjectUtil.findNewCell(row, "TAXI", "TAXT");
                    dao.query(Resources.SELECT_LD_BY_TAXTYPE_SQL);
                    dao.setObject(1, taxtCell.getColumnValue());
                    dao.setObject(2, user);
                    rs = dao.executeQuery();
                    try {
                        if (rs.next()) {
                            ld = rs.getString(1);                              
                        }
                        rs.close();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }

                    //TC
                    String tc = "";
                    Cell tcCell = ObjectUtil.findNewCell(row, "TAXI", "TC");
                    tc = (String)tcCell.getColumnValue();

                    //TAMT
                    double tamt = 0.0;
                    Cell tamtCell = ObjectUtil.findNewCell(row, "TAXI", "TAMT");
                    tamt = getDouble(tamtCell.getColumnValue());

                    //R
                    int r = 0;
                    if (isAdd) {
                        r = newR;
                    } else {
                        if (cell1.getColumnValue() instanceof Number)
                            r = ((Number)cell1.getColumnValue()).intValue();
                        else
                            r = Integer.parseInt((String)cell1.getColumnValue());
                    }

                    //RI
                    int ri = 0;
                    if (isAdd) {
                        ri =newRi;
                        newRi++;
                    } else {
                        if (cell2.getColumnValue() instanceof Number)
                            ri = ((Number)cell2.getColumnValue()).intValue();
                        else
                            ri = Integer.parseInt((String)cell2.getColumnValue());
                    }          
                   
//                    System.err.println("R = " + r);
//                    System.err.println("RI = " + ri);

                    //LC
                    String lc = "";
                    dao.query(Resources.SELECT_LC_FROM_FAMILY_SQL);
                    rs = dao.executeQuery();
                    try {
                        if (rs.next()) {
                            lc = rs.getString("LC");
                        }
                        rs.close();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }

                    //TDATE
                    Cell tdateCell = ObjectUtil.findNewCell(row, "TAX", "TDATE");
                    //some bugs
                    String tdate;
                    tdate = tdateCell.getColumnValue().toString();                                      

                    //XR
                    double xr = 1.0;
                    dao.query(Resources.SELECT_XR_SQL);
                    dao.setObject(1, lc);
                    dao.setObject(2, tc);
                    dao.setObject(3, lc);
                    dao.setObject(4, tc);
                    dao.setObject(5, tdate);
                    rs = dao.executeQuery();
                    try {
                        if (rs.next())
                            xr = rs.getDouble(1);
                        rs.close();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                   
                    //LAMT
                    double lamt = tamt * xr;

//                    System.err.println("r=" + r + " ri=" + ri + " ld=" + ld + " tc=" + tc + " tamt=" + tamt + " lc=" + lc + " lamt=" + lamt + " tdate=" + tdate + " xr=" + xr);
                   
                    //set new taxes
                    if (isAdd) {
                       
                        if (!row.isDelete()) {
                           
                            hasNewRow = true;
                            //insert r table
                            if (firstNewRow) {
                                firstNewRow = false;
                                dao.update(Resources.INSERT_R_SQL);
                                dao.setObject(1, r);
                                dao.setObject(2, "REAL");
                                dao.setObject(3, tdate);
                                String now = TimeManager.getTime(System.currentTimeMillis());
                                dao.setObject(4, now);                              
                                dao.setObject(5, user);
                                dao.setObject(6, now);
                                dao.setObject(7, user);
                                dao.setObject(8, "TAX");
                                dao.executeUpdate();
                            }
                           
                            //insert ri tables
                            Vector values = getNSAndPAndPA(row);
                            dao.update(Resources.INSERT_RI_SQL);                           
                            dao.setObject(1, r);
                            dao.setObject(2, ri);
                            dao.setObject(3, "TAX");
                            dao.setObject(4, ld);
                            dao.setObject(5, tc);
                            dao.setObject(6, tamt);
                            dao.setObject(7, lc);
                            dao.setObject(8, xr);
                            dao.setObject(9, lamt);                           
                            dao.setObject(10, values.get(0));
                            dao.setObject(11, values.get(1));
                            dao.setObject(12, values.get(2));
                            for (int i = 13; i <= 22; i++)
                                dao.setObject(i, null);
                            dao.executeUpdate();
                           
                            //update taxRows
                            Cell rCell = ObjectUtil.findNewCell(row, "TAXI", "R");
                            rCell.setColumnValue(r);
                            rCell = ObjectUtil.findOldCell(row, "TAXI", "R");
                            rCell.setColumnValue(r);
                           
                            Cell riCell = ObjectUtil.findNewCell(row, "TAXI", "RI");
                            riCell.setColumnValue(ri);
                            riCell = ObjectUtil.findOldCell(row, "TAXI", "RI");
                            riCell.setColumnValue(ri);
                           
                        }
                                                                         
                    }                    
                   
                }
               
                if (hasNewRow) {
                    dao = DAO.getInstance();
                    dao.query(Resources.SELECT_SUM_LAMT_SQL);
                    dao.setObject(1, newR);
                    double sumLamt = 0.0;
                    rs = dao.executeQuery();
                    try {
                        if (rs.next())
                            sumLamt = rs.getDouble(1);
                        rs.close();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                   
                    if (sumLamt != 0.0) {
                       
                        //LD
                        String ld="";
                        dao.query(Resources.SELECT_DEFLD_FROM_LT_SQL);
                        dao.setObject(1, "X");
                        rs = dao.executeQuery();
                        try {
                            if (rs.next())
                                ld = rs.getString("DEFLD");
                            rs.close();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                       
                        //LC
                        String lc = "";
                        dao.query(Resources.SELECT_LC_FROM_FAMILY_SQL);
                        rs = dao.executeQuery();
                        try {
                            if (rs.next()) {
                                lc = rs.getString("LC");
                            }
                            rs.close();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                       
                        //XR
                        double xr = 1.0;
                       
                        //TC
                        String tc = lc;
                       
                        //LAMT
                        double lamt = -sumLamt;
                       
                        //TAMT
                        double tamt = lamt / xr;
                       
                        dao.update(Resources.INSERT_RI_SQL);
                        dao.setObject(1, newR);
                        dao.setObject(2, newRi);
                        dao.setObject(3, "TAX X");
                        dao.setObject(4, ld);
                        dao.setObject(5, tc);
                        dao.setObject(6 , tamt);
                        dao.setObject(7, lc);
                        dao.setObject(8, xr);
                        dao.setObject(9, lamt);
                        for (int i = 10; i <= 22; i++)
                            dao.setObject(i, null);
                        dao.executeUpdate();
                       
                    }
                       
                }
               
View Full Code Here

               
                String ns = (String)noEncryData.get(0);
                String p = (String)noEncryData.get(1);
                String pa = (String)noEncryData.get(2);
               
                DAO dao = DAO.getInstance();
                dao.query(Resources.SELECT_PUBKEY_PRIKEY_FROM_PA_SQL);
                dao.setObject(1, ns);
                dao.setObject(2, p);
                dao.setObject(3, pa);
                ResultSet rs = dao.executeQuery();
                try {
                    if (rs.next()) {
                        publicKey = (PublicKey)rs.getObject("PUBKEY");
                        result = 401;
                    } else {
View Full Code Here

            String tax = (String)cell.getColumnValue();
           
            cell = ObjectUtil.findNewCell(taxRow, "TAXI", "TAXI");
            String taxi = (String)cell.getColumnValue();
           
            DAO dao = DAO.getInstance();
           
//            System.err.println("taxRow.isAdd() = " + taxRow.isAdd());
//            System.err.println("taxRow.isModify() = " + taxRow.isModify());
//            System.err.println("taxRow.isDelete() = " + taxRow.isDelete());
                       
            if ( (taxRow.isDelete()) && (!taxRow.isAdd()) ) {
                dao.update(Resources.DELETE_RITAXI_SQL);
                dao.setObject(1, oldr);
                dao.setObject(2, oldri);
                dao.setObject(3, taxt);
                dao.setObject(4, tax);
                dao.setObject(5, taxi);
                dao.executeUpdate();
            } else if ( (!taxRow.isAdd()) && (!taxRow.isDelete()) ) {
               
                dao.update(Resources.DELETE_RITAXI_SQL);
                dao.setObject(1, oldr);
                dao.setObject(2, oldri);
                dao.setObject(3, taxt);
                dao.setObject(4, tax);
                dao.setObject(5, taxi);               
                dao.executeUpdate();
                dao.update(Resources.INSERT_RITAXI_SQL);
                dao.setObject(1, r);
                dao.setObject(2, ri);
                dao.setObject(3, taxt);
                dao.setObject(4, tax);
                dao.setObject(5, taxi);
                dao.setObject(6, sign);
                dao.executeUpdate();
            } else if ( (taxRow.isAdd()) && (!taxRow.isDelete()) ) {
                dao.update(Resources.INSERT_RITAXI_SQL);
                dao.setObject(1, r);
                dao.setObject(2, ri);
                dao.setObject(3, taxt);
                dao.setObject(4, tax);
                dao.setObject(5, taxi);
                dao.setObject(6, sign);
                dao.executeUpdate();
            }
       
    }
View Full Code Here

TOP

Related Classes of realcix20.utils.DAO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.