Added --no-total option
This simply omits the final total in the balance report, nothing more.
This commit is contained in:
parent
40f2ff6d6f
commit
31feaad105
4 changed files with 12 additions and 12 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
|
|
@ -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':
|
||||
|
|
|
|||
|
|
@ -388,6 +388,8 @@ public:
|
|||
parent->HANDLER(period_).on("monthly");
|
||||
});
|
||||
|
||||
OPTION(report_t, no_total);
|
||||
|
||||
OPTION__
|
||||
(report_t, only_,
|
||||
CTOR(report_t, only_) {}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue