diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-19 04:21:15 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-19 04:21:15 -0500 |
commit | ceb8dd89a6740c218d17ed01dbe5a7e8a37be2f0 (patch) | |
tree | 370248b287f75ea3b03901fced2bbac2aceae528 /src/filters.cc | |
parent | d2422f99e6edd17b86502b34be4fb618fe4c838d (diff) | |
download | fork-ledger-ceb8dd89a6740c218d17ed01dbe5a7e8a37be2f0.tar.gz fork-ledger-ceb8dd89a6740c218d17ed01dbe5a7e8a37be2f0.tar.bz2 fork-ledger-ceb8dd89a6740c218d17ed01dbe5a7e8a37be2f0.zip |
Don't output zero balances with the equity command
Diffstat (limited to 'src/filters.cc')
-rw-r--r-- | src/filters.cc | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/filters.cc b/src/filters.cc index 96e8026a..73ee200d 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -1037,14 +1037,16 @@ void posts_as_equity::report_subtotal() if (! value.is_zero()) { if (value.is_balance()) { foreach (const balance_t::amounts_map::value_type& amount_pair, - value.as_balance_lval().amounts) - handle_value(/* value= */ amount_pair.second, - /* account= */ pair.second.account, - /* xact= */ &xact, - /* temps= */ temps, - /* handler= */ handler, - /* date= */ finish, - /* act_date_p= */ false); + value.as_balance_lval().amounts) { + if (! amount_pair.second.is_zero()) + handle_value(/* value= */ amount_pair.second, + /* account= */ pair.second.account, + /* xact= */ &xact, + /* temps= */ temps, + /* handler= */ handler, + /* date= */ finish, + /* act_date_p= */ false); + } } else { handle_value(/* value= */ value.to_amount(), /* account= */ pair.second.account, @@ -1063,9 +1065,11 @@ void posts_as_equity::report_subtotal() if (total.is_balance()) { foreach (const balance_t::amounts_map::value_type& pair, total.as_balance().amounts) { - post_t& balance_post = temps.create_post(xact, balance_account); - balance_post.amount = - pair.second; - (*handler)(balance_post); + if (! pair.second.is_zero()) { + post_t& balance_post = temps.create_post(xact, balance_account); + balance_post.amount = - pair.second; + (*handler)(balance_post); + } } } else { post_t& balance_post = temps.create_post(xact, balance_account); |