MyMoneySplit Class Reference

#include <mymoneysplit.h>

Inheritance diagram for MyMoneySplit:

MyMoneyObject MyMoneyKeyValueContainer
Collaboration diagram for MyMoneySplit:

Collaboration graph

List of all members.

Public Types

enum  reconcileFlagE {
  Unknown = -1, NotReconciled = 0, Cleared, Reconciled,
  Frozen, MaxReconcileState
enum  investTransactionTypeE {
  UnknownTransactionType = -1, BuyShares = 0, SellShares, Dividend,
  ReinvestDividend, Yield, AddShares, RemoveShares,

Public Member Functions

 MyMoneySplit ()
 MyMoneySplit (const QDomElement &node)
 MyMoneySplit (const QString &id, const MyMoneySplit &right)
 ~MyMoneySplit ()
bool operator== (const MyMoneySplit &) const
void writeXML (QDomDocument &document, QDomElement &parent) const
virtual bool hasReferenceTo (const QString &id) const
const MyMoneyMoneyshares (void) const
const MyMoneyMoneyvalue (void) const
MyMoneyMoney price (void) const
MyMoneyMoney actualPrice (void) const
const MyMoneyMoney value (const QString &transactionCurrencyId, const QString &splitCurrencyId) const
const QString & value (const QString &key) const
void setValue (const QString &key, const QString &value)
const QString & accountId (void) const
const QString & memo (void) const
reconcileFlagE reconcileFlag (void) const
const QDate & reconcileDate (void) const
const QString & payeeId (void) const
const QString & action (void) const
const QString & number (void) const
bool isAmortizationSplit (void) const
bool isInterestSplit (void) const
bool isAutoCalc (void) const
const QString & bankID (void) const
const QString & transactionId (void) const
void setShares (const MyMoneyMoney &shares)
void setValue (const MyMoneyMoney &value)
void setPrice (const MyMoneyMoney &price)
void setValue (const MyMoneyMoney &value, const QString &transactionCurrencyId, const QString &splitCurrencyId)
void setAccountId (const QString &account)
void setMemo (const QString &memo)
void setReconcileFlag (const reconcileFlagE flag)
void setReconcileDate (const QDate &date)
void setPayeeId (const QString &payee)
void setAction (const QString &action)
void setAction (investTransactionTypeE type)
void setNumber (const QString &number)
void setBankID (const QString &bankID)
void setTransactionId (const QString &id)
bool isMatched (void) const
void addMatch (const MyMoneyTransaction &t)
void removeMatch (void)
MyMoneyTransaction matchedTransaction (void) const

Static Public Attributes

static const char ActionCheck []
static const char ActionDeposit []
static const char ActionTransfer []
static const char ActionWithdrawal []
static const char ActionATM []
static const char ActionAmortization []
static const char ActionInterest []
static const char ActionBuyShares []
static const char ActionDividend []
static const char ActionReinvestDividend []
static const char ActionYield []
static const char ActionAddShares []
static const char ActionSplitShares []

Private Attributes

QString m_id
QString m_payee
QString m_account
MyMoneyMoney m_shares
MyMoneyMoney m_value
MyMoneyMoney m_price
QString m_memo
reconcileFlagE m_reconcileFlag
QDate m_reconcileDate
QString m_action
QString m_number
QString m_bankID
QString m_transactionId

Detailed Description

Thomas Baumgart This class represents a split of a transaction.

Member Enumeration Documentation

This enum defines the possible reconciliation states a split can be in. Possible values are as follows:

  • NotReconciled
  • Cleared
  • Reconciled
  • Frozen
Whenever a new split is created, it has the status NotReconciled. It can be set to cleared when the transaction has been performed. Once the account is reconciled, cleared splits will be set to Reconciled. The state Frozen will be used, when the concept of books is introduced into the engine and a split must not be changed anymore.


Constructor & Destructor Documentation

MyMoneySplit::MyMoneySplit (  ) 

MyMoneySplit::MyMoneySplit ( const QDomElement &  node  ) 

MyMoneySplit::MyMoneySplit ( const QString &  id,
const MyMoneySplit right 

MyMoneySplit::~MyMoneySplit (  ) 

Member Function Documentation

bool MyMoneySplit::operator== ( const MyMoneySplit  )  const

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

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

document reference to QDomDocument
parent reference to QDomElement parent node

Reimplemented from MyMoneyKeyValueContainer.

virtual bool MyMoneySplit::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.

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.

const MyMoneyMoney& MyMoneySplit::shares ( void   )  const [inline]

const MyMoneyMoney& MyMoneySplit::value ( void   )  const [inline]

MyMoneyMoney MyMoneySplit::price ( void   )  const

This method returns the price. If the member m_price is not zero its value is returned. Otherwise, if m_shares is not zero the quotient of m_value / m_shares is returned. If m_values equals to zero, 1 will be returned.

MyMoneyMoney MyMoneySplit::actualPrice ( void   )  const [inline]

This method just returns what is in m_price, so when we write to the database, we don't just generate prices

const MyMoneyMoney MyMoneySplit::value ( const QString &  transactionCurrencyId,
const QString &  splitCurrencyId 
) const

const QString& MyMoneySplit::value ( const QString &  key  )  const [inline]

Required to have (direct) access to the MyMoneyKeyValueContainer::value() method.

Reimplemented from MyMoneyKeyValueContainer.

void MyMoneySplit::setValue ( const QString &  key,
const QString &  value 
) [inline]

Required to have (direct) access to the MyMoneyKeyValueContainer::setValue() method.

Reimplemented from MyMoneyKeyValueContainer.

const QString& MyMoneySplit::accountId ( void   )  const [inline]

const QString& MyMoneySplit::memo ( void   )  const [inline]

reconcileFlagE MyMoneySplit::reconcileFlag ( void   )  const [inline]

const QDate& MyMoneySplit::reconcileDate ( void   )  const [inline]

const QString& MyMoneySplit::payeeId ( void   )  const [inline]

const QString& MyMoneySplit::action ( void   )  const [inline]

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

bool MyMoneySplit::isAmortizationSplit ( void   )  const [inline]

bool MyMoneySplit::isInterestSplit ( void   )  const [inline]

bool MyMoneySplit::isAutoCalc ( void   )  const [inline]

const QString& MyMoneySplit::bankID ( void   )  const [inline]

const QString& MyMoneySplit::transactionId ( void   )  const [inline]

void MyMoneySplit::setShares ( const MyMoneyMoney shares  ) 

void MyMoneySplit::setValue ( const MyMoneyMoney value  ) 

void MyMoneySplit::setPrice ( const MyMoneyMoney price  ) 

void MyMoneySplit::setValue ( const MyMoneyMoney value,
const QString &  transactionCurrencyId,
const QString &  splitCurrencyId 

This method is used to set either the shares or the value depending on the currencies assigned to the split/account and the transaction.

If transactionCurrencyId equals splitCurrencyId this method calls setValue(MyMoneyMoney) otherwise setShares(MyMoneyMoney).

value the value to be assiged
transactionCurrencyId the id of the currency assigned to the transaction
splitCurrencyId the id of the currency assigned to the split (i.e. the the id of the currency assigned to the account that is referenced by the split)

void MyMoneySplit::setAccountId ( const QString &  account  ) 

void MyMoneySplit::setMemo ( const QString &  memo  ) 

void MyMoneySplit::setReconcileFlag ( const reconcileFlagE  flag  ) 

void MyMoneySplit::setReconcileDate ( const QDate &  date  ) 

void MyMoneySplit::setPayeeId ( const QString &  payee  ) 

void MyMoneySplit::setAction ( const QString &  action  ) 

void MyMoneySplit::setAction ( investTransactionTypeE  type  ) 

void MyMoneySplit::setNumber ( const QString &  number  ) 

void MyMoneySplit::setBankID ( const QString &  bankID  )  [inline]

void MyMoneySplit::setTransactionId ( const QString &  id  )  [inline]

bool MyMoneySplit::isMatched ( void   )  const

returns true if this its a transaction matched against an imported transaction. The imported and matched transaction can be extracted using matchedTransaction() and can be removed using removeMatch().

void MyMoneySplit::addMatch ( const MyMoneyTransaction t  ) 

add an imported transaction t as matching transaction. Any previously added transaction will be overridden. t.isImported() must return true, otherwise the transaction is not stored.

void MyMoneySplit::removeMatch ( void   ) 

remove the data of the imported transaction added with addMatch().

MyMoneyTransaction MyMoneySplit::matchedTransaction ( void   )  const

Return the matching imported transaction. If no such transaction is available (isMatched() returns false) an empty transaction is returned.

Member Data Documentation

const char MyMoneySplit::ActionCheck[] [static]

const char MyMoneySplit::ActionDeposit[] [static]

const char MyMoneySplit::ActionTransfer[] [static]

const char MyMoneySplit::ActionWithdrawal[] [static]

const char MyMoneySplit::ActionATM[] [static]

const char MyMoneySplit::ActionAmortization[] [static]

const char MyMoneySplit::ActionInterest[] [static]

const char MyMoneySplit::ActionBuyShares[] [static]

const char MyMoneySplit::ActionDividend[] [static]

const char MyMoneySplit::ActionReinvestDividend[] [static]

const char MyMoneySplit::ActionYield[] [static]

const char MyMoneySplit::ActionAddShares[] [static]

const char MyMoneySplit::ActionSplitShares[] [static]

QString MyMoneySplit::m_id [private]

This member contains the ID of the transaction

Reimplemented from MyMoneyObject.

QString MyMoneySplit::m_payee [private]

This member contains the ID of the payee

QString MyMoneySplit::m_account [private]

This member contains the ID of the account

If the quotient of m_shares divided by m_values is not the correct price because of truncation, the price can be stored in this member. For display purpose and transaction edit this value can be used by the application.

QString MyMoneySplit::m_memo [private]

This member contains information about the reconciliation state of the split. Possible values are

  • NotReconciled
  • Cleared
  • Reconciled
  • Frozen

In case the reconciliation flag is set to Reconciled or Frozen this member contains the date of the reconciliation.

QString MyMoneySplit::m_action [private]

The m_action member is an arbitrary string, but is intended to be conveniently limited to a menu of selections such as "Buy", "Sell", "Interest", etc.

QString MyMoneySplit::m_number [private]

The m_number member is used to store a reference number to the split supplied by the user (e.g. check number, etc.).

QString MyMoneySplit::m_bankID [private]

This member keeps the bank's unique ID for the split, so we can avoid duplicates. This is only used for electronic statement downloads.

This should only be set on the split which refers to the account that was downloaded.

QString MyMoneySplit::m_transactionId [private]

This member keeps a backward id to the transaction that this split can be found in. It is the purpose of the MyMoneyTransaction object to maintain this member variable.

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

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