Insert <Rounding> posts within the affected xact

This commit is contained in:
John Wiegley 2010-06-09 02:25:53 -04:00
parent fc09b69fb7
commit 659741ac47

View file

@ -499,6 +499,11 @@ bool display_filter_posts::output_rounding(post_t& post)
"rounding.new_display_total = " << new_display_total); "rounding.new_display_total = " << new_display_total);
} }
// Allow the posting to be displayed if:
// 1. It's display_amount would display as non-zero
// 2. The --empty option was specified
// 3. The account of the posting is <Revalued>
if (post.account == &revalued_account) { if (post.account == &revalued_account) {
if (show_rounding) if (show_rounding)
last_display_total = new_display_total; last_display_total = new_display_total;
@ -522,30 +527,21 @@ bool display_filter_posts::output_rounding(post_t& post)
DEBUG("filters.changed_value.rounding", DEBUG("filters.changed_value.rounding",
"rounding.diff = " << diff); "rounding.diff = " << diff);
xact_t& xact = temps.create_xact();
xact.payee = _("Commodity rounding");
xact._date = post.date();
handle_value(/* value= */ diff, handle_value(/* value= */ diff,
/* account= */ &rounding_account, /* account= */ &rounding_account,
/* xact= */ &xact, /* xact= */ post.xact,
/* temps= */ temps, /* temps= */ temps,
/* handler= */ handler, /* handler= */ handler,
/* date= */ *xact._date, /* date= */ date_t(),
/* act_date_p= */ true, /* act_date_p= */ true,
/* total= */ precise_display_total, /* total= */ precise_display_total,
/* direct_amount= */ true); /* direct_amount= */ true);
} }
} }
if (show_rounding) if (show_rounding)
last_display_total = new_display_total; last_display_total = new_display_total;
return true; return true;
} else { } else {
// Allow the posting to be displayed if:
// 1. It's display_amount would display as non-zero
// 2. The --empty option was specified
// 3. The account of the posting is <Revalued>
return report.HANDLED(empty); return report.HANDLED(empty);
} }
} }