diff options
author | John Wiegley <johnw@newartisans.com> | 2003-10-01 20:47:10 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2003-10-01 20:47:10 +0000 |
commit | f44eea66c4d3a6430b41eb564e81f976e9abeeb6 (patch) | |
tree | e8fb24f3f69cbae1a3a270eeea53e23ea647a93d /balance.cc | |
parent | a40813d896fd929e92969c06229844073d58565d (diff) | |
download | fork-ledger-f44eea66c4d3a6430b41eb564e81f976e9abeeb6.tar.gz fork-ledger-f44eea66c4d3a6430b41eb564e81f976e9abeeb6.tar.bz2 fork-ledger-f44eea66c4d3a6430b41eb564e81f976e9abeeb6.zip |
*** empty log message ***
Diffstat (limited to 'balance.cc')
-rw-r--r-- | balance.cc | 27 |
1 files changed, 18 insertions, 9 deletions
@@ -51,7 +51,7 @@ static void display_total(std::ostream& out, totals& balance, displayed = true; out << acct->balance; - if (top_level) + if (! no_subtotals && top_level) balance.credit(acct->balance); if (acct->parent && ! no_subtotals && ! full_names) { @@ -126,14 +126,23 @@ void report_balances(int argc, char **argv, std::ostream& out) for (std::list<transaction *>::iterator x = (*i)->xacts.begin(); x != (*i)->xacts.end(); x++) { - account * acct = (*x)->acct; - - for (; acct; acct = no_subtotals ? NULL : acct->parent) { - bool true_match = false; - if (! (regexps.empty() || - account_matches(acct, regexps, &true_match))) + for (account * acct = (*x)->acct; + acct; + acct = no_subtotals ? NULL : acct->parent) { + if (acct->checked == 0) { + bool true_match = false; + if (! (regexps.empty() || + account_matches(acct, regexps, &true_match))) + acct->checked = 2; + else if (! (true_match || show_children || ! acct->parent)) + acct->checked = 3; + else + acct->checked = 1; + } + + if (acct->checked == 2) break; - else if (! (true_match || show_children || ! acct->parent)) + else if (acct->checked == 3) continue; acct->display = true; @@ -154,7 +163,7 @@ void report_balances(int argc, char **argv, std::ostream& out) // Print the total of all the balances shown - if (! no_subtotals) + if (! no_subtotals && balance) out << "--------------------" << std::endl << balance << std::endl; } |