summaryrefslogtreecommitdiff
path: root/src/filters.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-03-05 23:53:07 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-03-05 23:53:07 -0400
commit6ac79137f74a9257c0079f14cf3ef49e8da6375a (patch)
treee2cd10a90ae064b67192ec64ca1b4273f833b345 /src/filters.cc
parentfb9af0f1116992410b7b4aab352cc843be591587 (diff)
downloadledger-6ac79137f74a9257c0079f14cf3ef49e8da6375a.tar.gz
ledger-6ac79137f74a9257c0079f14cf3ef49e8da6375a.tar.bz2
ledger-6ac79137f74a9257c0079f14cf3ef49e8da6375a.zip
Don't compute running total for balance reports
Diffstat (limited to 'src/filters.cc')
-rw-r--r--src/filters.cc29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/filters.cc b/src/filters.cc
index b66bafae..2895bf7f 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -194,33 +194,33 @@ void calc_posts::operator()(post_t& post)
if (last_post) {
assert(last_post->has_xdata());
- add_or_set_value(xdata.total, last_post->xdata().total);
+ if (! account_wise)
+ xdata.total = last_post->xdata().total;
xdata.count = last_post->xdata().count + 1;
} else {
xdata.count = 1;
}
- value_t amount;
- post.add_to_value(amount, amount_expr);
+ post.add_to_value(xdata.visited_value, amount_expr);
+ xdata.add_flags(POST_EXT_VISITED);
- add_or_set_value(xdata.total, amount);
-
- if (calc_totals) {
- account_t * acct = post.reported_account();
+ account_t * acct = post.reported_account();
+ acct->xdata().add_flags(ACCOUNT_EXT_VISITED);
+ if (! account_wise) {
+ add_or_set_value(xdata.total, xdata.visited_value);
+ } else {
account_t::xdata_t * acct_xdata = &acct->xdata();
- add_or_set_value(acct_xdata->self_details.total, amount);
+ add_or_set_value(acct_xdata->self_details.total, xdata.visited_value);
acct_xdata->self_details.posts_count++;
acct_xdata->self_details.posts_virtuals_count++;
- acct_xdata->add_flags(ACCOUNT_EXT_VISITED);
-
while (true) {
- add_or_set_value(acct_xdata->family_details.total, amount);
- acct_xdata->family_details.posts_count++;
+ add_or_set_value(acct_xdata->family_details.total, xdata.visited_value);
+ acct_xdata->family_details.posts_count++;
if (post.has_flags(POST_VIRTUAL))
acct_xdata->family_details.posts_virtuals_count++;
@@ -259,7 +259,8 @@ namespace {
// If the account for this post is all virtual, then report the post as
// such. This allows subtotal reports to show "(Account)" for accounts
// that contain only virtual posts.
- if (account && account->has_xdata()) {
+ if (account && account->has_xdata() &&
+ account->xdata().has_flags(ACCOUNT_EXT_AUTO_VIRTUALIZE)) {
if (! account->xdata().has_flags(ACCOUNT_EXT_HAS_NON_VIRTUALS)) {
post.add_flags(POST_VIRTUAL);
if (! account->xdata().has_flags(ACCOUNT_EXT_HAS_UNB_VIRTUALS))
@@ -567,6 +568,8 @@ void subtotal_posts::operator()(post_t& post)
// such, so that `handle_value' can show "(Account)" for accounts
// that contain only virtual posts.
+ post.reported_account()->xdata().add_flags(ACCOUNT_EXT_AUTO_VIRTUALIZE);
+
if (! post.has_flags(POST_VIRTUAL))
post.reported_account()->xdata().add_flags(ACCOUNT_EXT_HAS_NON_VIRTUALS);
else if (! post.has_flags(POST_MUST_BALANCE))