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 {
|
namespace ledger {
|
||||||
|
|
||||||
xact_handler_ptr chain_xact_handlers(report_t& report,
|
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);
|
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
|
// truncate_entries cuts off a certain number of _entries_ from being
|
||||||
// displayed. It does not affect calculation.
|
// displayed. It does not affect calculation.
|
||||||
if (report.HANDLED(head_) || report.HANDLED(tail_))
|
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
|
// calc_xacts computes the running total. When this appears will
|
||||||
// determine, for example, whether filtered xacts are included or excluded
|
// determine, for example, whether filtered xacts are included or excluded
|
||||||
// from the running total.
|
// 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));
|
handler.reset(new calc_xacts(handler, expr));
|
||||||
|
}
|
||||||
|
|
||||||
// filter_xacts will only pass through xacts matching the
|
// filter_xacts will only pass through xacts matching the
|
||||||
// `secondary_predicate'.
|
// `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()));
|
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
|
// changed_value_xacts adds virtual xacts to the list to account for
|
||||||
// changes in market value of commodities, which otherwise would affect
|
// changes in market value of commodities, which otherwise would affect
|
||||||
// the running total unpredictably.
|
// the running total unpredictably.
|
||||||
|
|
@ -91,6 +96,7 @@ xact_handler_ptr chain_xact_handlers(report_t& report,
|
||||||
if (report.HANDLED(collapse))
|
if (report.HANDLED(collapse))
|
||||||
handler.reset(new collapse_xacts(handler, expr,
|
handler.reset(new collapse_xacts(handler, expr,
|
||||||
report.HANDLED(collapse_if_zero)));
|
report.HANDLED(collapse_if_zero)));
|
||||||
|
}
|
||||||
|
|
||||||
// subtotal_xacts combines all the xacts it receives into one subtotal
|
// subtotal_xacts combines all the xacts it receives into one subtotal
|
||||||
// entry, which has one xact for each commodity in each account.
|
// 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;
|
typedef shared_ptr<item_handler<account_t> > acct_handler_ptr;
|
||||||
|
|
||||||
class report_t;
|
class report_t;
|
||||||
xact_handler_ptr chain_xact_handlers(report_t& report,
|
xact_handler_ptr
|
||||||
xact_handler_ptr base_handler);
|
chain_xact_handlers(report_t& report,
|
||||||
|
xact_handler_ptr base_handler,
|
||||||
|
bool only_preliminaries = false);
|
||||||
|
|
||||||
} // namespace ledger
|
} // namespace ledger
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ void report_t::sum_all_accounts()
|
||||||
|
|
||||||
journal_xacts_iterator walker(*session.journal.get());
|
journal_xacts_iterator walker(*session.journal.get());
|
||||||
pass_down_xacts(chain_xact_handlers
|
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);
|
walker);
|
||||||
|
|
||||||
expr.mark_uncompiled(); // recompile, throw away xact_t bindings
|
expr.mark_uncompiled(); // recompile, throw away xact_t bindings
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue