diff options
Diffstat (limited to 'src/report.h')
-rw-r--r-- | src/report.h | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/src/report.h b/src/report.h index 8c66c88a..31f65c4f 100644 --- a/src/report.h +++ b/src/report.h @@ -196,6 +196,7 @@ public: HANDLER(abbrev_len_).report(out); HANDLER(account_).report(out); HANDLER(actual).report(out); + HANDLER(actual_dates).report(out); HANDLER(add_budget).report(out); HANDLER(amount_).report(out); HANDLER(amount_data).report(out); @@ -250,6 +251,7 @@ public: HANDLER(market).report(out); HANDLER(monthly).report(out); HANDLER(no_total).report(out); + HANDLER(now_).report(out); HANDLER(only_).report(out); HANDLER(output_).report(out); HANDLER(pager_).report(out); @@ -316,6 +318,8 @@ public: parent->HANDLER(limit_).on(string("--actual"), "actual"); }); + OPTION(report_t, actual_dates); + OPTION_(report_t, add_budget, DO() { parent->budget_flags |= BUDGET_BUDGETED | BUDGET_UNBUDGETED; }); @@ -347,7 +351,7 @@ public: "%(justify(scrub(display_total), 20, -1, true, color))" " %(!options.flat ? depth_spacer : \"\")" "%-(ansify_if(partial_account(options.flat), blue if color))\n%/" - "%(justify(scrub(display_total), 20, -1, true, color))\n%/" + "%$1\n%/" "--------------------\n"); }); @@ -377,16 +381,22 @@ public: OPTION__(report_t, budget_format_, CTOR(report_t, budget_format_) { on(none, "%(justify(scrub(get_at(total_expr, 0)), 12, -1, true, color))" - " %(justify(scrub(- get_at(total_expr, 1)), 12, -1, true, color))" - " %(justify(scrub(get_at(total_expr, 1) + get_at(total_expr, 0)), 12, -1, true, color))" - " %(justify(scrub((100% * get_at(total_expr, 0)) / - get_at(total_expr, 1)), 5, -1, true, color))" + " %(justify(scrub(- get_at(total_expr, 1)), 12, " + " 12 + 1 + 12, true, color))" + " %(justify(scrub(get_at(total_expr, 1) + " + " get_at(total_expr, 0)), 12, " + " 12 + 1 + 12 + 1 + 12, true, color))" + " %(ansify_if(" + " justify((get_at(total_expr, 1) ? " + " scrub((100% * get_at(total_expr, 0)) / " + " - get_at(total_expr, 1)) : 0), " + " 5, -1, true, false)," + " magenta if (color and get_at(total_expr, 1) and " + " (abs(quantity(get_at(total_expr, 0)) / " + " quantity(get_at(total_expr, 1))) >= 1))))" " %(!options.flat ? depth_spacer : \"\")" "%-(ansify_if(partial_account(options.flat), blue if color))\n" - "%/" - "%(justify(scrub(get_at(total_expr, 0)), 12, -1, true, color))" - " %(justify(scrub(- get_at(total_expr, 1)), 12, -1, true, color))" - " %(justify(scrub(get_at(total_expr, 1) + get_at(total_expr, 0)), 12, -1, true, color))" - " %(justify(scrub((100% * get_at(total_expr, 0)) / - get_at(total_expr, 1)), 5, -1, true, color))\n%/" + "%/%$1 %$2 %$3 %$4\n%/" "------------ ------------ ------------ -----\n"); }); @@ -403,9 +413,7 @@ public: " %(latest_cleared ? format_date(latest_cleared) : \" \")" " %(!options.flat ? depth_spacer : \"\")" "%-(ansify_if(partial_account(options.flat), blue if color))\n%/" - "%(justify(scrub(get_at(total_expr, 0)), 16, -1, true, color))" - " %(justify(scrub(get_at(total_expr, 1)), 16, -1, true, color))" - " %(latest_cleared ? format_date(latest_cleared) : \" \")\n%/" + "%$1 %$2 %$3\n%/" "---------------- ---------------- ---------\n"); }); @@ -598,6 +606,15 @@ public: OPTION(report_t, no_total); + OPTION_(report_t, now_, DO_(args) { + date_interval_t interval(args[1].to_string()); + if (! interval.start) + throw_(std::invalid_argument, + _("Could not determine beginning of period '%1'") + << args[1].to_string()); + ledger::epoch = datetime_t(*interval.start); + }); + OPTION__ (report_t, only_, CTOR(report_t, only_) {} @@ -678,13 +695,7 @@ public: "%(has_cost & !cost_calculated ?" " \" @ \" + justify(scrub(abs(cost / amount)), 0) : \"\")" "%(comment)\n%/" - " %(xact.uncleared ?" - " (cleared ? \"* \" : (pending ? \"! \" : \"\")) : \"\")" - "%-34(account)" - " %12(calculated ? \"\" : justify(scrub(amount), 12, -1, true))" - "%(has_cost & !cost_calculated ?" - " \" @ \" + justify(scrub(abs(cost / amount)), 0) : \"\")" - "%(comment)\n%/\n"); + " %$7%$8 %$9%$A%$B\n%/\n"); }); OPTION_(report_t, quantity, DO() { // -O @@ -717,15 +728,7 @@ public: " %(justify(scrub(display_total), total_width, " " 4 + date_width + payee_width + account_width + amount_width " " + total_width, true, color))\n%/" - "%(justify(\" \", 2 + date_width + payee_width))" - "%(ansify_if(justify(truncated(account, account_width, abbrev_len), " - " account_width), blue if color))" - " %(justify(scrub(display_amount), amount_width, " - " 3 + date_width + payee_width + account_width + amount_width, " - " true, color))" - " %(justify(scrub(display_total), total_width, " - " 4 + date_width + payee_width + account_width + amount_width " - " + total_width, true, color))\n"); + "%(justify(\" \", 2 + date_width + payee_width))%$3 %$4 %$5\n"); }); OPTION(report_t, related); // -r |