diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-19 02:00:10 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-19 02:00:10 -0500 |
commit | 63fee4c83775f79364199ea547dbc7e068b0abc8 (patch) | |
tree | 4230ae03ebea8e2cbc0b6e1de821730e4819af47 /src/chain.cc | |
parent | 3f1861fb1e9e374fb7756117638edcb6fb1e73fb (diff) | |
download | fork-ledger-63fee4c83775f79364199ea547dbc7e068b0abc8.tar.gz fork-ledger-63fee4c83775f79364199ea547dbc7e068b0abc8.tar.bz2 fork-ledger-63fee4c83775f79364199ea547dbc7e068b0abc8.zip |
Added an --unrealized option, for use with bal -V
When this option is on, then in balance report which show market values,
any gains or losses in value will be balanced into a pair of accounts
called Equity:Unrealized Gains and Equity:Unrealized Losses.
Diffstat (limited to 'src/chain.cc')
-rw-r--r-- | src/chain.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/chain.cc b/src/chain.cc index 9ab26bd6..113a71d8 100644 --- a/src/chain.cc +++ b/src/chain.cc @@ -77,18 +77,23 @@ post_handler_ptr chain_post_handlers(report_t& report, report.what_to_keep()); handler.reset(new filter_posts(handler, display_predicate, report)); } - - // changed_value_posts adds virtual posts 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_posts(handler, report)); } + // changed_value_posts adds virtual posts to the list to account for changes + // in market value of commodities, which otherwise would affect the running + // total unpredictably. + if (report.HANDLED(revalued) && (! for_accounts_report || + report.HANDLED(unrealized))) + handler.reset(new changed_value_posts(handler, report, + for_accounts_report, + report.HANDLED(unrealized))); + // calc_posts computes the running total. When this appears will determine, // for example, whether filtered posts are included or excluded from the // running total. - handler.reset(new calc_posts(handler, expr, ! for_accounts_report)); + handler.reset(new calc_posts(handler, expr, (! for_accounts_report || + (report.HANDLED(revalued) && + report.HANDLED(unrealized))))); // filter_posts will only pass through posts matching the // `secondary_predicate'. |