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

MyMoneyForecast Class Reference

#include <mymoneyforecast.h>

Collaboration diagram for MyMoneyForecast:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MyMoneyForecast ()
 ~MyMoneyForecast ()
void doForecast ()
QValueList< MyMoneyAccountaccountList (void)
MyMoneyMoney forecastBalance (const MyMoneyAccount &acc, QDate forecastDate)
MyMoneyMoney forecastBalance (const MyMoneyAccount &acc, int offset)
bool isForecastAccount (const MyMoneyAccount &acc)
int daysToMinimumBalance (const MyMoneyAccount &acc)
int daysToZeroBalance (const MyMoneyAccount &acc)
MyMoneyMoney accountCycleVariation (const MyMoneyAccount &acc)
MyMoneyMoney accountTotalVariation (const MyMoneyAccount &acc)
QValueList< QDate > accountMinimumBalanceDateList (const MyMoneyAccount &acc)
QValueList< QDate > accountMaximumBalanceDateList (const MyMoneyAccount &acc)
MyMoneyMoney accountAverageBalance (const MyMoneyAccount &acc)
void createBudget (MyMoneyBudget &budget, QDate historyStart, QDate historyEnd, QDate budgetStart, QDate budgetEnd, const bool returnBudget)
int historyDays (void) const
void setAccountsCycle (int accountsCycle)
void setForecastCycles (int forecastCycles)
void setForecastDays (int forecastDays)
void setBeginForecastDate (QDate beginForecastDate)
void setBeginForecastDay (int beginDay)
void setForecastMethod (int forecastMethod)
void setHistoryStartDate (QDate historyStartDate)
void setHistoryEndDate (QDate historyEndDate)
void setHistoryStartDate (int daysToStartDate)
void setHistoryEndDate (int daysToEndDate)
void setForecastStartDate (QDate _startDate)
void setForecastEndDate (QDate _endDate)
void setSkipOpeningDate (bool _skip)
void setHistoryMethod (int historyMethod)
void setIncludeUnusedAccounts (bool _bool)
void setForecastDone (bool _bool)
void setIncludeFutureTransactions (bool _bool)
void setIncludeScheduledTransactions (bool _bool)
int accountsCycle (void) const
int forecastCycles (void) const
int forecastDays (void) const
QDate beginForecastDate (void) const
int beginForecastDay (void) const
int forecastMethod (void) const
QDate historyStartDate (void) const
QDate historyEndDate (void) const
QDate forecastStartDate (void) const
QDate forecastEndDate (void) const
bool skipOpeningDate (void) const
int historyMethod (void) const
bool isIncludingUnusedAccounts (void) const
bool isForecastDone (void) const
bool isIncludingFutureTransactions (void) const
bool isIncludingScheduledTransactions (void) const

Static Public Member Functions

static MyMoneyMoney calculateAccountTrend (const MyMoneyAccount &acc, int forecastDays)

Private Types

typedef QMap< QDate, MyMoneyMoneydailyBalances
typedef QMap< int, MyMoneyMoneytrendBalances
enum  EForecastMethod { eScheduled = 0, eHistoric = 1 }

Private Member Functions

QValueList< MyMoneyAccountbudgetAccountList (void)
void calculateHistoricDailyBalances (void)
void calculateHistoricMonthlyBalances ()
void calculateScheduledMonthlyBalances ()
void doFutureScheduledForecast (void)
void addFutureTransactions (void)
void addScheduledTransactions (void)
void calculateScheduledDailyBalances (void)
void setStartingBalance (const MyMoneyAccount &acc)
MyMoneyMoney accountMovingAverage (const MyMoneyAccount &acc, const int trendDay, const int forecastTerms)
MyMoneyMoney accountWeightedMovingAverage (const MyMoneyAccount &acc, const int trendDay, const int totalWeight)
MyMoneyMoney accountLinearRegression (const MyMoneyAccount &acc, const int trendDay, const int totalWeight, const MyMoneyMoney meanTerms)
void calculateAccountTrendList (void)
void setForecastAccountList (void)
void setBudgetAccountList (void)
void pastTransactions (void)
int calculateBeginForecastDay ()
void purgeForecastAccountsList (QMap< QCString, dailyBalances > &accountList)

Static Private Member Functions

static QValueList< MyMoneyAccountforecastAccountList (void)

Private Attributes

QMap< QCString, dailyBalancesm_accountList
QMap< QCString, dailyBalancesm_accountListPast
QMap< QCString, trendBalancesm_accountTrendList
QMap< QCString, QCString > m_nameIdx
int m_accountsCycle
int m_forecastCycles
int m_forecastDays
QDate m_beginForecastDate
int m_beginForecastDay
int m_forecastMethod
int m_historyMethod
QDate m_historyStartDate
QDate m_historyEndDate
QDate m_forecastStartDate
QDate m_forecastEndDate
bool m_skipOpeningDate
bool m_includeUnusedAccounts
bool m_forecastDone
bool m_includeFutureTransactions
bool m_includeScheduledTransactions

Detailed Description

Author:
Alvaro Soliverez <asoliverez@gmail.com>


Member Typedef Documentation

typedef QMap<QDate, MyMoneyMoney> MyMoneyForecast::dailyBalances [private]
 

daily balances of an account

typedef QMap<int, MyMoneyMoney> MyMoneyForecast::trendBalances [private]
 

map of trends of an account


Member Enumeration Documentation

enum MyMoneyForecast::EForecastMethod [private]
 

Enumeration values:
eScheduled 
eHistoric 


Constructor & Destructor Documentation

MyMoneyForecast::MyMoneyForecast  ) 
 

MyMoneyForecast::~MyMoneyForecast  ) 
 


Member Function Documentation

MyMoneyMoney MyMoneyForecast::accountAverageBalance const MyMoneyAccount acc  ) 
 

returns the average balance of the account within the forecast period

MyMoneyMoney MyMoneyForecast::accountCycleVariation const MyMoneyAccount acc  ) 
 

amount of variation of a given account in one cycle

MyMoneyMoney MyMoneyForecast::accountLinearRegression const MyMoneyAccount acc,
const int  trendDay,
const int  totalWeight,
const MyMoneyMoney  meanTerms
[private]
 

Returns the linear regression for a given trendDay

QValueList<MyMoneyAccount> MyMoneyForecast::accountList void   ) 
 

Returns the list of accounts to be forecast.

QValueList<QDate> MyMoneyForecast::accountMaximumBalanceDateList const MyMoneyAccount acc  ) 
 

returns a list of the dates where the account was on its highest balance in each cycle

QValueList<QDate> MyMoneyForecast::accountMinimumBalanceDateList const MyMoneyAccount acc  ) 
 

returns a list of the dates where the account was on its lowest balance in each cycle

MyMoneyMoney MyMoneyForecast::accountMovingAverage const MyMoneyAccount acc,
const int  trendDay,
const int  forecastTerms
[private]
 

Returns the day moving average for the account acc based on the daily balances of a given number of forecastTerms It returns the moving average for a given trendDay of the forecastTerm With a term of 1 month and 3 terms, it calculates the trend taking the transactions occured at that day and the day before,for the last 3 months

int MyMoneyForecast::accountsCycle void   )  const [inline]
 

MyMoneyMoney MyMoneyForecast::accountTotalVariation const MyMoneyAccount acc  ) 
 

amount of variation of a given account for the whole forecast period

MyMoneyMoney MyMoneyForecast::accountWeightedMovingAverage const MyMoneyAccount acc,
const int  trendDay,
const int  totalWeight
[private]
 

Returns the weighted moving average for a given trendDay

void MyMoneyForecast::addFutureTransactions void   )  [private]
 

add future transactions to forecast

void MyMoneyForecast::addScheduledTransactions void   )  [private]
 

add scheduled transactions to forecast

QDate MyMoneyForecast::beginForecastDate void   )  const [inline]
 

int MyMoneyForecast::beginForecastDay void   )  const [inline]
 

QValueList<MyMoneyAccount> MyMoneyForecast::budgetAccountList void   )  [private]
 

Returns the list of accounts to create a budget. Only Income and Expenses are returned.

static MyMoneyMoney MyMoneyForecast::calculateAccountTrend const MyMoneyAccount acc,
int  forecastDays
[static]
 

Returns the balance trend for account acc based on a number of days forecastDays Collects and processes all transactions in the past for the same period of forecast and calculates the balance trend

void MyMoneyForecast::calculateAccountTrendList void   )  [private]
 

calculate daily forecast trend based on historic transactions

int MyMoneyForecast::calculateBeginForecastDay  )  [private]
 

calculate the day to start forecast and sets the begin date The quantity of forecast days will be counted from this date Depends on the values of begin day and accounts cycle The rules to calculate begin day are as follows:

  • if beginDay is 0, begin date is current date
  • if the day of the month set by beginDay has not passed, that will be used
  • if adding an account cycle to beginDay, will not go past the beginDay of next month, that date will be used, otherwise it will add account cycle to beginDay until it is past current date It returns the total amount of Forecast Days from current date.

void MyMoneyForecast::calculateHistoricDailyBalances void   )  [private]
 

calculate daily forecast balance based on historic transactions

void MyMoneyForecast::calculateHistoricMonthlyBalances  )  [private]
 

calculate monthly budget balance based on historic transactions

void MyMoneyForecast::calculateScheduledDailyBalances void   )  [private]
 

calculate daily forecast balance based on future and scheduled transactions

void MyMoneyForecast::calculateScheduledMonthlyBalances  )  [private]
 

calculate monthly budget balance based on historic transactions

void MyMoneyForecast::createBudget MyMoneyBudget budget,
QDate  historyStart,
QDate  historyEnd,
QDate  budgetStart,
QDate  budgetEnd,
const bool  returnBudget
 

creates a budget based on the history of a given timeframe

int MyMoneyForecast::daysToMinimumBalance const MyMoneyAccount acc  ) 
 

returns the number of days when a given account is forecast to be below minimum balance returns -1 if it will not be below minimum balance in the forecast period

int MyMoneyForecast::daysToZeroBalance const MyMoneyAccount acc  ) 
 

returns the number of days when a given account is forecast to be below zero if it is an asset accounts or above zero if it is a liability account returns -1 if it will not happen in the forecast period

void MyMoneyForecast::doForecast  ) 
 

calculate forecast based on historic transactions

void MyMoneyForecast::doFutureScheduledForecast void   )  [private]
 

calculate forecast based on future and scheduled transactions

static QValueList<MyMoneyAccount> MyMoneyForecast::forecastAccountList void   )  [static, private]
 

Returns the list of accounts to be forecast. Only Asset and Liability are returned.

MyMoneyMoney MyMoneyForecast::forecastBalance const MyMoneyAccount acc,
int  offset
 

Returns the forecast balance trend for account acc for offset int offset is days from current date, inside forecast days. Returns 0 if offset not in range of forecast days.

MyMoneyMoney MyMoneyForecast::forecastBalance const MyMoneyAccount acc,
QDate  forecastDate
 

Returns the forecast balance trend for account acc for day QDate

int MyMoneyForecast::forecastCycles void   )  const [inline]
 

int MyMoneyForecast::forecastDays void   )  const [inline]
 

QDate MyMoneyForecast::forecastEndDate void   )  const [inline]
 

int MyMoneyForecast::forecastMethod void   )  const [inline]
 

QDate MyMoneyForecast::forecastStartDate void   )  const [inline]
 

int MyMoneyForecast::historyDays void   )  const [inline]
 

number of days to go back in history to calculate forecast

QDate MyMoneyForecast::historyEndDate void   )  const [inline]
 

int MyMoneyForecast::historyMethod void   )  const [inline]
 

QDate MyMoneyForecast::historyStartDate void   )  const [inline]
 

bool MyMoneyForecast::isForecastAccount const MyMoneyAccount acc  ) 
 

Returns true if an account acc is an account to be forecast

bool MyMoneyForecast::isForecastDone void   )  const [inline]
 

bool MyMoneyForecast::isIncludingFutureTransactions void   )  const [inline]
 

bool MyMoneyForecast::isIncludingScheduledTransactions void   )  const [inline]
 

bool MyMoneyForecast::isIncludingUnusedAccounts void   )  const [inline]
 

void MyMoneyForecast::pastTransactions void   )  [private]
 

get past transactions for the accounts to be forecast

void MyMoneyForecast::purgeForecastAccountsList QMap< QCString, dailyBalances > &  accountList  )  [private]
 

remove accounts from the list if the accounts has no transactions in the forecast timeframe. Used for scheduled-forecast method.

void MyMoneyForecast::setAccountsCycle int  accountsCycle  )  [inline]
 

void MyMoneyForecast::setBeginForecastDate QDate  beginForecastDate  )  [inline]
 

void MyMoneyForecast::setBeginForecastDay int  beginDay  )  [inline]
 

void MyMoneyForecast::setBudgetAccountList void   )  [private]
 

set the internal list of accounts to create a budget

void MyMoneyForecast::setForecastAccountList void   )  [private]
 

set the internal list of accounts to be forecast

void MyMoneyForecast::setForecastCycles int  forecastCycles  )  [inline]
 

void MyMoneyForecast::setForecastDays int  forecastDays  )  [inline]
 

void MyMoneyForecast::setForecastDone bool  _bool  )  [inline]
 

void MyMoneyForecast::setForecastEndDate QDate  _endDate  )  [inline]
 

void MyMoneyForecast::setForecastMethod int  forecastMethod  )  [inline]
 

void MyMoneyForecast::setForecastStartDate QDate  _startDate  )  [inline]
 

void MyMoneyForecast::setHistoryEndDate int  daysToEndDate  )  [inline]
 

void MyMoneyForecast::setHistoryEndDate QDate  historyEndDate  )  [inline]
 

void MyMoneyForecast::setHistoryMethod int  historyMethod  )  [inline]
 

void MyMoneyForecast::setHistoryStartDate int  daysToStartDate  )  [inline]
 

void MyMoneyForecast::setHistoryStartDate QDate  historyStartDate  )  [inline]
 

void MyMoneyForecast::setIncludeFutureTransactions bool  _bool  )  [inline]
 

void MyMoneyForecast::setIncludeScheduledTransactions bool  _bool  )  [inline]
 

void MyMoneyForecast::setIncludeUnusedAccounts bool  _bool  )  [inline]
 

void MyMoneyForecast::setSkipOpeningDate bool  _skip  )  [inline]
 

void MyMoneyForecast::setStartingBalance const MyMoneyAccount acc  )  [private]
 

set the starting balance for an accounts

bool MyMoneyForecast::skipOpeningDate void   )  const [inline]
 


Member Data Documentation

QMap<QCString, dailyBalances> MyMoneyForecast::m_accountList [private]
 

daily forecast balance of accounts

QMap<QCString, dailyBalances> MyMoneyForecast::m_accountListPast [private]
 

daily past balance of accounts

int MyMoneyForecast::m_accountsCycle [private]
 

cycle of accounts in days

QMap<QCString, trendBalances> MyMoneyForecast::m_accountTrendList [private]
 

daily forecast trends of accounts

QDate MyMoneyForecast::m_beginForecastDate [private]
 

date to start forecast

int MyMoneyForecast::m_beginForecastDay [private]
 

day to start forecast

int MyMoneyForecast::m_forecastCycles [private]
 

number of cycles to use in forecast

int MyMoneyForecast::m_forecastDays [private]
 

number of days to forecast

bool MyMoneyForecast::m_forecastDone [private]
 

forecast already done

QDate MyMoneyForecast::m_forecastEndDate [private]
 

end date of forecast

int MyMoneyForecast::m_forecastMethod [private]
 

forecast method

QDate MyMoneyForecast::m_forecastStartDate [private]
 

start date of forecast

QDate MyMoneyForecast::m_historyEndDate [private]
 

end date of history

int MyMoneyForecast::m_historyMethod [private]
 

history method

QDate MyMoneyForecast::m_historyStartDate [private]
 

start date of history

bool MyMoneyForecast::m_includeFutureTransactions [private]
 

include future transactions when doing a scheduled-based forecast

bool MyMoneyForecast::m_includeScheduledTransactions [private]
 

include scheduled transactions when doing a scheduled-based forecast

bool MyMoneyForecast::m_includeUnusedAccounts [private]
 

include accounts with no transactions in the forecast timeframe. default is false.

QMap<QCString, QCString> MyMoneyForecast::m_nameIdx [private]
 

list of forecast accounts

bool MyMoneyForecast::m_skipOpeningDate [private]
 

skip opening date when fetching transactions of an account


The documentation for this class was generated from the following file:
Generated on Tue Nov 18 12:11:17 2008 for KMyMoney by  doxygen 1.4.1