Don't apply all filters for account-wise reports
This creates its own problems; instead, only most are used.
This commit is contained in:
parent
e32129b25c
commit
14ffc2b31a
3 changed files with 42 additions and 34 deletions
14
src/chain.cc
14
src/chain.cc
|
|
@ -36,10 +36,16 @@
|
|||
namespace ledger {
|
||||
|
||||
xact_handler_ptr chain_xact_handlers(report_t& report,
|
||||
xact_handler_ptr base_handler)
|
||||
xact_handler_ptr base_handler,
|
||||
bool only_preliminaries)
|
||||
{
|
||||
xact_handler_ptr handler(base_handler);
|
||||
|
||||
assert(report.HANDLED(amount_));
|
||||
expr_t& expr(report.HANDLER(amount_).expr);
|
||||
expr.set_context(&report);
|
||||
|
||||
if (! only_preliminaries) {
|
||||
// truncate_entries cuts off a certain number of _entries_ from being
|
||||
// displayed. It does not affect calculation.
|
||||
if (report.HANDLED(head_) || report.HANDLED(tail_))
|
||||
|
|
@ -57,10 +63,8 @@ xact_handler_ptr chain_xact_handlers(report_t& report,
|
|||
// calc_xacts computes the running total. When this appears will
|
||||
// determine, for example, whether filtered xacts are included or excluded
|
||||
// from the running total.
|
||||
assert(report.HANDLED(amount_));
|
||||
expr_t& expr(report.HANDLER(amount_).expr);
|
||||
expr.set_context(&report);
|
||||
handler.reset(new calc_xacts(handler, expr));
|
||||
}
|
||||
|
||||
// filter_xacts will only pass through xacts matching the
|
||||
// `secondary_predicate'.
|
||||
|
|
@ -78,6 +82,7 @@ xact_handler_ptr chain_xact_handlers(report_t& report,
|
|||
handler.reset(new sort_xacts(handler, report.HANDLER(sort_).str()));
|
||||
}
|
||||
|
||||
if (! only_preliminaries) {
|
||||
// changed_value_xacts adds virtual xacts to the list to account for
|
||||
// changes in market value of commodities, which otherwise would affect
|
||||
// the running total unpredictably.
|
||||
|
|
@ -91,6 +96,7 @@ xact_handler_ptr chain_xact_handlers(report_t& report,
|
|||
if (report.HANDLED(collapse))
|
||||
handler.reset(new collapse_xacts(handler, expr,
|
||||
report.HANDLED(collapse_if_zero)));
|
||||
}
|
||||
|
||||
// subtotal_xacts combines all the xacts it receives into one subtotal
|
||||
// entry, which has one xact for each commodity in each account.
|
||||
|
|
|
|||
|
|
@ -88,8 +88,10 @@ typedef shared_ptr<item_handler<xact_t> > xact_handler_ptr;
|
|||
typedef shared_ptr<item_handler<account_t> > acct_handler_ptr;
|
||||
|
||||
class report_t;
|
||||
xact_handler_ptr chain_xact_handlers(report_t& report,
|
||||
xact_handler_ptr base_handler);
|
||||
xact_handler_ptr
|
||||
chain_xact_handlers(report_t& report,
|
||||
xact_handler_ptr base_handler,
|
||||
bool only_preliminaries = false);
|
||||
|
||||
} // namespace ledger
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ void report_t::sum_all_accounts()
|
|||
|
||||
journal_xacts_iterator walker(*session.journal.get());
|
||||
pass_down_xacts(chain_xact_handlers
|
||||
(*this, xact_handler_ptr(new set_account_value(expr))),
|
||||
(*this, xact_handler_ptr(new set_account_value(expr)), true),
|
||||
walker);
|
||||
|
||||
expr.mark_uncompiled(); // recompile, throw away xact_t bindings
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue