Had to step back from a change that was breaking regular reports.

This commit is contained in:
John Wiegley 2009-02-09 00:57:56 -04:00
parent 90bba2a808
commit 391300aea2
3 changed files with 15 additions and 3 deletions

View file

@ -61,7 +61,9 @@ xact_handler_ptr chain_xact_handlers(report_t& report,
// determine, for example, whether filtered xacts are included or excluded
// from the running total.
assert(report.HANDLED(amount_));
handler.reset(new calc_xacts(handler, report.HANDLER(amount_).expr));
expr_t& expr(report.HANDLER(amount_).expr);
expr.set_context(&report);
handler.reset(new calc_xacts(handler, expr));
// filter_xacts will only pass through xacts matching the
// `secondary_predicate'.

View file

@ -191,8 +191,15 @@ void calc_xacts::operator()(xact_t& xact)
add_or_set_value(xdata.total, last_xact->xdata().total);
if (! xdata.has_flags(XACT_EXT_NO_TOTAL)) {
#if 0
bind_scope_t bound_scope(*amount_expr.get_context(), xact);
xdata.total += amount_expr.calc();
if (xdata.total.is_null())
xdata.total = amount_expr.calc();
else
xdata.total += amount_expr.calc();
#else
xact.add_to_value(xdata.total);
#endif
}
item_handler<xact_t>::operator()(xact);

View file

@ -186,10 +186,10 @@ public:
expr_t expr;
CTOR(report_t, amount_) {
expr = "amount";
on("amount");
}
DO_(args) {
expr = args[0].to_string();
expr.set_context(parent);
});
OPTION(report_t, amount_data); // -j
@ -246,6 +246,7 @@ public:
expr_t expr;
CTOR(report_t, display_amount_) {
expr = "amount_expr";
on("amount_expr");
}
DO_(args) {
expr = args[0].to_string();
@ -256,6 +257,7 @@ public:
expr_t expr;
CTOR(report_t, display_total_) {
expr = "total_expr";
on("total_expr");
}
DO_(args) {
expr = args[0].to_string();
@ -367,6 +369,7 @@ public:
expr_t expr;
CTOR(report_t, total_) {
expr = "total";
on("total");
}
DO_(args) {
expr = args[0].to_string();