MyMoneyAccount Class Reference

#include <mymoneyaccount.h>

Inheritance diagram for MyMoneyAccount:

MyMoneyObject MyMoneyKeyValueContainer MyMoneyAccountLoan reports::ReportAccount
Collaboration diagram for MyMoneyAccount:

Collaboration graph
[legend]

List of all members.

Public Types

enum  _accountTypeE {
  UnknownAccountType = 0, Checkings, Savings, Cash,
  CreditCard, Loan, CertificateDep, Investment,
  MoneyMarket, Asset, Liability, Currency,
  Income, Expense, AssetLoan, Stock,
  Equity, MaxAccountTypes
}
typedef enum
MyMoneyAccount::_accountTypeE 
accountTypeE

Public Member Functions

 MyMoneyAccount ()
 MyMoneyAccount (const QString &id, const MyMoneyAccount &right)
 MyMoneyAccount (const QDomElement &el)
 ~MyMoneyAccount ()
bool operator== (const MyMoneyAccount &) const
MyMoneyAccount::accountTypeE accountGroup (void) const
const QString & institutionId (void) const
const QString & name (void) const
const QString & number (void) const
const QString & description (void) const
const QDate & openingDate (void) const
const QDate & lastReconciliationDate (void) const
const QDate & lastModified (void) const
const QString & parentAccountId (void) const
const QStringList & accountList (void) const
int accountCount (void) const
void addAccountId (const QString &account)
void removeAccountId (const QString &account)
void removeAccountIds (void)
void setLastModified (const QDate &date)
void setName (const QString &name)
void setNumber (const QString &number)
void setDescription (const QString &desc)
void setInstitutionId (const QString &id)
void setOpeningDate (const QDate &date)
void setLastReconciliationDate (const QDate &date)
void setAccountType (const accountTypeE type)
void setParentAccountId (const QString &parent)
void touch (void)
accountTypeE accountType (void) const
const QString & currencyId (void) const
void setCurrencyId (const QString &id)
void writeXML (QDomDocument &document, QDomElement &parent) const
virtual bool hasReferenceTo (const QString &id) const
const MyMoneyMoneybalance (void) const
void adjustBalance (const MyMoneySplit &s, bool reverse=false)
void setBalance (const MyMoneyMoney &val)
void setOnlineBankingSettings (const MyMoneyKeyValueContainer &values)
const MyMoneyKeyValueContaineronlineBankingSettings (void) const
void setClosed (bool isClosed)
bool isClosed (void) const
int fraction (const MyMoneySecurity &sec)
int fraction (const MyMoneySecurity &sec) const
int fraction (void) const
bool isCategory (void) const __attribute__((deprecated))
bool isIncomeExpense (void) const
bool isAssetLiability (void) const
bool isLoan (void) const
bool isInvest (void) const
QString brokerageName (void) const
QPixmap accountPixmap (bool reconcileFlag=false, int size=0) const
KMYMONEY_EXPORT QDataStream & operator<< (const MyMoneyAccount &)
KMYMONEY_EXPORT QDataStream & operator>> (MyMoneyAccount &)

Static Public Member Functions

static MyMoneyAccount::accountTypeE accountGroup (MyMoneyAccount::accountTypeE type)
static QString accountTypeToString (const MyMoneyAccount::accountTypeE accountType)

Private Attributes

accountTypeE m_accountType
QString m_institution
QString m_name
QString m_number
QString m_description
QDate m_lastModified
QDate m_openingDate
QDate m_lastReconciliationDate
QStringList m_accountList
QString m_parentAccount
QString m_currencyId
MyMoneyMoney m_balance
MyMoneyKeyValueContainer m_onlineBankingSettings
int m_fraction

Friends

class MyMoneyObjectContainer


Detailed Description

A representation of an account. This object represents any type of account, those held at an institution as well as the accounts used for double entry accounting.

Currently, the following account types are known:

See also:
MyMoneyInstitution

MyMoneyFile

Author:
Michael Edwardes 2000-2001

Thomas Baumgart 2002


Member Typedef Documentation

Account types currently supported.


Member Enumeration Documentation

Account types currently supported.

Enumerator:
UnknownAccountType  For error handling
Checkings  Standard checking account
Savings  Typical savings account
Cash  Denotes a shoe-box or pillowcase stuffed with cash
CreditCard  Credit card accounts
Loan  Loan and mortgage accounts (liability)
CertificateDep  Certificates of Deposit
Investment  Investment account
MoneyMarket  Money Market Account
Asset  Denotes a generic asset account.
Liability  Denotes a generic liability account.
Currency  Denotes a currency trading account.
Income  Denotes an income account
Expense  Denotes an expense account
AssetLoan  Denotes a loan (asset of the owner of this object)
Stock  Denotes an security account as sub-account for an investment
Equity  Denotes an equity account e.g. opening/closeing balance
MaxAccountTypes  Denotes the number of different account types


Constructor & Destructor Documentation

MyMoneyAccount::MyMoneyAccount (  ) 

This is the constructor for a new empty account

MyMoneyAccount::MyMoneyAccount ( const QString &  id,
const MyMoneyAccount right 
)

This is the constructor for a new account known to the current file This is the only constructor that will set the attribute m_openingDate to a correct value.

Parameters:
id id assigned to the account
right account definition

MyMoneyAccount::MyMoneyAccount ( const QDomElement &  el  ) 

This is the constructor for an account that is described by a QDomElement (e.g. from a file).

Parameters:
el const reference to the QDomElement from which to create the object

MyMoneyAccount::~MyMoneyAccount (  ) 

This is the destructor for any MyMoneyAccount object


Member Function Documentation

bool MyMoneyAccount::operator== ( const MyMoneyAccount  )  const

This operator tests for equality of two MyMoneyAccount objects

static MyMoneyAccount::accountTypeE MyMoneyAccount::accountGroup ( MyMoneyAccount::accountTypeE  type  )  [static]

This converts the account type into one of the four major account types liability, asset, expense or income.

The current assignment is as follows:

  • Asset
    • Asset
    • Checkings
    • Savings
    • Cash
    • Currency
    • Investment
    • MoneyMarket
    • CertificateDep
    • AssetLoan
    • Stock

  • Liability
    • Liability
    • CreditCard
    • Loan

  • Income
    • Income

  • Expense
    • Expense

Parameters:
type actual account type
Returns:
accountTypeE of major account type

MyMoneyAccount::accountTypeE MyMoneyAccount::accountGroup ( void   )  const

const QString& MyMoneyAccount::institutionId ( void   )  const [inline]

This method returns the id of the MyMoneyInstitution object this account belongs to.

Returns:
id of MyMoneyInstitution object. QString() if it is an internal account
See also:
setInstitution

const QString& MyMoneyAccount::name ( void   )  const [inline]

This method returns the name of the account

Returns:
name of account
See also:
setName()

Reimplemented in reports::ReportAccount.

const QString& MyMoneyAccount::number ( void   )  const [inline]

This method returns the number of the account at the institution

Returns:
number of account at the institution
See also:
setNumber

const QString& MyMoneyAccount::description ( void   )  const [inline]

This method returns the descriptive text of the account.

Returns:
description of account
See also:
setDescription

const QDate& MyMoneyAccount::openingDate ( void   )  const [inline]

This method returns the opening date of this account

Returns:
date of opening of this account as const QDate value
See also:
setOpeningDate()

const QDate& MyMoneyAccount::lastReconciliationDate ( void   )  const [inline]

This method returns the date of the last reconciliation of this account

Returns:
date of last reconciliation as const QDate value
See also:
setLastReconciliationDate

const QDate& MyMoneyAccount::lastModified ( void   )  const [inline]

This method returns the date the account was last modified

Returns:
date of last modification as const QDate value
See also:
setLastModified

const QString& MyMoneyAccount::parentAccountId ( void   )  const [inline]

This method is used to return the ID of the parent account

Returns:
QString with the ID of the parent of this account

const QStringList& MyMoneyAccount::accountList ( void   )  const [inline]

This method returns the list of the account id's of subordinate accounts

Returns:
QStringList account ids

int MyMoneyAccount::accountCount ( void   )  const [inline]

This method returns the number of entries in the m_accountList

Returns:
number of entries in the accountList

void MyMoneyAccount::addAccountId ( const QString &  account  ) 

This method is used to add an account id as sub-ordinate account

Parameters:
account const QString reference to account ID

void MyMoneyAccount::removeAccountId ( const QString &  account  ) 

This method is used to remove an account from the list of sub-ordinate accounts.

Parameters:
account const QString reference to account ID to be removed

void MyMoneyAccount::removeAccountIds ( void   ) 

This method is used to remove all accounts from the list of sub-ordinate accounts.

void MyMoneyAccount::setLastModified ( const QDate &  date  ) 

This method is used to modify the date of the last modification access.

Parameters:
date date of last modification
See also:
lastModified

void MyMoneyAccount::setName ( const QString &  name  ) 

This method is used to set the name of the account

Parameters:
name name of the account
See also:
name

void MyMoneyAccount::setNumber ( const QString &  number  ) 

This method is used to set the number of the account at the institution

Parameters:
number number of the account
See also:
number

void MyMoneyAccount::setDescription ( const QString &  desc  ) 

This method is used to set the descriptive text of the account

Parameters:
desc text that serves as description
See also:
setDescription

void MyMoneyAccount::setInstitutionId ( const QString &  id  ) 

This method is used to set the id of the institution this account belongs to.

Parameters:
id id of the institution this account belongs to
See also:
institution

void MyMoneyAccount::setOpeningDate ( const QDate &  date  ) 

This method is used to set the opening date information of an account.

Parameters:
date QDate of opening date
See also:
openingDate

void MyMoneyAccount::setLastReconciliationDate ( const QDate &  date  ) 

This method is used to set the date of the last reconciliation of an account.

Parameters:
date QDate of last reconciliation
See also:
lastReconciliationDate

void MyMoneyAccount::setAccountType ( const accountTypeE  type  ) 

This method is used to change the account type

Parameters:
type account type

void MyMoneyAccount::setParentAccountId ( const QString &  parent  ) 

This method is used to set a new parent account id

Parameters:
parent QString reference to new parent account

void MyMoneyAccount::touch ( void   )  [inline]

This method is used to update m_lastModified to the current date

accountTypeE MyMoneyAccount::accountType ( void   )  const [inline]

This method returns the type of the account.

const QString& MyMoneyAccount::currencyId ( void   )  const [inline]

This method retrieves the id of the currency used with this account. If the return value is empty, the base currency should be used.

Returns:
id of currency

void MyMoneyAccount::setCurrencyId ( const QString &  id  ) 

This method sets the id of the currency used with this account.

Parameters:
id ID of currency to be associated with this account.

void MyMoneyAccount::writeXML ( QDomDocument &  document,
QDomElement &  parent 
) const

This method creates a QDomElement for the document under the parent node parent.

Parameters:
document reference to QDomDocument
parent reference to QDomElement parent node

Reimplemented from MyMoneyKeyValueContainer.

virtual bool MyMoneyAccount::hasReferenceTo ( const QString &  id  )  const [virtual]

This method checks if a reference to the given object exists. It returns, a true if the object is referencing the one requested by the parameter id. If it does not, this method returns false.

Parameters:
id id of the object to be checked for references
Return values:
true This object references object with id id.
false This object does not reference the object with id id.

Implements MyMoneyObject.

Reimplemented in MyMoneyAccountLoan.

const MyMoneyMoney& MyMoneyAccount::balance ( void   )  const [inline]

This member returns the balance of this account based on all transactions stored in the journal.

void MyMoneyAccount::adjustBalance ( const MyMoneySplit s,
bool  reverse = false 
)

This method adjusts the balance of this account according to the difference contained in the split s. If the s.action() is MyMoneySplit::ActionSplitShares then the balance will be adjusted accordingly.

Parameters:
s const reference to MyMoneySplit object containing the value to be added/subtracted to/from the balance
reverse add (false) or subtract (true) the shares contained in the split. It also affects the balance for share splits in the opposite direction.

void MyMoneyAccount::setBalance ( const MyMoneyMoney val  )  [inline]

This method sets the balance of this account according to the value provided by val.

Parameters:
val const reference to MyMoneyMoney object containing the value to be assigned to the balance

void MyMoneyAccount::setOnlineBankingSettings ( const MyMoneyKeyValueContainer values  ) 

This method sets the kvp's for online banking with this account

Parameters:
values The container of kvp's needed when connecting to this account

const MyMoneyKeyValueContainer& MyMoneyAccount::onlineBankingSettings ( void   )  const

This method retrieves the kvp's for online banking with this account

Returns:
The container of kvp's needed when connecting to this account

void MyMoneyAccount::setClosed ( bool  isClosed  ) 

This method sets the closed flag for the account. This is just an informational flag for the application. It has no other influence on the behaviour of the account object. The default for new objects open.

Parameters:
isClosed mark the account closed (true) or open (false).

bool MyMoneyAccount::isClosed ( void   )  const

Return the closed flag for the account.

Return values:
false account is marked open (the default for new accounts)
true account is marked closed

int MyMoneyAccount::fraction ( const MyMoneySecurity sec  ) 

returns the applicable smallest fraction for this account for the given security based on the account type. At the same time, m_fraction is updated to the value returned.

Parameters:
sec const reference to currency (security)
Return values:
sec.smallestCashFraction() for account type Cash
sec.smallestAccountFraction() for all other account types

int MyMoneyAccount::fraction ( const MyMoneySecurity sec  )  const

Same as the above method, but does not modify m_fraction.

int MyMoneyAccount::fraction ( void   )  const

This method returns the stored value for the fraction of this account or -1 if not initialized. It can be initialized by calling fraction(const MyMoneySecurity& sec) once.

Note:
Don't use this method outside of KMyMoney application context (eg. testcases). Use the above method instead.

bool MyMoneyAccount::isCategory ( void   )  const

This method returns true if the account type is either Income or Expense

Return values:
true account is of type income or expense
false for all other account types
Deprecated:
use isIncomeExpense() instead

bool MyMoneyAccount::isIncomeExpense ( void   )  const

This method returns true if the account type is either Income or Expense

Return values:
true account is of type income or expense
false for all other account types

bool MyMoneyAccount::isAssetLiability ( void   )  const

This method returns true if the account type is either Asset or Liability

Return values:
true account is of type asset or liability
false for all other account types

bool MyMoneyAccount::isLoan ( void   )  const

This method returns true if the account type is either AssetLoan or Loan

Return values:
true account is of type Loan or AssetLoan
false for all other account types

bool MyMoneyAccount::isInvest ( void   )  const

This method returns true if the account type is Stock

Return values:
true account is of type Stock
false for all other account types

QString MyMoneyAccount::brokerageName ( void   )  const

This method returns a name that has a brokerage suffix of the current name. It only works on investment accounts and returns the name for all other cases.

QPixmap MyMoneyAccount::accountPixmap ( bool  reconcileFlag = false,
int  size = 0 
) const

Parameters:
size is a hint for the size of the icon
Returns:
a pixmap using DesktopIcon for the account type

static QString MyMoneyAccount::accountTypeToString ( const MyMoneyAccount::accountTypeE  accountType  )  [static]

This method is used to convert the internal representation of an account type into a human readable format

Parameters:
accountType numerical representation of the account type. For possible values, see MyMoneyAccount::accountTypeE
Returns:
QString representing the human readable form

KMYMONEY_EXPORT QDataStream& MyMoneyAccount::operator<< ( const MyMoneyAccount  ) 

KMYMONEY_EXPORT QDataStream& MyMoneyAccount::operator>> ( MyMoneyAccount  ) 


Friends And Related Function Documentation

friend class MyMoneyObjectContainer [friend]


Member Data Documentation

This member variable identifies the type of account

QString MyMoneyAccount::m_institution [private]

This member variable keeps the ID of the MyMoneyInstitution object that this object belongs to.

QString MyMoneyAccount::m_name [private]

This member variable keeps the name of the account It is solely for documentation purposes and it's contents is not used otherwise by the mymoney-engine.

QString MyMoneyAccount::m_number [private]

This member variable keeps the account number at the institution It is solely for documentation purposes and it's contents is not used otherwise by the mymoney-engine.

QString MyMoneyAccount::m_description [private]

This member variable is a description of the account. It is solely for documentation purposes and it's contents is not used otherwise by the mymoney-engine.

This member variable keeps the date when the account was last modified.

This member variable keeps the date when the account was created as an object in a MyMoneyFile

This member variable keeps the date of the last reconciliation of this account

QStringList MyMoneyAccount::m_accountList [private]

This member holds the ID's of all sub-ordinate accounts

This member contains the ID of the parent account

QString MyMoneyAccount::m_currencyId [private]

This member contains the ID of the currency associated with this account

This member holds the balance of all transactions stored in the journal for this account.

This member variable keeps the set of kvp's needed to establish online banking sessions to this account.

This member keeps the fraction for the account. It is filled by MyMoneyFile when set to -1. See also

See also:
fraction(const MyMoneySecurity&).


The documentation for this class was generated from the following file:

Generated on Wed Jan 26 13:09:10 2011 for KMyMoney by  doxygen 1.5.6