summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/chain.cc12
-rw-r--r--src/filters.cc11
-rw-r--r--src/filters.h5
-rw-r--r--src/report.cc2
-rw-r--r--src/report.h2
5 files changed, 19 insertions, 13 deletions
diff --git a/src/chain.cc b/src/chain.cc
index c67de108..2fc6123e 100644
--- a/src/chain.cc
+++ b/src/chain.cc
@@ -48,6 +48,14 @@ xact_handler_ptr chain_xact_handlers(report_t& report,
expr.set_context(&report);
if (! only_preliminaries) {
+ // Make sure only forecast transactions which match are allowed through
+ if (report.HANDLED(forecast_while_)) {
+ handler.reset(new filter_xacts
+ (handler, item_predicate(report.HANDLER(forecast_while_).str(),
+ report.what_to_keep()),
+ report));
+ }
+
// truncate_entries cuts off a certain number of _entries_ from being
// displayed. It does not affect calculation.
if (report.HANDLED(head_) || report.HANDLED(tail_))
@@ -183,10 +191,10 @@ xact_handler_ptr chain_xact_handlers(report_t& report,
report.what_to_keep()),
report));
}
- else if (report.HANDLED(forecast_)) {
+ else if (report.HANDLED(forecast_while_)) {
forecast_xacts * forecast_handler
= new forecast_xacts(handler,
- item_predicate(report.HANDLER(forecast_).str(),
+ item_predicate(report.HANDLER(forecast_while_).str(),
report.what_to_keep()),
report);
forecast_handler->add_period_entries(report.session.journal->period_entries);
diff --git a/src/filters.cc b/src/filters.cc
index 0bb4cf98..06bc4487 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -660,16 +660,14 @@ void dow_xacts::flush()
subtotal_xacts::flush();
}
-void generate_xacts::add_period_entries
- (period_entries_list& period_entries)
+void generate_xacts::add_period_entries(period_entries_list& period_entries)
{
foreach (period_entry_t * entry, period_entries)
foreach (xact_t * xact, entry->xacts)
add_xact(entry->period, *xact);
}
-void generate_xacts::add_xact(const interval_t& period,
- xact_t& xact)
+void generate_xacts::add_xact(const interval_t& period, xact_t& xact)
{
pending_xacts.push_back(pending_xacts_pair(period, &xact));
}
@@ -722,7 +720,7 @@ void budget_xacts::operator()(xact_t& xact)
{
bool xact_in_budget = false;
- foreach (pending_xacts_list::value_type& pair, pending_xacts)
+ foreach (pending_xacts_list::value_type& pair, pending_xacts) {
for (account_t * acct = xact.reported_account();
acct;
acct = acct->parent) {
@@ -735,6 +733,7 @@ void budget_xacts::operator()(xact_t& xact)
goto handle;
}
}
+ }
handle:
if (xact_in_budget && flags & BUDGET_BUDGETED) {
@@ -763,7 +762,7 @@ void forecast_xacts::add_xact(const interval_t& period, xact_t& xact)
void forecast_xacts::flush()
{
xacts_list passed;
- date_t last;
+ date_t last;
while (pending_xacts.size() > 0) {
pending_xacts_list::iterator least = pending_xacts.begin();
diff --git a/src/filters.h b/src/filters.h
index 985fbf94..6089ef75 100644
--- a/src/filters.h
+++ b/src/filters.h
@@ -741,7 +741,7 @@ class generate_xacts : public item_handler<xact_t>
protected:
typedef std::pair<interval_t, xact_t *> pending_xacts_pair;
- typedef std::list<pending_xacts_pair> pending_xacts_list;
+ typedef std::list<pending_xacts_pair> pending_xacts_list;
pending_xacts_list pending_xacts;
std::list<entry_t> entry_temps;
@@ -815,8 +815,7 @@ class forecast_xacts : public generate_xacts
TRACE_DTOR(forecast_xacts);
}
- virtual void add_xact(const interval_t& period,
- xact_t& xact);
+ virtual void add_xact(const interval_t& period, xact_t& xact);
virtual void flush();
};
diff --git a/src/report.cc b/src/report.cc
index 877e6bbb..ce63101b 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -371,7 +371,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
break;
case 'f':
OPT(flat);
- else OPT(forecast_);
+ else OPT_ALT(forecast_while_, forecast_);
else OPT(format_);
else OPT_ALT(head_, first_);
break;
diff --git a/src/report.h b/src/report.h
index 991d60ba..53bddaae 100644
--- a/src/report.h
+++ b/src/report.h
@@ -372,7 +372,7 @@ public:
OPTION(report_t, equity);
OPTION(report_t, flat);
- OPTION(report_t, forecast_);
+ OPTION(report_t, forecast_while_);
OPTION(report_t, format_); // -F
OPTION(report_t, gain); // -G
OPTION(report_t, head_);