summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/filters.cc21
-rw-r--r--src/filters.h8
2 files changed, 18 insertions, 11 deletions
diff --git a/src/filters.cc b/src/filters.cc
index 811067fc..bef4dc24 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -350,9 +350,9 @@ void collapse_posts::report_subtotal()
component_posts.clear();
last_xact = NULL;
- last_post = NULL;
- subtotal = 0L;
- count = 0;
+ last_post = NULL;
+ subtotal = 0L;
+ count = 0;
}
void collapse_posts::operator()(post_t& post)
@@ -364,12 +364,12 @@ void collapse_posts::operator()(post_t& post)
report_subtotal();
post.add_to_value(subtotal, amount_expr);
- count++;
component_posts.push_back(&post);
last_xact = post.xact;
- last_post = &post;
+ last_post = &post;
+ count++;
}
void related_posts::flush()
@@ -648,8 +648,15 @@ void posts_as_equity::report_subtotal()
value_t total = 0L;
foreach (values_map::value_type& pair, values) {
- handle_value(pair.second.value, pair.second.account, &xact, temps,
- *handler);
+ if (pair.second.value.is_balance()) {
+ foreach (balance_t::amounts_map::value_type amount_pair,
+ pair.second.value.as_balance().amounts)
+ handle_value(amount_pair.second, pair.second.account, &xact, temps,
+ *handler);
+ } else {
+ handle_value(pair.second.value, pair.second.account, &xact, temps,
+ *handler);
+ }
total += pair.second.value;
}
values.clear();
diff --git a/src/filters.h b/src/filters.h
index 80bbe5b4..118838d2 100644
--- a/src/filters.h
+++ b/src/filters.h
@@ -466,8 +466,8 @@ public:
TRACE_DTOR(subtotal_posts);
}
- void report_subtotal(const char * spec_fmt = NULL,
- const optional<date_interval_t>& interval = none);
+ virtual void report_subtotal(const char * spec_fmt = NULL,
+ const optional<date_interval_t>& interval = none);
virtual void flush() {
if (values.size() > 0)
@@ -506,7 +506,7 @@ public:
TRACE_DTOR(interval_posts);
}
- void report_subtotal(const date_interval_t& interval);
+ virtual void report_subtotal(const date_interval_t& interval);
virtual void flush() {
if (last_post && interval.duration) {
@@ -537,7 +537,7 @@ public:
TRACE_DTOR(posts_as_equity);
}
- void report_subtotal();
+ virtual void report_subtotal();
virtual void flush() {
report_subtotal();