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.
This commit is contained in:
parent
a84c42fc17
commit
6df3ea10f7
3 changed files with 19 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -887,6 +887,8 @@ option_t<report_t> * report_t::lookup_option(const char * p)
|
|||
OPT(unbudgeted);
|
||||
else OPT(uncleared);
|
||||
else OPT(unrealized);
|
||||
else OPT(unrealized_gains_);
|
||||
else OPT(unrealized_losses_);
|
||||
else OPT(unround);
|
||||
else OPT(unsorted);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -302,6 +302,8 @@ public:
|
|||
HANDLER(unbudgeted).report(out);
|
||||
HANDLER(uncleared).report(out);
|
||||
HANDLER(unrealized).report(out);
|
||||
HANDLER(unrealized_gains_).report(out);
|
||||
HANDLER(unrealized_losses_).report(out);
|
||||
HANDLER(unround).report(out);
|
||||
HANDLER(unsorted).report(out);
|
||||
HANDLER(weekly).report(out);
|
||||
|
|
@ -876,6 +878,9 @@ public:
|
|||
|
||||
OPTION(report_t, unrealized);
|
||||
|
||||
OPTION(report_t, unrealized_gains_);
|
||||
OPTION(report_t, unrealized_losses_);
|
||||
|
||||
OPTION_(report_t, unround, DO() {
|
||||
parent->HANDLER(display_amount_)
|
||||
.set_expr(string("--unround"), "unrounded(amount_expr)");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue