Commit graph

106 commits

Author SHA1 Message Date
John Wiegley
9f53efbf5f Many fixes to both --market and --exchange 2009-02-23 01:51:23 -04:00
John Wiegley
de6de07bac Many fixes to --market and --exchange
Also, --exchange now accepted multiple, comma-separated commodities.
2009-02-22 22:23:02 -04:00
John Wiegley
ea75613760 --exchange option now accepts multiple commodities
They must be separated by a comma, and all whitespace is ignored.
2009-02-22 17:51:11 -04:00
John Wiegley
e124811d8a Added --exchange (-x) option
This is like -V, except it lets you specify the goal commodity to report
in terms of, for example:

    reg -x CAD
2009-02-22 04:51:11 -04:00
John Wiegley
04fd1ae24c Fixed the way values are justified for printing 2009-02-22 04:51:11 -04:00
John Wiegley
3e543d187c Changed --colors to --color, to match Git 2009-02-22 04:51:11 -04:00
John Wiegley
cebc1da256 Restored the --invert option 2009-02-22 04:51:08 -04:00
John Wiegley
348aae7478 Removed unused --totals option
This option was for outputting <total> elements in 2.x's XML output.
2009-02-22 01:29:34 -04:00
John Wiegley
eb4aa87843 Added a new --colors option, for terminal fun
The following colors are applied in the balance and register reports:

    GREEN   To a date, if it occurs in the future
    BOLD    If a payee name relates to an uncleared entry
    BLUE    For account names
    RED     For negative values
2009-02-21 22:04:01 -04:00
John Wiegley
dc63429785 Removed an unused class: format_entries 2009-02-21 19:22:55 -04:00
John Wiegley
6b9c83b156 Use more general scrub valexpr function in formats 2009-02-21 19:05:30 -04:00
John Wiegley
1f39d4148e Create a new interactive_t helper class
The purpose of this class is much like Emacs' (interactive) form: it
allows a value expression function to declare exactly how many
arguments, and of what type, it intends to receive.  It then offers
type-safe access to theese arguments in a consistent manner.

An example value expression function definition in C++:

    value_t fn_foo(call_scope_t& scope) {
      // We expect a string, an integer, and an optional date
      interactive_t args(scope, "sl&d");

      std::cout << "String  = " << args.get<string>(0)
                << "Integer = " << args.get<long>(1) << std::endl;

      if (args.has(2)) // was a date provided?
        std::cout << "Date    = " << args.get<date_t>(2) << std::endl;

      return NULL_VALUE;
    }

There is also an in_context_t<T> template, which finds the context type
T in the current scope hierarchy.  The in_context_t then also acts as a
smart pointer to reference this context object, in addition to serving
the same duty as interactive_t.  This combination of intent is solely
for the sake of brevity.

    value_t fn_bar(call_scope_t& scope) {
      in_context_t<account_t> env(scope, "sl&d");
      std::cout << "Account name = " << env->fullname()
                << "String arg   = " << env.get<string>(0)
                << std::endl;
      return NULL_VALUE;
    }

As you can see here, 'env' acts as a smart pointer to the required
context, and an object to extract the typed arguments.
2009-02-21 18:49:43 -04:00
John Wiegley
f4e13f3458 Added --start-of-week option, used with --weekly
For example, --start-of-week=monday can be used to report weeks that
begin on Mondays.
2009-02-21 02:20:08 -04:00
John Wiegley
d0ac3a2e4e Added a new --exact option
The purpose of this option is that usually when you do a --monthly
periodic report, you see dates ranges from the first day of each month,
to the last day.  With --exact, the first day of each range will be the
date of the first transaction found in that range, and likewise with the
end of the range.  Essentially it "contracts" the reported period dates
to reflect the exact begin and end dates.
2009-02-21 02:14:53 -04:00
John Wiegley
4ff8087815 Restored the --deviation option 2009-02-21 00:48:12 -04:00
John Wiegley
23725ffafb Restored --forecast, now also --forecast-while 2009-02-21 00:12:22 -04:00
John Wiegley
96782df17c Enabled --current option 2009-02-20 19:10:34 -04:00
John Wiegley
9d9f526816 Strip amounts displayed in the csv report 2009-02-20 18:35:20 -04:00
John Wiegley
01d8d28024 Removed unused --cache option 2009-02-20 16:32:44 -04:00
John Wiegley
95a3788fa7 Restored the --basis option 2009-02-20 15:41:49 -04:00
John Wiegley
31feaad105 Added --no-total option
This simply omits the final total in the balance report, nothing more.
2009-02-20 15:41:49 -04:00
John Wiegley
e05f29bff0 Don't use auto-widths for widths explicitly given 2009-02-20 15:41:48 -04:00
John Wiegley
c1b25fcf86 Rewrote the equity command, which is working again
The old implementation used an account formatter, and was very
specialized.  The new is done as a transaction filter, and works along
with everything else, eliminating bugs special to the equity report.
2009-02-20 02:53:54 -04:00
John Wiegley
8af4451472 Use the 'market' function, not 'market_value' 2009-02-19 15:05:53 -04:00
John Wiegley
5b897a12fc Added a new --columns= option 2009-02-19 14:42:18 -04:00
John Wiegley
39bdbbe053 The sequence -M -p 2004 now equals -p 2004 -M 2009-02-19 14:26:08 -04:00
John Wiegley
1f1a83c083 Restored the -j and -J options 2009-02-19 13:40:48 -04:00
John Wiegley
b684783eff Moved init of options to the options themselves 2009-02-19 13:29:15 -04:00
John Wiegley
a8e73064cf Improved how register reports are formatted
As a result, --wide is working again, and --wide-register-format has
been removed.  Also, the following new options are recognized, for
controlling per-column formatting:

    --date-width NUM
    --payee-width NUM
    --account-width NUM
    --amount-width NUM
    --total-width NUM
2009-02-19 01:36:21 -04:00
John Wiegley
4ec2dfeef1 Added --flat option, to flatten the balance report 2009-02-17 21:19:31 -04:00
John Wiegley
67fd38e073 The option --cost is now an alias for --basis 2009-02-17 06:51:40 -04:00
John Wiegley
72cdb41727 Added new --set-acount and --set-payee options
These fully generalize the previous --payee-as-account and such options,
which, for example, is now implemented to be the same as saying,
"--set-account payee".
2009-02-16 20:50:20 -04:00
John Wiegley
15bfeb3cb1 Added several new reporting options
To help with gathering specific reports:

 - --payee-as-account copies the entry's payee field to the account,
   allowing the subtotal report to show unique payees for each period.
 - --comm-as-account copies the transaction's amount's commodity to the
   account.
 - --code-as-account copies the entry's code to the account

Also created aliases for some of these options, for conistency's sake:

 - --commodity-as-payee is now an alias for --comm-as-payee
 - --commodity-as-account is now an alias for --comm-as-account
2009-02-16 18:11:23 -04:00
John Wiegley
d0a664d102 Fixed several unused value and param warnings 2009-02-16 16:55:18 -04:00
John Wiegley
4365d9e3fc Moved around some functions for clarity 2009-02-16 04:10:22 -04:00
John Wiegley
b5a972d1a0 The -n option for bal command is working again
The fix was that when appending new predicates, enclosed both sides of
the AND with parentheses.
2009-02-16 02:51:09 -04:00
John Wiegley
8c2a70e197 Made several of the filters more context aware
This resolves certain issues where value expressions were not being
looked up within their full context.
2009-02-15 23:00:16 -04:00
John Wiegley
780ce4a5d0 Normalized handling of several report options 2009-02-15 21:14:54 -04:00
John Wiegley
484b498c14 Re-enabled the --format (-F) option 2009-02-15 21:08:36 -04:00
John Wiegley
e861c312ac The "xact" variable now returns null for accounts 2009-02-15 21:05:59 -04:00
John Wiegley
2ec9b6a7b2 Split up session_t::reread_journal_files()
You now call session_t::close_journal_files() followed by
session_t::read_journal_files().
2009-02-15 19:32:15 -04:00
John Wiegley
3c7388918b Change a few calls to on() to use set_expr() 2009-02-15 17:07:43 -04:00
John Wiegley
6f7f87699c Parse '/' in an operator context as "div" 2009-02-15 16:34:34 -04:00
John Wiegley
48d985aacc Restored the --average (-A) report option 2009-02-15 15:50:15 -04:00
John Wiegley
3ef07ae39f Added a helper method for setting expr options
Now one does:

    parent->HANDLER(display_total_).set_expr("total");

Rather than what was required previously:

    parent->HANDLER(display_total_).on("total");
    parent->HANDLER(display_total_).expr = "total";
2009-02-15 15:46:03 -04:00
John Wiegley
6b515c0cb3 Added #if 0'd stub code from 2.x's option.cc 2009-02-14 04:55:44 -04:00
John Wiegley
1933bb2ead Restored the --actual and --real options 2009-02-14 04:46:53 -04:00
John Wiegley
7fb55eedef Re-enabled periodic reporting options (-M, etc) 2009-02-14 04:31:15 -04:00
John Wiegley
f15ae10a52 Enabled --cleared, --uncleared and --pending
Note that the --uncleared flag includes --pending, since it specifically
means "not yet cleared".
2009-02-13 20:03:58 -04:00
John Wiegley
2522f15437 Re-activated the budgeting flags
However, the budget reports themselves still need to be tested.
2009-02-13 06:13:19 -04:00