Commit graph

222 commits

Author SHA1 Message Date
John Wiegley
d7b8095c3d Tags were not being set properly on postings 2010-03-17 02:18:46 -04:00
John Wiegley
7e719c42dc Extended regexp syntax for "payee" and "capture" 2010-03-10 03:56:34 -05:00
John Wiegley
75b7294a6d Rewrite the "print" command as a custom function
There ended up being too many corner cases for the generalized formatter
to handle.
2010-03-08 01:11:48 -05:00
John Wiegley
3318722089 Added new "payee" and "capture" directives
The payee directive allows for transformation of payee names during the
parsing of a Ledger file.  This means you can record the payee name in
one form, but always have it reported in another form.  The syntax is
(and will be):

payee PAYEE_NAME  REGEXP

or

payee PAYEE_NAME
  REGEXP1
  REGEXP2
  ...

The account directive sets the account automatically based on the payee
iff the base account name is Unknown.  For example, if you have a bunch
of transaction in Expenses:Unknown, you can assign accounts for several
automatically using:

account ACCOUNT_NAME  PAYEE_REGEXP

or

account ACCOUNT_NAME
  PAYEE_REGEXP1
  PAYEE_REGEXP2
  ...
2010-03-05 22:14:14 -05:00
John Wiegley
ab416f759f Updated copyrights to 2003-2010 2010-03-05 22:14:10 -05:00
John Wiegley
69da18cd30 Some minor refactoring of the textual parser 2010-02-05 00:00:40 -05:00
John Wiegley
b78e22d52b Added a "seq" sequence property for all items
This indicates the absolute parsing order of every transaction and
posting.  It is 0 for generated items.
2010-02-04 18:23:52 -05:00
John Wiegley
f1a2a5a18d Cost of a post with neg. amount should be negative 2009-12-07 21:23:50 -05:00
John Wiegley
6d0ab845ea Allow relative includes in the current directory 2009-12-07 20:43:17 -05:00
John Wiegley
2c90c10db1 Added support for a "fixed" directive
It lets you specify a fixed cost for a duration of a ledger file, for
example:

  fixed ecu $2

  2008/01/01 income
      assets🏦checking  1 ecu
      income:salary

  end fixed

This is equivalent to:

  2008/01/01 income
      assets🏦checking  1 ecu {=$2}
      income:salary
2009-11-25 04:39:59 -05:00
John Wiegley
4141afbfae * and | now comment chars, for the sake of Org-mode 2009-11-25 02:36:32 -05:00
John Wiegley
4e30fcdf40 Many improvements to Ledger's Python bindings 2009-11-19 22:24:24 -05:00
John Wiegley
21a9fe108e Made the account and tag directives more rational
Now you must specify "account / end account", and "tag / end tag".  For
backwards compatability, plain "end" is the same as "end account".
2009-11-15 05:49:54 -05:00
John Wiegley
c22b8457ef Did away with the "finalizer" abstraction
This was from an earlier time, when it was intended to be used by
Python.  But it's not needed anymore.
2009-11-11 18:29:21 -05:00
John Wiegley
e8ea2d4938 Automated postings defer amount expression calculation
This allows for value expressions to be used which reference the
incoming posting, for example:

  = Income:Clients:
    (Liabilities:Taxes:VAT1)  (floor(amount) * 1)
    (Liabilities:Taxes:VAT2)  0.19

  2009/07/27 * Invoice
    Assets:Bank:Checking                           $1,190.45
    Income:Clients:ACME_Inc

The automated posting for VAT1 will use the floored amount multiplied by
a factor, while the posting for VAT2 multiples the whole amount as
before.
2009-11-11 04:22:37 -05:00
John Wiegley
ed9209cc27 Timeclock events now record their file position 2009-11-11 02:01:34 -05:00
John Wiegley
eb772893b0 Timeclock entries can now have notes
Example of a tagged entry:

i 2009/11/01 12:00:00 Account  Payee  ; :Foo:
o 2009/11/01 13:00:00

Two spaces or a tab must separate account from payee, and payee from
note.
2009-11-11 01:17:29 -05:00
John Wiegley
0ac2dc2810 Fixed an erroneous use of operator>> in textual.cc 2009-11-10 18:43:53 -05:00
John Wiegley
39532bdf35 Automated transactions now use report query syntax
This returns their behavior back very close to what 2.x accepts.
2009-11-10 02:44:16 -05:00
John Wiegley
329a0dfcc5 Corrected the parsing of data file directives 2009-11-10 02:26:34 -05:00
John Wiegley
3e39329eff Added "bucket" directive, as alt for A 2009-11-10 01:28:57 -05:00
John Wiegley
16a2a16097 Support include-ing of relative pathnames 2009-11-10 01:06:04 -05:00
John Wiegley
009b257397 It's now an error to use "end" without "account" 2009-11-10 01:05:44 -05:00
John Wiegley
09c9ec4b41 Directives no longer require @ or ! prefix char 2009-11-10 01:05:12 -05:00
John Wiegley
c927c74c2d Throw an exception if an include file doesn't exist 2009-11-10 00:30:09 -05:00
John Wiegley
c3535d06c8 Redesigned the expr_t, predicate_t, query_t classes 2009-11-09 02:06:06 -05:00
John Wiegley
1a43b22791 Throw an error for unrecognized options in data files 2009-11-07 06:40:09 -05:00
John Wiegley
06f4c27867 Renamed journal_t::basket to bucket 2009-11-07 06:39:50 -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
c5c2027624 Fix to xact_t::valid() 2009-11-01 04:25:23 -05:00
John Wiegley
ead642c7fa Commented out dependency on session_t (for now) 2009-10-31 17:54:40 -04:00
John Wiegley
3909d2678e Removed most #if 0 blocks and callout comments 2009-10-31 04:50:07 -04:00
John Wiegley
cb6f7cd54e Add a position_t object for tracking item positions
It is also optional, which is useful for generated items.
2009-10-30 17:54:54 -04:00
John Wiegley
55f5868380 Setting --date-format in ~/.ledgerrc works again 2009-10-29 00:52:51 -04:00
John Wiegley
aa45d2d38c Further improvements to handling temporaries 2009-10-28 01:18:27 -04:00
John Wiegley
07cca71893 Renamed two methods, for consistency's sake 2009-10-27 21:33:33 -04:00
John Wiegley
0fdb900c99 Redid the way temporaries are handled in filtering 2009-10-27 08:30:39 -04:00
John Wiegley
3fdd75fb5b Balance assertions now really assert
There are two kinds of balance related options for a posting: a balance
assignment, where the amount of the posting is blank and so it fills it
in to make the assertion true; and plain assertions, where the amount is
not blank and an error is reported if the balance does not match the
given amount after the posting is taken into account.
2009-10-26 19:08:15 -04:00
John Wiegley
8999607408 If a pricing entry fails to parse, give an error 2009-10-26 17:17:12 -04:00
John Wiegley
f161aea8ce Removed reliance on strptime/strftime
The code now uses Boost's input and output facets for times and dates.
This ensures completely consistency regarding timezones and times, and
fixes the regression test that was broken while I was away coding in
London (where it was GMT-0 and I didn't notice the difference between
local and GMT).
2009-10-11 05:19:01 -04:00
John Wiegley
991e3a3eaf Split commodity.h/cc into three files
commodity.h - code for commodity_t
annotate.h  - commodity annotations
pool.h      - commodity pool management
2009-06-24 16:43:46 +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
4253c2a35d Allow uncommoditized amounts to be used as costs 2009-06-18 16:10:08 +01:00
John Wiegley
94467e5b7f Fixed a problem with accounts and trailing spaces
This issue is caused by having a single space at the end of a posting
that has neither an amount nor a note.

Fixes C523E23F-CFAC-4A53-B0C6-21226640E763
2009-06-16 17:05:28 +01:00
John Wiegley
8747c724f1 Strip annotations before handling bal assignments 2009-06-13 18:04:29 +01:00
John Wiegley
c79fd9e72d Added new debug option --options
This reports which options are in place before invoking a command, and
where exactly each option value came from.
2009-06-02 19:14:46 +01:00
John Wiegley
f1523b5464 The new code is working now. 2009-03-16 03:44:27 -04:00
John Wiegley
110f0b8023 Enabled use of pre-compiled headers by default 2009-03-10 17:02:03 -04:00
John Wiegley
2728e4d55e Changed the way that account balances are computed 2009-03-06 00:27:29 -04:00
John Wiegley
c11d325712 Reduced the #include dependency tree to a minimum 2009-03-04 23:53:43 -04:00