void KNewAccountDlg::loadVatAccounts(void) { QValueList<MyMoneyAccount> list; MyMoneyFile::instance()->accountList(list); QValueList<MyMoneyAccount>::Iterator it; QStringList loadListExpense; QStringList loadListIncome; QStringList loadListAsset; QStringList loadListLiability; for(it = list.begin(); it != list.end(); ++it) { if(!(*it).value("VatRate").isEmpty()) { if((*it).accountType() == MyMoneyAccount::Expense) loadListExpense += (*it).id(); else if((*it).accountType() == MyMoneyAccount::Income) loadListIncome += (*it).id(); else if((*it).accountType() == MyMoneyAccount::Asset) loadListAsset += (*it).id(); else if((*it).accountType() == MyMoneyAccount::Liability) loadListLiability += (*it).id(); } } AccountSet vatSet; if(!loadListAsset.isEmpty()) vatSet.load(m_vatAccount, i18n("Asset"), loadListAsset, true); if(!loadListLiability.isEmpty()) vatSet.load(m_vatAccount, i18n("Liability"), loadListLiability, false); if(!loadListIncome.isEmpty()) vatSet.load(m_vatAccount, i18n("Income"), loadListIncome, false); if(!loadListExpense.isEmpty()) vatSet.load(m_vatAccount, i18n("Expense"), loadListExpense, false); }
void KEndingBalanceDlg::slotReloadEditWidgets() { QString payeeId, interestId, chargesId; // keep current selected items payeeId = field("payeeEdit").toString(); interestId = field("interestCategoryEdit").toString(); chargesId = field("chargesCategoryEdit").toString(); // load the payee and category widgets with data from the engine //FIXME: port m_interestChargeCheckings->m_payeeEdit->loadPayees(MyMoneyFile::instance()->payeeList()); // a user request to show all categories in both selectors due to a valid use case. AccountSet aSet; aSet.addAccountGroup(MyMoneyAccount::Expense); aSet.addAccountGroup(MyMoneyAccount::Income); //FIXME: port aSet.load(m_interestChargeCheckings->m_interestCategoryEdit->selector()); aSet.load(m_interestChargeCheckings->m_chargesCategoryEdit->selector()); // reselect currently selected items if (!payeeId.isEmpty()) setField("payeeEdit", payeeId); if (!interestId.isEmpty()) setField("interestCategoryEdit", interestId); if (!chargesId.isEmpty()) setField("chargesCategoryEdit", chargesId); }
bool RecordFactory::FilterOut(const StatementRec * const s) { if (opt_e && SkipAccounts.count(s->getAcctNum()) >= 1) return true; if (opt_i && KeepAccounts.count(s->getAcctNum()) <= 0) return true; if (patricks_special_flag) { if (s->getTotalDue() <= 0) return true; } return false; }
double Rts2Schedule::accountMerit () { if (!std::isnan (accMerit)) return accMerit; AccountSet *accountset = AccountSet::instance (); // map for storing calculated account time by account ids std::map <int, double> observedShares; // and fill map with all possible account IDs for (AccountSet::iterator iter = accountset->begin (); iter != accountset->end (); iter++) { observedShares[(*iter).first] = 0; } double sumDur = 0; for (Rts2Schedule::iterator iter = begin (); iter != end (); iter++) { observedShares[(*iter)->getAccountId ()] += (*iter)->getTotalDuration (); sumDur += (*iter)->getTotalDuration (); } // deviances and sum them accMerit = 0; for (AccountSet::iterator iter = accountset->begin (); iter != accountset->end (); iter++) { double sh = (*iter).second->getShare () / accountset->getShareSum (); accMerit += fabs (observedShares[(*iter).first] / sumDur - sh) * sh; } accMerit = (double) 1.0 / accMerit; return accMerit; }