bal was sometimes reporting empty accounts

This commit is contained in:
John Wiegley 2010-06-21 18:32:03 -04:00
parent 2f1b1c8ced
commit 963161a817
4 changed files with 31 additions and 6 deletions

View file

@ -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");

View file

@ -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)

View file

@ -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);

View file

@ -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