summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/report.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/report.h b/src/report.h
index 57cef3c5..4f53e8ec 100644
--- a/src/report.h
+++ b/src/report.h
@@ -386,7 +386,25 @@ public:
OPTION(report_t, flat);
OPTION(report_t, forecast_while_);
OPTION(report_t, format_); // -F
- OPTION(report_t, gain); // -G
+
+ OPTION_(report_t, gain, DO() { // -G
+ parent->HANDLER(revalued).on_only();
+ parent->HANDLER(amount_).set_expr("(amount, cost)");
+ // Since we are displaying the amounts of revalued transactions, they
+ // will end up being composite totals, and hence a pair of pairs.
+ parent->HANDLER(display_amount_)
+ .set_expr("is_seq(get_at(amount_expr, 0)) ?"
+ " get_at(get_at(amount_expr, 0), 0) :"
+ " market(get_at(amount_expr, 0), date, exchange) -"
+ " get_at(amount_expr, 1)");
+ parent->HANDLER(revalued_total_)
+ .set_expr("(market(get_at(total_expr, 0), date, exchange), "
+ "get_at(total_expr, 1))");
+ parent->HANDLER(display_total_)
+ .set_expr("market(get_at(total_expr, 0), date, exchange)"
+ " - get_at(total_expr, 1)");
+ });
+
OPTION(report_t, head_);
OPTION_(report_t, invert, DO() {