summaryrefslogtreecommitdiff
path: root/src/report.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-03-03 17:08:11 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-03-03 17:08:11 -0400
commiteb45a0a4f46577c6615695256e5f6866a27ef20e (patch)
tree7839ad1f692df20276921ec182a78a14b13c61b9 /src/report.cc
parentcf2548c29cbd10c41bd23d119394489e1ced8e2a (diff)
downloadledger-eb45a0a4f46577c6615695256e5f6866a27ef20e.tar.gz
ledger-eb45a0a4f46577c6615695256e5f6866a27ef20e.tar.bz2
ledger-eb45a0a4f46577c6615695256e5f6866a27ef20e.zip
Normalized how account totals are calculated
Diffstat (limited to 'src/report.cc')
-rw-r--r--src/report.cc22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/report.cc b/src/report.cc
index 2c145dc7..160cb698 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -67,27 +67,13 @@ void report_t::xact_report(post_handler_ptr handler, xact_t& xact)
session.clean_posts(xact);
}
-void report_t::sum_all_accounts()
-{
- expr_t& amount_expr(HANDLER(amount_).expr);
- amount_expr.set_context(this);
-
- journal_posts_iterator walker(*session.journal.get());
- pass_down_posts(chain_post_handlers
- (*this, post_handler_ptr(new set_account_value(amount_expr)),
- true), walker);
-
- expr_t& account_amount_expr(HANDLER(account_amount_).expr);
- account_amount_expr.set_context(this);
- session.master->calculate_sums(account_amount_expr);
-}
-
void report_t::accounts_report(acct_handler_ptr handler)
{
- sum_all_accounts();
+ journal_posts_iterator walker(*session.journal.get());
+ pass_down_posts(chain_post_handlers(*this, post_handler_ptr(new ignore_posts),
+ true), walker);
scoped_ptr<accounts_iterator> iter;
-
if (! HANDLED(sort_))
iter.reset(new basic_accounts_iterator(*session.master));
else
@@ -477,7 +463,6 @@ option_t<report_t> * report_t::lookup_option(const char * p)
case 'a':
OPT(abbrev_len_);
else OPT(account_);
- else OPT(account_amount_);
else OPT(actual);
else OPT(add_budget);
else OPT(amount_);
@@ -613,6 +598,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
OPT_CH(amount_);
else OPT(tail_);
else OPT(total_);
+ else OPT(totals);
else OPT(total_data);
else OPT(truncate_);
else OPT(total_width_);