Package nu.lazy8.ledger.jdbc

Examples of nu.lazy8.ledger.jdbc.DatabaseBackup


    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

  public static void createBackupCompanyFrame(JFrame view) {
    DataConnection dc = DataConnection.getInstance(view);
    if (dc == null || !dc.bIsConnectionMade) {
      return;
    }
    DatabaseBackup db = new DatabaseBackup(
        dc.con);
    db.BackupDatabase(db.sTables, true);
  }//}}}
View Full Code Here

  public static void createBackupFrame(JFrame view) {
    DataConnection dc = DataConnection.getInstance(view);
    if (dc == null || !dc.bIsConnectionMade) {
      return;
    }
    DatabaseBackup db = new DatabaseBackup(
        dc.con);
    db.BackupDatabase(db.sTables, false);
  }//}}}
View Full Code Here

  public static void createRestoreCompanyFrame(JFrame view) {
    DataConnection dc = DataConnection.getInstance(view);
    if (dc == null || !dc.bIsConnectionMade) {
      return;
    }
    DatabaseBackup db = new DatabaseBackup(
        dc.con);
    db.RestoreDatabase(true, null, 0, view);
  }//}}}
View Full Code Here

   * @param  iNewCompany             Description of the Parameter
   * @param  view                    Description of the Parameter
   */
  public static void createRestoreFile(Connection con,
      boolean bRestoreOneCompanyOnly, String fileName, int iNewCompany, JFrame view) {
    DatabaseBackup db = new DatabaseBackup(con);
    db.RestoreDatabase(bRestoreOneCompanyOnly, fileName, iNewCompany, view);
  }//}}}
View Full Code Here

  public static void createRestoreFrame(JFrame view) {
    DataConnection dc = DataConnection.getInstance(view);
    if (dc == null || !dc.bIsConnectionMade) {
      return;
    }
    DatabaseBackup db = new DatabaseBackup(
        dc.con);
    db.RestoreDatabase(false, null, 0, view);
  }//}}}
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

TOP

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

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.