Package nu.lazy8.ledger.forms

Examples of nu.lazy8.ledger.forms.ChangeLanguagesDialogs


   */
  public void clearFields() {
    textField1.setText("");
    //Get the next available number for the customer
    try {
      DataConnection dc = DataConnection.getInstance(null);
      if (dc == null || !dc.bIsConnectionMade) {
        return;
      }
      Statement st = dc.con.createStatement();
      ResultSet rs = st.executeQuery(dc.filterSQL(
          "SELECT MAX(CustId) FROM Customer2 WHERE CompId=" + ((Integer) cc.comboBox.getSelectedItemsKey()).intValue()));
      if (rs.next()) {
        int highestId = rs.getInt(1);
        highestId++;
        textField1.setInteger(new Integer(highestId));
View Full Code Here


   * @param  iCompId  Description of the Parameter
   * @return          The defaultAccount value
   */
  public static int getDefaultAccount(int iCustId, int iCompId) {
    try {
      DataConnection dc = DataConnection.getInstance(null);
      if (dc == null || !dc.bIsConnectionMade) {
        return 0;
      }
      Statement stmt = dc.con.createStatement();
      ResultSet rs = stmt.executeQuery(dc.filterSQL("SELECT DefaultAcc FROM Customer2 where CompId=" + iCompId + " and CustId=" + iCustId));
      if (rs.next()) {
        return rs.getInt(1);
      }
      return 0;
    } catch (Exception ex) {
View Full Code Here

   *
   * @param  bIsAddOnly   Description of the Parameter
   * @param  sAccountNum  Description of the Parameter
   */
  private void initialize(boolean bIsAddOnly, String sAccountNum) {
    DataConnection dc = DataConnection.getInstance(view);
    if (dc == null || !dc.bIsConnectionMade) {
      Exit();
      return;
    }
    /*
 
View Full Code Here

    rightButton.addActionListener(
      new java.awt.event.ActionListener() {
        //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          DataConnection dc = DataConnection.getInstance(null);
          if (dc == null || !dc.bIsConnectionMade) {
            return;
          }
          File ff = new File("");
          boolean bFoundFile = true;
          try {
            ff = Fileio.getFile("AccountPlan." + SetupInfo.getProperty(SetupInfo.PRESENT_LANGUAGE) + ".bin",
                "testdata", false, false);
            if (ff == null || !ff.isFile()) {
              bFoundFile = false;
            }
          } catch (Exception ee) {
            bFoundFile = false;
          }
          if (!bFoundFile) {
            try {
              ff = Fileio.getFile("AccountPlan.en.bin",
                  "testdata", false, false);
            } catch (Exception eee) {
              SystemLog.ErrorPrint("Cant find test database : " + eee.getMessage());
              return;
            }
          }
          Lazy8LedgerPlugin.createRestoreFile(dc.con, true, ff.getAbsolutePath(), iCompId, frameParent);
          //name was destroyed in the last operation
          CompanyForm.quickAndDirtyChangeCompany(iCompId, sCompName);
          //period destroyed also...
          try {
            PreparedStatement stmt = dc.con.prepareStatement(dc.filterSQL(
                "INSERT INTO AccountingPeriods (CompId,StartPeriod,EndPeriod) VALUES(?,?,?)"));
            stmt.setInt(1, iCompId);
            stmt.setDate(2, new java.sql.Date(dateField1.getDate().getTime()));
            stmt.setDate(3, new java.sql.Date(dateField2.getDate().getTime()));
            stmt.executeUpdate();
View Full Code Here

                    Translator.getTranslation("The StartPeriod must be less than the EndPeroid"),
                    Translator.getTranslation("Update not entered"),
                    JOptionPane.PLAIN_MESSAGE);
              } else {
                try {
                  DataConnection dc = DataConnection.getInstance(null);
                  if (dc == null || !dc.bIsConnectionMade) {
                    return;
                  }
                  PreparedStatement stmt = dc.con.prepareStatement(dc.filterSQL(
                      "INSERT INTO AccountingPeriods (CompId,StartPeriod,EndPeriod) VALUES(?,?,?)"));
                  stmt.setInt(1, iCompId);
                  stmt.setDate(2, new java.sql.Date(dateField1.getDate().getTime()));
                  stmt.setDate(3, new java.sql.Date(dateField2.getDate().getTime()));
                  stmt.executeUpdate();
View Full Code Here

      wholeSouth.add(jPbuttons);
      getContentPane().add(wholeSouth, BorderLayout.SOUTH);

      //fill the database
      try {
        dc = new DataConnection(null);
        if (dc == null || !dc.bIsConnectionMade) {
          setVisible(false);
        }
        Statement st = dc.con.createStatement();
        String select = "SELECT APP.Account.Account,AccDesc,IsAsset,Name,APP.Account.CompId FROM APP.Account,Company WHERE " +
View Full Code Here

   * @param  view  Description of the Parameter
   */
  public AllReports(View view) {
    EditBus.addToBus(this);
    this.view = view;
    DataConnection dc = DataConnection.getInstance(view);
    if (dc == null || !dc.bIsConnectionMade) {
      buttonExit();
      return;
    }
    nowSelectedReport = getTextReport(KNOWN_REPORT_BALANCE);
View Full Code Here

        intField2.getInteger().intValue() >= intField1.getInteger().intValue()) {
      sb.append(" AND Activity2.Act_id >= ? AND Activity2.Act_id <= ? ");
    }

    sb.append(" ORDER BY Amount.Act_id, IsDebit");
    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);
      if (intField1.getText().length() != 0 && intField2.getText().length() != 0 &&
          intField2.getInteger().intValue() >= intField1.getInteger().intValue()) {
        db.setObject(intField1.getInteger(), Types.INTEGER);
        db.setObject(intField2.getInteger(), Types.INTEGER);
      }
    } catch (Exception e) {
      Log.log(Log.DEBUG, this, "Error trying to execute sql=" + sb.toString());
      Log.log(Log.DEBUG, this, "Error =" + e);
      return "";
    }
    if (isJFreeReport) {
      db.GetFirstRecord();
      return new TransactionTable(db.resultSet);
    }

    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);
    }

    AddReportHeaders();

    Integer processingTransaction;
    boolean bNewRecordExists;
    do {
      processingTransaction = (Integer) db.getObject("Amount.Act_id", null);
      initializeRow(fieldSize, 5);
      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("Fileing information"), fieldSize, 4,
          -1, false);
      addField(Translator.getTranslation("RegDate"), fieldSize, 5,
          -1, false);
      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);

      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("FileInfo", null), fieldSize[4]));
      jTextArea.append(renderDateField(
          db.getObject("RegDate", null), fieldSize[5]));

      jTextArea.append(newline);
      initializeRow(fieldAccSize, 8);
      addField(Translator.getTranslation("Account"), fieldAccSize, 2,
          -1, false);
      addField(Translator.getTranslation("Account name"), fieldAccSize, 4,
          -1, false);
      addField(Translator.getTranslation("Commentary"), fieldAccSize, 5,
          -1, false);
      addField(Translator.getTranslation("Customer"), fieldAccSize, 6,
          -1, false);
      addField(Translator.getTranslation("Debit"), fieldAccSize, 7,
          -1, true);
      addField(Translator.getTranslation("Credit"), fieldAccSize, 8,
          -1, true);
      jTextArea.append(sbRow.toString());
      jTextArea.append(newline);
      double fDebitTotal = 0;
      double fCreditTotal = 0;
      IntHolder iType = new IntHolder();
      do {
        initializeRow(fieldAccSize, 8);

        addField(db.getObject("Amount.Account", iType),
            fieldAccSize, 2, iType.iValue, false);
        addField(db.getObject("AccDesc", iType),
            fieldAccSize, 4, iType.iValue, false);
        addField(db.getObject("Amount.Notes", iType),
            fieldAccSize, 5, iType.iValue, false);
        String cust = (String) db.getObject("CustName", iType);
        if (cust == null) {
          cust = "";
        }
        addField(cust,
            fieldAccSize, 6, iType.iValue, false);

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

        bNewRecordExists = db.GetNextRecord();
      } while (bNewRecordExists && processingTransaction.intValue()
           == ((Integer) db.getObject("Amount.Act_id", null)).intValue());

      initializeRow(fieldAccSize, 6);
      addField("---------------", fieldAccSize, 7, -1, true);
      addField("---------------", fieldAccSize, 8, -1, true);
      jTextArea.append(sbRow.toString());
View Full Code Here

    checkbox4 = new HelpedCheckBox(Translator.getTranslation("Include in the balance in reports"),
        false, "balance", "accounttype", view);
    jPanel1.add(new JPanel());
    jPanel1.add(checkbox4);

    accountTypeAccess = new JdbcTable("AccountType", 2, view);
    dataMovementPane = new DataMovementPane(
        accountTypeAccess, this, bIsAddOnly, view);

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

    label1 = new HelpedLabel(sLabelText, "company", helpFile, view);
    if (jPanel1 != null) {
      jPanel1.add(label1);
    }

    comboBox = new DataComboBox(new JdbcTable("Company", 1, view), false, "company", helpFile, view);
    comboBox.setMaximumSize(new Dimension(accountNameFieldSize, accountNameFieldSize));
    comboBox.setMinimumSize(new Dimension(accountNameFieldSize / 2, 1));
    ActionListener lsel =
      new ActionListener() {
        //{{{ +actionPerformed(ActionEvent) : void
        public void actionPerformed(ActionEvent e) {
          SwingUtilities.invokeLater(
            new Runnable() {
              //{{{ +run() : void
              public void run() {
                updateBoxes();
              }//}}}
            });
        }//}}}
      };
    if (jPanel1 != null) {
      jPanel1.add(comboBox);
    }

    comboBox.loadComboBox("Name", "CompId", new Integer(0));
    //select the default company
    JdbcTable aa = new JdbcTable("Company", 1, view);
    try {
      aa.setObject(new Integer(
          SetupInfo.getProperty(SetupInfo.DEFAULT_COMPANY)),
          "CompId");
      if (aa.GetFirstRecord()) {
        comboBox.setSelectedItemFromKey((Integer)
            aa.getObject("CompId", null));
      }
    } catch (Exception ex) {
      comboBox.setSelectedItem("");
      /*
       *  just clear the dialog
View Full Code Here

TOP

Related Classes of nu.lazy8.ledger.forms.ChangeLanguagesDialogs

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.