summaryrefslogtreecommitdiff
path: root/src/report.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/report.cc')
-rw-r--r--src/report.cc34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/report.cc b/src/report.cc
index d498cc85..62fbe503 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -120,22 +120,23 @@ value_t report_t::fn_display_total(call_scope_t& scope)
return HANDLER(display_total_).expr.calc(scope);
}
-value_t report_t::fn_market_value(call_scope_t& args)
+value_t report_t::fn_market_value(call_scope_t& scope)
{
- interactive_t env(args, "a&ts");
+ interactive_t args(scope, "a&ts");
commodity_t * commodity = NULL;
- if (env.has(2))
- commodity = amount_t::current_pool->find_or_create(env.get<string>(2));
+ if (args.has(2))
+ commodity = amount_t::current_pool->find_or_create(args.get<string>(2));
- DEBUG("report.market", "getting market value of: " << env.value_at(0));
+ DEBUG("report.market", "getting market value of: " << args.value_at(0));
value_t result =
- env.value_at(0).value(env.has(1) ?
- env.get<datetime_t>(1) : optional<datetime_t>(),
- commodity ?
- optional<commodity_t&>(*commodity) :
- optional<commodity_t&>());
+ args.value_at(0).value(! args.has(2),
+ args.has(1) ?
+ args.get<datetime_t>(1) : optional<datetime_t>(),
+ commodity ?
+ optional<commodity_t&>(*commodity) :
+ optional<commodity_t&>());
DEBUG("report.market", "result is: " << result);
return result;
@@ -165,13 +166,13 @@ value_t report_t::fn_quantity(call_scope_t& args)
return args[0].to_amount().number();
}
-value_t report_t::fn_truncate(call_scope_t& args)
+value_t report_t::fn_truncate(call_scope_t& scope)
{
- interactive_t env(args, "v&ll");
+ interactive_t args(scope, "v&ll");
return string_value(format_t::truncate
- (env.get<string>(0),
- env.has(1) && env.get<long>(1) > 0 ? env.get<long>(1) : 0,
- env.has(2) ? env.get<long>(2) : -1));
+ (args.get<string>(0),
+ args.has(1) && args.get<long>(1) > 0 ? args.get<long>(1) : 0,
+ args.has(2) ? args.get<long>(2) : -1));
}
value_t report_t::fn_justify(call_scope_t& scope)
@@ -400,6 +401,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
else OPT_(end_);
else OPT(equity);
else OPT(exact);
+ else OPT(exchange_);
break;
case 'f':
OPT(flat);
@@ -498,7 +500,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
else OPT_(wide);
break;
case 'x':
- OPT_CH(comm_as_payee);
+ OPT_CH(exchange_);
break;
case 'y':
OPT_CH(date_format_);