Package nu.lazy8.ledger.jdbc

Examples of nu.lazy8.ledger.jdbc.JdbcTable


    StringBuffer sb = new StringBuffer();
    sb.append(
        "SELECT CustId ,CustName, CustDesc, DefaultAcc " +
        " FROM Customer2 WHERE CompId=" + compId +
        " ORDER BY CustId ");
    JdbcTable db = new JdbcTable(sb.toString(), view, new int[]{0});
    if (isJFreeReport) {
      db.GetFirstRecord();
      return new CustomerTable(db.resultSet);
    }

    if (!db.GetFirstRecord()) {
      return "";
    }

    //Print the Report header
    AddReportHeaders();

    initializeRow(fieldSize, 3);
    addField(Translator.getTranslation("CustId"), fieldSize, 1,
        -1, false);
    addField(Translator.getTranslation("Customer name"), fieldSize, 2,
        -1, false);
    addField(Translator.getTranslation("Customer description"), fieldSize, 3,
        -1, false);
    addField(Translator.getTranslation("Default account"), fieldSize, 4,
        -1, false);
    jTextArea.append(sbRow.toString());
    jTextArea.append(newline);
    initializeRow(fieldSize, 3);
    addField("-----------------------", fieldSize, 1, -1, false);
    addField("------------------------------------------------------------", fieldSize, 2, -1, false);
    addField("------------------------------------------------------------", fieldSize, 3, -1, false);
    addField("-----------------------", fieldSize, 4, -1, false);
    jTextArea.append(sbRow.toString());
    jTextArea.append(newline);

    do {
      jTextArea.append(renderIntegerField(
          db.getObject("CustId", null), fieldSize[1]));
      jTextArea.append(renderField((String)
          db.getObject("CustName", null), fieldSize[2]));
      jTextArea.append(renderField((String)
          db.getObject("CustDesc", null), fieldSize[3]));
      jTextArea.append(renderIntegerField((Integer)
          db.getObject("DefaultAcc", null), fieldSize[4]));
      jTextArea.append(newline);
    } while (db.GetNextRecord());

    return jTextField3.getText();
  }//}}}
View Full Code Here


   * @param  compId         Description of the Parameter
   * @return                Description of the Return Value
   */
  public Object buttonGetReportOld(boolean isJFreeReport,
      String rapName, int compId) {
    JdbcTable db = getJdbcTable(compId, true);
    if (isJFreeReport) {
      if (db==null)return null;
      db.GetFirstRecord();
      try {
        return new AccountReportTable(db.resultSet,new java.sql.Date(
            jTextField1.getDate().getTime()),new java.sql.Date(
            jTextField2.getDate().getTime()),compId);
      } catch (Exception e) {
        e.printStackTrace();
        return null;
      }
    }
    if (db==null)return "";

    if (!db.GetFirstRecord()) {
      return "";
    }

    if (((Integer) customerComboBox.getSelectedItemsKey()).intValue() != 0) {
      jTextArea.append(Translator.getTranslation("Customer") + "     " + customerComboBox.getSelectedItemsSecondaryKey());
      jTextArea.append(newline);
    }
    //Print the Report header
    AddReportHeaders();

    Integer processingAccount = (Integer) db.getObject("Amount.Account", null);
    Integer processingCustomer = (Integer) db.getObject("Amount.Customer", null);
    boolean bIsNewAccount = true;
    boolean bIsNewCustomer = true;
    boolean bIsNewPost = false;
    double fDebitTotal = 0;
    double fCreditTotal = 0;
    double fCustDebitTotal = 0;
    double fCustCreditTotal = 0;
    do {
      if(bIsNewAccount){
        jTextArea.append("               " + Translator.getTranslation("Account") +
            " " + IntegerField.ConvertIntToLocalizedString(
            processingAccount) + " : " +
            (String) db.getObject("AccDesc", null));
        jTextArea.append(newline);
        jTextArea.append(newline);
      }
      jTextArea.append("               " + Translator.getTranslation("Customer") +
          " " + IntegerField.ConvertIntToLocalizedString(
          processingCustomer) + " : " +
          (String) db.getObject("CustName", null));
      jTextArea.append(newline);
      jTextArea.append(newline);
      initializeRow(fieldSize, 6);
      addField(Translator.getTranslation("Transaction"), fieldSize, 1,
          -1, false);
      addField(Translator.getTranslation("InvDate"), fieldSize, 2,
          -1, false);
      addField(Translator.getTranslation("Commentary"), fieldSize, 3,
          -1, false);
      addField(Translator.getTranslation("Commentary"), fieldSize, 4,
          -1, false);
      addField(Translator.getTranslation("Customer"), fieldSize, 5,
          -1, false);
      addField(Translator.getTranslation("Debit"), fieldSize, 6,
          -1, true);
      addField(Translator.getTranslation("Credit"), fieldSize, 7,
          -1, true);
      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);

      do {
        jTextArea.append(renderIntegerField(
            db.getObject("Amount.Act_id", null), fieldSize[1]));
        jTextArea.append(renderDateField(
            db.getObject("InvDate", null), fieldSize[2]));
        jTextArea.append(renderField((String)
            db.getObject("Activity2.Notes", null), fieldSize[3]));
        jTextArea.append(renderField((String)
            db.getObject("Amount.Notes", null), fieldSize[4]));
        jTextArea.append(renderField((String)
            db.getObject("CustName", null), fieldSize[5]));

        jTextArea.append(renderDecimalField(((Double)
            db.getObject("Debit", null)), fieldSize[6]));
        fCustDebitTotal += ((Double)
            db.getObject("Debit", null)).doubleValue();
        fDebitTotal += ((Double)
            db.getObject("Debit", null)).doubleValue();
        jTextArea.append(renderDecimalField(((Double)
            db.getObject("Credit", null)), fieldSize[7]));
        fCustCreditTotal += ((Double)
            db.getObject("Credit", null)).doubleValue();
        fCreditTotal += ((Double)
            db.getObject("Credit", null)).doubleValue();
        jTextArea.append(newline);
        bIsNewPost = db.GetNextRecord();
        if (bIsNewPost) {
          bIsNewAccount = processingAccount.compareTo(
              (Integer) db.getObject("Amount.Account", null)) != 0;
          bIsNewCustomer = processingCustomer.compareTo(
              (Integer) db.getObject("Amount.Customer", null)) != 0;
        }
      } while (bIsNewPost && !bIsNewAccount && !bIsNewCustomer);
      initializeRow(fieldSize, 7);
      addField("-----------------------", fieldSize, 6, -1, false);
      addField("-----------------------", fieldSize, 7, -1, false);
      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);
      initializeRow(fieldSize, 7);
      addField(Translator.getTranslation("Balance"), fieldSize, 4, -1, false);
      addField(new Double(fCustDebitTotal-fCustCreditTotal), fieldSize, 5, Types.DOUBLE, false);
      addField(new Double(fCustDebitTotal), fieldSize, 6, Types.DOUBLE, false);
      addField(new Double(fCustCreditTotal), fieldSize, 7, Types.DOUBLE, false);
      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);
      processingCustomer = (Integer) db.getObject("Amount.Customer", null);
      fCustCreditTotal=0;
      fCustDebitTotal=0;
      if(bIsNewAccount || !bIsNewPost){
        initializeRow(fieldSize, 7);
        addField("-----------------------", fieldSize, 6, -1, false);
        addField("-----------------------", fieldSize, 7, -1, false);
        jTextArea.append(sbRow.toString());
        jTextArea.append(newline);
        initializeRow(fieldSize, 7);
        addField(Translator.getTranslation("Balance"), fieldSize, 4, -1, false);
        addField(new Double(fDebitTotal-fCreditTotal), fieldSize, 5, Types.DOUBLE, false);
        addField(new Double(fDebitTotal), fieldSize, 6, Types.DOUBLE, false);
        addField(new Double(fCreditTotal), fieldSize, 7, Types.DOUBLE, false);
        jTextArea.append(sbRow.toString());
        jTextArea.append(newline);
        processingAccount = (Integer) db.getObject("Amount.Account", null);
        fCreditTotal=0;
        fDebitTotal=0;
      }

    } while (bIsNewPost);
View Full Code Here

    tableAccountView = new JTable(dataAccountModel);
    // Create the table
    tableSecondLevelView = new JTable(dataSecondLevelModel);

    // Create a combo box to show that you can use one in a table.
    accountComboBox = new DataComboBox(new JdbcTable("APP.Account", 2, view), true, "Account", "sumrep", view);
    accountComboBox.loadComboBox("AccDesc", "Account", (Integer) cc.comboBox.getSelectedItemsKey());

    JScrollPane scrollpane = new JScrollPane(tableAccountView);
    //scrollpane.setBorder(new BevelBorder(BevelBorder.LOWERED));
    scrollpane.setPreferredSize(new Dimension(200, 200));
View Full Code Here

    jPanel1.add(textField1);

    jPanel1.add(label2);
    jPanel1.add(textField2);

    accountAccess = new JdbcTable("AccountingPeriods", 3, view);
    dataMovementPane = new DataMovementPane(
        accountAccess, this, view);

    jPanel2.add(dataMovementPane);
    JPanel horizontalSpacePanel = new JPanel();
View Full Code Here

    accountEditor = new IntegerField("Account", "transaction", view);
    column.setCellEditor(new DefaultCellEditor(accountEditor));
    column.setPreferredWidth(accountIntFieldSize);
    column.setCellRenderer(numberRenderer);

    accountCombo = new DataComboBox(new JdbcTable("APP.Account", 2, view), true, "Account", "transaction", view);
    accountCombo.loadComboBox("AccDesc", "Account", (Integer) cc.comboBox.getSelectedItemsKey());
    column = tableView.getColumn(dataModel.getColumnName(COL_ACCOUNTNAME));
    column.setCellEditor(new DefaultCellEditor(accountCombo));
    column.setPreferredWidth(accountNameFieldSize);

    column = tableView.getColumn(dataModel.getColumnName(COL_CUSTOMERNUM));
    customerEditor = new IntegerField("Customer", "transaction", view);
    column.setCellEditor(new DefaultCellEditor(customerEditor));
    column.setPreferredWidth(accountIntFieldSize);
    column.setCellRenderer(numberRenderer);

    customerCombo = new DataComboBox(new JdbcTable(
        "SELECT CompId,CustId,CustName FROM Customer2 WHERE CompId=? ORDER BY CustName"
        , view, new int[]{Types.INTEGER}), true, "Customer", "transaction", view);
    customerCombo.loadComboBox("CustName", "CustId", (Integer) cc.comboBox.getSelectedItemsKey());
    column = tableView.getColumn(dataModel.getColumnName(COL_CUSTOMERNAME));
    column.setPreferredWidth(accountNameFieldSize);
    column.setCellEditor(new DefaultCellEditor(customerCombo));

    column = tableView.getColumn(dataModel.getColumnName(COL_DEBIT));
    column.setPreferredWidth(accountTotalSize);
    debitEditor = new DoubleField("DebitAccountTotal", "transaction", view);
    column.setCellEditor(new DefaultCellEditor(debitEditor));
    column.setCellRenderer(numberRenderer);

    column = tableView.getColumn(dataModel.getColumnName(COL_CREDIT));
    column.setPreferredWidth(accountTotalSize);
    creditEditor = new DoubleField("CreditAccountTotal", "transaction", view);
    column.setCellEditor(new DefaultCellEditor(creditEditor));
    column.setCellRenderer(numberRenderer);

    tableView.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

    tableView.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    ListSelectionModel colSM =
        tableView.getColumnModel().getSelectionModel();
    colSM.addListSelectionListener(
      new ListSelectionListener() {
        //{{{ +valueChanged(ListSelectionEvent) : void
        public void valueChanged(ListSelectionEvent e) {
          //Ignore extra messages.
          //if(true)return;
          if (e.getValueIsAdjusting()) {
            return;
          }
          if ((Calendar.getInstance().getTime().getTime() - lastTimeHere) < 100) {
            return;
          }
          lastTimeHere = Calendar.getInstance().getTime().getTime();
          ListSelectionModel lsm = (ListSelectionModel) e.getSource();
          if (!lsm.isSelectionEmpty()) {
            switch (lsm.getMinSelectionIndex()) {
              case COL_TEXT:
                textCommentsEditor.showHelp();
                break;
              case COL_ACCOUNTNUM:
                accountEditor.showHelp();
                break;
              case COL_ACCOUNTNAME:
                accountEditor.showHelp();
                break;
              case COL_CUSTOMERNUM:
                customerEditor.showHelp();
                break;
              case COL_CUSTOMERNAME:
                customerEditor.showHelp();
                break;
              case COL_DEBIT:
                debitEditor.showHelp();
                break;
              case COL_CREDIT:
                creditEditor.showHelp();
                break;
            }
          }
        }//}}}
      });

    KeyStroke aKeyStroke = KeyStroke.getKeyStroke("ENTER");
    InputMap im = tableView.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    im.remove(aKeyStroke);
    im.getParent().remove(aKeyStroke);
    tableView.setInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, im);
    im = tableView.getInputMap(JComponent.WHEN_FOCUSED);
    im.remove(aKeyStroke);
    tableView.setInputMap(JComponent.WHEN_FOCUSED, im);
    im = tableView.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    im.remove(aKeyStroke);
    tableView.setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW, im);
    tableView.getInputMap(JComponent.WHEN_FOCUSED).put(aKeyStroke, "eatme");
    tableView.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(aKeyStroke, "eatme");
    Action anAction =
      new Action() {

        //{{{ +actionPerformed(ActionEvent) : void
        public void actionPerformed(ActionEvent e) {
          ListSelectionModel rsm = tableView.getSelectionModel();
          ListSelectionModel csm = tableView.getColumnModel().getSelectionModel();

          int selectedRow = rsm.getAnchorSelectionIndex();
          int selectedColumn = csm.getAnchorSelectionIndex();
          Log.log(Log.DEBUG, "actionPerformed", "actionPerformed="
               + selectedRow + ":" + selectedColumn + ":");

          switch (selectedColumn) {
            case COL_ACCOUNTNUM:
              if (SetupInfo.getBoolProperty(SetupInfo.INPUT_TABSTOP_CUSTOMER)) {
                tableView.editCellAt(selectedRow, COL_CUSTOMERNUM);
                csm.setSelectionInterval(COL_CUSTOMERNUM, COL_CUSTOMERNUM);
              } else {
                tableView.editCellAt(selectedRow, COL_DEBIT);
                csm.setSelectionInterval(COL_DEBIT, COL_DEBIT);
              }
              if (debitTotal.getDouble().compareTo(
                  creditTotal.getDouble()) == 0 &&
                  creditTotal.getDouble().doubleValue() != 0 &&
                  tableFields[selectedRow][COL_ACCOUNTNUM].length() == 0) {

                tableView.editCellAt(selectedRow, COL_ACCOUNTNUM);
                csm.setSelectionInterval(COL_ACCOUNTNUM, COL_ACCOUNTNUM);
                nextComp = dataMovementPane.butAdd;
                dataMovementPane.butAdd.requestFocus();
                //tableView.transferFocus();//this doesnt do anything anymore
              } else
                  if (tableFields[selectedRow][COL_ACCOUNTNAME].length() == 0) {
                tableView.editCellAt(selectedRow, COL_ACCOUNTNAME);
                csm.setSelectionInterval(COL_ACCOUNTNAME, COL_ACCOUNTNAME);
                //create a model dialog to get a name to the new account number
                JDialog dialog = new JDialog((Frame) GUIUtilities.getView(tableView), true);
                AccountForm af = new AccountForm(true, tableFields[selectedRow][COL_ACCOUNTNUM].toString(), dialog, view);
                dialog.getContentPane().setLayout(new GridLayout(1, 1));
                dialog.getContentPane().add(af);
                dialog.pack();
                dialog.setLocationRelativeTo(GUIUtilities.getView(tableView));
                //This next command will not return untill the dialog dissappears.
                dialog.setVisible(true);
                if (af.isOk()) {
                  accountCombo = new DataComboBox(new JdbcTable("APP.Account", 2, view), true, "Account", "transaction", view);
                  accountCombo.loadComboBox("AccDesc", "Account", (Integer) cc.comboBox.getSelectedItemsKey());
                  TableColumn column = tableView.getColumn(dataModel.getColumnName(COL_ACCOUNTNAME));
                  column.setCellEditor(new DefaultCellEditor(accountCombo));
                  AccountNumberChanged(af.accountNum(), selectedRow, COL_ACCOUNTNUM);
                  dataModel.fireTableCellUpdated(selectedRow, COL_ACCOUNTNUM);
                  if (SetupInfo.getBoolProperty(SetupInfo.INPUT_TABSTOP_CUSTOMER)) {
                    tableView.editCellAt(selectedRow, COL_CUSTOMERNUM);
                    csm.setSelectionInterval(COL_CUSTOMERNUM, COL_CUSTOMERNUM);
                  } else {
                    tableView.editCellAt(selectedRow, COL_DEBIT);
                    csm.setSelectionInterval(COL_DEBIT, COL_DEBIT);
                  }
                } else {
                  accountCombo.showPopup();
                }
              }

              break;
            case COL_CUSTOMERNUM:
              tableView.editCellAt(selectedRow, COL_DEBIT);
              csm.setSelectionInterval(COL_DEBIT, COL_DEBIT);
              if (tableFields[selectedRow][COL_CUSTOMERNAME].length() == 0) {
                tableView.editCellAt(selectedRow, COL_CUSTOMERNAME);
                csm.setSelectionInterval(COL_CUSTOMERNAME, COL_CUSTOMERNAME);
                //create a model dialog to get a name to the new customer number
                JDialog dialog = new JDialog((Frame) GUIUtilities.getView(tableView), true);
                CustomerForm cf = new CustomerForm(true, tableFields[selectedRow][COL_CUSTOMERNUM].toString(), dialog, view);
                dialog.getContentPane().setLayout(new BorderLayout());
                dialog.getContentPane().add(BorderLayout.CENTER, cf);
                dialog.pack();
                dialog.setLocationRelativeTo(GUIUtilities.getView(tableView));
                //This next command will not return untill the dialog dissappears.
                dialog.setVisible(true);
                if (cf.isOk()) {
                  customerCombo = new DataComboBox(new JdbcTable(
                      "SELECT CompId,CustId,CustName FROM Customer2 WHERE CompId=? ORDER BY CustName"
                      , view, new int[]{Types.INTEGER}), true, "Customer", "transaction", view);
                  customerCombo.loadComboBox("CustName", "CustId", (Integer) cc.comboBox.getSelectedItemsKey());
                  TableColumn column = tableView.getColumn(dataModel.getColumnName(COL_CUSTOMERNAME));
                  column.setCellEditor(new DefaultCellEditor(customerCombo));
View Full Code Here

    }
    if(isCustomerReport)
      sb.append(" ORDER BY Amount.Account,Customer2.CustId,Amount.Act_id ");
    else
      sb.append(" ORDER BY Amount.Account,Amount.Act_id ");
    JdbcTable db = new JdbcTable(sb.toString(), view, new int[]{Types.DATE, Types.DATE, Types.INTEGER, Types.INTEGER});
    try {
      //invoice date
      db.setObject(new java.sql.Date(
          jTextField1.getDate().getTime()),
          Types.DATE);
      db.setObject(new java.sql.Date(
          jTextField2.getDate().getTime()),
          Types.DATE);
    } catch (Exception e) {
      e.printStackTrace();
      return null;
View Full Code Here

   * @param  rapName        Description of the Parameter
   * @param  compId         Description of the Parameter
   * @return                Description of the Return Value
   */
  public Object buttonGetReportOld(boolean isJFreeReport, String rapName, int compId) {
    JdbcTable db = getJdbcTable(compId, false);
    if (isJFreeReport) {
      if (db==null)return null;
      db.GetFirstRecord();
      try {
        return new AccountReportTable(db.resultSet,new java.sql.Date(
            jTextField1.getDate().getTime()),new java.sql.Date(
            jTextField2.getDate().getTime()),compId);
      } catch (Exception e) {
        e.printStackTrace();
        return null;
      }
    }
    AccountReportTable accIncOutTable=null;
    if (db==null)return "";
    db.GetFirstRecord();
    try {
      accIncOutTable = new AccountReportTable(db.resultSet,new java.sql.Date(
          jTextField1.getDate().getTime()),new java.sql.Date(
          jTextField2.getDate().getTime()),compId);
      db.resultSet.first();
    } catch (Exception e) {
      e.printStackTrace();
      return "";
    }
    db = getJdbcTable(compId, false);
    if (!db.GetFirstRecord())return "";
    if (accIncOutTable==null)return "";

    if (((Integer) customerComboBox.getSelectedItemsKey()).intValue() != 0) {
      jTextArea.append(Translator.getTranslation("Customer") + "     " + customerComboBox.getSelectedItemsSecondaryKey());
      jTextArea.append(newline);
    }
    //Print the Report header
    AddReportHeaders();

    Integer processingAccount = (Integer) db.getObject("Amount.Account", null);
    boolean bIsNewAccount = false;
    boolean bIsNewPost = false;
    do {
      jTextArea.append("               " + Translator.getTranslation("Account") +
          " " + IntegerField.ConvertIntToLocalizedString(
          processingAccount) + " : " +
          (String) db.getObject("AccDesc", null));
      jTextArea.append(newline);
      jTextArea.append(newline);

      initializeRow(fieldSize, 6);
      addField(Translator.getTranslation("Transaction"), fieldSize, 1,
          -1, false);
      addField(Translator.getTranslation("InvDate"), fieldSize, 2,
          -1, false);
      addField(Translator.getTranslation("Commentary"), fieldSize, 3,
          -1, false);
      addField(Translator.getTranslation("Commentary"), fieldSize, 4,
          -1, false);
      addField(Translator.getTranslation("Customer"), fieldSize, 5,
          -1, false);
      addField(Translator.getTranslation("Debit"), fieldSize, 6,
          -1, true);
      addField(Translator.getTranslation("Credit"), fieldSize, 7,
          -1, true);
      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);
      double fDebitTotal = 0;
      double fCreditTotal = 0;

      do {
        if (SetupInfo.getBoolProperty(SetupInfo.SHOW_PERIOD_ID)){
          jTextArea.append(renderIntegerField(
              db.getObject("PeriodId", null), fieldSize[1]));
        }
        else{
          jTextArea.append(renderIntegerField(
              db.getObject("Amount.Act_id", null), fieldSize[1]));
        }
        jTextArea.append(renderDateField(
            db.getObject("InvDate", null), fieldSize[2]));
        jTextArea.append(renderField((String)
            db.getObject("Activity2.Notes", null), fieldSize[3]));
        jTextArea.append(renderField((String)
            db.getObject("Amount.Notes", null), fieldSize[4]));
        jTextArea.append(renderField((String)
            db.getObject("CustName", null), fieldSize[5]));

        jTextArea.append(renderDecimalField(((Double)
            db.getObject("Debit", null)), fieldSize[6]));
        fDebitTotal += ((Double)
            db.getObject("Debit", null)).doubleValue();
        jTextArea.append(renderDecimalField(((Double)
            db.getObject("Credit", null)), fieldSize[7]));
        fCreditTotal += ((Double)
            db.getObject("Credit", null)).doubleValue();
        jTextArea.append(newline);
        bIsNewPost = db.GetNextRecord();
        if (bIsNewPost) {
          bIsNewAccount = processingAccount.compareTo(
              (Integer) db.getObject("Amount.Account", null)) != 0;
        }
      } while (bIsNewPost && !bIsNewAccount);

      initializeRow(fieldSize, 7);
      addField("-----------------------", fieldSize, 6, -1, false);
      addField("-----------------------", fieldSize, 7, -1, false);
      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);
      initializeRow(fieldSize, 7);
      addField(Translator.getTranslation("Total"), fieldSize, 5, -1, false);
      addField(new Double(fDebitTotal), fieldSize, 6, Types.DOUBLE, false);
      addField(new Double(fCreditTotal), fieldSize, 7, Types.DOUBLE, false);
      jTextArea.append(sbRow.toString());

      jTextArea.append(newline);
      initializeRow(fieldSize, 7);
      addField(Translator.getTranslation("Incomming"), fieldSize, 5, -1, false);
      addField(Translator.getTranslation("Value"), fieldSize, 6, -1, false);
      addField(Translator.getTranslation("Outgoing"), fieldSize, 7, -1, false);
      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);
      initializeRow(fieldSize, 7);
      addField("-----------------------", fieldSize, 5, -1, false);
      addField("-----------------------", fieldSize, 6, -1, false);
      addField("-----------------------", fieldSize, 7, -1, false);
      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);
      initializeRow(fieldSize, 7);
      try {
        addField(accIncOutTable.getValueAt(db.resultSet.getRow()-2, accIncOutTable.TABLEPOS_INCOMMINGAMOUNT), fieldSize, 5, -1, true);
        addField(new Double(fDebitTotal-fCreditTotal), fieldSize, 6, Types.DOUBLE, false);
        addField(accIncOutTable.getValueAt(db.resultSet.getRow()-2, accIncOutTable.TABLEPOS_OUTGOINGAMOUNT), fieldSize, 7, -1, true);
      } catch (Exception e) {}
      jTextArea.append(sbRow.toString());


      jTextArea.append(newline);
      if (bIsNewPost)
        processingAccount = (Integer) db.getObject("Amount.Account", null);

    } while (bIsNewPost);
    try {
      accIncOutTable.resultSet.close();
    } catch (Exception e) {}
View Full Code Here

  public void getSpecialGuiPane(JPanel jPanel1) {
    AddDateComponents(jPanel1, "allreports");
    JLabel label1 = new HelpedLabel(Translator.getTranslation("Account"),
        "Account", "allreports", view);
    jPanel1.add(label1);
    accountComboBox = new DataComboBox(new JdbcTable("APP.Account", 2, view), true,
        "Account", "allreports", view);
    accountComboBox.setMaximumSize(new Dimension(accountNameFieldSize, accountNameFieldSize));
    accountComboBox.setMinimumSize(new Dimension(accountNameFieldSize / 2, 1));
    jPanel1.add(accountComboBox);

    JLabel label2 = new HelpedLabel(Translator.getTranslation("Customer"),
        "Customer", "allreports", view);
    jPanel1.add(label2);
    customerComboBox = new DataComboBox(new JdbcTable(
        "SELECT CompId,CustId,CustName FROM Customer2 WHERE CompId=? ORDER BY CustName"
        , view, new int[]{Types.INTEGER}), true, "Customer", "allreports", view);
    customerComboBox.setMaximumSize(new Dimension(accountNameFieldSize, accountNameFieldSize));
    customerComboBox.setMinimumSize(new Dimension(accountNameFieldSize / 2, 1));
    customerComboBox.loadComboBox("CustName", "CustId", (Integer) cc.comboBox.getSelectedItemsKey());
View Full Code Here

  public Object buttonGetReportOld(boolean isJFreeReport, String rapName, int compId) {
    String select = "SELECT APP.Account.Account,AccDesc,TypeName " +
        "FROM APP.Account,AccountType WHERE AccountType.AccTypeId=APP.Account.IsAsset " +
        "AND AccountType.CompId=APP.Account.CompId AND AccountType.CompId=" +
        compId + " ORDER BY APP.Account.Account";
    JdbcTable db = new JdbcTable(select, view, new int[]{0});
    if (isJFreeReport) {
      db.GetFirstRecord();
      return new ChartAccountTable(db.resultSet);
    }

    if (!db.GetFirstRecord()) {
      return "";
    }

    //Print the Report header
    AddReportHeaders();

    initializeRow(fieldSize, 3);
    addField(Translator.getTranslation("Account"), fieldSize, 1,
        -1, false);
    addField(Translator.getTranslation("Account name"), fieldSize, 2,
        -1, false);
    addField(Translator.getTranslation("Account type"), fieldSize, 3,
        -1, false);
    jTextArea.append(sbRow.toString());
    jTextArea.append(newline);
    initializeRow(fieldSize, 3);
    addField("-----------------------", fieldSize, 1, -1, false);
    addField("------------------------------------------------------------", fieldSize, 2, -1, false);
    addField("-----------------------", fieldSize, 3, -1, false);
    jTextArea.append(sbRow.toString());
    jTextArea.append(newline);

    do {
      jTextArea.append(renderIntegerField(
          db.getObject("APP.Account.Account", null), fieldSize[1]));
      jTextArea.append(renderField((String)
          db.getObject("AccDesc", null), fieldSize[2]));
      jTextArea.append(renderField((String)
          Translator.getTranslation(db.getObject("TypeName", null).toString()), fieldSize[3]));
      jTextArea.append(newline);
    } while (db.GetNextRecord());

    return jTextField3.getText();
  }//}}}
View Full Code Here

   * @param  compId         Description of the Parameter
   * @return                Description of the Return Value
   */
  public Object buttonGetReportOld(boolean isJFreeReport,
      String rapName, int compId) {
    JdbcTable db = getJdbcTable(compId);
    if (isJFreeReport) {
      if (db==null)return null;
      db.GetFirstRecord();
      return new TransactionTable(db.resultSet);
    }
    if (db==null)return "";

    if (!db.GetFirstRecord()) {
      return "";
    }
    //Print the Report header
    if (intField1.getText().length() != 0 && intField2.getText().length() != 0 &&
        intField2.getInteger().intValue() >= intField1.getInteger().intValue()) {
      jTextArea.append(Translator.getTranslation("Start Transaction number") + "    " + intField1.getText());
      jTextArea.append(newline);
      jTextArea.append(Translator.getTranslation("Stop Transaction number") + "     " + intField2.getText());
      jTextArea.append(newline);
    }
    if (((Integer) customerComboBox.getSelectedItemsKey()).intValue() != 0) {
      jTextArea.append(Translator.getTranslation("Customer") + "     " + customerComboBox.getSelectedItemsSecondaryKey());
      jTextArea.append(newline);
    }

    AddReportHeaders();

    boolean bIsNewAccount = true;
    double fDebitTotal = 0;
    double fCreditTotal = 0;
    double fTotalSum=0;
    Integer processingAccount;
    Integer processingTransaction;
    boolean bNewRecordExists;
    do {
      processingAccount = (Integer) db.getObject("Amount.Account", null);
      processingTransaction = (Integer) db.getObject("Customer2.CustId", null);
      initializeRow(fieldSize, 8);
      jTextArea.append(renderIntegerField(
          db.getObject("Customer2.CustId", null), 14));
      jTextArea.append(renderField((String)
          db.getObject("Customer2.CustName", null), 50));

      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);
      initializeRow(fieldSize, 8);
      String sLotsOfLines = new String("--------------------------------------------------------------------------");
      addField(sLotsOfLines, fieldSize, 1,
          -1, false);
      addField(sLotsOfLines, fieldSize, 2,
          -1, false);
      addField(sLotsOfLines, fieldSize, 3,
          -1, false);
      addField(sLotsOfLines, fieldSize, 4,
          -1, false);
      addField(sLotsOfLines, fieldSize, 5,
          -1, false);
      addField(sLotsOfLines, fieldSize, 6,
          -1, false);
      addField(sLotsOfLines, fieldSize, 7,
          -1, false);
      addField(sLotsOfLines, fieldSize, 8,
          -1, false);
      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);
      initializeRow(fieldSize, 8);
      addField(Translator.getTranslation("Transaction"), fieldSize, 1,
          -1, false);
      addField(Translator.getTranslation("InvDate"), fieldSize, 2,
          -1, false);
      addField(Translator.getTranslation("Commentary"), fieldSize, 3,
          -1, false);
      addField(Translator.getTranslation("Commentary"), fieldSize, 4,
          -1, false);
      addField(Translator.getTranslation("Account"), fieldSize, 5,
          -1, false);
      addField(Translator.getTranslation("Account name"), fieldSize, 6,
          -1, false);
      addField(Translator.getTranslation("Debit"), fieldSize, 7,
          -1, true);
      addField(Translator.getTranslation("Credit"), fieldSize, 8,
          -1, true);
      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);
      IntHolder iType = new IntHolder();
      do {

        initializeRow(fieldSize, 8);
        if (SetupInfo.getBoolProperty(SetupInfo.SHOW_PERIOD_ID))
          addField(db.getObject("PeriodId", iType), fieldSize, 1, iType.iValue, false);
        else
          addField(db.getObject("Amount.Act_id", iType), fieldSize, 1, iType.iValue, false);
        addField(
            db.getObject("InvDate", iType), fieldSize, 2, iType.iValue, false);
        addField((String)
            db.getObject("Activity2.Notes", iType), fieldSize, 3, iType.iValue, false);
        addField((String)
            db.getObject("Amount.Notes", iType), fieldSize, 4, iType.iValue, false);
        addField(
            db.getObject("Amount.Account", iType), fieldSize, 5, iType.iValue, false);
        addField((String)
            db.getObject("AccDesc", iType), fieldSize, 6, iType.iValue, false);

        if (((Integer) db.getObject("IsDebit", iType)).intValue() == 1) {
          addField(db.getObject("Amount.Amount", iType),
              fieldSize, 7, iType.iValue, false);
          fDebitTotal += ((Double)
              db.getObject("Amount.Amount", null)).doubleValue();
        } else {
          addField(db.getObject("Amount.Amount", iType),
              fieldSize, 8, iType.iValue, false);
          fCreditTotal += ((Double)
              db.getObject("Amount.Amount", null)).doubleValue();
        }
        jTextArea.append(sbRow.toString());
        jTextArea.append(newline);

        bNewRecordExists = db.GetNextRecord();
       
        if(!bNewRecordExists || processingAccount.intValue()
           != ((Integer) db.getObject("Amount.Account", null)).intValue()
           ||  processingTransaction.intValue()
           != ((Integer) db.getObject("Customer2.CustId", null)).intValue()){
          initializeRow(fieldSize, 8);
          addField("-----------------------", fieldSize, 7, -1, false);
          addField("-----------------------", fieldSize, 8, -1, false);
          jTextArea.append(sbRow.toString());
          jTextArea.append(newline);
          initializeRow(fieldSize, 8);
          addField(Translator.getTranslation("Balance"), fieldSize, 4, -1, false);
          fTotalSum+=fDebitTotal-fCreditTotal;
          addField(new Double(fDebitTotal-fCreditTotal), fieldSize, 6, Types.DOUBLE, false);
          addField(new Double(fDebitTotal), fieldSize, 7, Types.DOUBLE, false);
          addField(new Double(fCreditTotal), fieldSize, 8, Types.DOUBLE, false);
          jTextArea.append(sbRow.toString());
          jTextArea.append(newline);
          processingAccount = (Integer) db.getObject("Amount.Account", null);
          fCreditTotal=0;
          fDebitTotal=0;
        }

      } while (bNewRecordExists && processingTransaction.intValue()
           == ((Integer) db.getObject("Customer2.CustId", null)).intValue());
     
      initializeRow(fieldSize, 8);
      addField("-----------------------------------------", fieldSize, 4, -1, false);
      addField("-----------------------", fieldSize, 5, -1, false);
      addField("-----------------------------------------", fieldSize, 6, -1, false);
      addField("-----------------------", fieldSize, 7, -1, false);
      addField("-----------------------", fieldSize, 8, -1, false);
      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);
      initializeRow(fieldSize, 8);
      addField(Translator.getTranslation("Total"), fieldSize, 4, -1, false);
      addField(new Double(fTotalSum), fieldSize, 6, Types.DOUBLE, false);
      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);
      processingAccount = (Integer) db.getObject("Amount.Account", null);
      fTotalSum=0;
     
      jTextArea.append(newline);
      jTextArea.append(newline);

View Full Code Here

TOP

Related Classes of nu.lazy8.ledger.jdbc.JdbcTable

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.