From 6df3ea10f747bf76e233f582c8a3aa06ae3afd56 Mon Sep 17 00:00:00 2001 From: Aristid Breitkreuz Date: Tue, 24 Nov 2009 11:02:17 +0100 Subject: Added options: --unrealized-gains and --unrealized-losses These options allow the user to specify what accounts names should be used for these two types of accounts. They are optional, and default to: --unrealized-gains "Equity:Unrealized Gains" --unrealized-losses "Equity:Unrealized Losses" These are intended to be set in one's ~/.ledgerrc file. --- src/filters.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/filters.cc') diff --git a/src/filters.cc b/src/filters.cc index 39097c58..0084fac7 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -430,12 +430,22 @@ changed_value_posts::changed_value_posts(post_handler_ptr handler, display_total_expr = report.HANDLER(display_total_).expr; changed_values_only = report.HANDLED(revalued_only); + string gains_equity_account_name; + if (report.HANDLED(unrealized_gains_)) + gains_equity_account_name = report.HANDLER(unrealized_gains_).str(); + else + gains_equity_account_name = _("Equity:Unrealized Gains"); gains_equity_account = - report.session.journal->master->find_account(_("Equity:Unrealized Gains")); + report.session.journal->master->find_account(gains_equity_account_name); gains_equity_account->add_flags(ACCOUNT_GENERATED); + string losses_equity_account_name; + if (report.HANDLED(unrealized_losses_)) + losses_equity_account_name = report.HANDLER(unrealized_losses_).str(); + else + losses_equity_account_name = _("Equity:Unrealized Losses"); losses_equity_account = - report.session.journal->master->find_account(_("Equity:Unrealized Losses")); + report.session.journal->master->find_account(losses_equity_account_name); losses_equity_account->add_flags(ACCOUNT_GENERATED); } -- cgit v1.2.3