Commit graph

76 commits

Author SHA1 Message Date
John Wiegley
97693b43b5 Resolve account.date to latest post in the account 2012-08-09 16:56:53 -05:00
John Wiegley
4681e58d7f Converted the Ledger build system to use CMake 2012-05-20 04:48:05 -05:00
John Wiegley
a38ed141c1 Switched to Boost.PropertyTree for XML generation 2012-05-18 01:31:01 -06:00
John Wiegley
c0fa144ca5 Added "last_checkout_cleared" valexpr variable 2012-05-07 01:53:53 -05:00
John Wiegley
2932e05c18 Account valexprs: earliest_checkin, latest_checkout
Lets you access the earliest/latest checkin/checkout times for timelog
entries in an account.  Will be NULL if the account doesn't contain any.
2012-03-13 03:42:11 -05:00
John Wiegley
7bb83173da Added some missing DEBUG #if's 2012-03-07 08:34:15 -06:00
John Wiegley
71d0033b6f Corrected several compile and link problems 2012-03-06 23:04:27 -06:00
John Wiegley
f9de33d21c Removed an invalid assertion 2012-03-05 17:46:55 -06:00
John Wiegley
e2afc783db Increased file copyrights to 2012 2012-02-29 22:32:23 -06:00
John Wiegley
4dd536c670 Add "note" valexpr function to accounts 2012-02-27 03:55:36 -06:00
John Wiegley
a3c9cc02d7 Fixes for variable shadowing (2/28) 2012-02-17 15:05:56 -06:00
John Wiegley
76f979901e Fixes for variable shadowing (1/28) 2012-02-17 15:05:45 -06:00
John Wiegley
f0791bbd72 Cleanup whitespace 2011-08-18 14:48:38 -04:00
John Wiegley
31e8ed7587 Individual postings may each have their own payee
If a posting has the metadata field "Payee" set to a string, that will
be used as the payee name for that posting.  This affects the register
report, the payees report, and the --by-payee option.

This is useful because sometimes I send, say, 4 checks at a time to my
bank.  So on my bank statement, this is all just one amount:

   2010-06-17 Sample
     Assets:Bank        $400.00
     Income:Check1     $-100.00
     Income:Check2     $-100.00
     Income:Check3     $-100.00
     Income:Check4     $-100.00

Though it's important that the Assets:Bank posting be a single posting
of $400 value, I'd like for income reports to show whom each check came
from.  Now I can say:

   2010-06-17 Sample
     Assets:Bank        $400.00
     Income:Check1     $-100.00  ; Payee: Person One
     Income:Check2     $-100.00  ; Payee: Person Two
     Income:Check3     $-100.00  ; Payee: Person Three
     Income:Check4     $-100.00  ; Payee: Person Four

When I report this, it appears as:

10-Jun-17 Sample             Assets:Bank             $400.00     $400.00
          Person One         Income:Check1          $-100.00     $300.00
          Person Two         Income:Check2          $-100.00     $200.00
          Person Three       Income:Check3          $-100.00     $100.00
          Person Four        Income:Check4          $-100.00           0

This shows that they are all in the same transaction (which is why the
date is not repeated), but they have different payees.
2010-06-17 23:42:23 -04:00
John Wiegley
2ea075dc4f Report error context in expressions more precisely 2010-06-13 18:39:26 -04:00
John Wiegley
ea1642b3f9 Completely reworked argument passing in expressions 2010-06-13 05:02:14 -04:00
John Wiegley
1bc5b894df Expression evaluations now have a "type context"
Thus, an expression can know if the context in which it's being
evaluated requires a string, and if so, determine it's output
accordingly.  For example:

  account       ; returns the full name of the posting's account
  account.total ; here the context is SCOPE, so account is an obj
2010-06-13 01:03:48 -04:00
John Wiegley
536e3e7322 Added a new scope_value() inline helper function 2010-06-13 01:03:48 -04:00
John Wiegley
5ec85538d9 account_t::add_post resets family_details.gathered 2010-06-13 01:03:48 -04:00
John Wiegley
15bf3ed39e account(NAME) function can lookup account objects
For example, just the word "account" returns the name of the current
posting's account, but account("Expenses:Food") returns the actual
account object, so that it's total may be accessed.
2010-06-13 01:03:47 -04:00
John Wiegley
dea2aed0b5 Untabified all source files 2010-06-11 17:02:25 -04:00
John Wiegley
41e4aea759 Made lookup of an account's "cost" a calc error 2010-06-06 06:03:56 -04:00
John Wiegley
3a0f096cb6 Added new "addr" value expression function
It returns the address of the given object as an integer.  This can be
used to uniquely compare entities.
2010-06-03 05:37:21 -04:00
John Wiegley
e0c5f6db30 Fixed two memory reference errors 2010-06-02 00:27:35 -04:00
John Wiegley
57abfd7ef8 Temporary accounts were referenced after deletion
Fixes D53C98E5-506D-4CE5-91A3-7666FD33B65B
2010-05-22 21:33:47 -04:00
John Wiegley
4ec54b86f8 Added any() and all() value expression macros
any() matches an expression against every post in a transaction or
account, and returns true if any of them are true.  all() tests if all
are true.  For example:

  ledger -l 'account =~ /Expense/ & any(account =~ /MasterCard/)' reg

This reports every posting affecting an Expense account (regex match),
but only if some other posting in the same transaction affects the
MasterCard account.

Both functions also take a second boolean argument.  If it is false, the
"source" posting is not considered.  For example:

  ledger -l 'any(/x/, false)'

This matches any posting where a *different* posting in the same
transaction contains the letter 'x'.
2010-05-08 02:06:06 -04:00
John Wiegley
ab416f759f Updated copyrights to 2003-2010 2010-03-05 22:14:10 -05:00
John Wiegley
0be486c58b Fixed assertion failure in -M -A bal report 2010-01-21 04:59:45 -05:00
John Wiegley
a461e17eee Added historical support for single-letter valexprs 2009-11-14 03:11:48 -05:00
John Wiegley
48dc654eda Added has_xdata() methods for journal_t and xact_t 2009-11-12 05:11:06 -05:00
John Wiegley
115da19121 account.amount and .total return simplified values 2009-11-10 01:28:53 -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
3a0879aff0 Added "reported posts" into account xdata
This is necessary because sometimes, a post from one account will get
reported as though it were in another account (this happens with
--budget, to show child account postings within their parent account).
In that case, the account needs to remember which postings have been
reported as being within it, so that it can add these amounts to its own
total in the balance report.
2009-11-02 01:40:07 -05:00
John Wiegley
6b6ca6d4c7 Improved the way account temporaries are managed 2009-11-01 21:14:05 -05:00
John Wiegley
48f024a42a Increased size of buffer used to split account names 2009-11-01 21:12:57 -05: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
b7233edd8a Added some additional assertion tests re: temps 2009-10-28 01:15:57 -04:00
John Wiegley
07cca71893 Renamed two methods, for consistency's sake 2009-10-27 21:33:33 -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
0fdb900c99 Redid the way temporaries are handled in filtering 2009-10-27 08:30:39 -04:00
John Wiegley
521b935aa8 Restored --percent option, added baseline test 2009-06-21 18:07:27 +01:00
John Wiegley
e97b59b006 Refinement to display of account balances
Fixes 5A03CFC3-1A76-4F93-A1FE-555F98438C5A
2009-06-15 17:52:52 +01:00
John Wiegley
110f0b8023 Enabled use of pre-compiled headers by default 2009-03-10 17:02:03 -04:00
John Wiegley
77faaa926f Rewrote the balance report again, to fix --depth 2009-03-08 04:15:48 -04:00
John Wiegley
f340d50362 Revised the ways statistics are computed
It is no longer done in calc_posts, but recursively on each account.
This allows value expressions to ask statistical questions, like
"earliest cleared posting?" (TBD) from any specific account, computed
lazily.
2009-03-06 04:07:25 -04:00
John Wiegley
2728e4d55e Changed the way that account balances are computed 2009-03-06 00:27:29 -04:00
John Wiegley
1540ccec01 Gather account details in a details_t structure 2009-03-03 20:28:09 -04:00
John Wiegley
eb45a0a4f4 Normalized how account totals are calculated 2009-03-03 17:08:11 -04:00
John Wiegley
d58797e98c The -B, -G, -V reports now show rounding amounts
This way, if the running total is off by a penny or two due to rounding
of one or more commodities in the account, the user will see it.

This commit also reorganizes the testing code a bit, which I did after
adding the ninth test series (ConfirmTests), to validate the new
rounding code.
2009-02-26 03:16:39 -04:00