diff options
author | John Wiegley <johnw@newartisans.com> | 2009-10-27 08:04:31 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-10-27 08:30:59 -0400 |
commit | 88460db2fbb0ab76c0ab3705cc4043e7fb2726d4 (patch) | |
tree | a9d6824db1ecc83abf0d2e0d4ea8549f01e002ad /src/report.h | |
parent | a8768587c8e6850e23ecbbfe4a108515b8ade892 (diff) | |
download | fork-ledger-88460db2fbb0ab76c0ab3705cc4043e7fb2726d4.tar.gz fork-ledger-88460db2fbb0ab76c0ab3705cc4043e7fb2726d4.tar.bz2 fork-ledger-88460db2fbb0ab76c0ab3705cc4043e7fb2726d4.zip |
Added a new "budget" report
This is a balance report with four columns:
Amount spent | Budgeted Amount | Difference | Percentage
Diffstat (limited to 'src/report.h')
-rw-r--r-- | src/report.h | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/report.h b/src/report.h index f0052128..baacd28c 100644 --- a/src/report.h +++ b/src/report.h @@ -117,9 +117,10 @@ public: session_t& session; output_stream_t output_stream; -#define BUDGET_NO_BUDGET 0x00 -#define BUDGET_BUDGETED 0x01 -#define BUDGET_UNBUDGETED 0x02 +#define BUDGET_NO_BUDGET 0x00 +#define BUDGET_BUDGETED 0x01 +#define BUDGET_UNBUDGETED 0x02 +#define BUDGET_WRAP_VALUES 0x04 datetime_t terminus; uint_least8_t budget_flags; @@ -205,6 +206,7 @@ public: HANDLER(basis).report(out); HANDLER(begin_).report(out); HANDLER(budget).report(out); + HANDLER(budget_format_).report(out); HANDLER(by_payee).report(out); HANDLER(cleared).report(out); HANDLER(code_as_payee).report(out); @@ -314,7 +316,7 @@ public: }); OPTION_(report_t, add_budget, DO() { - parent->budget_flags = BUDGET_BUDGETED | BUDGET_UNBUDGETED; + parent->budget_flags |= BUDGET_BUDGETED | BUDGET_UNBUDGETED; }); OPTION__ @@ -368,7 +370,23 @@ public: }); OPTION_(report_t, budget, DO() { - parent->budget_flags = BUDGET_BUDGETED; + parent->budget_flags |= BUDGET_BUDGETED; + }); + + 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))" + " %(!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%/" + "------------ ------------ ------------ -----\n"); }); OPTION(report_t, by_payee); // -P @@ -772,7 +790,7 @@ public: }); OPTION_(report_t, unbudgeted, DO() { - parent->budget_flags = BUDGET_UNBUDGETED; + parent->budget_flags |= BUDGET_UNBUDGETED; }); OPTION_(report_t, uncleared, DO() { // -U |