diff options
author | John Wiegley <johnw@newartisans.com> | 2010-05-30 02:28:58 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-05-30 02:47:40 -0600 |
commit | 647d4aac2fa474085d01f7ea1cebdc34fafd64a6 (patch) | |
tree | c17157d73c3a9d5dd182a4b7b0896e4f31e318be /src/output.h | |
parent | a41d33fba37460587f59ea0349ac4947a4de9f3c (diff) | |
download | fork-ledger-647d4aac2fa474085d01f7ea1cebdc34fafd64a6.tar.gz fork-ledger-647d4aac2fa474085d01f7ea1cebdc34fafd64a6.tar.bz2 fork-ledger-647d4aac2fa474085d01f7ea1cebdc34fafd64a6.zip |
New: --group-by=EXPR and --group-title-format=FMT
The --group-by option allows for most reports to be split up into
sections based on the varying value of EXPR. For example, to see
register subtotals by payee, use:
ledger reg --group-by=payee -s
This works for separated balances too:
ledger bal --group-by=payee
Another interesting possibility is seeing a register of all the accounts
affected by a related account:
ledger reg -r --group-by=payee
The option --group-title-format can be used to add a separator bar to
the group titles. The option --no-titles can be used to drop titles
altogether.
Diffstat (limited to 'src/output.h')
-rw-r--r-- | src/output.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/output.h b/src/output.h index f0e7f9a5..a19c6235 100644 --- a/src/output.h +++ b/src/output.h @@ -64,6 +64,8 @@ protected: std::size_t prepend_width; xact_t * last_xact; post_t * last_post; + bool first_report_title; + string report_title; public: format_posts(report_t& _report, const string& format, @@ -73,6 +75,10 @@ public: TRACE_DTOR(format_posts); } + virtual void title(const string& str) { + report_title = str; + } + virtual void flush(); virtual void operator()(post_t& post); @@ -80,6 +86,8 @@ public: last_xact = NULL; last_post = NULL; + report_title = ""; + item_handler<post_t>::clear(); } }; @@ -94,6 +102,8 @@ protected: format_t prepend_format; std::size_t prepend_width; predicate_t disp_pred; + bool first_report_title; + string report_title; std::list<account_t *> posted_accounts; @@ -108,6 +118,10 @@ public: std::pair<std::size_t, std::size_t> mark_accounts(account_t& account, const bool flat); + virtual void title(const string& str) { + report_title = str; + } + virtual std::size_t post_account(account_t& account, const bool flat); virtual void flush(); @@ -117,6 +131,8 @@ public: disp_pred.mark_uncompiled(); posted_accounts.clear(); + report_title = ""; + item_handler<account_t>::clear(); } }; |