diff options
author | John Wiegley <johnw@newartisans.com> | 2003-10-08 23:05:15 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2003-10-08 23:05:15 +0000 |
commit | 072d5131b49ff64de40d1c9e44a0abcf3b0f1d73 (patch) | |
tree | aa3425496ac09539bacb15991dca36657bdcbcfb /equity.cc | |
parent | 331f389cc68b9ca54c50dddb58cb2e7bb3523cf6 (diff) | |
download | fork-ledger-072d5131b49ff64de40d1c9e44a0abcf3b0f1d73.tar.gz fork-ledger-072d5131b49ff64de40d1c9e44a0abcf3b0f1d73.tar.bz2 fork-ledger-072d5131b49ff64de40d1c9e44a0abcf3b0f1d73.zip |
*** empty log message ***
Diffstat (limited to 'equity.cc')
-rw-r--r-- | equity.cc | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/equity.cc b/equity.cc deleted file mode 100644 index 2f3246aa..00000000 --- a/equity.cc +++ /dev/null @@ -1,68 +0,0 @@ -#include "ledger.h" - -namespace ledger { - -extern bool get_quotes; - -static void equity_entry(account * acct, regexps_map& regexps, - std::ostream& out) -{ - if (! acct->balance.is_zero() && - (regexps.empty() || matches(regexps, acct->as_str()))) { - entry opening; - - opening.date = std::time(NULL); - opening.cleared = true; - opening.desc = "Opening Balance"; - - transaction * xact; - for (totals::const_iterator i = acct->balance.amounts.begin(); - i != acct->balance.amounts.end(); - i++) { - // Skip it, if there is a zero balance for the commodity - if ((*i).second->is_zero()) - continue; - - xact = new transaction(); - xact->acct = const_cast<account *>(acct); - xact->cost = (*i).second->street(get_quotes); - opening.xacts.push_back(xact); - - xact = new transaction(); - xact->acct = main_ledger->find_account("Equity:Opening Balances"); - xact->cost = (*i).second->street(get_quotes); - xact->cost->negate(); - opening.xacts.push_back(xact); - } - - opening.print(out); - } - - // Display balances for all child accounts - - for (accounts_map_iterator i = acct->children.begin(); - i != acct->children.end(); - i++) - equity_entry((*i).second, regexps, out); -} - -////////////////////////////////////////////////////////////////////// -// -// Create an Equity file based on a ledger. This is used for -// archiving past years, and starting out a new year with compiled -// balances. -// - -void equity_ledger(std::ostream& out, regexps_map& regexps) -{ - // The account have their current totals already generated as a - // result of parsing. We just have to output those values. - // totals - - for (accounts_map_iterator i = main_ledger->accounts.begin(); - i != main_ledger->accounts.end(); - i++) - equity_entry((*i).second, regexps, out); -} - -} // namespace ledger |