docs: rewrite commodity/amount styles and dates a bit

This commit is contained in:
Simon Michael 2012-12-10 11:55:46 +00:00
parent 28e06a2776
commit e7de67ec68

View File

@ -198,23 +198,20 @@ digit group separators, you must also include a decimal point in at least
one number in the same commodity, so that hledger knows which character is one number in the same commodity, so that hledger knows which character is
which. Eg, write `$1,000.00` or `$1.000,00`. which. Eg, write `$1,000.00` or `$1.000,00`.
### Commodity display settings ### Amount styles
Based on how you format amounts, hledger will infer canonical display Based on how you format amounts, hledger will infer canonical display
settings for each commodity, and use them consistently when displaying styles for each commodity, and use these when displaying amounts in that
amounts in that commodity. Display settings include: commodity. Amount styles include:
- the position and spacing of the currency/commodity symbol - the position (left or right) and spacing (space or no separator) of the commodity symbol
- the digit group separator character and digit group sizes, if any - the digit group separator character (comma or period) and digit group sizes, if any
- the decimal point character - the decimal point character (period or comma)
- the number of decimal places - the display precision (number of decimal places displayed)
The canonical settings are those of the first amount seen in the The canonical style is generally the style of the first amount seen in a commodity
commodity, with the decimal places adjusted upward to the highest (which may be in a [default commodity directive](#default-commodity).
precision seen in the commodity. The precision is the highest precision seen among all amounts in the commmodity.
[Default commodity](#default-commodity) directives also influence the
commodity display settings (note: only if they have a commodity symbol).
### Simple dates ### Simple dates
@ -238,21 +235,18 @@ transactions, like so:
1/31 ; equivalent to 2010/1/31 1/31 ; equivalent to 2010/1/31
... ...
### Primary & secondary dates ### Secondary dates
Most of the time, a simple transaction date is all you need. However Real-life transactions sometimes involve more than one date - eg the date
real-life transactions sometimes involve more than one date. Eg, cheque you write a cheque, and the date it clears in your bank. When you want to
writing and clearing dates. When you want to model this, eg so that your model this, eg for more accurate balances, write both dates separated by
daily checking account balance is more accurate, write both dates, an equals sign. The *primary date*, on the left, is used by default; the
separated by an equals sign. The *primary date* goes on the left, and is *secondary date*, on the right, is used when the `--date2` flag is specified
used by default; the *secondary date* goes on the right, and is used when (`--aux-date` or `--effective` will also work).
the `--date2` flag is provided. (You can also spell this `--aux-date`,
like ledger, or `--effective` like older versions).
These used to be called "actual" and "effective" dates. Their meaning is Their meaning is up to you, but it's best to follow a consistent rule. I
up to you, but it's best to follow a consistent rule. I write the bank's write the bank's clearing date as primary, and the date I initiated the
clearing date as primary, and the date I initiated the transaction as transaction as secondary (if needed).
secondary (if needed).
Example: Example:
@ -268,21 +262,34 @@ Example:
$ 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
### Posting dates
[Comments and tags](#comments) are covered below, but while we are talking
about dates: you can give individual postings a different date from their
parent transaction, by adding a posting tag like `date:DATE`, where DATE is
a [simple date](#simple-dates). The secondary date can be set with
`date2:DATE2`. If present, these dates will take precedence in reports.
Ledger's bracketed posting date syntax (`[DATE]`,
`[DATE=DATE2]` or `[=DATE2]` in a posting comment)
is also supported, as an alternate spelling of the date tags.
### Default commodity ### Default commodity
You can set a default commodity or currency with a D directive. This will You can set a default commodity, to be used for any subsequent amounts
be used for any subsequent amounts which have no commodity symbol. which have no commodity symbol, with the D directive:
; default commodity: british pound, comma thousands separator, two decimal places ; set british pound as default commodity
; also sets canonical style for pound amounts, since it's the first one
; (pound symbol on left, comma thousands separator, two decimal places)
D £1,000.00 D £1,000.00
2010/1/1 2010/1/1
a 2340 ; no commodity symbol, will use the above a 2340 ; no symbol, will use pound
b b
If such an amount is the first seen in that commodity, the canonical A default commodity directive may also influence the canonical
[commodity display settings](#commodity-display-settings) will also be [amount style](#commodity-display-settings) for the commodity.
taken from the directive (note: only if it includes a commodity symbol).
### Prices ### Prices
@ -395,18 +402,6 @@ Querying by tag is work in progress; for now you can test for existence of
a tag with `tag:NAME`. a tag with `tag:NAME`.
<!-- tag:NAME=EXACTVALUE` --> <!-- tag:NAME=EXACTVALUE` -->
### Posting dates
You can give individual postings a different date from their parent
transaction, by adding a [posting tag]("tags") like `date:DATE` where
DATE is a [simple date](#simple-dates). The secondary date can be set
with `date2:DATE2`. If present, these dates will take precedence in
reports.
Ledger's bracketed posting date syntax (`[DATE]`,
`[DATE=DATE2]` or `[=DATE2]` in a posting comment)
is also supported, as an alternate spelling of the date tags.
### Including other files ### Including other files
You can pull in the content of additional journal files, by writing lines like this: You can pull in the content of additional journal files, by writing lines like this: