diff options
author | John Wiegley <johnw@newartisans.com> | 2004-06-30 02:09:42 -0400 |
---|---|---|
committer | johnw <johnw@newartisans.com> | 2004-06-30 02:09:42 -0400 |
commit | f9c4f85870a03722953e950ef27f01a44a911c4d (patch) | |
tree | a91816410bbbc746df5eef6f88ca118f0aa7dda1 /ledger.cc | |
parent | 1a5390243edf87b21e7bba0568150d50e3f10d5a (diff) | |
download | fork-ledger-f9c4f85870a03722953e950ef27f01a44a911c4d.tar.gz fork-ledger-f9c4f85870a03722953e950ef27f01a44a911c4d.tar.bz2 fork-ledger-f9c4f85870a03722953e950ef27f01a44a911c4d.zip |
fixes
Diffstat (limited to 'ledger.cc')
-rw-r--r-- | ledger.cc | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -447,21 +447,37 @@ void totals::print(std::ostream& out, int width) const } } -void totals::print_street(std::ostream& out, int width, std::time_t * when, - bool use_history, bool download) const +totals * totals::value() const +{ + totals * cost_basis = new totals; + + for (const_iterator i = amounts.begin(); i != amounts.end(); i++) { + if ((*i).second->is_zero()) + continue; + + amount * value = (*i).second->value(); + cost_basis->credit(value); + delete value; + } + + return cost_basis; +} + +totals * totals::street(std::time_t * when, bool use_history, + bool download) const { - totals street_balance; + totals * street_balance = new totals; for (const_iterator i = amounts.begin(); i != amounts.end(); i++) { if ((*i).second->is_zero()) continue; amount * street = (*i).second->street(when, use_history, download); - street_balance.credit(street); + street_balance->credit(street); delete street; } - street_balance.print(out, width); + return street_balance; } account::~account() |