Package nu.lazy8.ledger.jdbc

Examples of nu.lazy8.ledger.jdbc.UniqNumGenerator


    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

          startNum=rs.getInt("id")+1;
        }
        st.close();
      }catch(Exception e){
      }
      UniqNumGenerator a = new UniqNumGenerator();
      accountTypeAccess.setObject(
          new Integer(a.GetUniqueNumber("AccTypeId", startNum, 999999999,
          (Integer) cc.comboBox.getSelectedItemsKey())), "AccTypeId");
    } else {
      getCustomerId(i++);
    }
    accountTypeAccess.setObject(textField2.getText(), "TypeName");
View Full Code Here

    report1.setProperty("startdatetext", Translator.getTranslation("Start date"));
    report1.setProperty("stopdatetext", Translator.getTranslation("Stop date"));
    report1.setProperty("company", compName);
    report1.setProperty("companytext", Translator.getTranslation("Company"));
    report1.setProperty("LastTransactionNumberText", Translator.getTranslation("Last transaction number"));
    int iActId = (new UniqNumGenerator()).ViewNextAvailableNumber("Act_Id", 1, 999999999, new Integer(compId));
    if (iActId>0)iActId-=1;
    report1.setProperty("LastTransactionNumber", IntegerField.ConvertIntToLocalizedString(new Integer(iActId)));
    // add an image as a report property...
    if (imagePath.length() != 0) {
      try {
View Full Code Here

      }
      Log.log(Log.DEBUG, this, "writeIB Start");
      java.sql.Date todaysDate = new java.sql.Date(Calendar.getInstance().getTime().getTime());
      java.sql.Date headerDate = todaysDate;
      double balanceSum = 0;
      int actId = new UniqNumGenerator().GetUniqueNumber("Act_Id", 1, 999999999, new Integer(compId));

      //write the Amounts
      for (int i = 0; i < list.size(); i++) {
        //these wont balance. Make them balance!!!!!
        Object[] row = (Object[]) list.get(i);
View Full Code Here

          Object[] row = (Object[]) list.get(i);
//Log.log(Log.DEBUG,this,"writeSaldos date="+(java.sql.Date)row[YearDefinition.REGISTERDATE]);
          if (startCal.getTime().compareTo((java.sql.Date) row[YearDefinition.REGISTERDATE]) <= 0
               && stopCal.getTime().compareTo((java.sql.Date) row[YearDefinition.REGISTERDATE]) > 0) {
            if (!foundPeriod) {
              actId = (new UniqNumGenerator()).GetUniqueNumber("Act_Id", 1, 999999999, new Integer(compId));
              foundPeriod = true;
            }
            printedMonth = (java.sql.Date) row[YearDefinition.REGISTERDATE];
            double amount = ((Double) row[YearDefinition.AMOUNT]).doubleValue();
            int custId = ((Integer) row[YearDefinition.CUSTOMER]).intValue();
View Full Code Here

        return;
      }
      java.sql.Date todaysDate = new java.sql.Date(Calendar.getInstance().getTime().getTime());
      java.sql.Date headerDate = todaysDate;
      double balanceSum = 0;
      int actId = new UniqNumGenerator().GetUniqueNumber("Act_Id", 1, 999999999, new Integer(compId));
      //write the Amounts
      for (int i = 0; i < uB.size(); i++) {
        //everything in one big transaction
        Object[] row = (Object[]) uB.get(i);
        double amount = ((Double) row[YearDefinition.AMOUNT]).doubleValue();
View Full Code Here

    fileInfoTextField.setText("");
    lableTransaction.setText("");
    //lets put the next available number in the lableTransaction..
    Integer compId = (Integer) cc.comboBox.getSelectedItemsKey();
    Integer iActId = IntegerField.ConvertLocalizedStringToInt(lableTransaction.getText());
    UniqNumGenerator a = new UniqNumGenerator();
    String UniqKey="Act_Id";
    if (SetupInfo.getBoolProperty(SetupInfo.SHOW_PERIOD_ID))
      UniqKey="PeriodId="+ (Date) cc.comboBoxPeriod.getSelectedItemsKey() + "-"
        +(Date) cc.comboBoxPeriod.getSelectedItemsSecondaryKey();
    iActId = new Integer(a.ViewNextAvailableNumber(UniqKey, 1, 999999999, compId));
    lableTransaction.setText(IntegerField.ConvertIntToLocalizedString(iActId));
    clearTable();
    TotalDebitAndCredit();
    SetSelectionFirstNoEdit();
    //repaints whole table
View Full Code Here

  private void getWholeList(int ii, int iWhyGet) {
    Integer compId = (Integer) cc.comboBox.getSelectedItemsKey();
    Integer iActId =iLastActId;
    Integer iPeriodId =iLastPeriodId;
    if (iWhyGet == DataMovementPane.ADD) {
      UniqNumGenerator a = new UniqNumGenerator();
      iActId = new Integer(a.GetUniqueNumber("Act_Id", 1, 999999999, compId));
      getAndAddAmounts(iActId, compId);
      iPeriodId = new Integer(a.GetUniqueNumber("PeriodId="
        + (Date) cc.comboBoxPeriod.getSelectedItemsKey() + "-"
        + (Date) cc.comboBoxPeriod.getSelectedItemsSecondaryKey(), 1, 999999999, compId));
      if (SetupInfo.getBoolProperty(SetupInfo.SHOW_PERIOD_ID))
        lableTransaction.setText(IntegerField.ConvertIntToLocalizedString(iPeriodId));
      else
View Full Code Here

      Log.log(Log.DEBUG, this, "doExport CompName =" + CompName);
      ResultSet rsCompany = st.executeQuery(dc.filterSQL(select));
      while(rsCompany.next()) {
        CompId=rsCompany.getInt(1);
        bufOut.write("  <company code=\"" + rsCompany.getInt(1) + "\" name=\"" + XmlEncode(rsCompany.getString(2)) +
          "\" lastAbsTransNum=\"" + (new UniqNumGenerator()).GetUniqueNumber("Act_Id", 1, 999999999, CompId) + "\" >");
        bufOut.newLine();  
        select="SELECT APP.Account.Account, AccDesc,AccTypeId, TypeName, SortOrder, IsInBalanceReport " +
          " FROM AccountType JOIN Account ON AccountType.AccTypeId=APP.Account.IsAsset WHERE " +
          " AccountType.CompId=" + CompId + " AND APP.Account.CompId=" + CompId +
          " ORDER BY AccTypeId,APP.Account.Account";
View Full Code Here

TOP

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

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.