summaryrefslogtreecommitdiff
path: root/src/report.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/report.cc')
-rw-r--r--src/report.cc24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/report.cc b/src/report.cc
index 76f1df39..0a64abcc 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -56,16 +56,17 @@ void report_t::entry_report(xact_handler_ptr handler, entry_t& entry)
void report_t::sum_all_accounts()
{
- expr_t& expr(HANDLER(amount_).expr);
- expr.set_context(this);
+ expr_t& amount_expr(HANDLER(amount_).expr);
+ amount_expr.set_context(this);
journal_xacts_iterator walker(*session.journal.get());
pass_down_xacts(chain_xact_handlers
- (*this, xact_handler_ptr(new set_account_value(expr)), true),
- walker);
+ (*this, xact_handler_ptr(new set_account_value(amount_expr)),
+ true), walker);
- expr.mark_uncompiled(); // recompile, throw away xact_t bindings
- session.master->calculate_sums(expr);
+ expr_t& account_amount_expr(HANDLER(account_amount_).expr);
+ account_amount_expr.set_context(this);
+ session.master->calculate_sums(account_amount_expr);
}
void report_t::accounts_report(acct_handler_ptr handler)
@@ -143,6 +144,11 @@ value_t report_t::fn_strip(call_scope_t& args)
return args[0].strip_annotations(what_to_keep());
}
+value_t report_t::fn_rounded(call_scope_t& args)
+{
+ return args[0].rounded();
+}
+
value_t report_t::fn_quantity(call_scope_t& args)
{
return args[0].to_amount().number();
@@ -310,6 +316,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
case 'a':
OPT(abbrev_len_);
else OPT(account_);
+ else OPT(account_amount_);
else OPT(actual);
else OPT(add_budget);
else OPT(amount_);
@@ -613,6 +620,11 @@ expr_t::ptr_op_t report_t::lookup(const string& name)
return MAKE_FUNCTOR(report_t::fn_quantity);
break;
+ case 'r':
+ if (is_eq(p, "rounded"))
+ return MAKE_FUNCTOR(report_t::fn_rounded);
+ break;
+
case 's':
if (is_eq(p, "strip"))
return MAKE_FUNCTOR(report_t::fn_strip);