summaryrefslogtreecommitdiff
path: root/src/chain.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-15 22:55:29 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-15 22:57:23 -0400
commit14ffc2b31a38a7fdd25bd93fe21d17132b16062a (patch)
tree5188fc520c8bf3af25c7b6a266fb485dd0e0e2fb /src/chain.cc
parente32129b25cbea725208bb4212edb6caf1cf9bbf3 (diff)
downloadfork-ledger-14ffc2b31a38a7fdd25bd93fe21d17132b16062a.tar.gz
fork-ledger-14ffc2b31a38a7fdd25bd93fe21d17132b16062a.tar.bz2
fork-ledger-14ffc2b31a38a7fdd25bd93fe21d17132b16062a.zip
Don't apply all filters for account-wise reports
This creates its own problems; instead, only most are used.
Diffstat (limited to 'src/chain.cc')
-rw-r--r--src/chain.cc70
1 files changed, 38 insertions, 32 deletions
diff --git a/src/chain.cc b/src/chain.cc
index c8cbf673..62aac7b0 100644
--- a/src/chain.cc
+++ b/src/chain.cc
@@ -36,31 +36,35 @@
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);
- // truncate_entries cuts off a certain number of _entries_ from being
- // displayed. It does not affect calculation.
- if (report.HANDLED(head_) || report.HANDLED(tail_))
- handler.reset(new truncate_entries(handler,
- report.HANDLER(head_).value.to_long(),
- report.HANDLER(tail_).value.to_long()));
-
- // filter_xacts will only pass through xacts matching the
- // `display_predicate'.
- if (report.HANDLED(display_))
- handler.reset(new filter_xacts
- (handler, item_predicate(report.HANDLER(display_).str(),
- report.what_to_keep())));
-
- // 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));
+
+ 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_))
+ handler.reset(new truncate_entries(handler,
+ report.HANDLER(head_).value.to_long(),
+ report.HANDLER(tail_).value.to_long()));
+
+ // filter_xacts will only pass through xacts matching the
+ // `display_predicate'.
+ if (report.HANDLED(display_))
+ handler.reset(new filter_xacts
+ (handler, item_predicate(report.HANDLER(display_).str(),
+ report.what_to_keep())));
+
+ // calc_xacts computes the running total. When this appears will
+ // determine, for example, whether filtered xacts are included or excluded
+ // from the running total.
+ handler.reset(new calc_xacts(handler, expr));
+ }
// filter_xacts will only pass through xacts matching the
// `secondary_predicate'.
@@ -78,19 +82,21 @@ xact_handler_ptr chain_xact_handlers(report_t& report,
handler.reset(new sort_xacts(handler, report.HANDLER(sort_).str()));
}
- // 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.
- if (report.HANDLED(revalued))
- handler.reset(new changed_value_xacts(handler,
- report.HANDLER(total_).expr,
- report.HANDLED(revalued_only)));
-
- // collapse_xacts causes entries with multiple xacts to appear as entries
- // with a subtotaled xact for each commodity used.
- if (report.HANDLED(collapse))
- handler.reset(new collapse_xacts(handler, expr,
- report.HANDLED(collapse_if_zero)));
+ 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.
+ if (report.HANDLED(revalued))
+ handler.reset(new changed_value_xacts(handler,
+ report.HANDLER(total_).expr,
+ report.HANDLED(revalued_only)));
+
+ // collapse_xacts causes entries with multiple xacts to appear as entries
+ // with a subtotaled xact for each commodity used.
+ 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.