summaryrefslogtreecommitdiff
path: root/src/report.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/report.cc')
-rw-r--r--src/report.cc36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/report.cc b/src/report.cc
index e6aa3ec8..4a7b105f 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -37,6 +37,7 @@
#include "format.h"
#include "query.h"
#include "output.h"
+#include "print.h"
#include "iterators.h"
#include "filters.h"
#include "precmd.h"
@@ -410,15 +411,20 @@ value_t report_t::fn_trim(call_scope_t& args)
}
}
-value_t report_t::fn_scrub(call_scope_t& args)
+value_t report_t::scrub(value_t val)
{
- value_t temp(args.value().strip_annotations(what_to_keep()));
+ value_t temp(val.strip_annotations(what_to_keep()));
if (HANDLED(base))
return temp;
else
return temp.unreduced();
}
+value_t report_t::fn_scrub(call_scope_t& args)
+{
+ return scrub(args.value());
+}
+
value_t report_t::fn_rounded(call_scope_t& args)
{
return args.value().rounded();
@@ -880,9 +886,9 @@ option_t<report_t> * report_t::lookup_option(const char * p)
else OPT(price);
else OPT(prices_format_);
else OPT(pricedb_format_);
- else OPT(print_format_);
else OPT(payee_width_);
else OPT(prepend_format_);
+ else OPT(print_virtual);
break;
case 'q':
OPT(quantity);
@@ -1200,7 +1206,6 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind,
else if (is_eq(p, "cleared")) {
HANDLER(amount_).set_expr(string("#cleared"),
"(amount, cleared ? amount : 0)");
-
return expr_t::op_t::wrap_functor
(reporter<account_t, acct_handler_ptr, &report_t::accounts_report>
(new format_accounts(*this, report_format(HANDLER(cleared_format_)),
@@ -1212,11 +1217,10 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind,
break;
case 'e':
- if (is_eq(p, "equity"))
- return WRAP_FUNCTOR
- (reporter<>
- (new format_posts(*this, report_format(HANDLER(print_format_))),
- *this, "#equity"));
+ if (is_eq(p, "equity")) {
+ HANDLER(print_virtual).on_only(string("#equity"));
+ return WRAP_FUNCTOR(reporter<>(new print_xacts(*this), *this, "#equity"));
+ }
else if (is_eq(p, "entry"))
return WRAP_FUNCTOR(xact_command);
else if (is_eq(p, "emacs"))
@@ -1229,9 +1233,7 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind,
case 'p':
if (*(p + 1) == '\0' || is_eq(p, "print"))
return WRAP_FUNCTOR
- (reporter<>
- (new format_posts(*this, report_format(HANDLER(print_format_)),
- HANDLED(raw)), *this, "#print"));
+ (reporter<>(new print_xacts(*this, HANDLED(raw)), *this, "#print"));
else if (is_eq(p, "prices"))
return expr_t::op_t::wrap_functor
(reporter<post_t, post_handler_ptr, &report_t::commodities_report>
@@ -1251,7 +1253,7 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind,
return WRAP_FUNCTOR
(reporter<>
(new format_posts(*this, report_format(HANDLER(register_format_)),
- false, maybe_format(HANDLER(prepend_format_))),
+ maybe_format(HANDLER(prepend_format_))),
*this, "#register"));
else if (is_eq(p, "reload"))
return MAKE_FUNCTOR(report_t::reload_command);
@@ -1286,11 +1288,13 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind,
return WRAP_FUNCTOR(format_command);
break;
case 'g':
- if (is_eq(p, "generate"))
+ if (is_eq(p, "generate")) {
+ HANDLER(print_virtual).on_only(string("#generate"));
return expr_t::op_t::wrap_functor
(reporter<post_t, post_handler_ptr, &report_t::generate_report>
- (new format_posts(*this, report_format(HANDLER(print_format_)),
- false), *this, "#generate"));
+ (new print_xacts(*this), *this, "#generate"));
+ }
+ break;
case 'p':
if (is_eq(p, "parse"))
return WRAP_FUNCTOR(parse_command);