reports::ReportAccount Class Reference

#include <reportaccount.h>

Inheritance diagram for reports::ReportAccount:

MyMoneyAccount MyMoneyObject MyMoneyKeyValueContainer
Collaboration diagram for reports::ReportAccount:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ReportAccount (void)
 ReportAccount (const ReportAccount &)
 ReportAccount (const QString &accountid)
 ReportAccount (const MyMoneyAccount &accountid)
bool operator< (const ReportAccount &right) const
MyMoneyMoney deepCurrencyPrice (const QDate &date) const
MyMoneyMoney baseCurrencyPrice (const QDate &date) const
MyMoneyMoney foreignCurrencyPrice (const QString foreignCurrency, const QDate &date) const
MyMoneySecurity currency (void) const
bool isForeignCurrency (void) const
QString name (void) const
QString fullName (void) const
QString debugName (void) const
bool isTopLevel (void) const
QString topParentName (void) const
ReportAccount topParent (void) const
ReportAccount parent (void) const
unsigned hierarchyDepth (void) const
bool isLiquidAsset (void) const
bool isLiquidLiability (void) const

Protected Member Functions

void calculateAccountHierarchy (void)

Private Attributes

QStringList m_nameHierarchy


Detailed Description

This is a MyMoneyAccount as viewed from the reporting engine.

All reporting methods should use ReportAccount INSTEAD OF MyMoneyAccount at all times.

The primary functionality this provides is a full chain of account hierarchy that is easy to traverse. It's needed because the PivotTable grid needs to store and sort by the full account hierarchy, while still having access to the account itself for currency conversion.

In addition, several other convenience functions are provided that may be worth moving into MyMoneyAccount at some point.

Author:
Ace Jones

Constructor & Destructor Documentation

reports::ReportAccount::ReportAccount ( void   ) 

Default constructor

Needed to allow this object to be stored in a QMap.

reports::ReportAccount::ReportAccount ( const ReportAccount  ) 

Copy constructor

Needed to allow this object to be stored in a QMap.

reports::ReportAccount::ReportAccount ( const QString &  accountid  ) 

Regular constructor

Parameters:
accountid Account which this account descriptor should be based off of

reports::ReportAccount::ReportAccount ( const MyMoneyAccount accountid  ) 

Regular constructor

Parameters:
accountid Account which this account descriptor should be based off of


Member Function Documentation

bool reports::ReportAccount::operator< ( const ReportAccount right  )  const

Parameters:
right The object to compare against
Returns:
bool True if this account's fully-qualified hierarchy name is less than that of the given qccount

MyMoneyMoney reports::ReportAccount::deepCurrencyPrice ( const QDate &  date  )  const

Returns the price of this account's underlying currency on the indicated date, translated into the account's deep currency

There are three different currencies in play with a single Account:

  • The underlying currency: What currency the account itself is denominated in
  • The deep currency: The underlying currency's own underlying currency. This is only a factor if the underlying currency of this account IS NOT a currency itself, but is some other kind of security. In that case, the underlying security has its own currency. The deep currency is the currency of the underlying security. On the other hand, if the account has a currency itself, then the deep currency == the underlying currency, and this function will return 1.0.
  • The base currency: The base currency of the user's overall file

Parameters:
date The date in question
Returns:
MyMoneyMoney The value of the account's currency on that date

MyMoneyMoney reports::ReportAccount::baseCurrencyPrice ( const QDate &  date  )  const

Returns the price of this account's deep currency on the indicated date, translated into the base currency

Parameters:
date The date in question
Returns:
MyMoneyMoney The value of the account's currency on that date

MyMoneyMoney reports::ReportAccount::foreignCurrencyPrice ( const QString  foreignCurrency,
const QDate &  date 
) const

Returns the price of this account's deep currency on the indicated date, translated into the base currency

Parameters:
foreignCurrency The currency on which the price will be returned
date The date in question
Returns:
MyMoneyMoney The value of the account's currency on that date

MyMoneySecurity reports::ReportAccount::currency ( void   )  const

Fetch the trading symbol of this account's deep currency

Returns:
The account's currency trading currency object

bool reports::ReportAccount::isForeignCurrency ( void   )  const

Determine if this account's deep currency is different from the file's base currency

Returns:
bool True if this account is in a foreign currency

QString reports::ReportAccount::name ( void   )  const

The name of only this account. No matter how deep the hierarchy, this method only returns the last name in the list, which is the engine name] of this account.

Returns:
QString The account's name

Reimplemented from MyMoneyAccount.

QString reports::ReportAccount::fullName ( void   )  const

The entire hierarchy of this account descriptor This is similiar to debugName(), however debugName() is not guaranteed to always look pretty, while fullName() is. So if the user is ever going to see the results, use fullName().

Returns:
QString The account's full hierarchy

QString reports::ReportAccount::debugName ( void   )  const

The entire hierarchy of this account descriptor, suitable for displaying in debugging output

Returns:
QString The account's full hierarchy (suitable for debugging)

bool reports::ReportAccount::isTopLevel ( void   )  const

Whether this account is a 'top level' parent account. This means that it's parent is an account class, like asset, liability, expense or income

Returns:
bool True if this account is a top level parent account

QString reports::ReportAccount::topParentName ( void   )  const

Returns the name of the top level parent account

(See isTopLevel for a definition of 'top level parent')

Returns:
QString The name of the top level parent account

ReportAccount reports::ReportAccount::topParent ( void   )  const

Returns a report account containing the top parent account

Returns:
ReportAccount The account of the top parent

ReportAccount reports::ReportAccount::parent ( void   )  const

Returns a report account containing the immediate parent account

Returns:
ReportAccount The account of the immediate parent

unsigned reports::ReportAccount::hierarchyDepth ( void   )  const

Returns the number of accounts in this account's hierarchy. If this is a Top Category, it returns 1. If it's parent is a Top Category, returns 2, etc.

Returns:
unsigned Hierarchy depth

bool reports::ReportAccount::isLiquidAsset ( void   )  const

Returns whether this account is a liquid asset

bool reports::ReportAccount::isLiquidLiability ( void   )  const

Returns whether this account is a liquid liability

void reports::ReportAccount::calculateAccountHierarchy ( void   )  [protected]

Calculates the full account hierarchy of this account


Member Data Documentation


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

Generated on Wed Jan 26 13:11:45 2011 for KMyMoney by  doxygen 1.5.6