The balance report is working again.
This commit is contained in:
parent
fd2e6c2502
commit
7ffb6c472c
5 changed files with 24 additions and 13 deletions
|
|
@ -219,8 +219,13 @@ void account_t::calculate_sums()
|
|||
(*pair.second).calculate_sums();
|
||||
|
||||
xdata_t& child_xd((*pair.second).xdata());
|
||||
add_or_set_value(xd.total, child_xd.total);
|
||||
xd.total_count += child_xd.total_count + child_xd.count;
|
||||
if (! child_xd.total.is_null()) {
|
||||
add_or_set_value(xd.total, child_xd.total);
|
||||
xd.total_count += child_xd.total_count + child_xd.count;
|
||||
} else {
|
||||
assert(child_xd.total_count == 0);
|
||||
assert(child_xd.count == 0);
|
||||
}
|
||||
}
|
||||
|
||||
call_scope_t args(*this);
|
||||
|
|
|
|||
|
|
@ -739,14 +739,16 @@ void forecast_xacts::flush()
|
|||
item_handler<xact_t>::flush();
|
||||
}
|
||||
|
||||
pass_down_accounts::pass_down_accounts(acct_handler_ptr handler,
|
||||
accounts_iterator& iter)
|
||||
: item_handler<account_t>(handler)
|
||||
pass_down_accounts::pass_down_accounts(acct_handler_ptr handler,
|
||||
accounts_iterator& iter,
|
||||
const expr_t& predicate)
|
||||
: item_handler<account_t>(handler), pred(predicate)
|
||||
{
|
||||
TRACE_CTOR(pass_down_accounts,
|
||||
"acct_handler_ptr, accounts_iterator");
|
||||
for (account_t * account = iter(); account; account = iter())
|
||||
item_handler<account_t>::operator()(*account);
|
||||
if (pred(*account))
|
||||
item_handler<account_t>::operator()(*account);
|
||||
}
|
||||
|
||||
} // namespace ledger
|
||||
|
|
|
|||
|
|
@ -651,13 +651,11 @@ class forecast_xacts : public generate_xacts
|
|||
item_predicate<xact_t> pred;
|
||||
|
||||
public:
|
||||
forecast_xacts(xact_handler_ptr handler,
|
||||
const expr_t& predicate)
|
||||
forecast_xacts(xact_handler_ptr handler, const expr_t& predicate)
|
||||
: generate_xacts(handler), pred(predicate) {
|
||||
TRACE_CTOR(forecast_xacts, "xact_handler_ptr, const expr_t&");
|
||||
}
|
||||
forecast_xacts(xact_handler_ptr handler,
|
||||
const string& predicate)
|
||||
forecast_xacts(xact_handler_ptr handler, const string& predicate)
|
||||
: generate_xacts(handler), pred(predicate) {
|
||||
TRACE_CTOR(forecast_xacts, "xact_handler_ptr, const string&");
|
||||
}
|
||||
|
|
@ -689,8 +687,12 @@ class pass_down_accounts : public item_handler<account_t>
|
|||
{
|
||||
pass_down_accounts();
|
||||
|
||||
item_predicate<account_t> pred;
|
||||
|
||||
public:
|
||||
pass_down_accounts(acct_handler_ptr handler, accounts_iterator& iter);
|
||||
pass_down_accounts(acct_handler_ptr handler,
|
||||
accounts_iterator& iter,
|
||||
const expr_t& predicate = expr_t());
|
||||
|
||||
virtual ~pass_down_accounts() {
|
||||
TRACE_DTOR(pass_down_accounts);
|
||||
|
|
|
|||
|
|
@ -336,10 +336,10 @@ void report_t::accounts_report(acct_handler_ptr handler)
|
|||
|
||||
if (sort_string.empty()) {
|
||||
basic_accounts_iterator walker(*session.master);
|
||||
pass_down_accounts(handler, walker);
|
||||
pass_down_accounts(handler, walker, expr_t("total"));
|
||||
} else {
|
||||
sorted_accounts_iterator walker(*session.master, sort_string);
|
||||
pass_down_accounts(handler, walker);
|
||||
pass_down_accounts(handler, walker, expr_t("total"));
|
||||
}
|
||||
handler->flush();
|
||||
|
||||
|
|
|
|||
|
|
@ -185,6 +185,8 @@ void value_t::_dup()
|
|||
value_t::operator bool() const
|
||||
{
|
||||
switch (type()) {
|
||||
case VOID:
|
||||
return false;
|
||||
case BOOLEAN:
|
||||
return as_boolean();
|
||||
case DATETIME:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue