示例#1
0
QValueList<MyMoneyAccount> MyMoneyForecast::forecastAccountList(void)
{
  MyMoneyFile* file = MyMoneyFile::instance();

  QValueList<MyMoneyAccount> accList;
  //Get all accounts from the file and check if they are of the right type to calculate forecast
  file->accountList(accList);
  QValueList<MyMoneyAccount>::iterator accList_t = accList.begin();
  for(; accList_t != accList.end(); ) {
    MyMoneyAccount acc = *accList_t;
    if(acc.isClosed()             //check the account is not closed
    || (!acc.isAssetLiability()) ) {
    //|| (acc.accountType() == MyMoneyAccount::Investment) ) {//check that it is not an Investment account and only include Stock accounts
      accList.remove(accList_t);    //remove the account if it is not of the correct type
      accList_t = accList.begin();
    } else {
      ++accList_t;
    }
  }
  return accList;
}
示例#2
0
void MyMoneyAccountTest::testIsAssetLiability()
{
  MyMoneyAccount a;

  a.setAccountType(MyMoneyAccount::UnknownAccountType);
  QVERIFY(a.isAssetLiability() == false);

  a.setAccountType(MyMoneyAccount::Checkings);
  QVERIFY(a.isAssetLiability() == true);

  a.setAccountType(MyMoneyAccount::Savings);
  QVERIFY(a.isAssetLiability() == true);

  a.setAccountType(MyMoneyAccount::Cash);
  QVERIFY(a.isAssetLiability() == true);

  a.setAccountType(MyMoneyAccount::CreditCard);
  QVERIFY(a.isAssetLiability() == true);

  a.setAccountType(MyMoneyAccount::Loan);
  QVERIFY(a.isAssetLiability() == true);

  a.setAccountType(MyMoneyAccount::CertificateDep);
  QVERIFY(a.isAssetLiability() == true);

  a.setAccountType(MyMoneyAccount::Investment);
  QVERIFY(a.isAssetLiability() == true);

  a.setAccountType(MyMoneyAccount::MoneyMarket);
  QVERIFY(a.isAssetLiability() == true);

  a.setAccountType(MyMoneyAccount::Asset);
  QVERIFY(a.isAssetLiability() == true);

  a.setAccountType(MyMoneyAccount::Liability);
  QVERIFY(a.isAssetLiability() == true);

  a.setAccountType(MyMoneyAccount::Currency);
  QVERIFY(a.isAssetLiability() == true);

  a.setAccountType(MyMoneyAccount::Income);
  QVERIFY(a.isAssetLiability() == false);

  a.setAccountType(MyMoneyAccount::Expense);
  QVERIFY(a.isAssetLiability() == false);

  a.setAccountType(MyMoneyAccount::AssetLoan);
  QVERIFY(a.isAssetLiability() == true);

  a.setAccountType(MyMoneyAccount::Stock);
  QVERIFY(a.isAssetLiability() == true);

  a.setAccountType(MyMoneyAccount::Equity);
  QVERIFY(a.isAssetLiability() == false);
}