Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

mymoneyaccount.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           mymoneyaccount.h
00003                           -------------------
00004     copyright            : (C) 2002 by Thomas Baumgart
00005     email                : ipwizard@users.sourceforge.net
00006  ***************************************************************************/
00007 
00008 /***************************************************************************
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  ***************************************************************************/
00016 
00017 #ifndef MYMONEYACCOUNT_H
00018 #define MYMONEYACCOUNT_H
00019 
00020 #ifdef HAVE_CONFIG_H
00021 #include <config.h>
00022 #endif
00023 
00024 // ----------------------------------------------------------------------------
00025 // QT Includes
00026 
00027 #include <qstring.h>
00028 #include <qcstring.h>
00029 #include <qdatetime.h>
00030 #include <qvaluelist.h>
00031 #include <qstringlist.h>
00032 #include <qdom.h>
00033 #include <qpixmap.h>
00034 
00035 // ----------------------------------------------------------------------------
00036 // Project Includes
00037 
00038 #include <kmymoney/mymoneymoney.h>
00039 #include <kmymoney/mymoneyobject.h>
00040 #include <kmymoney/mymoneykeyvaluecontainer.h>
00041 #include <kmymoney/mymoneysecurity.h>
00042 #include <kmymoney/export.h>
00043 #include "mymoneyutils.h"
00044 class MyMoneyTransaction;
00045 class MyMoneyInstitution;
00046 class MyMoneySplit;
00047 class MyMoneyObjectContainer;
00048 
00081 class KMYMONEY_EXPORT MyMoneyAccount : public MyMoneyObject, public MyMoneyKeyValueContainer
00082 {
00083   friend class MyMoneyObjectContainer;
00084 public:
00085 
00089   typedef enum _accountTypeE {
00090     UnknownAccountType=0, 
00091     Checkings,            
00092     Savings,              
00093     Cash,                 
00095     CreditCard,           
00096     Loan,                 
00097     CertificateDep,       
00098     Investment,           
00099     MoneyMarket,          
00100     Asset,                
00101     Liability,            
00102     Currency,             
00103     Income,               
00104     Expense,              
00105     AssetLoan,            
00106     Stock,                
00107     Equity,               
00109     /* insert new account types above this line */
00110     MaxAccountTypes       
00111   }accountTypeE;
00112 
00116   MyMoneyAccount();
00117 
00126   MyMoneyAccount(const QCString& id, const MyMoneyAccount& right);
00127 
00135   MyMoneyAccount(const QDomElement& el);
00136 
00140   ~MyMoneyAccount();
00141 
00145   bool operator == (const MyMoneyAccount &) const;
00146 
00179   static MyMoneyAccount::accountTypeE accountGroup(MyMoneyAccount::accountTypeE type);
00180 
00181   MyMoneyAccount::accountTypeE accountGroup(void) const;
00182 
00190   const QCString& institutionId(void) const { return m_institution; }
00191 
00197   const QString& name(void) const { return m_name; }
00198 
00204   const QString& number(void) const { return m_number; }
00205 
00211   const QString& description(void) const { return m_description; }
00212 
00218   const QDate& openingDate(void) const { return m_openingDate; }
00219 
00225   const QDate& lastReconciliationDate(void) const { return m_lastReconciliationDate; }
00226 
00232   const QDate& lastModified(void) const { return m_lastModified; }
00233 
00238   const QCString& parentAccountId(void) const { return m_parentAccount; };
00239 
00245   const QCStringList& accountList(void) const { return m_accountList; };
00246 
00251   int accountCount(void) const { return m_accountList.count(); };
00252 
00257   void addAccountId(const QCString& account);
00258 
00264   void removeAccountId(const QCString& account);
00265 
00270   void removeAccountIds(void);
00271 
00278   void setLastModified(const QDate& date);
00279 
00285   void setName(const QString& name);
00286 
00292   void setNumber(const QString& number);
00293 
00300   void setDescription(const QString& desc);
00301 
00309   void setInstitutionId(const QCString& id);
00310 
00318   void setOpeningDate(const QDate& date);
00319 
00326   void setLastReconciliationDate(const QDate& date);
00327 
00333   void setAccountType(const accountTypeE type);
00334 
00339   void setParentAccountId(const QCString& parent);
00340 
00344   void touch(void) { setLastModified(QDate::currentDate()); }
00345 
00349   accountTypeE accountType(void) const { return m_accountType; }
00350 
00357   const QCString& currencyId(void) const { return m_currencyId; };
00358 
00364   void setCurrencyId(const QCString& id);
00365 
00366   void writeXML(QDomDocument& document, QDomElement& parent) const;
00367 
00377   virtual bool hasReferenceTo(const QCString& id) const;
00378 
00383   const MyMoneyMoney& balance(void) const { return m_balance; }
00384 
00396   void adjustBalance(const MyMoneySplit& s, bool reverse = false);
00397 
00405   void setBalance(const MyMoneyMoney& val) { m_balance = val; }
00406 
00412   void setOnlineBankingSettings(const MyMoneyKeyValueContainer& values);
00413 
00419   const MyMoneyKeyValueContainer& onlineBankingSettings(void) const;
00420 
00429   void setClosed(bool isClosed);
00430 
00437   bool isClosed(void) const;
00438 
00449   int fraction(const MyMoneySecurity& sec);
00450 
00454   int fraction(const MyMoneySecurity& sec) const;
00455 
00464   int fraction(void) const;
00465 
00475   bool isCategory(void) const __attribute__ ((deprecated));
00476 
00484   bool isIncomeExpense(void) const;
00485 
00493   bool isAssetLiability(void) const;
00494 
00502   bool isLoan(void) const;
00503 
00511   bool isInvest(void) const;
00512 
00518   QString brokerageName(void) const;
00519 
00523   QPixmap accountPixmap(bool reconcileFlag = false) const;
00524 
00528   QPixmap accountGroupPixmap(bool reconcileFlag = false) const;
00529 
00538   static QString accountTypeToString(const MyMoneyAccount::accountTypeE accountType);
00539 
00540   KMYMONEY_EXPORT QDataStream &operator<<( const MyMoneyAccount & );
00541   KMYMONEY_EXPORT QDataStream &operator>>( MyMoneyAccount & );
00542 
00543 private:
00547   accountTypeE m_accountType;
00548 
00553   QCString m_institution;
00554 
00560   QString m_name;
00561 
00567   QString m_number;
00568 
00574   QString m_description;
00575 
00580   QDate m_lastModified;
00581 
00586   QDate m_openingDate;
00587 
00592   QDate m_lastReconciliationDate;
00593 
00597   QCStringList m_accountList;
00598 
00602   QCString m_parentAccount;
00603 
00607   QCString m_currencyId;
00608 
00613   MyMoneyMoney    m_balance;
00614 
00619   MyMoneyKeyValueContainer m_onlineBankingSettings;
00620 
00625   int             m_fraction;
00626 
00627 };
00628 
00636 class KMYMONEY_EXPORT MyMoneyAccountLoan : public MyMoneyAccount
00637 {
00638 public:
00639   enum interestDueE {
00640     paymentDue = 0,
00641     paymentReceived
00642   };
00643 
00644   enum interestChangeUnitE {
00645     changeDaily = 0,
00646     changeWeekly,
00647     changeMonthly,
00648     changeYearly
00649   };
00650 
00651   MyMoneyAccountLoan() {}
00652   MyMoneyAccountLoan(const MyMoneyAccount&);
00653   ~MyMoneyAccountLoan() {}
00654 
00655   const MyMoneyMoney loanAmount(void) const;
00656   void setLoanAmount(const MyMoneyMoney& amount);
00657   const MyMoneyMoney interestRate(const QDate& date) const;
00658   void setInterestRate(const QDate& date, const MyMoneyMoney& rate);
00659   interestDueE interestCalculation(void) const;
00660   void setInterestCalculation(const interestDueE onReception);
00661   const QDate nextInterestChange(void) const;
00662   void setNextInterestChange(const QDate& date);
00663   const QCString schedule(void) const;
00664   void setSchedule(const QCString& sched);
00665   bool fixedInterestRate(void) const;
00666   void setFixedInterestRate(const bool fixed);
00667   const MyMoneyMoney finalPayment(void) const;
00668   void setFinalPayment(const MyMoneyMoney& finalPayment);
00669   unsigned int term(void) const;
00670   void setTerm(const unsigned int payments);
00671   int interestChangeFrequency(int* unit = 0) const;
00672   void setInterestChangeFrequency(const int amount, const int unit);
00673   const MyMoneyMoney periodicPayment(void) const;
00674   void setPeriodicPayment(const MyMoneyMoney& payment);
00675   int interestCompounding(void) const;
00676   void setInterestCompounding(int frequency);
00677   const QCString payee(void) const;
00678   void setPayee(const QCString& payee);
00679   const QCString interestAccountId(void) const;
00680   void setInterestAccountId(const QCString& id);
00681 
00691   virtual bool hasReferenceTo(const QCString& id) const;
00692 
00693 };
00694 
00695 #endif
00696 
00697 

Generated on Mon Nov 17 11:59:19 2008 for KMyMoney by  doxygen 1.4.1