diff options
author | John Wiegley <johnw@newartisans.com> | 2009-10-26 18:52:26 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-10-26 18:52:26 -0400 |
commit | 151a8d87ee299b54da262346471aa71a729a6eb2 (patch) | |
tree | e2151c34eb1a2756e5e4324465ebf629ef4859e6 /src/output.cc | |
parent | d85a415bc5119d4271ca7355fe3e0ce3951c0d23 (diff) | |
download | fork-ledger-151a8d87ee299b54da262346471aa71a729a6eb2.tar.gz fork-ledger-151a8d87ee299b54da262346471aa71a729a6eb2.tar.bz2 fork-ledger-151a8d87ee299b54da262346471aa71a729a6eb2.zip |
Fixed sorting in bal reports when --flat is used
Note that sorting on the "total" is not the same thing as sorting on the
"display_total" when multiple commodities are in use and the -X flag is
selected! One should always sort on display_total, since that's the
value which is shown in the report. 'T' is a synonym for display_total.
Diffstat (limited to 'src/output.cc')
-rw-r--r-- | src/output.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/output.cc b/src/output.cc index fead2326..a0c2581b 100644 --- a/src/output.cc +++ b/src/output.cc @@ -136,14 +136,14 @@ format_accounts::format_accounts(report_t& _report, } } -std::size_t format_accounts::post_account(account_t& account) +std::size_t format_accounts::post_account(account_t& account, const bool flat) { if (account.xdata().has_flags(ACCOUNT_EXT_TO_DISPLAY) && ! account.xdata().has_flags(ACCOUNT_EXT_DISPLAYED)) { - if (account.parent && + if (! flat && account.parent && account.parent->xdata().has_flags(ACCOUNT_EXT_TO_DISPLAY) && ! account.parent->xdata().has_flags(ACCOUNT_EXT_DISPLAYED)) - post_account(*account.parent); + post_account(*account.parent, flat); account.xdata().add_flags(ACCOUNT_EXT_DISPLAYED); @@ -208,7 +208,7 @@ void format_accounts::flush() std::size_t displayed = 0; foreach (account_t * account, posted_accounts) - displayed += post_account(*account); + displayed += post_account(*account, report.HANDLED(flat)); if (displayed > 1 && ! report.HANDLED(no_total) && ! report.HANDLED(percent)) { @@ -222,6 +222,7 @@ void format_accounts::flush() void format_accounts::operator()(account_t& account) { + DEBUG("account.display", "Posting account: " << account.fullname()); posted_accounts.push_back(&account); } |