Break up multiple commodities in equity report

This commit is contained in:
John Wiegley 2009-11-14 02:32:49 -05:00
parent ee93b5c740
commit 2d58224001
2 changed files with 18 additions and 11 deletions

View file

@ -364,12 +364,12 @@ void collapse_posts::operator()(post_t& post)
report_subtotal(); report_subtotal();
post.add_to_value(subtotal, amount_expr); post.add_to_value(subtotal, amount_expr);
count++;
component_posts.push_back(&post); component_posts.push_back(&post);
last_xact = post.xact; last_xact = post.xact;
last_post = &post; last_post = &post;
count++;
} }
void related_posts::flush() void related_posts::flush()
@ -648,8 +648,15 @@ void posts_as_equity::report_subtotal()
value_t total = 0L; value_t total = 0L;
foreach (values_map::value_type& pair, values) { foreach (values_map::value_type& pair, values) {
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, handle_value(pair.second.value, pair.second.account, &xact, temps,
*handler); *handler);
}
total += pair.second.value; total += pair.second.value;
} }
values.clear(); values.clear();

View file

@ -466,7 +466,7 @@ public:
TRACE_DTOR(subtotal_posts); TRACE_DTOR(subtotal_posts);
} }
void report_subtotal(const char * spec_fmt = NULL, virtual void report_subtotal(const char * spec_fmt = NULL,
const optional<date_interval_t>& interval = none); const optional<date_interval_t>& interval = none);
virtual void flush() { virtual void flush() {
@ -506,7 +506,7 @@ public:
TRACE_DTOR(interval_posts); TRACE_DTOR(interval_posts);
} }
void report_subtotal(const date_interval_t& interval); virtual void report_subtotal(const date_interval_t& interval);
virtual void flush() { virtual void flush() {
if (last_post && interval.duration) { if (last_post && interval.duration) {
@ -537,7 +537,7 @@ public:
TRACE_DTOR(posts_as_equity); TRACE_DTOR(posts_as_equity);
} }
void report_subtotal(); virtual void report_subtotal();
virtual void flush() { virtual void flush() {
report_subtotal(); report_subtotal();