mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-26 03:42:25 +03:00
update generated journal, csv manuals
[ci skip]
This commit is contained in:
parent
240406706a
commit
d4fa546d27
@ -112,15 +112,15 @@ Examples:
|
|||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
\f[C]
|
\f[C]
|
||||||
#\ for\ dates\ like\ "6/11/2013":
|
#\ for\ dates\ like\ "11/06/2013":
|
||||||
date\-format\ %\-d/%\-m/%Y
|
date\-format\ %m/%d/%Y
|
||||||
\f[]
|
\f[]
|
||||||
.fi
|
.fi
|
||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
\f[C]
|
\f[C]
|
||||||
#\ for\ dates\ like\ "11/06/2013":
|
#\ for\ dates\ like\ "6/11/2013"\ (note\ the\ \-\ to\ make\ leading\ zeros\ optional):
|
||||||
date\-format\ %m/%d/%Y
|
date\-format\ %\-d/%\-m/%Y
|
||||||
\f[]
|
\f[]
|
||||||
.fi
|
.fi
|
||||||
.IP
|
.IP
|
||||||
|
@ -113,12 +113,12 @@ File: hledger_csv.info, Node: date-format, Next: field list, Prev: skip, Up:
|
|||||||
DATEFMT is a strptime-like date parsing pattern, which must parse the
|
DATEFMT is a strptime-like date parsing pattern, which must parse the
|
||||||
date field values completely. Examples:
|
date field values completely. Examples:
|
||||||
|
|
||||||
# for dates like "6/11/2013":
|
|
||||||
date-format %-d/%-m/%Y
|
|
||||||
|
|
||||||
# for dates like "11/06/2013":
|
# for dates like "11/06/2013":
|
||||||
date-format %m/%d/%Y
|
date-format %m/%d/%Y
|
||||||
|
|
||||||
|
# for dates like "6/11/2013" (note the - to make leading zeros optional):
|
||||||
|
date-format %-d/%-m/%Y
|
||||||
|
|
||||||
# for dates like "2013-Nov-06":
|
# for dates like "2013-Nov-06":
|
||||||
date-format %Y-%h-%d
|
date-format %Y-%h-%d
|
||||||
|
|
||||||
@ -323,27 +323,27 @@ Node: skip2539
|
|||||||
Ref: #skip2633
|
Ref: #skip2633
|
||||||
Node: date-format2805
|
Node: date-format2805
|
||||||
Ref: #date-format2932
|
Ref: #date-format2932
|
||||||
Node: field list3438
|
Node: field list3482
|
||||||
Ref: #field-list3575
|
Ref: #field-list3619
|
||||||
Node: field assignment4280
|
Node: field assignment4324
|
||||||
Ref: #field-assignment4435
|
Ref: #field-assignment4479
|
||||||
Node: conditional block4939
|
Node: conditional block4983
|
||||||
Ref: #conditional-block5093
|
Ref: #conditional-block5137
|
||||||
Node: include5989
|
Node: include6033
|
||||||
Ref: #include6119
|
Ref: #include6163
|
||||||
Node: newest-first6350
|
Node: newest-first6394
|
||||||
Ref: #newest-first6464
|
Ref: #newest-first6508
|
||||||
Node: CSV TIPS6875
|
Node: CSV TIPS6919
|
||||||
Ref: #csv-tips6969
|
Ref: #csv-tips7013
|
||||||
Node: CSV ordering7087
|
Node: CSV ordering7131
|
||||||
Ref: #csv-ordering7205
|
Ref: #csv-ordering7249
|
||||||
Node: CSV accounts7386
|
Node: CSV accounts7430
|
||||||
Ref: #csv-accounts7524
|
Ref: #csv-accounts7568
|
||||||
Node: CSV amounts7778
|
Node: CSV amounts7822
|
||||||
Ref: #csv-amounts7924
|
Ref: #csv-amounts7968
|
||||||
Node: CSV balance assertions8699
|
Node: CSV balance assertions8743
|
||||||
Ref: #csv-balance-assertions8881
|
Ref: #csv-balance-assertions8925
|
||||||
Node: Reading multiple CSV files9086
|
Node: Reading multiple CSV files9130
|
||||||
Ref: #reading-multiple-csv-files9256
|
Ref: #reading-multiple-csv-files9300
|
||||||
|
|
||||||
End Tag Table
|
End Tag Table
|
||||||
|
@ -88,12 +88,12 @@ CSV RULES
|
|||||||
is a strptime-like date parsing pattern, which must parse the date
|
is a strptime-like date parsing pattern, which must parse the date
|
||||||
field values completely. Examples:
|
field values completely. Examples:
|
||||||
|
|
||||||
# for dates like "6/11/2013":
|
|
||||||
date-format %-d/%-m/%Y
|
|
||||||
|
|
||||||
# for dates like "11/06/2013":
|
# for dates like "11/06/2013":
|
||||||
date-format %m/%d/%Y
|
date-format %m/%d/%Y
|
||||||
|
|
||||||
|
# for dates like "6/11/2013" (note the - to make leading zeros optional):
|
||||||
|
date-format %-d/%-m/%Y
|
||||||
|
|
||||||
# for dates like "2013-Nov-06":
|
# for dates like "2013-Nov-06":
|
||||||
date-format %Y-%h-%d
|
date-format %Y-%h-%d
|
||||||
|
|
||||||
|
@ -635,6 +635,13 @@ Balance assertions are checked against all postings, both real and
|
|||||||
virtual.
|
virtual.
|
||||||
They are not affected by the \f[C]\-\-real/\-R\f[] flag or
|
They are not affected by the \f[C]\-\-real/\-R\f[] flag or
|
||||||
\f[C]real:\f[] query.
|
\f[C]real:\f[] query.
|
||||||
|
.SS Assertions and precision
|
||||||
|
.PP
|
||||||
|
Balance assertions compare the exactly calculated amounts, which are not
|
||||||
|
always what is shown by reports.
|
||||||
|
Eg a commodity directive may limit the display precision, but this will
|
||||||
|
not affect balance assertions.
|
||||||
|
Balance assertion failure messages show exact amounts.
|
||||||
.SS Balance Assignments
|
.SS Balance Assignments
|
||||||
.PP
|
.PP
|
||||||
Ledger\-style balance assignments are also supported.
|
Ledger\-style balance assignments are also supported.
|
||||||
@ -1514,21 +1521,20 @@ Partial or relative dates (M/D, D, tomorrow, last week) in the period
|
|||||||
expression can work (useful or not).
|
expression can work (useful or not).
|
||||||
They will be relative to today's date, unless a Y default year directive
|
They will be relative to today's date, unless a Y default year directive
|
||||||
is in effect, in which case they will be relative to Y/1/1.
|
is in effect, in which case they will be relative to Y/1/1.
|
||||||
|
.SS Two spaces after the period expression
|
||||||
.PP
|
.PP
|
||||||
Period expressions must be terminated by \f[B]two or more spaces\f[] if
|
If the period expression is followed by a transaction description, these
|
||||||
followed by additional fields.
|
must be separated by \f[B]two or more spaces\f[].
|
||||||
For example, the periodic transaction given below includes a transaction
|
This helps hledger know where the period expression ends, so that
|
||||||
description \[lq]paycheck\[rq], which is separated from the period
|
descriptions can not accidentally alter their meaning, as in this
|
||||||
expression by a double space.
|
example:
|
||||||
If not for the second space, hledger would attempt (and fail) to parse
|
|
||||||
\[lq]paycheck\[rq] as a part of the period expression.
|
|
||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
\f[C]
|
\f[C]
|
||||||
;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\ or\ more\ spaces
|
;\ 2\ or\ more\ spaces\ needed\ here,\ so\ the\ period\ is\ not\ understood\ as\ "every\ 2\ months\ in\ 2020"
|
||||||
;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||
|
;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||
|
||||||
;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ vv
|
;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ vv
|
||||||
~\ every\ 2\ weeks\ from\ 2018/6/4\ to\ 2018/9\ \ paycheck
|
~\ every\ 2\ months\ \ in\ 2020,\ we\ will\ review
|
||||||
\ \ \ \ assets:bank:checking\ \ \ $1500
|
\ \ \ \ assets:bank:checking\ \ \ $1500
|
||||||
\ \ \ \ income:acme\ inc
|
\ \ \ \ income:acme\ inc
|
||||||
\f[]
|
\f[]
|
||||||
|
@ -476,6 +476,7 @@ or for reading Ledger files.
|
|||||||
* Assertions and prices::
|
* Assertions and prices::
|
||||||
* Assertions and subaccounts::
|
* Assertions and subaccounts::
|
||||||
* Assertions and virtual postings::
|
* Assertions and virtual postings::
|
||||||
|
* Assertions and precision::
|
||||||
|
|
||||||
|
|
||||||
File: hledger_journal.info, Node: Assertions and ordering, Next: Assertions and included files, Up: Balance Assertions
|
File: hledger_journal.info, Node: Assertions and ordering, Next: Assertions and included files, Up: Balance Assertions
|
||||||
@ -599,7 +600,7 @@ $ hledger bal checking --flat
|
|||||||
2
|
2
|
||||||
|
|
||||||
|
|
||||||
File: hledger_journal.info, Node: Assertions and virtual postings, Prev: Assertions and subaccounts, Up: Balance Assertions
|
File: hledger_journal.info, Node: Assertions and virtual postings, Next: Assertions and precision, Prev: Assertions and subaccounts, Up: Balance Assertions
|
||||||
|
|
||||||
1.9.7 Assertions and virtual postings
|
1.9.7 Assertions and virtual postings
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
@ -608,6 +609,17 @@ Balance assertions are checked against all postings, both real and
|
|||||||
virtual. They are not affected by the '--real/-R' flag or 'real:'
|
virtual. They are not affected by the '--real/-R' flag or 'real:'
|
||||||
query.
|
query.
|
||||||
|
|
||||||
|
|
||||||
|
File: hledger_journal.info, Node: Assertions and precision, Prev: Assertions and virtual postings, Up: Balance Assertions
|
||||||
|
|
||||||
|
1.9.8 Assertions and precision
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
Balance assertions compare the exactly calculated amounts, which are not
|
||||||
|
always what is shown by reports. Eg a commodity directive may limit the
|
||||||
|
display precision, but this will not affect balance assertions. Balance
|
||||||
|
assertion failure messages show exact amounts.
|
||||||
|
|
||||||
|
|
||||||
File: hledger_journal.info, Node: Balance Assignments, Next: Transaction prices, Prev: Balance Assertions, Up: FILE FORMAT
|
File: hledger_journal.info, Node: Balance Assignments, Next: Transaction prices, Prev: Balance Assertions, Up: FILE FORMAT
|
||||||
|
|
||||||
@ -1342,30 +1354,34 @@ date must fall on a natural boundary of the interval. Eg 'monthly from
|
|||||||
expression can work (useful or not). They will be relative to today's
|
expression can work (useful or not). They will be relative to today's
|
||||||
date, unless a Y default year directive is in effect, in which case they
|
date, unless a Y default year directive is in effect, in which case they
|
||||||
will be relative to Y/1/1.
|
will be relative to Y/1/1.
|
||||||
|
|
||||||
Period expressions must be terminated by *two or more spaces* if
|
|
||||||
followed by additional fields. For example, the periodic transaction
|
|
||||||
given below includes a transaction description "paycheck", which is
|
|
||||||
separated from the period expression by a double space. If not for the
|
|
||||||
second space, hledger would attempt (and fail) to parse "paycheck" as a
|
|
||||||
part of the period expression.
|
|
||||||
|
|
||||||
; 2 or more spaces
|
|
||||||
; ||
|
|
||||||
; vv
|
|
||||||
~ every 2 weeks from 2018/6/4 to 2018/9 paycheck
|
|
||||||
assets:bank:checking $1500
|
|
||||||
income:acme inc
|
|
||||||
|
|
||||||
* Menu:
|
* Menu:
|
||||||
|
|
||||||
|
* Two spaces after the period expression::
|
||||||
* Forecasting with periodic transactions::
|
* Forecasting with periodic transactions::
|
||||||
* Budgeting with periodic transactions::
|
* Budgeting with periodic transactions::
|
||||||
|
|
||||||
|
|
||||||
File: hledger_journal.info, Node: Forecasting with periodic transactions, Next: Budgeting with periodic transactions, Up: Periodic transactions
|
File: hledger_journal.info, Node: Two spaces after the period expression, Next: Forecasting with periodic transactions, Up: Periodic transactions
|
||||||
|
|
||||||
1.15.1 Forecasting with periodic transactions
|
1.15.1 Two spaces after the period expression
|
||||||
|
---------------------------------------------
|
||||||
|
|
||||||
|
If the period expression is followed by a transaction description, these
|
||||||
|
must be separated by *two or more spaces*. This helps hledger know
|
||||||
|
where the period expression ends, so that descriptions can not
|
||||||
|
accidentally alter their meaning, as in this example:
|
||||||
|
|
||||||
|
; 2 or more spaces needed here, so the period is not understood as "every 2 months in 2020"
|
||||||
|
; ||
|
||||||
|
; vv
|
||||||
|
~ every 2 months in 2020, we will review
|
||||||
|
assets:bank:checking $1500
|
||||||
|
income:acme inc
|
||||||
|
|
||||||
|
|
||||||
|
File: hledger_journal.info, Node: Forecasting with periodic transactions, Next: Budgeting with periodic transactions, Prev: Two spaces after the period expression, Up: Periodic transactions
|
||||||
|
|
||||||
|
1.15.2 Forecasting with periodic transactions
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
|
|
||||||
With the '--forecast' flag, each periodic transaction rule generates
|
With the '--forecast' flag, each periodic transaction rule generates
|
||||||
@ -1408,7 +1424,7 @@ disables forecast transactions on previous dates.)
|
|||||||
|
|
||||||
File: hledger_journal.info, Node: Budgeting with periodic transactions, Prev: Forecasting with periodic transactions, Up: Periodic transactions
|
File: hledger_journal.info, Node: Budgeting with periodic transactions, Prev: Forecasting with periodic transactions, Up: Periodic transactions
|
||||||
|
|
||||||
1.15.2 Budgeting with periodic transactions
|
1.15.3 Budgeting with periodic transactions
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
With the '--budget' flag, currently supported by the balance command,
|
With the '--budget' flag, currently supported by the balance command,
|
||||||
@ -1549,71 +1565,75 @@ Node: Virtual Postings15032
|
|||||||
Ref: #virtual-postings15191
|
Ref: #virtual-postings15191
|
||||||
Node: Balance Assertions16411
|
Node: Balance Assertions16411
|
||||||
Ref: #balance-assertions16586
|
Ref: #balance-assertions16586
|
||||||
Node: Assertions and ordering17508
|
Node: Assertions and ordering17537
|
||||||
Ref: #assertions-and-ordering17694
|
Ref: #assertions-and-ordering17723
|
||||||
Node: Assertions and included files18394
|
Node: Assertions and included files18423
|
||||||
Ref: #assertions-and-included-files18635
|
Ref: #assertions-and-included-files18664
|
||||||
Node: Assertions and multiple -f options18968
|
Node: Assertions and multiple -f options18997
|
||||||
Ref: #assertions-and-multiple--f-options19222
|
Ref: #assertions-and-multiple--f-options19251
|
||||||
Node: Assertions and commodities19354
|
Node: Assertions and commodities19383
|
||||||
Ref: #assertions-and-commodities19584
|
Ref: #assertions-and-commodities19613
|
||||||
Node: Assertions and prices20772
|
Node: Assertions and prices20801
|
||||||
Ref: #assertions-and-prices20984
|
Ref: #assertions-and-prices21013
|
||||||
Node: Assertions and subaccounts21093
|
Node: Assertions and subaccounts21122
|
||||||
Ref: #assertions-and-subaccounts21320
|
Ref: #assertions-and-subaccounts21349
|
||||||
Node: Assertions and virtual postings21841
|
Node: Assertions and virtual postings21870
|
||||||
Ref: #assertions-and-virtual-postings22048
|
Ref: #assertions-and-virtual-postings22110
|
||||||
Node: Balance Assignments22190
|
Node: Assertions and precision22252
|
||||||
Ref: #balance-assignments22371
|
Ref: #assertions-and-precision22443
|
||||||
Node: Transaction prices23491
|
Node: Balance Assignments22710
|
||||||
Ref: #transaction-prices23660
|
Ref: #balance-assignments22891
|
||||||
Node: Comments25928
|
Node: Transaction prices24011
|
||||||
Ref: #comments26062
|
Ref: #transaction-prices24180
|
||||||
Node: Tags27232
|
Node: Comments26448
|
||||||
Ref: #tags27350
|
Ref: #comments26582
|
||||||
Node: Directives28752
|
Node: Tags27752
|
||||||
Ref: #directives28895
|
Ref: #tags27870
|
||||||
Node: Comment blocks34502
|
Node: Directives29272
|
||||||
Ref: #comment-blocks34647
|
Ref: #directives29415
|
||||||
Node: Including other files34823
|
Node: Comment blocks35022
|
||||||
Ref: #including-other-files35003
|
Ref: #comment-blocks35167
|
||||||
Node: Default year35411
|
Node: Including other files35343
|
||||||
Ref: #default-year35580
|
Ref: #including-other-files35523
|
||||||
Node: Declaring commodities36003
|
Node: Default year35931
|
||||||
Ref: #declaring-commodities36186
|
Ref: #default-year36100
|
||||||
Node: Default commodity37413
|
Node: Declaring commodities36523
|
||||||
Ref: #default-commodity37589
|
Ref: #declaring-commodities36706
|
||||||
Node: Market prices38225
|
Node: Default commodity37933
|
||||||
Ref: #market-prices38390
|
Ref: #default-commodity38109
|
||||||
Node: Declaring accounts39231
|
Node: Market prices38745
|
||||||
Ref: #declaring-accounts39407
|
Ref: #market-prices38910
|
||||||
Node: Account types40364
|
Node: Declaring accounts39751
|
||||||
Ref: #account-types40513
|
Ref: #declaring-accounts39927
|
||||||
Node: Account comments41587
|
Node: Account types40884
|
||||||
Ref: #account-comments41772
|
Ref: #account-types41033
|
||||||
Node: Account display order42093
|
Node: Account comments42107
|
||||||
Ref: #account-display-order42266
|
Ref: #account-comments42292
|
||||||
Node: Rewriting accounts43388
|
Node: Account display order42613
|
||||||
Ref: #rewriting-accounts43573
|
Ref: #account-display-order42786
|
||||||
Node: Basic aliases44307
|
Node: Rewriting accounts43908
|
||||||
Ref: #basic-aliases44453
|
Ref: #rewriting-accounts44093
|
||||||
Node: Regex aliases45157
|
Node: Basic aliases44827
|
||||||
Ref: #regex-aliases45328
|
Ref: #basic-aliases44973
|
||||||
Node: Multiple aliases46046
|
Node: Regex aliases45677
|
||||||
Ref: #multiple-aliases46221
|
Ref: #regex-aliases45848
|
||||||
Node: end aliases46719
|
Node: Multiple aliases46566
|
||||||
Ref: #end-aliases46866
|
Ref: #multiple-aliases46741
|
||||||
Node: Default parent account46967
|
Node: end aliases47239
|
||||||
Ref: #default-parent-account47133
|
Ref: #end-aliases47386
|
||||||
Node: Periodic transactions48017
|
Node: Default parent account47487
|
||||||
Ref: #periodic-transactions48199
|
Ref: #default-parent-account47653
|
||||||
Node: Forecasting with periodic transactions49902
|
Node: Periodic transactions48537
|
||||||
Ref: #forecasting-with-periodic-transactions50145
|
Ref: #periodic-transactions48719
|
||||||
Node: Budgeting with periodic transactions51832
|
Node: Two spaces after the period expression49844
|
||||||
Ref: #budgeting-with-periodic-transactions52071
|
Ref: #two-spaces-after-the-period-expression50089
|
||||||
Node: Transaction Modifiers52530
|
Node: Forecasting with periodic transactions50574
|
||||||
Ref: #transaction-modifiers52693
|
Ref: #forecasting-with-periodic-transactions50864
|
||||||
Node: EDITOR SUPPORT54674
|
Node: Budgeting with periodic transactions52551
|
||||||
Ref: #editor-support54792
|
Ref: #budgeting-with-periodic-transactions52790
|
||||||
|
Node: Transaction Modifiers53249
|
||||||
|
Ref: #transaction-modifiers53412
|
||||||
|
Node: EDITOR SUPPORT55393
|
||||||
|
Ref: #editor-support55511
|
||||||
|
|
||||||
End Tag Table
|
End Tag Table
|
||||||
|
@ -472,11 +472,17 @@ FILE FORMAT
|
|||||||
Balance assertions are checked against all postings, both real and vir-
|
Balance assertions are checked against all postings, both real and vir-
|
||||||
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.
|
||||||
|
|
||||||
|
Assertions and precision
|
||||||
|
Balance assertions compare the exactly calculated amounts, which are
|
||||||
|
not always what is shown by reports. Eg a commodity directive may
|
||||||
|
limit the display precision, but this will not affect balance asser-
|
||||||
|
tions. Balance assertion failure messages show exact amounts.
|
||||||
|
|
||||||
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
|
||||||
@ -494,17 +500,17 @@ 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.
|
||||||
|
|
||||||
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. Note transaction prices are
|
record purchases of a foreign currency. Note transaction prices are
|
||||||
fixed at the time of the transaction, and do not change over time. See
|
fixed at the time of the transaction, and do not change over time. See
|
||||||
also market prices, which represent prevailing exchange rates on a cer-
|
also market prices, which represent prevailing exchange rates on a cer-
|
||||||
tain date.
|
tain date.
|
||||||
@ -533,7 +539,7 @@ FILE FORMAT
|
|||||||
(Ledger users: Ledger uses a different syntax for fixed prices, {=UNIT-
|
(Ledger users: Ledger uses a different syntax for fixed prices, {=UNIT-
|
||||||
PRICE}, which hledger currently ignores).
|
PRICE}, which hledger currently ignores).
|
||||||
|
|
||||||
Use the -B/--cost flag to convert amounts to their transaction price's
|
Use the -B/--cost flag to convert amounts to their transaction price's
|
||||||
commodity, if any. (mnemonic: "B" is from "cost Basis", as in Ledger).
|
commodity, if any. (mnemonic: "B" is from "cost Basis", as in Ledger).
|
||||||
Eg here is how -B affects the balance report for the example above:
|
Eg here is how -B affects the balance report for the example above:
|
||||||
|
|
||||||
@ -544,8 +550,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:
|
||||||
|
|
||||||
@ -559,14 +565,14 @@ FILE FORMAT
|
|||||||
|
|
||||||
Comments
|
Comments
|
||||||
Lines in the journal beginning with a semicolon (;) or hash (#) or star
|
Lines in the journal beginning with a semicolon (;) or hash (#) or star
|
||||||
(*) are comments, and will be ignored. (Star comments cause org-mode
|
(*) are comments, and will be ignored. (Star comments cause org-mode
|
||||||
nodes to be ignored, allowing emacs users to fold and navigate their
|
nodes to be ignored, allowing emacs users to fold and navigate their
|
||||||
journals with org-mode or orgstruct-mode.)
|
journals with org-mode or orgstruct-mode.)
|
||||||
|
|
||||||
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.
|
||||||
Transaction and posting comments must begin with a semicolon (;).
|
Transaction and posting comments must begin with a semicolon (;).
|
||||||
|
|
||||||
Some examples:
|
Some examples:
|
||||||
@ -590,24 +596,24 @@ FILE FORMAT
|
|||||||
; another comment line for posting 2
|
; another comment line for posting 2
|
||||||
; a file comment (because not indented)
|
; a file comment (because not indented)
|
||||||
|
|
||||||
You can also comment larger regions of a file using comment and
|
You can also comment larger regions of a file using comment and
|
||||||
end comment directives.
|
end comment directives.
|
||||||
|
|
||||||
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:
|
||||||
|
|
||||||
@ -621,74 +627,68 @@ 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.
|
||||||
|
|
||||||
Directives
|
Directives
|
||||||
A directive is a line in the journal beginning with a special keyword,
|
A directive is a line in the journal beginning with a special keyword,
|
||||||
that influences how the journal is processed. hledger's directives are
|
that influences how the journal is processed. hledger's directives are
|
||||||
based on a subset of Ledger's, but there are many differences (and also
|
based on a subset of Ledger's, but there are many differences (and also
|
||||||
some differences between hledger versions).
|
some differences between hledger versions).
|
||||||
|
|
||||||
Directives' behaviour and interactions can get a little bit complex, so
|
Directives' behaviour and interactions can get a little bit complex, so
|
||||||
here is a table summarising the directives and their effects, with
|
here is a table summarising the directives and their effects, with
|
||||||
links to more detailed docs.
|
links to more detailed docs.
|
||||||
|
|
||||||
|
|
||||||
direc- end subdi- purpose can affect (as of
|
direc- end subdi- purpose can affect (as of
|
||||||
tive directive rec- 2018/06)
|
tive directive rec- 2018/06)
|
||||||
tives
|
tives
|
||||||
-------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------
|
||||||
account any document account names, all entries in all
|
account any document account names, all entries in all
|
||||||
text declare account types & dis- files, before or
|
text declare account types & dis- files, before or
|
||||||
play order after
|
play order after
|
||||||
alias end aliases rewrite account names following
|
alias end aliases rewrite account names following
|
||||||
inline/included
|
inline/included
|
||||||
entries until end
|
entries until end
|
||||||
of current file or
|
of current file or
|
||||||
end directive
|
end directive
|
||||||
apply account end apply account prepend a common parent to following
|
apply account end apply account prepend a common parent to following
|
||||||
account names inline/included
|
account names inline/included
|
||||||
entries until end
|
entries until end
|
||||||
of current file or
|
of current file or
|
||||||
end directive
|
end directive
|
||||||
comment end comment ignore part of journal following
|
comment end comment ignore part of journal following
|
||||||
inline/included
|
inline/included
|
||||||
entries until end
|
entries until end
|
||||||
of current file or
|
of current file or
|
||||||
end directive
|
end directive
|
||||||
commodity format declare a commodity and its number notation:
|
commodity format declare a commodity and its number notation:
|
||||||
number notation & display following entries
|
number notation & display following entries
|
||||||
style in that commodity
|
style in that commodity
|
||||||
in all files; dis-
|
in all files; dis-
|
||||||
play style: amounts
|
play style: amounts
|
||||||
of that commodity
|
of that commodity
|
||||||
in reports
|
in reports
|
||||||
|
|
||||||
|
|
||||||
|
D declare a commodity, number commodity: all com-
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
D declare a commodity, number commodity: all com-
|
|
||||||
notation & display style for modityless entries
|
notation & display style for modityless entries
|
||||||
commodityless amounts in all files; num-
|
commodityless amounts in all files; num-
|
||||||
ber notation: fol-
|
ber notation: fol-
|
||||||
lowing commodity-
|
lowing commodity-
|
||||||
less entries and
|
less entries and
|
||||||
entries in that
|
entries in that
|
||||||
commodity in all
|
commodity in all
|
||||||
files; display
|
files; display
|
||||||
style: amounts of
|
style: amounts of
|
||||||
that commodity in
|
that commodity in
|
||||||
@ -699,7 +699,7 @@ FILE FORMAT
|
|||||||
commodity commodity in
|
commodity commodity in
|
||||||
reports, when -V is
|
reports, when -V is
|
||||||
used
|
used
|
||||||
Y declare a year for yearless following
|
Y declare a year for yearless following
|
||||||
dates inline/included
|
dates inline/included
|
||||||
entries until end
|
entries until end
|
||||||
of current file
|
of current file
|
||||||
@ -709,9 +709,9 @@ FILE FORMAT
|
|||||||
|
|
||||||
subdirec- optional indented directive line immediately following a par-
|
subdirec- optional indented directive line immediately following a par-
|
||||||
tive ent directive
|
tive ent directive
|
||||||
number how to interpret numbers when parsing journal entries (the
|
number how to interpret numbers when parsing journal entries (the
|
||||||
notation identity of the decimal separator character). (Currently
|
notation identity of the decimal separator character). (Currently
|
||||||
each commodity can have its own notation, even in the same
|
each commodity can have its own notation, even in the same
|
||||||
file.)
|
file.)
|
||||||
display how to display amounts of a commodity in reports (symbol side
|
display how to display amounts of a commodity in reports (symbol side
|
||||||
style and spacing, digit groups, decimal separator, decimal places)
|
style and spacing, digit groups, decimal separator, decimal places)
|
||||||
@ -719,37 +719,37 @@ FILE FORMAT
|
|||||||
scope are affected by a directive
|
scope are affected by a directive
|
||||||
|
|
||||||
As you can see, directives vary in which journal entries and files they
|
As you can see, directives vary in which journal entries and files they
|
||||||
affect, and whether they are focussed on input (parsing) or output
|
affect, and whether they are focussed on input (parsing) or output
|
||||||
(reports). Some directives have multiple effects.
|
(reports). Some directives have multiple effects.
|
||||||
|
|
||||||
If you have a journal made up of multiple files, or pass multiple -f
|
If you have a journal made up of multiple files, or pass multiple -f
|
||||||
options on the command line, note that directives which affect input
|
options on the command line, note that directives which affect input
|
||||||
typically last only until the end of their defining file. This pro-
|
typically last only until the end of their defining file. This pro-
|
||||||
vides more simplicity and predictability, eg reports are not changed by
|
vides more simplicity and predictability, eg reports are not changed by
|
||||||
writing file options in a different order. It can be surprising at
|
writing file options in a different order. It can be surprising at
|
||||||
times though.
|
times though.
|
||||||
|
|
||||||
Comment blocks
|
Comment blocks
|
||||||
A line containing just comment starts a commented region of the file,
|
A line containing just comment starts a commented region of the file,
|
||||||
and a line containing just end comment (or the end of the current file)
|
and a line containing just end comment (or the end of the current file)
|
||||||
ends it. See also comments.
|
ends it. See also comments.
|
||||||
|
|
||||||
Including other files
|
Including other files
|
||||||
You can pull in the content of additional files by writing an include
|
You can pull in the content of additional files by writing an include
|
||||||
directive, like this:
|
directive, like this:
|
||||||
|
|
||||||
include path/to/file.journal
|
include path/to/file.journal
|
||||||
|
|
||||||
If the path does not begin with a slash, it is relative to the current
|
If the path does not begin with a slash, it is relative to the current
|
||||||
file. The include file path may contain common glob patterns (e.g.
|
file. The include file path may contain common glob patterns (e.g.
|
||||||
*).
|
*).
|
||||||
|
|
||||||
The include directive can only be used in journal files. It can
|
The include directive can only be used in journal files. It can
|
||||||
include journal, timeclock or timedot files, but not CSV files.
|
include journal, timeclock or timedot files, but not CSV files.
|
||||||
|
|
||||||
Default year
|
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
|
||||||
specify a year. This is a line beginning with Y followed by the year.
|
specify a year. This is a line beginning with Y followed by the year.
|
||||||
Eg:
|
Eg:
|
||||||
|
|
||||||
Y2009 ; set default year to 2009
|
Y2009 ; set default year to 2009
|
||||||
@ -769,8 +769,8 @@ FILE FORMAT
|
|||||||
assets
|
assets
|
||||||
|
|
||||||
Declaring commodities
|
Declaring commodities
|
||||||
The commodity directive declares commodities which may be used in the
|
The commodity directive declares commodities which may be used in the
|
||||||
journal (though currently we do not enforce this). It may be written
|
journal (though currently we do not enforce this). It may be written
|
||||||
on a single line, like this:
|
on a single line, like this:
|
||||||
|
|
||||||
; commodity EXAMPLEAMOUNT
|
; commodity EXAMPLEAMOUNT
|
||||||
@ -780,8 +780,8 @@ FILE FORMAT
|
|||||||
; separating thousands with comma.
|
; separating thousands with comma.
|
||||||
commodity 1,000.0000 AAAA
|
commodity 1,000.0000 AAAA
|
||||||
|
|
||||||
or on multiple lines, using the "format" subdirective. In this case
|
or on multiple lines, using the "format" subdirective. In this case
|
||||||
the commodity symbol appears twice and should be the same in both
|
the commodity symbol appears twice and should be the same in both
|
||||||
places:
|
places:
|
||||||
|
|
||||||
; commodity SYMBOL
|
; commodity SYMBOL
|
||||||
@ -793,19 +793,19 @@ FILE FORMAT
|
|||||||
commodity INR
|
commodity INR
|
||||||
format INR 9,99,99,999.00
|
format INR 9,99,99,999.00
|
||||||
|
|
||||||
Commodity directives have a second purpose: they define the standard
|
Commodity directives have a second purpose: they define the standard
|
||||||
display format for amounts in the commodity. Normally the display for-
|
display format for amounts in the commodity. Normally the display for-
|
||||||
mat is inferred from journal entries, but this can be unpredictable;
|
mat is inferred from journal entries, but this can be unpredictable;
|
||||||
declaring it with a commodity directive overrides this and removes
|
declaring it with a commodity directive overrides this and removes
|
||||||
ambiguity. Towards this end, amounts in commodity directives must
|
ambiguity. Towards this end, amounts in commodity directives must
|
||||||
always be written with a decimal point (a period or comma, followed by
|
always be written with a decimal point (a period or comma, followed by
|
||||||
0 or more decimal digits).
|
0 or more decimal digits).
|
||||||
|
|
||||||
Default commodity
|
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
|
||||||
used for amounts without a commodity symbol (ie, plain numbers). (Note
|
used for amounts without a commodity symbol (ie, plain numbers). (Note
|
||||||
this differs from Ledger's default commodity directive.) The commodity
|
this differs from Ledger's default commodity directive.) The commodity
|
||||||
and display format will be applied to all subsequent commodity-less
|
and display format will be applied to all subsequent commodity-less
|
||||||
amounts, or until the next D directive.
|
amounts, or until the next D directive.
|
||||||
|
|
||||||
# commodity-less amounts should be treated as dollars
|
# commodity-less amounts should be treated as dollars
|
||||||
@ -820,9 +820,9 @@ FILE FORMAT
|
|||||||
a decimal point.
|
a decimal point.
|
||||||
|
|
||||||
Market prices
|
Market prices
|
||||||
The P directive declares a market price, which is an exchange rate
|
The P directive declares a market price, which is an exchange rate
|
||||||
between two commodities on a certain date. (In Ledger, they are called
|
between two commodities on a certain date. (In Ledger, they are called
|
||||||
"historical prices".) These are often obtained from a stock exchange,
|
"historical prices".) These are often obtained from a stock exchange,
|
||||||
cryptocurrency exchange, or the foreign exchange market.
|
cryptocurrency exchange, or the foreign exchange market.
|
||||||
|
|
||||||
Here is the format:
|
Here is the format:
|
||||||
@ -833,36 +833,36 @@ FILE FORMAT
|
|||||||
|
|
||||||
o COMMODITYA is the symbol of the commodity being priced
|
o COMMODITYA is the symbol of the commodity being priced
|
||||||
|
|
||||||
o COMMODITYBAMOUNT is an amount (symbol and quantity) in a second com-
|
o COMMODITYBAMOUNT is an amount (symbol and quantity) in a second com-
|
||||||
modity, giving the price in commodity B of one unit of commodity A.
|
modity, giving the price in commodity B of one unit of commodity A.
|
||||||
|
|
||||||
These two market price directives say that one euro was worth 1.35 US
|
These two market price directives say that one euro was worth 1.35 US
|
||||||
dollars during 2009, and $1.40 from 2010 onward:
|
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
|
||||||
|
|
||||||
The -V/--value flag can be used to convert reported amounts to another
|
The -V/--value flag can be used to convert reported amounts to another
|
||||||
commodity using these prices.
|
commodity using these prices.
|
||||||
|
|
||||||
Declaring accounts
|
Declaring accounts
|
||||||
account directives can be used to pre-declare some or all accounts.
|
account directives can be used to pre-declare some or all accounts.
|
||||||
Though not required, they can provide several benefits:
|
Though not required, they can provide several benefits:
|
||||||
|
|
||||||
o They can document your intended chart of accounts, providing a refer-
|
o They can document your intended chart of accounts, providing a refer-
|
||||||
ence.
|
ence.
|
||||||
|
|
||||||
o They can store extra information about accounts (account numbers,
|
o They can store extra information about accounts (account numbers,
|
||||||
notes, etc.)
|
notes, etc.)
|
||||||
|
|
||||||
o They can help hledger know your accounts' types (asset, liability,
|
o They can help hledger know your accounts' types (asset, liability,
|
||||||
equity, revenue, expense), useful for reports like balancesheet and
|
equity, revenue, expense), useful for reports like balancesheet and
|
||||||
incomestatement.
|
incomestatement.
|
||||||
|
|
||||||
o They control account display order in reports, allowing non-alpha-
|
o They control account display order in reports, allowing non-alpha-
|
||||||
betic sorting (eg Revenues to appear above Expenses).
|
betic sorting (eg Revenues to appear above Expenses).
|
||||||
|
|
||||||
o They help with account name completion in the add command,
|
o They help with account name completion in the add command,
|
||||||
hledger-iadd, hledger-web, ledger-mode etc.
|
hledger-iadd, hledger-web, ledger-mode etc.
|
||||||
|
|
||||||
Here is the full syntax:
|
Here is the full syntax:
|
||||||
@ -875,15 +875,15 @@ FILE FORMAT
|
|||||||
account assets:bank:checking
|
account assets:bank:checking
|
||||||
|
|
||||||
Account types
|
Account types
|
||||||
hledger recognises five types of account: asset, liability, equity,
|
hledger recognises five types of account: asset, liability, equity,
|
||||||
revenue, expense. This is useful for certain accounting-aware reports,
|
revenue, expense. This is useful for certain accounting-aware reports,
|
||||||
in particular balancesheet, incomestatement and cashflow.
|
in particular balancesheet, incomestatement and cashflow.
|
||||||
|
|
||||||
If you name your top-level accounts with some variation of assets, lia-
|
If you name your top-level accounts with some variation of assets, lia-
|
||||||
bilities/debts, equity, revenues/income, or expenses, their types are
|
bilities/debts, equity, revenues/income, or expenses, their types are
|
||||||
detected automatically.
|
detected automatically.
|
||||||
|
|
||||||
More generally, you can declare an account's type by adding one of the
|
More generally, you can declare an account's type by adding one of the
|
||||||
letters ALERX to its account directive, separated from the account name
|
letters ALERX to its account directive, separated from the account name
|
||||||
by two or more spaces. Eg:
|
by two or more spaces. Eg:
|
||||||
|
|
||||||
@ -893,8 +893,8 @@ FILE FORMAT
|
|||||||
account revenues R
|
account revenues R
|
||||||
account expenses X
|
account expenses X
|
||||||
|
|
||||||
Note: if you ever override the types of those auto-detected english
|
Note: if you ever override the types of those auto-detected english
|
||||||
account names mentioned above, you might need to help the reports a
|
account names mentioned above, you might need to help the reports a
|
||||||
bit:
|
bit:
|
||||||
|
|
||||||
; make "liabilities" not have the liability type, who knows why
|
; make "liabilities" not have the liability type, who knows why
|
||||||
@ -907,22 +907,22 @@ FILE FORMAT
|
|||||||
)
|
)
|
||||||
|
|
||||||
Account comments
|
Account comments
|
||||||
An account directive can also have indented comments on following
|
An account directive can also have indented comments on following
|
||||||
lines, eg:
|
lines, eg:
|
||||||
|
|
||||||
account assets:bank:checking
|
account assets:bank:checking
|
||||||
; acctno:12345
|
; acctno:12345
|
||||||
; a comment
|
; a comment
|
||||||
|
|
||||||
We also allow (and ignore) Ledger-style subdirectives, with no leading
|
We also allow (and ignore) Ledger-style subdirectives, with no leading
|
||||||
semicolon, for compatibility.
|
semicolon, for compatibility.
|
||||||
|
|
||||||
Tags in account comments, like acctno above, currently have no effect.
|
Tags in account comments, like acctno above, currently have no effect.
|
||||||
|
|
||||||
Account display order
|
Account display order
|
||||||
Account directives also set the order in which accounts are displayed
|
Account directives also set the order in which accounts are displayed
|
||||||
in reports, the hledger-ui accounts screen, the hledger-web sidebar,
|
in reports, the hledger-ui accounts screen, the hledger-web sidebar,
|
||||||
etc. Normally accounts are listed in alphabetical order, but if you
|
etc. Normally accounts are listed in alphabetical order, but if you
|
||||||
have eg these account directives in the journal:
|
have eg these account directives in the journal:
|
||||||
|
|
||||||
account assets
|
account assets
|
||||||
@ -931,7 +931,7 @@ FILE FORMAT
|
|||||||
account revenues
|
account revenues
|
||||||
account expenses
|
account expenses
|
||||||
|
|
||||||
you'll see those accounts listed in declaration order, not alphabeti-
|
you'll see those accounts listed in declaration order, not alphabeti-
|
||||||
cally:
|
cally:
|
||||||
|
|
||||||
$ hledger accounts -1
|
$ hledger accounts -1
|
||||||
@ -943,16 +943,16 @@ FILE FORMAT
|
|||||||
|
|
||||||
Undeclared accounts, if any, are displayed last, in alphabetical order.
|
Undeclared accounts, if any, are displayed last, in alphabetical order.
|
||||||
|
|
||||||
Note that sorting is done at each level of the account tree (within
|
Note that sorting is done at each level of the account tree (within
|
||||||
each group of sibling accounts under the same parent). And currently,
|
each group of sibling accounts under the same parent). And currently,
|
||||||
this directive:
|
this directive:
|
||||||
|
|
||||||
account other:zoo
|
account other:zoo
|
||||||
|
|
||||||
would influence the position of zoo among other's subaccounts, but not
|
would influence the position of zoo among other's subaccounts, but not
|
||||||
the position of other among the top-level accounts. This means: - you
|
the position of other among the top-level accounts. This means: - you
|
||||||
will sometimes declare parent accounts (eg account other above) that
|
will sometimes declare parent accounts (eg account other above) that
|
||||||
you don't intend to post to, just to customize their display order -
|
you don't intend to post to, just to customize their display order -
|
||||||
sibling accounts stay together (you couldn't display x:y in between a:b
|
sibling accounts stay together (you couldn't display x:y in between a:b
|
||||||
and a:c).
|
and a:c).
|
||||||
|
|
||||||
@ -971,14 +971,14 @@ FILE FORMAT
|
|||||||
o customising reports
|
o customising reports
|
||||||
|
|
||||||
Account aliases also rewrite account names in account directives. They
|
Account aliases also rewrite account names in account directives. They
|
||||||
do not affect account names being entered via hledger add or
|
do not affect account names being entered via hledger add or
|
||||||
hledger-web.
|
hledger-web.
|
||||||
|
|
||||||
See also Cookbook: Rewrite account names.
|
See also Cookbook: Rewrite account names.
|
||||||
|
|
||||||
Basic aliases
|
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.
|
||||||
This affects all subsequent journal entries in the current file or its
|
This affects all subsequent journal entries in the current file or its
|
||||||
included files. The spaces around the = are optional:
|
included files. The spaces around the = are optional:
|
||||||
|
|
||||||
alias OLD = NEW
|
alias OLD = NEW
|
||||||
@ -986,54 +986,54 @@ FILE FORMAT
|
|||||||
Or, you can use the --alias 'OLD=NEW' option on the command line. This
|
Or, you can use the --alias 'OLD=NEW' option on the command line. This
|
||||||
affects all entries. It's useful for trying out aliases interactively.
|
affects all entries. It's useful for trying out aliases interactively.
|
||||||
|
|
||||||
OLD and NEW are case sensitive full account names. hledger will
|
OLD and NEW are case sensitive full account names. hledger will
|
||||||
replace any occurrence of the old account name with the new one. Sub-
|
replace any occurrence of the old account name with the new one. Sub-
|
||||||
accounts are also affected. Eg:
|
accounts are also affected. Eg:
|
||||||
|
|
||||||
alias checking = assets:bank:wells fargo:checking
|
alias checking = assets:bank:wells fargo:checking
|
||||||
# rewrites "checking" to "assets:bank:wells fargo:checking", or "checking:a" to "assets:bank:wells fargo:checking:a"
|
# rewrites "checking" to "assets:bank:wells fargo:checking", or "checking:a" to "assets:bank:wells fargo:checking:a"
|
||||||
|
|
||||||
Regex aliases
|
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,
|
||||||
indicated by the forward slashes:
|
indicated by the forward slashes:
|
||||||
|
|
||||||
alias /REGEX/ = REPLACEMENT
|
alias /REGEX/ = REPLACEMENT
|
||||||
|
|
||||||
or --alias '/REGEX/=REPLACEMENT'.
|
or --alias '/REGEX/=REPLACEMENT'.
|
||||||
|
|
||||||
REGEX is a case-insensitive regular expression. Anywhere it matches
|
REGEX is a case-insensitive regular expression. Anywhere it matches
|
||||||
inside an account name, the matched part will be replaced by REPLACE-
|
inside an account name, the matched part will be replaced by REPLACE-
|
||||||
MENT. If REGEX contains parenthesised match groups, these can be ref-
|
MENT. If REGEX contains parenthesised match groups, these can be ref-
|
||||||
erenced by the usual numeric backreferences in REPLACEMENT. Eg:
|
erenced by the usual numeric backreferences in REPLACEMENT. Eg:
|
||||||
|
|
||||||
alias /^(.+):bank:([^:]+)(.*)/ = \1:\2 \3
|
alias /^(.+):bank:([^:]+)(.*)/ = \1:\2 \3
|
||||||
# rewrites "assets:bank:wells fargo:checking" to "assets:wells fargo checking"
|
# rewrites "assets:bank:wells fargo:checking" to "assets:wells fargo checking"
|
||||||
|
|
||||||
Also note that REPLACEMENT continues to the end of line (or on command
|
Also note that REPLACEMENT continues to the end of line (or on command
|
||||||
line, to end of option argument), so it can contain trailing white-
|
line, to end of option argument), so it can contain trailing white-
|
||||||
space.
|
space.
|
||||||
|
|
||||||
Multiple aliases
|
Multiple aliases
|
||||||
You can define as many aliases as you like using directives or com-
|
You can define as many aliases as you like using directives or com-
|
||||||
mand-line options. Aliases are recursive - each alias sees the result
|
mand-line options. Aliases are recursive - each alias sees the result
|
||||||
of applying previous ones. (This is different from Ledger, where
|
of applying previous ones. (This is different from Ledger, where
|
||||||
aliases are non-recursive by default). Aliases are applied in the fol-
|
aliases are non-recursive by default). Aliases are applied in the fol-
|
||||||
lowing order:
|
lowing order:
|
||||||
|
|
||||||
1. alias directives, most recently seen first (recent directives take
|
1. alias directives, most recently seen first (recent directives take
|
||||||
precedence over earlier ones; directives not yet seen are ignored)
|
precedence over earlier ones; directives not yet seen are ignored)
|
||||||
|
|
||||||
2. alias options, in the order they appear on the command line
|
2. alias options, in the order they appear on the command line
|
||||||
|
|
||||||
end aliases
|
end aliases
|
||||||
You can clear (forget) all currently defined aliases with the
|
You can clear (forget) all currently defined aliases with the
|
||||||
end aliases directive:
|
end aliases directive:
|
||||||
|
|
||||||
end aliases
|
end aliases
|
||||||
|
|
||||||
Default parent account
|
Default parent account
|
||||||
You can specify a parent account which will be prepended to all
|
You can specify a parent account which will be prepended to all
|
||||||
accounts within a section of the journal. Use the apply account and
|
accounts within a section of the journal. Use the apply account and
|
||||||
end apply account directives like so:
|
end apply account directives like so:
|
||||||
|
|
||||||
apply account home
|
apply account home
|
||||||
@ -1050,7 +1050,7 @@ FILE FORMAT
|
|||||||
home:food $10
|
home:food $10
|
||||||
home:cash $-10
|
home:cash $-10
|
||||||
|
|
||||||
If end apply account is omitted, the effect lasts to the end of the
|
If end apply account is omitted, the effect lasts to the end of the
|
||||||
file. Included files are also affected, eg:
|
file. Included files are also affected, eg:
|
||||||
|
|
||||||
apply account business
|
apply account business
|
||||||
@ -1059,18 +1059,18 @@ FILE FORMAT
|
|||||||
apply account personal
|
apply account personal
|
||||||
include personal.journal
|
include personal.journal
|
||||||
|
|
||||||
Prior to hledger 1.0, legacy account and end spellings were also sup-
|
Prior to hledger 1.0, legacy account and end spellings were also sup-
|
||||||
ported.
|
ported.
|
||||||
|
|
||||||
A default parent account also affects account directives. It does not
|
A default parent account also affects account directives. It does not
|
||||||
affect account names being entered via hledger add or hledger-web. If
|
affect account names being entered via hledger add or hledger-web. If
|
||||||
account aliases are present, they are applied after the default parent
|
account aliases are present, they are applied after the default parent
|
||||||
account.
|
account.
|
||||||
|
|
||||||
Periodic transactions
|
Periodic transactions
|
||||||
Periodic transaction rules describe transactions that recur. They
|
Periodic transaction rules describe transactions that recur. They
|
||||||
allow you to generate future transactions for forecasting, without hav-
|
allow you to generate future transactions for forecasting, without hav-
|
||||||
ing to write them out explicitly in the journal (with --forecast).
|
ing to write them out explicitly in the journal (with --forecast).
|
||||||
Secondly, they also can be used to define budget goals (with --budget).
|
Secondly, they also can be used to define budget goals (with --budget).
|
||||||
|
|
||||||
A periodic transaction rule looks like a normal journal entry, with the
|
A periodic transaction rule looks like a normal journal entry, with the
|
||||||
@ -1081,89 +1081,88 @@ FILE FORMAT
|
|||||||
expenses:rent $2000
|
expenses:rent $2000
|
||||||
assets:bank:checking
|
assets:bank:checking
|
||||||
|
|
||||||
There is an additional constraint on the period expression: the start
|
There is an additional constraint on the period expression: the start
|
||||||
date must fall on a natural boundary of the interval. Eg
|
date must fall on a natural boundary of the interval. Eg
|
||||||
monthly from 2018/1/1 is valid, but monthly from 2018/1/15 is not.
|
monthly from 2018/1/1 is valid, but monthly from 2018/1/15 is not.
|
||||||
|
|
||||||
Partial or relative dates (M/D, D, tomorrow, last week) in the period
|
Partial or relative dates (M/D, D, tomorrow, last week) in the period
|
||||||
expression can work (useful or not). They will be relative to today's
|
expression can work (useful or not). They will be relative to today's
|
||||||
date, unless a Y default year directive is in effect, in which case
|
date, unless a Y default year directive is in effect, in which case
|
||||||
they will be relative to Y/1/1.
|
they will be relative to Y/1/1.
|
||||||
|
|
||||||
Period expressions must be terminated by two or more spaces if followed
|
Two spaces after the period expression
|
||||||
by additional fields. For example, the periodic transaction given
|
If the period expression is followed by a transaction description,
|
||||||
below includes a transaction description "paycheck", which is separated
|
these must be separated by two or more spaces. This helps hledger know
|
||||||
from the period expression by a double space. If not for the second
|
where the period expression ends, so that descriptions can not acciden-
|
||||||
space, hledger would attempt (and fail) to parse "paycheck" as a part
|
tally alter their meaning, as in this example:
|
||||||
of the period expression.
|
|
||||||
|
|
||||||
; 2 or more spaces
|
; 2 or more spaces needed here, so the period is not understood as "every 2 months in 2020"
|
||||||
; ||
|
; ||
|
||||||
; vv
|
; vv
|
||||||
~ every 2 weeks from 2018/6/4 to 2018/9 paycheck
|
~ every 2 months in 2020, we will review
|
||||||
assets:bank:checking $1500
|
assets:bank:checking $1500
|
||||||
income:acme inc
|
income:acme inc
|
||||||
|
|
||||||
Forecasting with periodic transactions
|
Forecasting with periodic transactions
|
||||||
With the --forecast flag, each periodic transaction rule generates
|
With the --forecast flag, each periodic transaction rule generates
|
||||||
future transactions recurring at the specified interval. These are not
|
future transactions recurring at the specified interval. These are not
|
||||||
saved in the journal, but appear in all reports. They will look like
|
saved in the journal, but appear in all reports. They will look like
|
||||||
normal transactions, but with an extra tag named recur, whose value is
|
normal transactions, but with an extra tag named recur, whose value is
|
||||||
the generating period expression.
|
the generating period expression.
|
||||||
|
|
||||||
Forecast transactions start on the first occurrence, and end on the
|
Forecast transactions start on the first occurrence, and end on the
|
||||||
last occurrence, of their interval within the forecast period. The
|
last occurrence, of their interval within the forecast period. The
|
||||||
forecast period:
|
forecast period:
|
||||||
|
|
||||||
o begins on the later of
|
o begins on the later of
|
||||||
|
|
||||||
o the report start date if specified with -b/-p/date:
|
o the report start date if specified with -b/-p/date:
|
||||||
|
|
||||||
o the day after the latest normal (non-periodic) transaction in the
|
o the day after the latest normal (non-periodic) transaction in the
|
||||||
journal, or today if there are no normal transactions.
|
journal, or today if there are no normal transactions.
|
||||||
|
|
||||||
o ends on the report end date if specified with -e/-p/date:, or 180
|
o ends on the report end date if specified with -e/-p/date:, or 180
|
||||||
days from today.
|
days from today.
|
||||||
|
|
||||||
where "today" means the current date at report time. The "later of"
|
where "today" means the current date at report time. The "later of"
|
||||||
rule ensures that forecast transactions do not overlap normal transac-
|
rule ensures that forecast transactions do not overlap normal transac-
|
||||||
tions in time; they will begin only after normal transactions end.
|
tions in time; they will begin only after normal transactions end.
|
||||||
|
|
||||||
Forecasting can be useful for estimating balances into the future, and
|
Forecasting can be useful for estimating balances into the future, and
|
||||||
experimenting with different scenarios. Note the start date logic
|
experimenting with different scenarios. Note the start date logic
|
||||||
means that forecasted transactions are automatically replaced by normal
|
means that forecasted transactions are automatically replaced by normal
|
||||||
transactions as you add those.
|
transactions as you add those.
|
||||||
|
|
||||||
Forecasting can also help with data entry: describe most of your trans-
|
Forecasting can also help with data entry: describe most of your trans-
|
||||||
actions with periodic rules, and every so often copy the output of
|
actions with periodic rules, and every so often copy the output of
|
||||||
print --forecast to the journal.
|
print --forecast to the journal.
|
||||||
|
|
||||||
You can generate one-time transactions too: just write a period expres-
|
You can generate one-time transactions too: just write a period expres-
|
||||||
sion specifying a date with no report interval. (You could also write
|
sion specifying a date with no report interval. (You could also write
|
||||||
a normal transaction with a future date, but remember this disables
|
a normal transaction with a future date, but remember this disables
|
||||||
forecast transactions on previous dates.)
|
forecast transactions on previous dates.)
|
||||||
|
|
||||||
Budgeting with periodic transactions
|
Budgeting with periodic transactions
|
||||||
With the --budget flag, currently supported by the balance command,
|
With the --budget flag, currently supported by the balance command,
|
||||||
each periodic transaction rule declares recurring budget goals for the
|
each periodic transaction rule declares recurring budget goals for the
|
||||||
specified accounts. Eg the first example above declares a goal of
|
specified accounts. Eg the first example above declares a goal of
|
||||||
spending $2000 on rent (and also, a goal of depositing $2000 into
|
spending $2000 on rent (and also, a goal of depositing $2000 into
|
||||||
checking) every month. Goals and actual performance can then be com-
|
checking) every month. Goals and actual performance can then be com-
|
||||||
pared in budget reports.
|
pared in budget reports.
|
||||||
|
|
||||||
For more details, see: balance: Budget report and Cookbook: Budgeting
|
For more details, see: balance: Budget report and Cookbook: Budgeting
|
||||||
and Forecasting.
|
and Forecasting.
|
||||||
|
|
||||||
|
|
||||||
Transaction Modifiers
|
Transaction Modifiers
|
||||||
Transaction modifier rules describe changes that should be applied
|
Transaction modifier rules describe changes that should be applied
|
||||||
automatically to certain transactions. Currently, this means adding
|
automatically to certain transactions. Currently, this means adding
|
||||||
extra postings (also known as "automated postings"). Transaction modi-
|
extra postings (also known as "automated postings"). Transaction modi-
|
||||||
fiers are enabled by the --auto flag.
|
fiers are enabled by the --auto flag.
|
||||||
|
|
||||||
A transaction modifier rule looks quite like a normal transaction,
|
A transaction modifier rule looks quite like a normal transaction,
|
||||||
except the first line is an equals sign followed by a query that
|
except the first line is an equals sign followed by a query that
|
||||||
matches certain postings (mnemonic: = suggests matching). And each
|
matches certain postings (mnemonic: = suggests matching). And each
|
||||||
"posting" is actually a posting-generating rule:
|
"posting" is actually a posting-generating rule:
|
||||||
|
|
||||||
= QUERY
|
= QUERY
|
||||||
@ -1174,17 +1173,17 @@ FILE FORMAT
|
|||||||
The posting rules look just like normal postings, except the amount can
|
The posting rules look just like normal postings, except the amount can
|
||||||
be:
|
be:
|
||||||
|
|
||||||
o a normal amount with a commodity symbol, eg $2. This will be used
|
o a normal amount with a commodity symbol, eg $2. This will be used
|
||||||
as-is.
|
as-is.
|
||||||
|
|
||||||
o a number, eg 2. The commodity symbol (if any) from the matched post-
|
o a number, eg 2. The commodity symbol (if any) from the matched post-
|
||||||
ing will be added to this.
|
ing will be added to this.
|
||||||
|
|
||||||
o a numeric multiplier, eg *2 (a star followed by a number N). The
|
o a numeric multiplier, eg *2 (a star followed by a number N). The
|
||||||
matched posting's amount (and total price, if any) will be multiplied
|
matched posting's amount (and total price, if any) will be multiplied
|
||||||
by N.
|
by N.
|
||||||
|
|
||||||
o a multiplier with a commodity symbol, eg *$2 (a star, number N, and
|
o a multiplier with a commodity symbol, eg *$2 (a star, number N, and
|
||||||
symbol S). The matched posting's amount will be multiplied by N, and
|
symbol S). The matched posting's amount will be multiplied by N, and
|
||||||
its commodity symbol will be replaced with S.
|
its commodity symbol will be replaced with S.
|
||||||
|
|
||||||
@ -1220,16 +1219,16 @@ FILE FORMAT
|
|||||||
assets:checking $20
|
assets:checking $20
|
||||||
|
|
||||||
Postings added by transaction modifiers participate in transaction bal-
|
Postings added by transaction modifiers participate in transaction bal-
|
||||||
ancing, missing amount inference and balance assertions, like regular
|
ancing, missing amount inference and balance assertions, like regular
|
||||||
postings.
|
postings.
|
||||||
|
|
||||||
EDITOR SUPPORT
|
EDITOR SUPPORT
|
||||||
Add-on modes exist for various text editors, to make working with jour-
|
Add-on modes exist for various text editors, to make working with jour-
|
||||||
nal files easier. They add colour, navigation aids and helpful com-
|
nal files easier. They add colour, navigation aids and helpful com-
|
||||||
mands. For hledger users who edit the journal file directly (the
|
mands. For hledger users who edit the journal file directly (the
|
||||||
majority), using one of these modes is quite recommended.
|
majority), using one of these modes is quite recommended.
|
||||||
|
|
||||||
These were written with Ledger in mind, but also work with hledger
|
These were written with Ledger in mind, but also work with hledger
|
||||||
files:
|
files:
|
||||||
|
|
||||||
|
|
||||||
@ -1248,7 +1247,7 @@ EDITOR SUPPORT
|
|||||||
|
|
||||||
|
|
||||||
REPORTING BUGS
|
REPORTING BUGS
|
||||||
Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel
|
Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel
|
||||||
or hledger mail list)
|
or hledger mail list)
|
||||||
|
|
||||||
|
|
||||||
@ -1262,7 +1261,7 @@ COPYRIGHT
|
|||||||
|
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),
|
hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),
|
||||||
hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
|
hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
|
||||||
dot(5), ledger(1)
|
dot(5), ledger(1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user