Package realcix20.classes.basic

Examples of realcix20.classes.basic.Cell


       
        private Vector generateCixFile(Row mainRow) {
           
                Vector data = new Vector();
           
                Cell urtCell = ObjectUtil.findNewCell(mainRow, "T", "URT");
                String urt = (String)urtCell.getColumnValue();
                if ( (urt == null) || (urt.trim().equals("")) ) {                   
                    CixFile file = generateCixFile_Stat4(mainRow);
                    String fileName = generateCixFileName(mainRow, 4);
                    data.add(file);
                    data.add(fileName);
View Full Code Here


                Vector noEncryData = new Vector();
                byte[] wrappedKey = null;
                Vector encryData = new Vector();
                SealedObject sealedEncryData = null;
               
                Cell nsCell = ObjectUtil.findNewCell(mainRow, "T", "NS");
                String ns = (String)nsCell.getColumnValue();
                Cell pCell = ObjectUtil.findNewCell(mainRow, "T", "P");
                String p = (String)pCell.getColumnValue();
                Cell paCell = ObjectUtil.findNewCell(mainRow, "T", "PA");
                String pa = (String)paCell.getColumnValue();
               
                String urns = null;
                String urp = null;
                DAO dao = DAO.getInstance();
                dao.query(Resources.SELECT_URNS_URP_FORM_P_SQL);
View Full Code Here

        }
       
        private String generateCixFileName(Row mainRow, int stat) {
           
                StringBuffer sb = new StringBuffer("");
                Cell tCell = ObjectUtil.findNewCell(mainRow, "T", "T");
                java.sql.Date now = new java.sql.Date(System.currentTimeMillis());
                String time = now.toString();
                sb.append(tCell.getColumnValue() + "_");
                sb.append(stat + "_");
                sb.append(time);
               
                return sb.toString();
           
View Full Code Here

                            if ( (row != tempRow) && (!tempRow.isDelete()) ) {                               
                                boolean flag = false;
                                Iterator cellIter = row.getNewCells().iterator();
                                Iterator tempCellIter = tempRow.getNewCells().iterator();                                   
                                while (cellIter.hasNext()) {
                                    Cell cell = (Cell)cellIter.next();
                                    Cell tempCell = (Cell)tempCellIter.next();
                                    Column column = findColumn(container.getObject(), cell.getTableName(), cell.getColumnName());
                                    if ( (column.isPrimaryKey()) && (column.getTableName().equals(container.getObject().getChildTableName())) ) {
                                        if (!cell.getColumnValue().equals(tempCell.getColumnValue())) {
                                            flag = true;
                                            break;
                                        }
                                    }
                                }
View Full Code Here

        ItemTableModel model = (ItemTableModel)container.getTable().getModel();           
       
        Iterator cellIter = row.getNewCells().iterator();       
        int currentColumn = 0;     
        while (cellIter.hasNext()) {           
            Cell cell = (Cell)cellIter.next();
            Column column = findColumn(container.getObject(), cell.getTableName(), cell.getColumnName());
            if (column.isItemField()) {
                model.setValueAt(cell.getColumnValue(), container.getSelectedRowNumber(), currentColumn);
                currentColumn++;
            }           
        }
        container.getContainer().updateTable();
       
View Full Code Here

                ComponentExt componentExt = (ComponentExt)componentExtIter.next();
                Column column = componentExt.getColumn();
                JComponent component = componentExt.getComponent();
                Iterator cellIter = row.getNewCells().iterator();
                while (cellIter.hasNext()) {
                    Cell cell = (Cell)cellIter.next();
                    if ( (cell.getColumnName().equals(column.getColumnName())) && (cell.getTableName().equals(column.getTableName())) ) {
                       
                        if (column.getInputType() == 24) {//lastchanged by
                            Row currentRow = Session.getInstance().getCurrentUser();
                            Iterator tempCellIter = currentRow.getOldCells().iterator();
                            while (tempCellIter.hasNext()) {
                                Cell tempCell = (Cell)tempCellIter.next();
                                if (tempCell.getColumnName().equals("RUSER"))
                                    cell.setColumnValue(tempCell.getColumnValue());
                            }
                        } else if (column.getInputType() == 23) {//lastchanged
                            Date date = new Date();
                            Calendar cal = Calendar.getInstance();
                            cal.setTime(date);
View Full Code Here

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

            double b1 = baseAMT1;
           
            double b2 = baseAMT2;
           
            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 {
View Full Code Here

       
            Iterator rowsIter = rows.iterator();
            Vector rAndRis = new Vector();
            while (rowsIter.hasNext()) {
                Row row = (Row)rowsIter.next();               
                Cell cell1 = ObjectUtil.findNewCell(row, "TAXI", "R");
                Cell cell2 = ObjectUtil.findNewCell(row, "TAXI", "RI");               
                if ( (cell1.getColumnValue() != null) && (cell2.getColumnValue() != null) ) {    
                    boolean flag = true;//used by some bug
                    int r = 0;
                    if (cell1.getColumnValue() instanceof Number)
                        r = ((Number)cell1.getColumnValue()).intValue();
                    else if (cell1.getColumnValue() instanceof String) {
                        if (((String)cell1.getColumnValue()).trim().equals("")) {
                            flag = false;
                        } else {
                            r = Integer.parseInt((String)cell1.getColumnValue());
                        }
                    }

                    int ri = 0;                   
                    if (cell2.getColumnValue() instanceof Number)
                        ri = ((Number)cell2.getColumnValue()).intValue();
                    else if (cell2.getColumnValue() instanceof String) {
                        if (((String)cell2.getColumnValue()).trim().equals("")) {
                            flag = false;
                        } else {
                            ri = Integer.parseInt((String)cell2.getColumnValue());
                        }
                    }
                   
                    if (flag) {
                        Vector data = new Vector();
                        data.add(r);
                        data.add(ri);
                        Iterator rAndRisIter = rAndRis.iterator();
                        while (rAndRisIter.hasNext()) {
                            Vector oldData = (Vector)rAndRisIter.next();
                            Integer oldR = (Integer)oldData.get(0);
                            Integer oldRi = (Integer)oldData.get(1);
                            if ( (r == oldR.intValue()) && (ri == oldRi.intValue()) ) {
                                result = false;
                                break;
                            }
                        }
                        if (result)
                            rAndRis.add(data);
                        }
                   
                }
               
            }                       
           
            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);
                           
                        }
                                                                         
                    }                    
                   
View Full Code Here

       
    }
   
    private void updateRITAXI(Row taxRow, Row regRow, double sign) {
       
            Cell cell = ObjectUtil.findNewCell(regRow, "RI", "R");
            Integer r = 0;
            if (cell.getColumnValue() instanceof Number)
                r = ((Number)cell.getColumnValue()).intValue();
            else
                r = Integer.parseInt((String)cell.getColumnValue());

            cell = ObjectUtil.findNewCell(regRow, "RI", "RI");
            Integer ri = 0;
            if (cell.getColumnValue() instanceof Number)
                ri = ((Number)cell.getColumnValue()).intValue();                       
            else
                ri = Integer.parseInt((String)cell.getColumnValue());
           
            cell = ObjectUtil.findOldCell(regRow, "RI", "R");
            Integer oldr = 0;
            if (cell.getColumnValue() instanceof Number)
                oldr = ((Number)cell.getColumnValue()).intValue();
            else
                oldr = Integer.parseInt((String)cell.getColumnValue());

            cell = ObjectUtil.findOldCell(regRow, "RI", "RI");
            Integer oldri = 0;
            if (cell.getColumnValue() instanceof Number)
                oldri = ((Number)cell.getColumnValue()).intValue();                       
            else
                oldri = Integer.parseInt((String)cell.getColumnValue());
           
            cell = ObjectUtil.findNewCell(taxRow, "TAXI", "TAXT");
            String taxt = (String)cell.getColumnValue();
           
            cell = ObjectUtil.findNewCell(taxRow, "TAXI", "TAX");
            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());
View Full Code Here

TOP

Related Classes of realcix20.classes.basic.Cell

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.