diff options
Diffstat (limited to 'src/filters.cc')
-rw-r--r-- | src/filters.cc | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/filters.cc b/src/filters.cc index b6530c04..d9fb64b0 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -448,16 +448,20 @@ void collapse_posts::report_subtotal() DEBUG("filters.collapse", "Pseudo-xact date = " << *xact._date); DEBUG("filters.collapse", "earliest date = " << earliest_date); DEBUG("filters.collapse", "latest date = " << latest_date); + + foreach (totals_map::value_type& pat, totals) { + handle_value(/* value= */ pat.second, + /* account= */ &temps.create_account(pat.first), + /* xact= */ &xact, + /* temps= */ temps, + /* handler= */ handler, + /* date= */ latest_date, + /* act_date_p= */ false); + } - handle_value(/* value= */ subtotal, - /* account= */ totals_account, - /* xact= */ &xact, - /* temps= */ temps, - /* handler= */ handler, - /* date= */ latest_date, - /* act_date_p= */ false); } + totals.clear(); component_posts.clear(); last_xact = NULL; @@ -466,6 +470,20 @@ void collapse_posts::report_subtotal() count = 0; } +value_t& collapse_posts::find_totals(account_t* account) +{ + unsigned short depth=3; + + if(depth==0) + return totals[_("<Total>")]; + + if(account->depth==depth) + return totals[account->fullname()]; + + //else recurse + return find_totals(account->parent); +} + void collapse_posts::operator()(post_t& post) { // If we've reached a new xact, report on the subtotal @@ -475,6 +493,7 @@ void collapse_posts::operator()(post_t& post) report_subtotal(); post.add_to_value(subtotal, amount_expr); + post.add_to_value(find_totals(post.account), amount_expr); component_posts.push_back(&post); |