diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-21 18:32:03 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-21 18:32:03 -0400 |
commit | 963161a817c3d6b2a8171c8e3faa382dbc39ba02 (patch) | |
tree | 28baefd70f0b51229ae1bdf4b01a0fc9e49afe1b | |
parent | 2f1b1c8ceded9bff5fa26d0899da04180f539e94 (diff) | |
download | fork-ledger-963161a817c3d6b2a8171c8e3faa382dbc39ba02.tar.gz fork-ledger-963161a817c3d6b2a8171c8e3faa382dbc39ba02.tar.bz2 fork-ledger-963161a817c3d6b2a8171c8e3faa382dbc39ba02.zip |
bal was sometimes reporting empty accounts
-rw-r--r-- | src/output.cc | 3 | ||||
-rw-r--r-- | src/report.cc | 15 | ||||
-rw-r--r-- | src/report.h | 2 | ||||
-rw-r--r-- | test/regress/56BBE69B.test | 17 |
4 files changed, 31 insertions, 6 deletions
diff --git a/src/output.cc b/src/output.cc index cc4845a3..f53e60c9 100644 --- a/src/output.cc +++ b/src/output.cc @@ -228,7 +228,8 @@ format_accounts::mark_accounts(account_t& account, const bool flat) if ((! flat && to_display > 1) || ((flat || to_display != 1 || account.has_xflags(ACCOUNT_EXT_VISITED)) && - (report.HANDLED(empty) || report.fn_display_total(call_scope)) && + (report.HANDLED(empty) || + report.display_value(report.fn_display_total(call_scope))) && disp_pred(bound_scope))) { account.xdata().add_flags(ACCOUNT_EXT_TO_DISPLAY); DEBUG("account.display", "Marking account as TO_DISPLAY"); diff --git a/src/report.cc b/src/report.cc index da7c11f5..df37f9dc 100644 --- a/src/report.cc +++ b/src/report.cc @@ -428,6 +428,15 @@ void report_t::commodities_report(post_handler_ptr handler) session.journal->clear_xdata(); } +value_t report_t::display_value(const value_t& val) +{ + value_t temp(val.strip_annotations(what_to_keep())); + if (HANDLED(base)) + return temp; + else + return temp.unreduced(); +} + value_t report_t::fn_amount_expr(call_scope_t& scope) { return HANDLER(amount_).expr.calc(scope); @@ -533,11 +542,7 @@ value_t report_t::fn_print(call_scope_t& args) value_t report_t::fn_scrub(call_scope_t& args) { - value_t temp(args.value().strip_annotations(what_to_keep())); - if (HANDLED(base)) - return temp; - else - return temp.unreduced(); + return display_value(args.value()); } value_t report_t::fn_rounded(call_scope_t& args) diff --git a/src/report.h b/src/report.h index 7e52933a..e0073193 100644 --- a/src/report.h +++ b/src/report.h @@ -134,6 +134,8 @@ public: void accounts_report(acct_handler_ptr handler); void commodities_report(post_handler_ptr handler); + value_t display_value(const value_t& val); + value_t fn_amount_expr(call_scope_t& scope); value_t fn_total_expr(call_scope_t& scope); value_t fn_display_amount(call_scope_t& scope); diff --git a/test/regress/56BBE69B.test b/test/regress/56BBE69B.test new file mode 100644 index 00000000..76fedc17 --- /dev/null +++ b/test/regress/56BBE69B.test @@ -0,0 +1,17 @@ +bol +<<< +D 1000.00 USD + +2010-01-07 * Put money in + Assets:A -20.00 EUR + Equity:Opening balances + +2010-01-11 * Purchase + Assets:A 20.00 EUR @@ 25.00 USD + Expenses:B +>>> + 20.00 EUR Equity:Opening balances + -25.00 USD Expenses:B +-------------------- + 20.00 EUR + -25.00 USD |