From 3a926da4cbffe903d138f8df9f5cb33332ff1030 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 16 Jun 2009 18:49:27 +0100 Subject: When --end is used, set a "terminus" date This means that final balance valuations (with -V or -X) will be done in terms of the date given to --end, rather than based on the current day. Fixes 647D5DB9-DBBB-47C8-80CE-F3F70E3B0253 --- src/report.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/report.h') diff --git a/src/report.h b/src/report.h index a1c93c39..d48b5a78 100644 --- a/src/report.h +++ b/src/report.h @@ -119,10 +119,12 @@ public: #define BUDGET_BUDGETED 0x01 #define BUDGET_UNBUDGETED 0x02 + date_t terminus; uint_least8_t budget_flags; explicit report_t(session_t& _session) - : session(_session), budget_flags(BUDGET_NO_BUDGET) {} + : session(_session), terminus(CURRENT_DATE()), + budget_flags(BUDGET_NO_BUDGET) {} virtual ~report_t() { output_stream.close(); @@ -154,6 +156,15 @@ public: value_t fn_format_date(call_scope_t& scope); value_t fn_ansify_if(call_scope_t& scope); +#if 0 + value_t fn_now(call_scope_t&) { + return CURRENT_TIME(); + } +#endif + value_t fn_today(call_scope_t&) { + return terminus; + } + value_t fn_options(call_scope_t&) { return value_t(static_cast(this)); } @@ -476,9 +487,8 @@ public: string predicate = "date<[" + to_iso_extended_string(*interval.start) + "]"; parent->HANDLER(limit_).on(string("--end"), predicate); -#if 0 - terminus = interval.begin; -#endif + + parent->terminus = *interval.start; }); OPTION(report_t, equity); -- cgit v1.2.3