diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-20 15:04:55 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-20 15:41:49 -0400 |
commit | 31feaad1056cda45f3b8cfa0faff45ddc8487c09 (patch) | |
tree | 8c69685fae1ec95d37dd1f45ad9a34f43e5dbd61 /src | |
parent | 40f2ff6d6f7902c4957e0710a5a9d09c1f49ad1e (diff) | |
download | fork-ledger-31feaad1056cda45f3b8cfa0faff45ddc8487c09.tar.gz fork-ledger-31feaad1056cda45f3b8cfa0faff45ddc8487c09.tar.bz2 fork-ledger-31feaad1056cda45f3b8cfa0faff45ddc8487c09.zip |
Added --no-total option
This simply omits the final total in the balance report, nothing more.
Diffstat (limited to 'src')
-rw-r--r-- | src/output.cc | 10 | ||||
-rw-r--r-- | src/output.h | 7 | ||||
-rw-r--r-- | src/report.cc | 5 | ||||
-rw-r--r-- | src/report.h | 2 |
4 files changed, 12 insertions, 12 deletions
diff --git a/src/output.cc b/src/output.cc index 2cc075eb..48773aa0 100644 --- a/src/output.cc +++ b/src/output.cc @@ -218,12 +218,12 @@ void format_accounts::post_account(account_t& account) DEBUG("account.display", "Should we display " << account.fullname()); if (account.has_flags(ACCOUNT_EXT_MATCHING) || - (! flatten_list && + (! report.HANDLED(flat) && account.children_with_flags(ACCOUNT_EXT_MATCHING) > 1)) { DEBUG("account.display", " Yes, because it matched"); format_account = true; } - else if (! flatten_list && + else if (! report.HANDLED(flat) && account.children_with_flags(ACCOUNT_EXT_VISITED) && ! account.children_with_flags(ACCOUNT_EXT_MATCHING)) { DEBUG("account.display", @@ -257,11 +257,11 @@ void format_accounts::flush() foreach (account_t * account, posted_accounts) { post_account(*account); - if (flatten_list && account->has_flags(ACCOUNT_EXT_DISPLAYED)) + if (report.HANDLED(flat) && account->has_flags(ACCOUNT_EXT_DISPLAYED)) top_displayed++; } - if (! flatten_list) { + if (! report.HANDLED(flat)) { foreach (accounts_map::value_type pair, report.session.master->accounts) { if (pair.second->has_flags(ACCOUNT_EXT_DISPLAYED) || pair.second->children_with_flags(ACCOUNT_EXT_DISPLAYED)) @@ -272,7 +272,7 @@ void format_accounts::flush() assert(report.session.master->has_xdata()); account_t::xdata_t& xdata(report.session.master->xdata()); - if (top_displayed > 1 && ! report.HANDLED(collapse) && xdata.total) { + if (! report.HANDLED(no_total) && top_displayed > 1 && xdata.total) { out << "--------------------\n"; xdata.value = xdata.total; bind_scope_t bound_scope(report, *report.session.master); diff --git a/src/output.h b/src/output.h index f638f4de..18718c7c 100644 --- a/src/output.h +++ b/src/output.h @@ -163,16 +163,13 @@ protected: report_t& report; format_t format; item_predicate disp_pred; - bool flatten_list; std::list<account_t *> posted_accounts; public: format_accounts(report_t& _report, - const string& _format = "", - bool _flatten_list = false) - : report(_report), format(_format), disp_pred(), - flatten_list(_flatten_list) + const string& _format = "") + : report(_report), format(_format), disp_pred() { TRACE_CTOR(format_accounts, "report&, const string&, bool"); diff --git a/src/report.cc b/src/report.cc index da56e141..76f1df39 100644 --- a/src/report.cc +++ b/src/report.cc @@ -391,6 +391,7 @@ option_t<report_t> * report_t::lookup_option(const char * p) break; case 'n': OPT_CH(collapse); + else OPT(no_total); break; case 'o': OPT(only_); @@ -481,8 +482,8 @@ expr_t::ptr_op_t report_t::lookup(const string& name) if (*(q + 1) == '\0' || is_eq(q, "bal") || is_eq(q, "balance")) return expr_t::op_t::wrap_functor (reporter<account_t, acct_handler_ptr, &report_t::accounts_report> - (new format_accounts(*this, report_format(HANDLER(balance_format_)), - HANDLED(flat)), *this)); + (new format_accounts(*this, report_format(HANDLER(balance_format_))), + *this)); break; case 'c': diff --git a/src/report.h b/src/report.h index 242792b0..0e6f7dc6 100644 --- a/src/report.h +++ b/src/report.h @@ -388,6 +388,8 @@ public: parent->HANDLER(period_).on("monthly"); }); + OPTION(report_t, no_total); + OPTION__ (report_t, only_, CTOR(report_t, only_) {} |