Commit graph

198 commits

Author SHA1 Message Date
John Wiegley
a461e17eee Added historical support for single-letter valexprs 2009-11-14 03:11:48 -05:00
John Wiegley
9858b4957f Reorganized a bit of the reporting code 2009-11-12 05:11:09 -05:00
John Wiegley
b5dca67396 Moved report normalization into report.cc 2009-11-12 03:31:53 -05:00
John Wiegley
013965d0ce Removed unused code 2009-11-12 01:43:59 -05:00
John Wiegley
c182b7051b Renamed the pricesdb command to pricedb 2009-11-12 01:43:57 -05:00
John Wiegley
95cc364961 Added new value expressions for value conversion
They are:

  to_boolean
  to_int
  to_datetime
  to_date
  to_amount
  to_balance
  to_string
  to_mask
  to_sequence
2009-11-11 21:33:53 -05:00
John Wiegley
67c9cf134d Added --date, similar to --account and --payee
This lets you do things like store a date as the value of a tag, then
run:

  ledger --date='has_tag("Foo") ? to_date(tag("Foo")) : date' reg
2009-11-11 21:32:32 -05:00
John Wiegley
dae24c259b Added floor() value expression function 2009-11-11 04:22:41 -05:00
John Wiegley
a4b1e7c5ab Added a --prepend-format option
This lets you, for example, debug registers that cull data from many
different sources, without having to change the basic formatting
string.  You can locate each posting's location with this:

  ledger reg --prepend-format='%-25(filename + ":" + beg_line)'
2009-11-11 02:01:24 -05:00
John Wiegley
7cd37b1d50 Moving the #include of unistring.h into format.h 2009-11-10 18:43:38 -05:00
John Wiegley
91e8378f04 Fixes to Python importing; removed "hello" precommand 2009-11-10 14:16:40 -05:00
John Wiegley
a5f0b6e5dc account_amount() is now account().amount 2009-11-10 01:28:57 -05:00
John Wiegley
6cdb79e2a6 XML reporting now works via the "xml" command 2009-11-09 03:42:35 -05:00
John Wiegley
2c80227339 Added basic foundation for XML reporting 2009-11-09 02:17:26 -05:00
John Wiegley
7411c74d6d Redesigned the draft_t class 2009-11-09 02:06:08 -05:00
John Wiegley
c3535d06c8 Redesigned the expr_t, predicate_t, query_t classes 2009-11-09 02:06:06 -05:00
John Wiegley
c8641a6de6 Added support for Boost.Regex w/ ICU
This allows for correct searching of UTF-8 encoded strings, such as
lower-case versions of Russian words to find mixed-case words.
2009-11-07 08:34:13 -05:00
John Wiegley
a05d39b722 Renamed --set-reported-account to just --account
This fits better with the --amount and --total options, which both
change the amount and total used for calculation.  Same with --account:
it happens after filtering, but before calculation so that balance
reports look as you'd expect.
2009-11-06 02:39:30 -05:00
John Wiegley
deb674586c Added new account_total value expression
This is used for accessing an account's current total within one's
Ledger file.
2009-11-05 05:11:39 -05:00
John Wiegley
3dc200983d Moved xdata clearing code into each type proper 2009-11-05 02:27:39 -05:00
John Wiegley
78e6770c4c Segregated symbols into 5 separate namespaces
The different namespaces are:

  Function      Value expression functions, which receive a "context"
  Option        Command-line options
  Precommand    Commands which are invoked before reading the journal
  Command       Commands which are invoked after reading the journal
  Directive     Directives that occur at column 0 in a data file

This greatly eases the ability for Python uses to add intercept hooks to
change how the basic Ledger module functions.  An example of what should
be possible soon:

  import ledger

  def my_foo_handler(value):
      print "--foo received:", value

  ledger.add_handler(ledger.Option, "foo=", my_foo_handler)
2009-11-04 20:40:48 -05:00
John Wiegley
a77d9fc261 Added error message if a predicate query is invalid 2009-11-03 15:34:08 -05:00
John Wiegley
449c7ca790 New: --set-reported-account, --set-reported-payee 2009-11-01 21:15:11 -05:00
John Wiegley
3909d2678e Removed most #if 0 blocks and callout comments 2009-10-31 04:50:07 -04:00
John Wiegley
4427016b1b Improved arg checking for several valexpr functions 2009-10-31 04:07:33 -04:00
John Wiegley
77c9d7b1ff Add valexpr functions for lot dates, prices and tags 2009-10-31 03:22:38 -04:00
John Wiegley
b0f12c600c Added a --forecast-years option
This sets how many years of forecasting Ledger will do before it
terminates the attempt.
2009-10-31 03:07:15 -04:00
John Wiegley
63aa8992a8 Moved ownership of master account into journal_t
The journal_t now completely represents the data part of a session.
2009-10-30 19:03:28 -04:00
John Wiegley
55f5868380 Setting --date-format in ~/.ledgerrc works again 2009-10-29 00:52:51 -04:00
John Wiegley
52433e56e5 Fixed "show" keywords, and added // syntax 2009-10-28 23:44:57 -04:00
John Wiegley
218a333e83 Fixes to the new query expression parser 2009-10-28 23:07:03 -04:00
John Wiegley
47df7dd60e Rewrote the report query parser
It is now a full parser that parses report queries directly into value
expression trees.  These then get rendered into text so that other
options may extend the expression.
2009-10-28 18:40:31 -04:00
John Wiegley
0a6f1a6328 -D now means --daily, not --deviation
Because --daily is more commonly desired, and fits the pattern of the
other periodic switches:

  -D  --daily
  -W  --weekly
  -M  --monthly
  -Y  --yearly

Only --quarterly doesn't have its own short option.
2009-10-28 01:19:16 -04:00
John Wiegley
559566751d Sort by default unless --unsorted is selected 2009-10-28 01:17:10 -04:00
John Wiegley
432be9e989 Removed unnused parameter to value_t::print 2009-10-27 22:25:13 -04:00
John Wiegley
828a1e8bf9 Added --actual-dates, for overriding --effective
This is so that if someone has --effective in their .ledgerrc, they can
force the use of actual dates.
2009-10-27 21:34:08 -04:00
John Wiegley
ab433d28e0 Support a --now option, for testing purposes
This sets Ledger's notion of the "current time" to the given date.  This
makes it possible to have stable output from budgeting and forecasting
reports, for the sake of baseline tests.
2009-10-27 21:32:55 -04:00
John Wiegley
fd23b56a21 Added a new "cleared" report
This is a balance report with three columns:

  Current balance | Cleared balance | Last cleared date
2009-10-27 08:30:59 -04:00
John Wiegley
88460db2fb Added a new "budget" report
This is a balance report with four columns:

  Amount spent |  Budgeted Amount | Difference | Percentage
2009-10-27 08:30:59 -04:00
John Wiegley
f20b6a3b9e Fixed a data lifetime bug
This was causing budget totals not to appear in balance reports.

Fixes 8254755E-7B61-47C8-B48E-A2A7FD79EB80
2009-10-27 05:23:24 -04:00
John Wiegley
4f11ded5bc Added t and T as valexpr synonyms
t = display_amount, T = display_total
2009-10-26 18:52:43 -04:00
John Wiegley
151a8d87ee Fixed sorting in bal reports when --flat is used
Note that sorting on the "total" is not the same thing as sorting on the
"display_total" when multiple commodities are in use and the -X flag is
selected!  One should always sort on display_total, since that's the
value which is shown in the report.  'T' is a synonym for display_total.
2009-10-26 18:52:26 -04:00
John Wiegley
1ed22646f1 Added an "echo" command, for REPL testing 2009-10-26 17:17:23 -04:00
John Wiegley
fc84eeb358 Rewrote the way date and time I/O is managed 2009-10-25 05:01:47 -04:00
John Wiegley
588f2ef2f5 Fixed many compiler warnings from g++ 4.4 2009-10-25 05:01:39 -04:00
John Wiegley
2ef1934bb0 Restored --price option, added baseline test
This option reports only in terms of the annotated price of the
commodities involved, otherwise it reports the amounts themselves.  It
can be used in conjunction with other reports, as it applies to the
displayed amounts, not the actual amounts being calculated.
2009-06-26 17:15:35 +01:00
John Wiegley
4574c30fcf The --download option is now fully restored 2009-06-26 16:52:41 +01:00
John Wiegley
1fad2ec7c1 More refactoring for --download 2009-06-24 18:08:56 +01:00
John Wiegley
440124eacc Restored --download, although not done yet
The problem at this point is that it's recording prices in the price
database multiple times; it should only need to download a price for
each commodity once per day.
2009-06-24 02:44:07 +01:00
John Wiegley
407d057f4d Added a --no-color option, to disable --color 2009-06-22 00:27:00 +01:00