doc: update description/payee/note docs (#598, #608)

This commit is contained in:
Simon Michael 2017-09-05 11:44:02 -07:00
parent 9501b43471
commit 079e76a370
16 changed files with 756 additions and 733 deletions

View File

@ -92,8 +92,8 @@ m4_define({{_inputoptions_}}, {{
`--anon` `--anon`
: anonymize accounts and payees : anonymize accounts and payees
`--pivot TAGNAME` `--pivot FIELDNAME`
: use some other field/tag for account names : use some other field or tag for the account name
`-I --ignore-assertions` `-I --ignore-assertions`
: ignore any failing balance assertions : ignore any failing balance assertions

View File

@ -77,7 +77,10 @@ This can be followed by any of the following, separated by spaces:
parentheses) parentheses)
.IP \[bu] 2 .IP \[bu] 2
(optional) a transaction description (any remaining text until end of (optional) a transaction description (any remaining text until end of
line) line or a semicolon)
.IP \[bu] 2
(optional) a transaction comment (any remaining text following a
semicolon until end of line)
.PP .PP
Then comes zero or more (but usually at least 2) indented lines Then comes zero or more (but usually at least 2) indented lines
representing... representing...
@ -300,6 +303,23 @@ With this scheme, you would use \f[C]\-PC\f[] to see the current balance
at your bank, \f[C]\-U\f[] to see things which will probably hit your at your bank, \f[C]\-U\f[] to see things which will probably hit your
bank soon (like uncashed checks), and no flags to see the most bank soon (like uncashed checks), and no flags to see the most
up\-to\-date state of your finances. up\-to\-date state of your finances.
.SS Description, payee and note
.PP
As mentioned, a transaction\[aq]s description is the rest of the line
following the date and status mark (or, the rest of line until a comment
begins).
Sometimes called the "narration" in traditional bookkeeping, it can be
used for whatever you wish, or left blank.
The description can be queried, unlike comments.
.PP
Including a \f[C]|\f[] (pipe) character in the description will
subdivide it into a payee/payer name (on the left) and additional notes
(on the right).
This is entirely optional, but it can allow more precise
.PD 0
.P
.PD
querying and pivoting.
.SS Account names .SS Account names
.PP .PP
Account names typically have several parts separated by a full colon, Account names typically have several parts separated by a full colon,
@ -797,24 +817,6 @@ For example, the following transaction has three tags (\f[C]A\f[],
.PP .PP
Tags are like Ledger\[aq]s metadata feature, except hledger\[aq]s tag Tags are like Ledger\[aq]s metadata feature, except hledger\[aq]s tag
values are simple strings. values are simple strings.
.SS Implicit tags
.PP
Some predefined "implicit" tags are also provided:
.IP \[bu] 2
\f[C]code\f[] \- the transaction\[aq]s code field
.IP \[bu] 2
\f[C]description\f[] \- the transaction\[aq]s description
.IP \[bu] 2
\f[C]payee\f[] \- the part of description before \f[C]|\f[], or all of
it
.IP \[bu] 2
\f[C]note\f[] \- the part of description after \f[C]|\f[], or all of it
.PP
\f[C]payee\f[] and \f[C]note\f[] support descriptions written in a
special \f[C]PAYEE\ |\ NOTE\f[] format, accessing the parts before and
after the pipe character respectively.
For descriptions not containing a pipe character they are the same as
\f[C]description\f[].
.SS Directives .SS Directives
.SS Account aliases .SS Account aliases
.PP .PP

View File

@ -71,6 +71,7 @@ File: hledger_journal.5.info, Node: FILE FORMAT, Next: EDITOR SUPPORT, Prev:
* Postings:: * Postings::
* Dates:: * Dates::
* Status:: * Status::
* Description payee and note::
* Account names:: * Account names::
* Amounts:: * Amounts::
* Virtual Postings:: * Virtual Postings::
@ -96,7 +97,9 @@ following, separated by spaces:
* (optional) a transaction code (any short number or text, enclosed * (optional) a transaction code (any short number or text, enclosed
in parentheses) in parentheses)
* (optional) a transaction description (any remaining text until end * (optional) a transaction description (any remaining text until end
of line) of line or a semicolon)
* (optional) a transaction comment (any remaining text following a
semicolon until end of line)
Then comes zero or more (but usually at least 2) indented lines Then comes zero or more (but usually at least 2) indented lines
representing... representing...
@ -231,7 +234,7 @@ characters in this way. With this syntax, DATE infers its year from the
transaction and DATE2 infers its year from DATE. transaction and DATE2 infers its year from DATE.
 
File: hledger_journal.5.info, Node: Status, Next: Account names, Prev: Dates, Up: FILE FORMAT File: hledger_journal.5.info, Node: Status, Next: Description payee and note, Prev: Dates, Up: FILE FORMAT
1.4 Status 1.4 Status
========== ==========
@ -281,9 +284,26 @@ your bank, '-U' to see things which will probably hit your bank soon
your finances. your finances.
 
File: hledger_journal.5.info, Node: Account names, Next: Amounts, Prev: Status, Up: FILE FORMAT File: hledger_journal.5.info, Node: Description payee and note, Next: Account names, Prev: Status, Up: FILE FORMAT
1.5 Account names 1.5 Description, payee and note
===============================
As mentioned, a transaction's description is the rest of the line
following the date and status mark (or, the rest of line until a comment
begins). Sometimes called the "narration" in traditional bookkeeping,
it can be used for whatever you wish, or left blank. The description
can be queried, unlike comments.
Including a '|' (pipe) character in the description will subdivide it
into a payee/payer name (on the left) and additional notes (on the
right). This is entirely optional, but it can allow more precise
querying and pivoting.

File: hledger_journal.5.info, Node: Account names, Next: Amounts, Prev: Description payee and note, Up: FILE FORMAT
1.6 Account names
================= =================
Account names typically have several parts separated by a full colon, Account names typically have several parts separated by a full colon,
@ -301,7 +321,7 @@ more spaces* (or newline).
 
File: hledger_journal.5.info, Node: Amounts, Next: Virtual Postings, Prev: Account names, Up: FILE FORMAT File: hledger_journal.5.info, Node: Amounts, Next: Virtual Postings, Prev: Account names, Up: FILE FORMAT
1.6 Amounts 1.7 Amounts
=========== ===========
After the account name, there is usually an amount. Important: between After the account name, there is usually an amount. Important: between
@ -356,7 +376,7 @@ format with a commodity directive.
 
File: hledger_journal.5.info, Node: Virtual Postings, Next: Balance Assertions, Prev: Amounts, Up: FILE FORMAT File: hledger_journal.5.info, Node: Virtual Postings, Next: Balance Assertions, Prev: Amounts, Up: FILE FORMAT
1.7 Virtual Postings 1.8 Virtual Postings
==================== ====================
When you parenthesise the account name in a posting, we call that a When you parenthesise the account name in a posting, we call that a
@ -391,7 +411,7 @@ is more correct and provides better error checking.
 
File: hledger_journal.5.info, Node: Balance Assertions, Next: Balance Assignments, Prev: Virtual Postings, Up: FILE FORMAT File: hledger_journal.5.info, Node: Balance Assertions, Next: Balance Assignments, Prev: Virtual Postings, Up: FILE FORMAT
1.8 Balance Assertions 1.9 Balance Assertions
====================== ======================
hledger supports Ledger-style balance assertions in journal files. hledger supports Ledger-style balance assertions in journal files.
@ -425,7 +445,7 @@ or for reading Ledger files.
 
File: hledger_journal.5.info, Node: Assertions and ordering, Next: Assertions and included files, Up: Balance Assertions File: hledger_journal.5.info, Node: Assertions and ordering, Next: Assertions and included files, Up: Balance Assertions
1.8.1 Assertions and ordering 1.9.1 Assertions and ordering
----------------------------- -----------------------------
hledger sorts an account's postings and assertions first by date and hledger sorts an account's postings and assertions first by date and
@ -444,7 +464,7 @@ can assert intra-day balances.
 
File: hledger_journal.5.info, Node: Assertions and included files, Next: Assertions and multiple -f options, Prev: Assertions and ordering, Up: Balance Assertions File: hledger_journal.5.info, Node: Assertions and included files, Next: Assertions and multiple -f options, Prev: Assertions and ordering, Up: Balance Assertions
1.8.2 Assertions and included files 1.9.2 Assertions and included files
----------------------------------- -----------------------------------
With included files, things are a little more complicated. Including With included files, things are a little more complicated. Including
@ -456,7 +476,7 @@ you'll have to put the assertion in the right file.
 
File: hledger_journal.5.info, Node: Assertions and multiple -f options, Next: Assertions and commodities, Prev: Assertions and included files, Up: Balance Assertions File: hledger_journal.5.info, Node: Assertions and multiple -f options, Next: Assertions and commodities, Prev: Assertions and included files, Up: Balance Assertions
1.8.3 Assertions and multiple -f options 1.9.3 Assertions and multiple -f options
---------------------------------------- ----------------------------------------
Balance assertions don't work well across files specified with multiple Balance assertions don't work well across files specified with multiple
@ -465,7 +485,7 @@ Balance assertions don't work well across files specified with multiple
 
File: hledger_journal.5.info, Node: Assertions and commodities, Next: Assertions and subaccounts, Prev: Assertions and multiple -f options, Up: Balance Assertions File: hledger_journal.5.info, Node: Assertions and commodities, Next: Assertions and subaccounts, Prev: Assertions and multiple -f options, Up: Balance Assertions
1.8.4 Assertions and commodities 1.9.4 Assertions and commodities
-------------------------------- --------------------------------
The asserted balance must be a simple single-commodity amount, and in The asserted balance must be a simple single-commodity amount, and in
@ -484,7 +504,7 @@ for this kind of total balance assertion if there's demand.)
 
File: hledger_journal.5.info, Node: Assertions and subaccounts, Next: Assertions and virtual postings, Prev: Assertions and commodities, Up: Balance Assertions File: hledger_journal.5.info, Node: Assertions and subaccounts, Next: Assertions and virtual postings, Prev: Assertions and commodities, Up: Balance Assertions
1.8.5 Assertions and subaccounts 1.9.5 Assertions and subaccounts
-------------------------------- --------------------------------
Balance assertions do not count the balance from subaccounts; they check Balance assertions do not count the balance from subaccounts; they check
@ -507,7 +527,7 @@ $ hledger bal checking --flat
 
File: hledger_journal.5.info, Node: Assertions and virtual postings, Prev: Assertions and subaccounts, Up: Balance Assertions File: hledger_journal.5.info, Node: Assertions and virtual postings, Prev: Assertions and subaccounts, Up: Balance Assertions
1.8.6 Assertions and virtual postings 1.9.6 Assertions and virtual postings
------------------------------------- -------------------------------------
Balance assertions are checked against all postings, both real and Balance assertions are checked against all postings, both real and
@ -517,8 +537,8 @@ query.
 
File: hledger_journal.5.info, Node: Balance Assignments, Next: Prices, Prev: Balance Assertions, Up: FILE FORMAT File: hledger_journal.5.info, Node: Balance Assignments, Next: Prices, Prev: Balance Assertions, Up: FILE FORMAT
1.9 Balance Assignments 1.10 Balance Assignments
======================= ========================
Ledger-style balance assignments are also supported. These are like Ledger-style balance assignments are also supported. These are like
balance assertions, but with no posting amount on the left side of the balance assertions, but with no posting amount on the left side of the
@ -550,7 +570,7 @@ hledger or do the calculations yourself, instead of just reading it.
 
File: hledger_journal.5.info, Node: Prices, Next: Comments, Prev: Balance Assignments, Up: FILE FORMAT File: hledger_journal.5.info, Node: Prices, Next: Comments, Prev: Balance Assignments, Up: FILE FORMAT
1.10 Prices 1.11 Prices
=========== ===========
* Menu: * Menu:
@ -561,7 +581,7 @@ File: hledger_journal.5.info, Node: Prices, Next: Comments, Prev: Balance Ass
 
File: hledger_journal.5.info, Node: Transaction prices, Next: Market prices, Up: Prices File: hledger_journal.5.info, Node: Transaction prices, Next: Market prices, Up: Prices
1.10.1 Transaction prices 1.11.1 Transaction prices
------------------------- -------------------------
Within a transaction, you can note an amount's price in another Within a transaction, you can note an amount's price in another
@ -622,7 +642,7 @@ $ hledger bal -N --flat -B
 
File: hledger_journal.5.info, Node: Market prices, Prev: Transaction prices, Up: Prices File: hledger_journal.5.info, Node: Market prices, Prev: Transaction prices, Up: Prices
1.10.2 Market prices 1.11.2 Market prices
-------------------- --------------------
Market prices are not tied to a particular transaction; they represent Market prices are not tied to a particular transaction; they represent
@ -651,7 +671,7 @@ P 2010/1/1 € $1.40
 
File: hledger_journal.5.info, Node: Comments, Next: Tags, Prev: Prices, Up: FILE FORMAT File: hledger_journal.5.info, Node: Comments, Next: Tags, Prev: Prices, Up: FILE FORMAT
1.11 Comments 1.12 Comments
============= =============
Lines in the journal beginning with a semicolon (';') or hash ('#') or Lines in the journal beginning with a semicolon (';') or hash ('#') or
@ -691,7 +711,7 @@ end comment
 
File: hledger_journal.5.info, Node: Tags, Next: Directives, Prev: Comments, Up: FILE FORMAT File: hledger_journal.5.info, Node: Tags, Next: Directives, Prev: Comments, Up: FILE FORMAT
1.12 Tags 1.13 Tags
========= =========
Tags are a way to add extra labels or labelled data to postings and Tags are a way to add extra labels or labelled data to postings and
@ -730,32 +750,11 @@ example, the following transaction has three tags ('A', 'TAG2',
Tags are like Ledger's metadata feature, except hledger's tag values Tags are like Ledger's metadata feature, except hledger's tag values
are simple strings. are simple strings.
* Menu:
* Implicit tags::

File: hledger_journal.5.info, Node: Implicit tags, Up: Tags
1.12.1 Implicit tags
--------------------
Some predefined "implicit" tags are also provided:
* 'code' - the transaction's code field
* 'description' - the transaction's description
* 'payee' - the part of description before '|', or all of it
* 'note' - the part of description after '|', or all of it
'payee' and 'note' support descriptions written in a special 'PAYEE |
NOTE' format, accessing the parts before and after the pipe character
respectively. For descriptions not containing a pipe character they are
the same as 'description'.
 
File: hledger_journal.5.info, Node: Directives, Prev: Tags, Up: FILE FORMAT File: hledger_journal.5.info, Node: Directives, Prev: Tags, Up: FILE FORMAT
1.13 Directives 1.14 Directives
=============== ===============
* Menu: * Menu:
@ -772,7 +771,7 @@ File: hledger_journal.5.info, Node: Directives, Prev: Tags, Up: FILE FORMAT
 
File: hledger_journal.5.info, Node: Account aliases, Next: account directive, Up: Directives File: hledger_journal.5.info, Node: Account aliases, Next: account directive, Up: Directives
1.13.1 Account aliases 1.14.1 Account aliases
---------------------- ----------------------
You can define aliases which rewrite your account names (after reading You can define aliases which rewrite your account names (after reading
@ -797,7 +796,7 @@ be useful for:
 
File: hledger_journal.5.info, Node: Basic aliases, Next: Regex aliases, Up: Account aliases File: hledger_journal.5.info, Node: Basic aliases, Next: Regex aliases, Up: Account aliases
1.13.1.1 Basic aliases 1.14.1.1 Basic aliases
...................... ......................
To set an account alias, use the 'alias' directive in your journal file. To set an account alias, use the 'alias' directive in your journal file.
@ -820,7 +819,7 @@ alias checking = assets:bank:wells fargo:checking
 
File: hledger_journal.5.info, Node: Regex aliases, Next: Multiple aliases, Prev: Basic aliases, Up: Account aliases File: hledger_journal.5.info, Node: Regex aliases, Next: Multiple aliases, Prev: Basic aliases, Up: Account aliases
1.13.1.2 Regex aliases 1.14.1.2 Regex aliases
...................... ......................
There is also a more powerful variant that uses a regular expression, There is also a more powerful variant that uses a regular expression,
@ -843,7 +842,7 @@ alias /^(.+):bank:([^:]+)(.*)/ = \1:\2 \3
 
File: hledger_journal.5.info, Node: Multiple aliases, Next: end aliases, Prev: Regex aliases, Up: Account aliases File: hledger_journal.5.info, Node: Multiple aliases, Next: end aliases, Prev: Regex aliases, Up: Account aliases
1.13.1.3 Multiple aliases 1.14.1.3 Multiple aliases
......................... .........................
You can define as many aliases as you like using directives or You can define as many aliases as you like using directives or
@ -859,7 +858,7 @@ following order:
 
File: hledger_journal.5.info, Node: end aliases, Prev: Multiple aliases, Up: Account aliases File: hledger_journal.5.info, Node: end aliases, Prev: Multiple aliases, Up: Account aliases
1.13.1.4 end aliases 1.14.1.4 end aliases
.................... ....................
You can clear (forget) all currently defined aliases with the 'end You can clear (forget) all currently defined aliases with the 'end
@ -870,7 +869,7 @@ end aliases
 
File: hledger_journal.5.info, Node: account directive, Next: apply account directive, Prev: Account aliases, Up: Directives File: hledger_journal.5.info, Node: account directive, Next: apply account directive, Prev: Account aliases, Up: Directives
1.13.2 account directive 1.14.2 account directive
------------------------ ------------------------
The 'account' directive predefines account names, as in Ledger and The 'account' directive predefines account names, as in Ledger and
@ -891,7 +890,7 @@ account expenses:food
 
File: hledger_journal.5.info, Node: apply account directive, Next: Multi-line comments, Prev: account directive, Up: Directives File: hledger_journal.5.info, Node: apply account directive, Next: Multi-line comments, Prev: account directive, Up: Directives
1.13.3 apply account directive 1.14.3 apply account directive
------------------------------ ------------------------------
You can specify a parent account which will be prepended to all accounts You can specify a parent account which will be prepended to all accounts
@ -927,7 +926,7 @@ supported.
 
File: hledger_journal.5.info, Node: Multi-line comments, Next: commodity directive, Prev: apply account directive, Up: Directives File: hledger_journal.5.info, Node: Multi-line comments, Next: commodity directive, Prev: apply account directive, Up: Directives
1.13.4 Multi-line comments 1.14.4 Multi-line comments
-------------------------- --------------------------
A line containing just 'comment' starts a multi-line comment, and a line A line containing just 'comment' starts a multi-line comment, and a line
@ -936,7 +935,7 @@ containing just 'end comment' ends it. See comments.
 
File: hledger_journal.5.info, Node: commodity directive, Next: Default commodity, Prev: Multi-line comments, Up: Directives File: hledger_journal.5.info, Node: commodity directive, Next: Default commodity, Prev: Multi-line comments, Up: Directives
1.13.5 commodity directive 1.14.5 commodity directive
-------------------------- --------------------------
The 'commodity' directive predefines commodities (currently this is just The 'commodity' directive predefines commodities (currently this is just
@ -968,7 +967,7 @@ commodity INR
 
File: hledger_journal.5.info, Node: Default commodity, Next: Default year, Prev: commodity directive, Up: Directives File: hledger_journal.5.info, Node: Default commodity, Next: Default year, Prev: commodity directive, Up: Directives
1.13.6 Default commodity 1.14.6 Default commodity
------------------------ ------------------------
The D directive sets a default commodity (and display format), to be The D directive sets a default commodity (and display format), to be
@ -988,7 +987,7 @@ D $1,000.00
 
File: hledger_journal.5.info, Node: Default year, Next: Including other files, Prev: Default commodity, Up: Directives File: hledger_journal.5.info, Node: Default year, Next: Including other files, Prev: Default commodity, Up: Directives
1.13.7 Default year 1.14.7 Default year
------------------- -------------------
You can set a default year to be used for subsequent dates which don't You can set a default year to be used for subsequent dates which don't
@ -1014,7 +1013,7 @@ Y2010 ; change default year to 2010
 
File: hledger_journal.5.info, Node: Including other files, Prev: Default year, Up: Directives File: hledger_journal.5.info, Node: Including other files, Prev: Default year, Up: Directives
1.13.8 Including other files 1.14.8 Including other files
---------------------------- ----------------------------
You can pull in the content of additional journal files by writing an You can pull in the content of additional journal files by writing an
@ -1055,81 +1054,81 @@ Tag Table:
Node: Top78 Node: Top78
Node: FILE FORMAT2380 Node: FILE FORMAT2380
Ref: #file-format2506 Ref: #file-format2506
Node: Transactions2713 Node: Transactions2744
Ref: #transactions2836 Ref: #transactions2867
Node: Postings3401 Node: Postings3551
Ref: #postings3530 Ref: #postings3680
Node: Dates4525 Node: Dates4675
Ref: #dates4642 Ref: #dates4792
Node: Simple dates4707 Node: Simple dates4857
Ref: #simple-dates4835 Ref: #simple-dates4985
Node: Secondary dates5201 Node: Secondary dates5351
Ref: #secondary-dates5357 Ref: #secondary-dates5507
Node: Posting dates6920 Node: Posting dates7070
Ref: #posting-dates7051 Ref: #posting-dates7201
Node: Status8425 Node: Status8575
Ref: #status8549 Ref: #status8712
Node: Account names10263 Node: Description payee and note10426
Ref: #account-names10403 Ref: #description-payee-and-note10613
Node: Amounts10890 Node: Account names11157
Ref: #amounts11028 Ref: #account-names11317
Node: Virtual Postings13129 Node: Amounts11804
Ref: #virtual-postings13290 Ref: #amounts11942
Node: Balance Assertions14510 Node: Virtual Postings14043
Ref: #balance-assertions14687 Ref: #virtual-postings14204
Node: Assertions and ordering15583 Node: Balance Assertions15424
Ref: #assertions-and-ordering15771 Ref: #balance-assertions15601
Node: Assertions and included files16471 Node: Assertions and ordering16497
Ref: #assertions-and-included-files16714 Ref: #assertions-and-ordering16685
Node: Assertions and multiple -f options17047 Node: Assertions and included files17385
Ref: #assertions-and-multiple--f-options17303 Ref: #assertions-and-included-files17628
Node: Assertions and commodities17435 Node: Assertions and multiple -f options17961
Ref: #assertions-and-commodities17672 Ref: #assertions-and-multiple--f-options18217
Node: Assertions and subaccounts18368 Node: Assertions and commodities18349
Ref: #assertions-and-subaccounts18602 Ref: #assertions-and-commodities18586
Node: Assertions and virtual postings19123 Node: Assertions and subaccounts19282
Ref: #assertions-and-virtual-postings19332 Ref: #assertions-and-subaccounts19516
Node: Balance Assignments19474 Node: Assertions and virtual postings20037
Ref: #balance-assignments19643 Ref: #assertions-and-virtual-postings20246
Node: Prices20762 Node: Balance Assignments20388
Ref: #prices20897 Ref: #balance-assignments20559
Node: Transaction prices20948 Node: Prices21678
Ref: #transaction-prices21095 Ref: #prices21813
Node: Market prices23251 Node: Transaction prices21864
Ref: #market-prices23388 Ref: #transaction-prices22011
Node: Comments24348 Node: Market prices24167
Ref: #comments24472 Ref: #market-prices24304
Node: Tags25585 Node: Comments25264
Ref: #tags25705 Ref: #comments25388
Node: Implicit tags27134 Node: Tags26501
Ref: #implicit-tags27242 Ref: #tags26621
Node: Directives27759 Node: Directives28023
Ref: #directives27874 Ref: #directives28138
Node: Account aliases28067 Node: Account aliases28331
Ref: #account-aliases28213 Ref: #account-aliases28477
Node: Basic aliases28817 Node: Basic aliases29081
Ref: #basic-aliases28962 Ref: #basic-aliases29226
Node: Regex aliases29652 Node: Regex aliases29916
Ref: #regex-aliases29822 Ref: #regex-aliases30086
Node: Multiple aliases30537 Node: Multiple aliases30801
Ref: #multiple-aliases30711 Ref: #multiple-aliases30975
Node: end aliases31209 Node: end aliases31473
Ref: #end-aliases31351 Ref: #end-aliases31615
Node: account directive31452 Node: account directive31716
Ref: #account-directive31634 Ref: #account-directive31898
Node: apply account directive31930 Node: apply account directive32194
Ref: #apply-account-directive32128 Ref: #apply-account-directive32392
Node: Multi-line comments32787 Node: Multi-line comments33051
Ref: #multi-line-comments32979 Ref: #multi-line-comments33243
Node: commodity directive33107 Node: commodity directive33371
Ref: #commodity-directive33293 Ref: #commodity-directive33557
Node: Default commodity34165 Node: Default commodity34429
Ref: #default-commodity34340 Ref: #default-commodity34604
Node: Default year34877 Node: Default year35141
Ref: #default-year35044 Ref: #default-year35308
Node: Including other files35467 Node: Including other files35731
Ref: #including-other-files35626 Ref: #including-other-files35890
Node: EDITOR SUPPORT36023 Node: EDITOR SUPPORT36287
Ref: #editor-support36143 Ref: #editor-support36407
 
End Tag Table End Tag Table

View File

@ -75,7 +75,8 @@ This can be followed by any of the following, separated by spaces:
- (optional) a [status](#status) character (empty, `!`, or `*`) - (optional) a [status](#status) character (empty, `!`, or `*`)
- (optional) a transaction code (any short number or text, enclosed in parentheses) - (optional) a transaction code (any short number or text, enclosed in parentheses)
- (optional) a transaction description (any remaining text until end of line) - (optional) a transaction description (any remaining text until end of line or a semicolon)
- (optional) a transaction comment (any remaining text following a semicolon until end of line)
Then comes zero or more (but usually at least 2) indented lines representing... Then comes zero or more (but usually at least 2) indented lines representing...
@ -228,6 +229,18 @@ With this scheme, you would use
`-U` to see things which will probably hit your bank soon (like uncashed checks), `-U` to see things which will probably hit your bank soon (like uncashed checks),
and no flags to see the most up-to-date state of your finances. and no flags to see the most up-to-date state of your finances.
## Description, payee and note
As mentioned, a transaction's description is the rest of the line following the date and status mark
(or, the rest of line until a comment begins).
Sometimes called the "narration" in traditional bookkeeping, it can be used for whatever you wish,
or left blank. The description can be queried, unlike [comments](#comments).
Including a `|` (pipe) character in the description will subdivide it
into a payee/payer name (on the left) and additional notes (on the right).
This is entirely optional, but it can allow more precise
[querying](/hledger.html#queries) and [pivoting](/hledger.html#pivoting).
## Account names ## Account names
Account names typically have several parts separated by a full colon, from Account names typically have several parts separated by a full colon, from
@ -604,19 +617,6 @@ Tags are like Ledger's
[metadata](http://ledger-cli.org/3.0/doc/ledger3.html#Metadata) [metadata](http://ledger-cli.org/3.0/doc/ledger3.html#Metadata)
feature, except hledger's tag values are simple strings. feature, except hledger's tag values are simple strings.
### Implicit tags
Some predefined "implicit" tags are also provided:
- `code` - the transaction's code field
- `description` - the transaction's description
- `payee` - the part of description before `|`, or all of it
- `note` - the part of description after `|`, or all of it
`payee` and `note` support descriptions written in a special `PAYEE | NOTE` format,
accessing the parts before and after the pipe character respectively.
For descriptions not containing a pipe character they are the same as `description`.
## Directives ## Directives
### Account aliases ### Account aliases

View File

@ -68,59 +68,62 @@ FILE FORMAT
parentheses) parentheses)
o (optional) a transaction description (any remaining text until end of o (optional) a transaction description (any remaining text until end of
line) line or a semicolon)
Then comes zero or more (but usually at least 2) indented lines repre- o (optional) a transaction comment (any remaining text following a
semicolon until end of line)
Then comes zero or more (but usually at least 2) indented lines repre-
senting... senting...
Postings Postings
A posting is an addition of some amount to, or removal of some amount A posting is an addition of some amount to, or removal of some amount
from, an account. Each posting line begins with at least one space or from, an account. Each posting line begins with at least one space or
tab (2 or 4 spaces is common), followed by: tab (2 or 4 spaces is common), followed by:
o (optional) a status character (empty, !, or *), followed by a space o (optional) a status character (empty, !, or *), followed by a space
o (required) an account name (any text, optionally containing single o (required) an account name (any text, optionally containing single
spaces, until end of line or a double space) spaces, until end of line or a double space)
o (optional) two or more spaces or tabs followed by an amount. o (optional) two or more spaces or tabs followed by an amount.
Positive amounts are being added to the account, negative amounts are Positive amounts are being added to the account, negative amounts are
being removed. being removed.
The amounts within a transaction must always sum up to zero. As a con- The amounts within a transaction must always sum up to zero. As a con-
venience, one amount may be left blank; it will be inferred so as to venience, one amount may be left blank; it will be inferred so as to
balance the transaction. balance the transaction.
Be sure to note the unusual two-space delimiter between account name Be sure to note the unusual two-space delimiter between account name
and amount. This makes it easy to write account names containing spa- and amount. This makes it easy to write account names containing spa-
ces. But if you accidentally leave only one space (or tab) before the ces. But if you accidentally leave only one space (or tab) before the
amount, the amount will be considered part of the account name. amount, the amount will be considered part of the account name.
Dates Dates
Simple dates Simple dates
Within a journal file, transaction dates use Y/M/D (or Y-M-D or Y.M.D) Within a journal file, transaction dates use Y/M/D (or Y-M-D or Y.M.D)
Leading zeros are optional. The year may be omitted, in which case it Leading zeros are optional. The year may be omitted, in which case it
will be inferred from the context - the current transaction, the will be inferred from the context - the current transaction, the
default year set with a default year directive, or the current date default year set with a default year directive, or the current date
when the command is run. Some examples: 2010/01/31, 1/31, 2010-01-31, when the command is run. Some examples: 2010/01/31, 1/31, 2010-01-31,
2010.1.31. 2010.1.31.
Secondary dates Secondary dates
Real-life transactions sometimes involve more than one date - eg the Real-life transactions sometimes involve more than one date - eg the
date you write a cheque, and the date it clears in your bank. When you date you write a cheque, and the date it clears in your bank. When you
want to model this, eg for more accurate balances, you can specify want to model this, eg for more accurate balances, you can specify
individual posting dates, which I recommend. Or, you can use the sec- individual posting dates, which I recommend. Or, you can use the sec-
ondary dates (aka auxiliary/effective dates) feature, supported for ondary dates (aka auxiliary/effective dates) feature, supported for
compatibility with Ledger. compatibility with Ledger.
A secondary date can be written after the primary date, separated by an A secondary date can be written after the primary date, separated by an
equals sign. The primary date, on the left, is used by default; the equals sign. The primary date, on the left, is used by default; the
secondary date, on the right, is used when the --date2 flag is speci- secondary date, on the right, is used when the --date2 flag is speci-
fied (--aux-date or --effective also work). fied (--aux-date or --effective also work).
The meaning of secondary dates is up to you, but it's best to follow a The meaning of secondary dates is up to you, but it's best to follow a
consistent rule. Eg write the bank's clearing date as primary, and consistent rule. Eg write the bank's clearing date as primary, and
when needed, the date the transaction was initiated as secondary. when needed, the date the transaction was initiated as secondary.
Here's an example. Note that a secondary date will use the year of the Here's an example. Note that a secondary date will use the year of the
@ -136,18 +139,18 @@ FILE FORMAT
$ hledger register checking --date2 $ hledger register checking --date2
2010/02/19 movie ticket assets:checking $-10 $-10 2010/02/19 movie ticket assets:checking $-10 $-10
Secondary dates require some effort; you must use them consistently in Secondary dates require some effort; you must use them consistently in
your journal entries and remember whether to use or not use the --date2 your journal entries and remember whether to use or not use the --date2
flag for your reports. They are included in hledger for Ledger compat- flag for your reports. They are included in hledger for Ledger compat-
ibility, but posting dates are a more powerful and less confusing ibility, but posting dates are a more powerful and less confusing
alternative. alternative.
Posting dates Posting dates
You can give individual postings a different date from their parent You can give individual postings a different date from their parent
transaction, by adding a posting comment containing a tag (see below) transaction, by adding a posting comment containing a tag (see below)
like date:DATE. This is probably the best way to control posting dates like date:DATE. This is probably the best way to control posting dates
precisely. Eg in this example the expense should appear in May precisely. Eg in this example the expense should appear in May
reports, and the deduction from checking should be reported on 6/1 for reports, and the deduction from checking should be reported on 6/1 for
easy bank reconciliation: easy bank reconciliation:
2015/5/30 2015/5/30
@ -160,22 +163,22 @@ FILE FORMAT
$ hledger -f t.j register checking $ hledger -f t.j register checking
2015/06/01 assets:checking $-10 $-10 2015/06/01 assets:checking $-10 $-10
DATE should be a simple date; if the year is not specified it will use DATE should be a simple date; if the year is not specified it will use
the year of the transaction's date. You can set the secondary date the year of the transaction's date. You can set the secondary date
similarly, with date2:DATE2. The date: or date2: tags must have a similarly, with date2:DATE2. The date: or date2: tags must have a
valid simple date value if they are present, eg a date: tag with no valid simple date value if they are present, eg a date: tag with no
value is not allowed. value is not allowed.
Ledger's earlier, more compact bracketed date syntax is also supported: Ledger's earlier, more compact bracketed date syntax is also supported:
[DATE], [DATE=DATE2] or [=DATE2]. hledger will attempt to parse any [DATE], [DATE=DATE2] or [=DATE2]. hledger will attempt to parse any
square-bracketed sequence of the 0123456789/-.= characters in this way. square-bracketed sequence of the 0123456789/-.= characters in this way.
With this syntax, DATE infers its year from the transaction and DATE2 With this syntax, DATE infers its year from the transaction and DATE2
infers its year from DATE. infers its year from DATE.
Status Status
Transactions, or individual postings within a transaction, can have a Transactions, or individual postings within a transaction, can have a
status mark, which is a single character before the transaction status mark, which is a single character before the transaction
description or posting account name, separated from it by a space, description or posting account name, separated from it by a space,
indicating one of three statuses: indicating one of three statuses:
@ -185,47 +188,59 @@ FILE FORMAT
! pending ! pending
* cleared * cleared
When reporting, you can filter by status with the -U/--unmarked, When reporting, you can filter by status with the -U/--unmarked,
-P/--pending, and -C/--cleared flags; or the status:, status:!, and -P/--pending, and -C/--cleared flags; or the status:, status:!, and
status:* queries; or the U, P, C keys in hledger-ui. status:* queries; or the U, P, C keys in hledger-ui.
Note, in Ledger and in older versions of hledger, the "unmarked" state Note, in Ledger and in older versions of hledger, the "unmarked" state
is called "uncleared". As of hledger 1.3 we have renamed it to is called "uncleared". As of hledger 1.3 we have renamed it to
unmarked for clarity. unmarked for clarity.
To replicate Ledger and old hledger's behaviour of also matching pend- To replicate Ledger and old hledger's behaviour of also matching pend-
ing, combine -U and -P. ing, combine -U and -P.
Status marks are optional, but can be helpful eg for reconciling with Status marks are optional, but can be helpful eg for reconciling with
real-world accounts. Some editor modes provide highlighting and short- real-world accounts. Some editor modes provide highlighting and short-
cuts for working with status. Eg in Emacs ledger-mode, you can toggle cuts for working with status. Eg in Emacs ledger-mode, you can toggle
transaction status with C-c C-e, or posting status with C-c C-c. transaction status with C-c C-e, or posting status with C-c C-c.
What "uncleared", "pending", and "cleared" actually mean is up to you. What "uncleared", "pending", and "cleared" actually mean is up to you.
Here's one suggestion: Here's one suggestion:
status meaning status meaning
-------------------------------------------------------------------------- --------------------------------------------------------------------------
uncleared recorded but not yet reconciled; needs review uncleared recorded but not yet reconciled; needs review
pending tentatively reconciled (if needed, eg during a big recon- pending tentatively reconciled (if needed, eg during a big recon-
ciliation) ciliation)
cleared complete, reconciled as far as possible, and considered cleared complete, reconciled as far as possible, and considered
correct correct
With this scheme, you would use -PC to see the current balance at your With this scheme, you would use -PC to see the current balance at your
bank, -U to see things which will probably hit your bank soon (like bank, -U to see things which will probably hit your bank soon (like
uncashed checks), and no flags to see the most up-to-date state of your uncashed checks), and no flags to see the most up-to-date state of your
finances. finances.
Account names Description, payee and note
Account names typically have several parts separated by a full colon, As mentioned, a transaction's description is the rest of the line fol-
from which hledger derives a hierarchical chart of accounts. They can lowing the date and status mark (or, the rest of line until a comment
be anything you like, but in finance there are traditionally five begins). Sometimes called the "narration" in traditional bookkeeping,
top-level accounts: assets, liabilities, income, expenses, and equity. it can be used for whatever you wish, or left blank. The description
can be queried, unlike comments.
Account names may contain single spaces, eg: assets:accounts receiv- Including a | (pipe) character in the description will subdivide it
able. Because of this, they must always be followed by two or more into a payee/payer name (on the left) and additional notes (on the
right). This is entirely optional, but it can allow more precise
querying and pivoting.
Account names
Account names typically have several parts separated by a full colon,
from which hledger derives a hierarchical chart of accounts. They can
be anything you like, but in finance there are traditionally five
top-level accounts: assets, liabilities, income, expenses, and equity.
Account names may contain single spaces, eg: assets:accounts receiv-
able. Because of this, they must always be followed by two or more
spaces (or newline). spaces (or newline).
Account names can be aliased. Account names can be aliased.
@ -234,7 +249,7 @@ FILE FORMAT
After the account name, there is usually an amount. Important: between After the account name, there is usually an amount. Important: between
account name and amount, there must be two or more spaces. account name and amount, there must be two or more spaces.
Amounts consist of a number and (usually) a currency symbol or commod- Amounts consist of a number and (usually) a currency symbol or commod-
ity name. Some examples: ity name. Some examples:
2.00001 2.00001
@ -247,53 +262,53 @@ FILE FORMAT
As you can see, the amount format is somewhat flexible: As you can see, the amount format is somewhat flexible:
o amounts are a number (the "quantity") and optionally a currency sym- o amounts are a number (the "quantity") and optionally a currency sym-
bol/commodity name (the "commodity"). bol/commodity name (the "commodity").
o the commodity is a symbol, word, or phrase, on the left or right, o the commodity is a symbol, word, or phrase, on the left or right,
with or without a separating space. If the commodity contains num- with or without a separating space. If the commodity contains num-
bers, spaces or non-word punctuation it must be enclosed in double bers, spaces or non-word punctuation it must be enclosed in double
quotes. quotes.
o negative amounts with a commodity on the left can have the minus sign o negative amounts with a commodity on the left can have the minus sign
before or after it before or after it
o digit groups (thousands, or any other grouping) can be separated by o digit groups (thousands, or any other grouping) can be separated by
commas (in which case period is used for decimal point) or periods commas (in which case period is used for decimal point) or periods
(in which case comma is used for decimal point) (in which case comma is used for decimal point)
You can use any of these variations when recording data, but when You can use any of these variations when recording data, but when
hledger displays amounts, it will choose a consistent format for each hledger displays amounts, it will choose a consistent format for each
commodity. (Except for price amounts, which are always formatted as commodity. (Except for price amounts, which are always formatted as
written). The display format is chosen as follows: written). The display format is chosen as follows:
o if there is a commodity directive specifying the format, that is used o if there is a commodity directive specifying the format, that is used
o otherwise the format is inferred from the first posting amount in o otherwise the format is inferred from the first posting amount in
that commodity in the journal, and the precision (number of decimal that commodity in the journal, and the precision (number of decimal
places) will be the maximum from all posting amounts in that commmod- places) will be the maximum from all posting amounts in that commmod-
ity ity
o or if there are no such amounts in the journal, a default format is o or if there are no such amounts in the journal, a default format is
used (like $1000.00). used (like $1000.00).
Price amounts and amounts in D directives usually don't affect amount Price amounts and amounts in D directives usually don't affect amount
format inference, but in some situations they can do so indirectly. format inference, but in some situations they can do so indirectly.
(Eg when D's default commodity is applied to a commodity-less amount, (Eg when D's default commodity is applied to a commodity-less amount,
or when an amountless posting is balanced using a price's commodity, or or when an amountless posting is balanced using a price's commodity, or
when -V is used.) If you find this causing problems, set the desired when -V is used.) If you find this causing problems, set the desired
format with a commodity directive. format with a commodity directive.
Virtual Postings Virtual Postings
When you parenthesise the account name in a posting, we call that a When you parenthesise the account name in a posting, we call that a
virtual posting, which means: virtual posting, which means:
o it is ignored when checking that the transaction is balanced o it is ignored when checking that the transaction is balanced
o it is excluded from reports when the --real/-R flag is used, or the o it is excluded from reports when the --real/-R flag is used, or the
real:1 query. real:1 query.
You could use this, eg, to set an account's opening balance without You could use this, eg, to set an account's opening balance without
needing to use the equity:opening balances account: needing to use the equity:opening balances account:
1/1 special unbalanced posting to set initial balance 1/1 special unbalanced posting to set initial balance
@ -301,8 +316,8 @@ FILE FORMAT
When the account name is bracketed, we call it a balanced virtual post- When the account name is bracketed, we call it a balanced virtual post-
ing. This is like an ordinary virtual posting except the balanced vir- ing. This is like an ordinary virtual posting except the balanced vir-
tual postings in a transaction must balance to 0, like the real post- tual postings in a transaction must balance to 0, like the real post-
ings (but separately from them). Balanced virtual postings are also ings (but separately from them). Balanced virtual postings are also
excluded by --real/-R or real:1. excluded by --real/-R or real:1.
1/1 buy food with cash, and update some budget-tracking subaccounts elsewhere 1/1 buy food with cash, and update some budget-tracking subaccounts elsewhere
@ -312,13 +327,13 @@ FILE FORMAT
[assets:checking:budget:food] $-10 [assets:checking:budget:food] $-10
Virtual postings have some legitimate uses, but those are few. You can Virtual postings have some legitimate uses, but those are few. You can
usually find an equivalent journal entry using real postings, which is usually find an equivalent journal entry using real postings, which is
more correct and provides better error checking. more correct and provides better error checking.
Balance Assertions Balance Assertions
hledger supports Ledger-style balance assertions in journal files. hledger supports Ledger-style balance assertions in journal files.
These look like =EXPECTEDBALANCE following a posting's amount. Eg in These look like =EXPECTEDBALANCE following a posting's amount. Eg in
this example we assert the expected dollar balance in accounts a and b this example we assert the expected dollar balance in accounts a and b
after each posting: after each posting:
2013/1/1 2013/1/1
@ -330,31 +345,31 @@ FILE FORMAT
b $-1 =$-2 b $-1 =$-2
After reading a journal file, hledger will check all balance assertions After reading a journal file, hledger will check all balance assertions
and report an error if any of them fail. Balance assertions can pro- and report an error if any of them fail. Balance assertions can pro-
tect you from, eg, inadvertently disrupting reconciled balances while tect you from, eg, inadvertently disrupting reconciled balances while
cleaning up old entries. You can disable them temporarily with the cleaning up old entries. You can disable them temporarily with the
--ignore-assertions flag, which can be useful for troubleshooting or --ignore-assertions flag, which can be useful for troubleshooting or
for reading Ledger files. for reading Ledger files.
Assertions and ordering Assertions and ordering
hledger sorts an account's postings and assertions first by date and hledger sorts an account's postings and assertions first by date and
then (for postings on the same day) by parse order. Note this is dif- then (for postings on the same day) by parse order. Note this is dif-
ferent from Ledger, which sorts assertions only by parse order. (Also, ferent from Ledger, which sorts assertions only by parse order. (Also,
Ledger assertions do not see the accumulated effect of repeated post- Ledger assertions do not see the accumulated effect of repeated post-
ings to the same account within a transaction.) ings to the same account within a transaction.)
So, hledger balance assertions keep working if you reorder differ- So, hledger balance assertions keep working if you reorder differ-
ently-dated transactions within the journal. But if you reorder ently-dated transactions within the journal. But if you reorder
same-dated transactions or postings, assertions might break and require same-dated transactions or postings, assertions might break and require
updating. This order dependence does bring an advantage: precise con- updating. This order dependence does bring an advantage: precise con-
trol over the order of postings and assertions within a day, so you can trol over the order of postings and assertions within a day, so you can
assert intra-day balances. assert intra-day balances.
Assertions and included files Assertions and included files
With included files, things are a little more complicated. Including With included files, things are a little more complicated. Including
preserves the ordering of postings and assertions. If you have multi- preserves the ordering of postings and assertions. If you have multi-
ple postings to an account on the same day, split across different ple postings to an account on the same day, split across different
files, and you also want to assert the account's balance on the same files, and you also want to assert the account's balance on the same
day, you'll have to put the assertion in the right file. day, you'll have to put the assertion in the right file.
Assertions and multiple -f options Assertions and multiple -f options
@ -362,21 +377,21 @@ FILE FORMAT
-f options. Use include or concatenate the files instead. -f options. Use include or concatenate the files instead.
Assertions and commodities Assertions and commodities
The asserted balance must be a simple single-commodity amount, and in The asserted balance must be a simple single-commodity amount, and in
fact the assertion checks only this commodity's balance within the fact the assertion checks only this commodity's balance within the
(possibly multi-commodity) account balance. We could call this a par- (possibly multi-commodity) account balance. We could call this a par-
tial balance assertion. This is compatible with Ledger, and makes it tial balance assertion. This is compatible with Ledger, and makes it
possible to make assertions about accounts containing multiple commodi- possible to make assertions about accounts containing multiple commodi-
ties. ties.
To assert each commodity's balance in such a multi-commodity account, To assert each commodity's balance in such a multi-commodity account,
you can add multiple postings (with amount 0 if necessary). But note you can add multiple postings (with amount 0 if necessary). But note
that no matter how many assertions you add, you can't be sure the that no matter how many assertions you add, you can't be sure the
account does not contain some unexpected commodity. (We'll add support account does not contain some unexpected commodity. (We'll add support
for this kind of total balance assertion if there's demand.) for this kind of total balance assertion if there's demand.)
Assertions and subaccounts Assertions and subaccounts
Balance assertions do not count the balance from subaccounts; they Balance assertions do not count the balance from subaccounts; they
check the posted account's exclusive balance. For example: check the posted account's exclusive balance. For example:
1/1 1/1
@ -384,7 +399,7 @@ FILE FORMAT
checking 1 = 1 ; post to the parent account, its exclusive balance is now 1 checking 1 = 1 ; post to the parent account, its exclusive balance is now 1
equity equity
The balance report's flat mode shows these exclusive balances more The balance report's flat mode shows these exclusive balances more
clearly: clearly:
$ hledger bal checking --flat $ hledger bal checking --flat
@ -398,10 +413,10 @@ FILE FORMAT
tual. They are not affected by the --real/-R flag or real: query. tual. They are not affected by the --real/-R flag or real: query.
Balance Assignments Balance Assignments
Ledger-style balance assignments are also supported. These are like Ledger-style balance assignments are also supported. These are like
balance assertions, but with no posting amount on the left side of the balance assertions, but with no posting amount on the left side of the
equals sign; instead it is calculated automatically so as to satisfy equals sign; instead it is calculated automatically so as to satisfy
the assertion. This can be a convenience during data entry, eg when the assertion. This can be a convenience during data entry, eg when
setting opening balances: setting opening balances:
; starting a new journal, set asset account balances ; starting a new journal, set asset account balances
@ -419,8 +434,8 @@ FILE FORMAT
expenses:misc expenses:misc
The calculated amount depends on the account's balance in the commodity The calculated amount depends on the account's balance in the commodity
at that point (which depends on the previously-dated postings of the at that point (which depends on the previously-dated postings of the
commodity to that account since the last balance assertion or assign- commodity to that account since the last balance assertion or assign-
ment). Note that using balance assignments makes your journal a little ment). Note that using balance assignments makes your journal a little
less explicit; to know the exact amount posted, you have to run hledger less explicit; to know the exact amount posted, you have to run hledger
or do the calculations yourself, instead of just reading it. or do the calculations yourself, instead of just reading it.
@ -428,12 +443,12 @@ FILE FORMAT
Prices Prices
Transaction prices Transaction prices
Within a transaction, you can note an amount's price in another commod- Within a transaction, you can note an amount's price in another commod-
ity. This can be used to document the cost (in a purchase) or selling ity. This can be used to document the cost (in a purchase) or selling
price (in a sale). For example, transaction prices are useful to price (in a sale). For example, transaction prices are useful to
record purchases of a foreign currency. record purchases of a foreign currency.
Transaction prices are fixed, and do not change over time. (Ledger Transaction prices are fixed, and do not change over time. (Ledger
users: Ledger uses a different syntax for fixed prices, {=UNITPRICE}, users: Ledger uses a different syntax for fixed prices, {=UNITPRICE},
which hledger currently ignores). which hledger currently ignores).
There are several ways to record a transaction price: There are several ways to record a transaction price:
@ -457,9 +472,9 @@ FILE FORMAT
assets:euros 100 ; one hundred euros purchased assets:euros 100 ; one hundred euros purchased
assets:dollars $-135 ; for $135 assets:dollars $-135 ; for $135
Amounts with transaction prices can be displayed in the transaction Amounts with transaction prices can be displayed in the transaction
price's commodity by using the -B/--cost flag (except for #551) ("B" is price's commodity by using the -B/--cost flag (except for #551) ("B" is
from "cost Basis"). Eg for the above, here is how -B affects the bal- from "cost Basis"). Eg for the above, here is how -B affects the bal-
ance report: ance report:
$ hledger bal -N --flat $ hledger bal -N --flat
@ -469,8 +484,8 @@ FILE FORMAT
$-135 assets:dollars $-135 assets:dollars
$135 assets:euros # <- the euros' cost $135 assets:euros # <- the euros' cost
Note -B is sensitive to the order of postings when a transaction price Note -B is sensitive to the order of postings when a transaction price
is inferred: the inferred price will be in the commodity of the last is inferred: the inferred price will be in the commodity of the last
amount. So if example 3's postings are reversed, while the transaction amount. So if example 3's postings are reversed, while the transaction
is equivalent, -B shows something different: is equivalent, -B shows something different:
@ -483,41 +498,41 @@ FILE FORMAT
100 assets:euros 100 assets:euros
Market prices Market prices
Market prices are not tied to a particular transaction; they represent Market prices are not tied to a particular transaction; they represent
historical exchange rates between two commodities. (Ledger calls them historical exchange rates between two commodities. (Ledger calls them
historical prices.) For example, the prices published by a stock historical prices.) For example, the prices published by a stock
exchange or the foreign exchange market. hledger can use these prices exchange or the foreign exchange market. hledger can use these prices
to show the market value of things at a given date, see market value. to show the market value of things at a given date, see market value.
To record market prices, use P directives in the main journal or in an To record market prices, use P directives in the main journal or in an
included file. Their format is: included file. Their format is:
P DATE COMMODITYBEINGPRICED UNITPRICE P DATE COMMODITYBEINGPRICED UNITPRICE
DATE is a simple date as usual. COMMODITYBEINGPRICED is the symbol of DATE is a simple date as usual. COMMODITYBEINGPRICED is the symbol of
the commodity being priced. UNITPRICE is an ordinary amount (symbol the commodity being priced. UNITPRICE is an ordinary amount (symbol
and quantity) in a second commodity, specifying the unit price or con- and quantity) in a second commodity, specifying the unit price or con-
version rate for the first commodity in terms of the second, on the version rate for the first commodity in terms of the second, on the
given date. given date.
For example, the following directives say that one euro was worth 1.35 For example, the following directives say that one euro was worth 1.35
US dollars during 2009, and $1.40 from 2010 onward: US dollars during 2009, and $1.40 from 2010 onward:
P 2009/1/1 $1.35 P 2009/1/1 $1.35
P 2010/1/1 $1.40 P 2010/1/1 $1.40
Comments Comments
Lines in the journal beginning with a semicolon (;) or hash (#) or Lines in the journal beginning with a semicolon (;) or hash (#) or
asterisk (*) are comments, and will be ignored. (Asterisk comments asterisk (*) are comments, and will be ignored. (Asterisk comments
make it easy to treat your journal like an org-mode outline in emacs.) make it easy to treat your journal like an org-mode outline in emacs.)
Also, anything between comment and end comment directives is a Also, anything between comment and end comment directives is a
(multi-line) comment. If there is no end comment, the comment extends (multi-line) comment. If there is no end comment, the comment extends
to the end of the file. to the end of the file.
You can attach comments to a transaction by writing them after the You can attach comments to a transaction by writing them after the
description and/or indented on the following lines (before the post- description and/or indented on the following lines (before the post-
ings). Similarly, you can attach comments to an individual posting by ings). Similarly, you can attach comments to an individual posting by
writing them after the amount and/or indented on the following lines. writing them after the amount and/or indented on the following lines.
Some examples: Some examples:
@ -542,20 +557,20 @@ FILE FORMAT
; a journal comment (because not indented) ; a journal comment (because not indented)
Tags Tags
Tags are a way to add extra labels or labelled data to postings and Tags are a way to add extra labels or labelled data to postings and
transactions, which you can then search or pivot on. transactions, which you can then search or pivot on.
A simple tag is a word (which may contain hyphens) followed by a full A simple tag is a word (which may contain hyphens) followed by a full
colon, written inside a transaction or posting comment line: colon, written inside a transaction or posting comment line:
2017/1/16 bought groceries ; sometag: 2017/1/16 bought groceries ; sometag:
Tags can have a value, which is the text after the colon, up to the Tags can have a value, which is the text after the colon, up to the
next comma or end of line, with leading/trailing whitespace removed: next comma or end of line, with leading/trailing whitespace removed:
expenses:food $10 ; a-posting-tag: the tag value expenses:food $10 ; a-posting-tag: the tag value
Note this means hledger's tag values can not contain commas or new- Note this means hledger's tag values can not contain commas or new-
lines. Ending at commas means you can write multiple short tags on one lines. Ending at commas means you can write multiple short tags on one
line, comma separated: line, comma separated:
@ -569,34 +584,18 @@ FILE FORMAT
o "tag2" is another tag, whose value is "some value ..." o "tag2" is another tag, whose value is "some value ..."
Tags in a transaction comment affect the transaction and all of its Tags in a transaction comment affect the transaction and all of its
postings, while tags in a posting comment affect only that posting. postings, while tags in a posting comment affect only that posting.
For example, the following transaction has three tags (A, TAG2, For example, the following transaction has three tags (A, TAG2,
third-tag) and the posting has four (those plus posting-tag): third-tag) and the posting has four (those plus posting-tag):
1/1 a transaction ; A:, TAG2: 1/1 a transaction ; A:, TAG2:
; third-tag: a third transaction tag, <- with a value ; third-tag: a third transaction tag, <- with a value
(a) $1 ; posting-tag: (a) $1 ; posting-tag:
Tags are like Ledger's metadata feature, except hledger's tag values Tags are like Ledger's metadata feature, except hledger's tag values
are simple strings. are simple strings.
Implicit tags
Some predefined "implicit" tags are also provided:
o code - the transaction's code field
o description - the transaction's description
o payee - the part of description before |, or all of it
o note - the part of description after |, or all of it
payee and note support descriptions written in a special PAYEE | NOTE
format, accessing the parts before and after the pipe character respec-
tively. For descriptions not containing a pipe character they are the
same as description.
Directives Directives
Account aliases Account aliases
You can define aliases which rewrite your account names (after reading You can define aliases which rewrite your account names (after reading
@ -809,8 +808,6 @@ EDITOR SUPPORT
ting-started ting-started
Sublime Text https://github.com/ledger/ledger/wiki/Using-Sub- Sublime Text https://github.com/ledger/ledger/wiki/Using-Sub-
lime-Text lime-Text
Textmate https://github.com/ledger/ledger/wiki/Using-Text- Textmate https://github.com/ledger/ledger/wiki/Using-Text-
Mate-2 Mate-2
Text Wrangler https://github.com/ledger/ledger/wiki/Edit- Text Wrangler https://github.com/ledger/ledger/wiki/Edit-

View File

@ -88,8 +88,8 @@ anonymize accounts and payees
.RS .RS
.RE .RE
.TP .TP
.B \f[C]\-\-pivot\ TAGNAME\f[] .B \f[C]\-\-pivot\ FIELDNAME\f[]
use some other field/tag for account names use some other field or tag for the account name
.RS .RS
.RE .RE
.TP .TP

View File

@ -67,9 +67,9 @@ the data.
'--anon' '--anon'
anonymize accounts and payees anonymize accounts and payees
'--pivot TAGNAME' '--pivot FIELDNAME'
use some other field/tag for account names use some other field or tag for the account name
'-I --ignore-assertions' '-I --ignore-assertions'
ignore any failing balance assertions ignore any failing balance assertions
@ -358,17 +358,17 @@ Tag Table:
Node: Top73 Node: Top73
Node: OPTIONS831 Node: OPTIONS831
Ref: #options930 Ref: #options930
Node: KEYS3479 Node: KEYS3487
Ref: #keys3576 Ref: #keys3584
Node: SCREENS6372 Node: SCREENS6380
Ref: #screens6459 Ref: #screens6467
Node: Accounts screen6549 Node: Accounts screen6557
Ref: #accounts-screen6679 Ref: #accounts-screen6687
Node: Register screen8909 Node: Register screen8917
Ref: #register-screen9066 Ref: #register-screen9074
Node: Transaction screen11140 Node: Transaction screen11148
Ref: #transaction-screen11300 Ref: #transaction-screen11308
Node: Error screen12170 Node: Error screen12178
Ref: #error-screen12294 Ref: #error-screen12302
 
End Tag Table End Tag Table

View File

@ -65,8 +65,8 @@ OPTIONS
--anon anonymize accounts and payees --anon anonymize accounts and payees
--pivot TAGNAME --pivot FIELDNAME
use some other field/tag for account names use some other field or tag for the account name
-I --ignore-assertions -I --ignore-assertions
ignore any failing balance assertions ignore any failing balance assertions

View File

@ -144,8 +144,8 @@ anonymize accounts and payees
.RS .RS
.RE .RE
.TP .TP
.B \f[C]\-\-pivot\ TAGNAME\f[] .B \f[C]\-\-pivot\ FIELDNAME\f[]
use some other field/tag for account names use some other field or tag for the account name
.RS .RS
.RE .RE
.TP .TP

View File

@ -112,9 +112,9 @@ options as shown above.
'--anon' '--anon'
anonymize accounts and payees anonymize accounts and payees
'--pivot TAGNAME' '--pivot FIELDNAME'
use some other field/tag for account names use some other field or tag for the account name
'-I --ignore-assertions' '-I --ignore-assertions'
ignore any failing balance assertions ignore any failing balance assertions

View File

@ -110,8 +110,8 @@ OPTIONS
--anon anonymize accounts and payees --anon anonymize accounts and payees
--pivot TAGNAME --pivot FIELDNAME
use some other field/tag for account names use some other field or tag for the account name
-I --ignore-assertions -I --ignore-assertions
ignore any failing balance assertions ignore any failing balance assertions

View File

@ -199,8 +199,8 @@ anonymize accounts and payees
.RS .RS
.RE .RE
.TP .TP
.B \f[C]\-\-pivot\ TAGNAME\f[] .B \f[C]\-\-pivot\ FIELDNAME\f[]
use some other field/tag for account names use some other field or tag for the account name
.RS .RS
.RE .RE
.TP .TP
@ -750,21 +750,17 @@ Use this when you want a summary with less detail.
.PP .PP
Normally hledger sums amounts, and organizes them in a hierarchy, based Normally hledger sums amounts, and organizes them in a hierarchy, based
on account name. on account name.
The \f[C]\-\-pivot\ TAGNAME\f[] option causes it to sum and organize The \f[C]\-\-pivot\ FIELD\f[] option causes it to sum and organize
hierarchy based on some other field instead. hierarchy based on the value of some other field instead.
.PP FIELD can be: \f[C]code\f[], \f[C]description\f[], \f[C]payee\f[],
TAGNAME is the full, case\-insensitive name of a tag you have defined, \f[C]note\f[], or the full name (case insensitive) of any tag.
or one of the built\-in implicit tags (like \f[C]code\f[] or As with account names, values containing \f[C]colon:separated:parts\f[]
\f[C]payee\f[]). will be displayed hierarchically in reports.
As with account names, when tag values have
\f[C]multiple:colon\-separated:parts\f[] hledger will build hierarchy,
displayed in tree\-mode reports, summarisable with a depth limit, and so
on.
.PP .PP
\f[C]\-\-pivot\f[] is a general option affecting all reports; you can \f[C]\-\-pivot\f[] is a general option affecting all reports; you can
think of hledger transforming the journal before any other processing, think of hledger transforming the journal before any other processing,
replacing every posting\[aq]s account name with the value of the replacing every posting\[aq]s account name with the value of the
specified tag on that posting, inheriting it from the transaction or specified field on that posting, inheriting it from the transaction or
using a blank value if it\[aq]s not present. using a blank value if it\[aq]s not present.
.PP .PP
An example: An example:
@ -1007,7 +1003,7 @@ quoting to hide it from the shell, so eg do:
.RE .RE
.TP .TP
.B \f[B]\f[C]desc:REGEX\f[]\f[] .B \f[B]\f[C]desc:REGEX\f[]\f[]
match transaction descriptions match transaction descriptions.
.RS .RS
.RE .RE
.TP .TP
@ -1031,6 +1027,18 @@ match (or display, depending on command) accounts at or above this depth
.RS .RS
.RE .RE
.TP .TP
.B \f[B]\f[C]note:REGEX\f[]\f[]
match transaction notes (part of description right of \f[C]|\f[], or
whole description when there\[aq]s no \f[C]|\f[])
.RS
.RE
.TP
.B \f[B]\f[C]payee:REGEX\f[]\f[]
match transaction payee/payer names (part of description left of
\f[C]|\f[], or whole description when there\[aq]s no \f[C]|\f[])
.RS
.RE
.TP
.B \f[B]\f[C]real:,\ real:0\f[]\f[] .B \f[B]\f[C]real:,\ real:0\f[]\f[]
match real or virtual postings respectively match real or virtual postings respectively
.RS .RS

View File

@ -167,9 +167,9 @@ different, like git.)
'--anon' '--anon'
anonymize accounts and payees anonymize accounts and payees
'--pivot TAGNAME' '--pivot FIELDNAME'
use some other field/tag for account names use some other field or tag for the account name
'-I --ignore-assertions' '-I --ignore-assertions'
ignore any failing balance assertions ignore any failing balance assertions
@ -507,20 +507,17 @@ File: hledger.1.info, Node: Pivoting, Next: Cost, Prev: Depth limiting, Up:
============= =============
Normally hledger sums amounts, and organizes them in a hierarchy, based Normally hledger sums amounts, and organizes them in a hierarchy, based
on account name. The '--pivot TAGNAME' option causes it to sum and on account name. The '--pivot FIELD' option causes it to sum and
organize hierarchy based on some other field instead. organize hierarchy based on the value of some other field instead.
FIELD can be: 'code', 'description', 'payee', 'note', or the full name
TAGNAME is the full, case-insensitive name of a tag you have defined, (case insensitive) of any tag. As with account names, values containing
or one of the built-in implicit tags (like 'code' or 'payee'). As with 'colon:separated:parts' will be displayed hierarchically in reports.
account names, when tag values have 'multiple:colon-separated:parts'
hledger will build hierarchy, displayed in tree-mode reports,
summarisable with a depth limit, and so on.
'--pivot' is a general option affecting all reports; you can think of '--pivot' is a general option affecting all reports; you can think of
hledger transforming the journal before any other processing, replacing hledger transforming the journal before any other processing, replacing
every posting's account name with the value of the specified tag on that every posting's account name with the value of the specified field on
posting, inheriting it from the transaction or using a blank value if that posting, inheriting it from the transaction or using a blank value
it's not present. if it's not present.
An example: An example:
@ -717,7 +714,7 @@ match (or negatively match)
print cur:'\$'' or 'hledger print cur:\\$'. print cur:'\$'' or 'hledger print cur:\\$'.
*'desc:REGEX'* *'desc:REGEX'*
match transaction descriptions match transaction descriptions.
*'date:PERIODEXPR'* *'date:PERIODEXPR'*
match dates within the specified period. PERIODEXPR is a period match dates within the specified period. PERIODEXPR is a period
@ -732,6 +729,14 @@ match (or negatively match)
match (or display, depending on command) accounts at or above this match (or display, depending on command) accounts at or above this
depth depth
*'note:REGEX'*
match transaction notes (part of description right of '|', or whole
description when there's no '|')
*'payee:REGEX'*
match transaction payee/payer names (part of description left of
'|', or whole description when there's no '|')
*'real:, real:0'* *'real:, real:0'*
match real or virtual postings respectively match real or virtual postings respectively
@ -2129,123 +2134,123 @@ Node: OPTIONS3640
Ref: #options3744 Ref: #options3744
Node: General options4025 Node: General options4025
Ref: #general-options4152 Ref: #general-options4152
Node: Command options6498 Node: Command options6506
Ref: #command-options6651 Ref: #command-options6659
Node: Command arguments7049 Node: Command arguments7057
Ref: #command-arguments7209 Ref: #command-arguments7217
Node: Special characters7330 Node: Special characters7338
Ref: #special-characters7488 Ref: #special-characters7496
Node: Input files8656 Node: Input files8664
Ref: #input-files8794 Ref: #input-files8802
Node: Smart dates10757 Node: Smart dates10765
Ref: #smart-dates10900 Ref: #smart-dates10908
Node: Report start & end date11879 Node: Report start & end date11887
Ref: #report-start-end-date12051 Ref: #report-start-end-date12059
Node: Report intervals13117 Node: Report intervals13125
Ref: #report-intervals13282 Ref: #report-intervals13290
Node: Period expressions13683 Node: Period expressions13691
Ref: #period-expressions13843 Ref: #period-expressions13851
Node: Depth limiting16183 Node: Depth limiting16191
Ref: #depth-limiting16329 Ref: #depth-limiting16337
Node: Pivoting16530 Node: Pivoting16538
Ref: #pivoting16650 Ref: #pivoting16658
Node: Cost18421 Node: Cost18334
Ref: #cost18531 Ref: #cost18444
Node: Market value18649 Node: Market value18562
Ref: #market-value18786 Ref: #market-value18699
Node: Regular expressions20086 Node: Regular expressions19999
Ref: #regular-expressions20224 Ref: #regular-expressions20137
Node: QUERIES21585 Node: QUERIES21498
Ref: #queries21689 Ref: #queries21602
Node: COMMANDS25354 Node: COMMANDS25534
Ref: #commands25468 Ref: #commands25648
Node: accounts26147 Node: accounts26327
Ref: #accounts26247 Ref: #accounts26427
Node: activity27229 Node: activity27409
Ref: #activity27341 Ref: #activity27521
Node: add27700 Node: add27880
Ref: #add27801 Ref: #add27981
Node: balance30459 Node: balance30639
Ref: #balance30572 Ref: #balance30752
Node: Flat mode33587 Node: Flat mode33767
Ref: #flat-mode33714 Ref: #flat-mode33894
Node: Depth limited balance reports34134 Node: Depth limited balance reports34314
Ref: #depth-limited-balance-reports34337 Ref: #depth-limited-balance-reports34517
Node: Multicolumn balance reports34757 Node: Multicolumn balance reports34937
Ref: #multicolumn-balance-reports34968 Ref: #multicolumn-balance-reports35148
Node: Custom balance output39616 Node: Custom balance output39796
Ref: #custom-balance-output39800 Ref: #custom-balance-output39980
Node: Colour support41893 Node: Colour support42073
Ref: #colour-support42054 Ref: #colour-support42234
Node: Output destination42227 Node: Output destination42407
Ref: #output-destination42385 Ref: #output-destination42565
Node: CSV output42655 Node: CSV output42835
Ref: #csv-output42774 Ref: #csv-output42954
Node: balancesheet43171 Node: balancesheet43351
Ref: #balancesheet43309 Ref: #balancesheet43489
Node: balancesheetequity45216 Node: balancesheetequity45396
Ref: #balancesheetequity45367 Ref: #balancesheetequity45547
Node: cashflow46156 Node: cashflow46336
Ref: #cashflow46279 Ref: #cashflow46459
Node: help48130 Node: help48310
Ref: #help48242 Ref: #help48422
Node: incomestatement49316 Node: incomestatement49496
Ref: #incomestatement49447 Ref: #incomestatement49627
Node: print51339 Node: print51519
Ref: #print51456 Ref: #print51636
Node: register55212 Node: register55392
Ref: #register55325 Ref: #register55505
Node: Custom register output59821 Node: Custom register output60001
Ref: #custom-register-output59952 Ref: #custom-register-output60132
Node: stats61249 Node: stats61429
Ref: #stats61355 Ref: #stats61535
Node: test62236 Node: test62416
Ref: #test62323 Ref: #test62503
Node: ADD-ON COMMANDS62691 Node: ADD-ON COMMANDS62871
Ref: #add-on-commands62803 Ref: #add-on-commands62983
Node: Official add-ons64090 Node: Official add-ons64270
Ref: #official-add-ons64232 Ref: #official-add-ons64412
Node: api64319 Node: api64499
Ref: #api64410 Ref: #api64590
Node: ui64462 Node: ui64642
Ref: #ui64563 Ref: #ui64743
Node: web64621 Node: web64801
Ref: #web64712 Ref: #web64892
Node: Third party add-ons64758 Node: Third party add-ons64938
Ref: #third-party-add-ons64935 Ref: #third-party-add-ons65115
Node: diff65070 Node: diff65250
Ref: #diff65169 Ref: #diff65349
Node: iadd65268 Node: iadd65448
Ref: #iadd65384 Ref: #iadd65564
Node: interest65467 Node: interest65647
Ref: #interest65590 Ref: #interest65770
Node: irr65685 Node: irr65865
Ref: #irr65785 Ref: #irr65965
Node: Experimental add-ons65863 Node: Experimental add-ons66043
Ref: #experimental-add-ons66017 Ref: #experimental-add-ons66197
Node: autosync66419 Node: autosync66599
Ref: #autosync66533 Ref: #autosync66713
Node: budget66772 Node: budget66952
Ref: #budget66896 Ref: #budget67076
Node: chart66962 Node: chart67142
Ref: #chart67081 Ref: #chart67261
Node: check67152 Node: check67332
Ref: #check67276 Ref: #check67456
Node: check-dates67343 Node: check-dates67523
Ref: #check-dates67485 Ref: #check-dates67665
Node: check-dupes67558 Node: check-dupes67738
Ref: #check-dupes67701 Ref: #check-dupes67881
Node: equity67778 Node: equity67958
Ref: #equity67906 Ref: #equity68086
Node: prices68025 Node: prices68205
Ref: #prices68154 Ref: #prices68334
Node: print-unique68209 Node: print-unique68389
Ref: #print-unique68358 Ref: #print-unique68538
Node: register-match68451 Node: register-match68631
Ref: #register-match68607 Ref: #register-match68787
Node: rewrite68705 Node: rewrite68885
Ref: #rewrite68839 Ref: #rewrite69019
Node: tags68917 Node: tags69097
Ref: #tags69022 Ref: #tags69202
 
End Tag Table End Tag Table

File diff suppressed because it is too large Load Diff

View File

@ -265,16 +265,15 @@ tree, down to level N. Use this when you want a summary with less detail.
## Pivoting ## Pivoting
Normally hledger sums amounts, and organizes them in a hierarchy, based on account name. Normally hledger sums amounts, and organizes them in a hierarchy, based on account name.
The `--pivot TAGNAME` option causes it to sum and organize hierarchy based on some other field instead. The `--pivot FIELD` option causes it to sum and organize hierarchy based on the value of some other field instead.
FIELD can be:
TAGNAME is the full, case-insensitive name of a [tag](/journal.html#tags) you have defined, `code`, `description`, `payee`, `note`,
or one of the built-in implicit tags (like `code` or `payee`). or the full name (case insensitive) of any [tag](/journal.html#tags).
As with account names, when tag values have `multiple:colon-separated:parts` hledger will build hierarchy, As with account names, values containing `colon:separated:parts` will be displayed hierarchically in reports.
displayed in tree-mode reports, summarisable with a depth limit, and so on.
`--pivot` is a general option affecting all reports; you can think of hledger transforming `--pivot` is a general option affecting all reports; you can think of hledger transforming
the journal before any other processing, replacing every posting's account name with the journal before any other processing, replacing every posting's account name with
the value of the specified tag on that posting, inheriting it from the transaction the value of the specified field on that posting, inheriting it from the transaction
or using a blank value if it's not present. or using a blank value if it's not present.
An example: An example:

View File

@ -54,7 +54,7 @@ quoting to hide it from the shell, so eg do: `hledger print cur:'\$'`
or `hledger print cur:\\$`. or `hledger print cur:\\$`.
**`desc:REGEX`** **`desc:REGEX`**
: match transaction descriptions : match transaction [descriptions](/manual.html#description-payee-and-note).
**`date:PERIODEXPR`** **`date:PERIODEXPR`**
: match dates within the specified period. : match dates within the specified period.
@ -68,6 +68,14 @@ If the `--date2` command line flag is present, this matches [secondary dates](ma
**`depth:N`** **`depth:N`**
: match (or display, depending on command) accounts at or above this depth : match (or display, depending on command) accounts at or above this depth
**`note:REGEX`**
: match transaction [notes](/manual.html#description-payee-and-note)
(part of description right of `|`, or whole description when there's no `|`)
**`payee:REGEX`**
: match transaction [payee/payer names](/manual.html#description-payee-and-note)
(part of description left of `|`, or whole description when there's no `|`)
**`real:, real:0`** **`real:, real:0`**
: match real or virtual postings respectively : match real or virtual postings respectively