update generated manuals

[ci skip]
This commit is contained in:
Simon Michael 2019-01-22 13:36:11 -08:00
parent cc7c3928fb
commit a29b70c93f
6 changed files with 697 additions and 372 deletions

View File

@ -1189,8 +1189,7 @@ The \f[C]\-V/\-\-value\f[] flag can be used to convert reported amounts
to another commodity using these prices.
.SS Declaring accounts
.PP
\f[C]account\f[] directives can be used to pre\-declare some or all
accounts.
\f[C]account\f[] directives can be used to pre\-declare accounts.
Though not required, they can provide several benefits:
.IP \[bu] 2
They can document your intended chart of accounts, providing a
@ -1209,38 +1208,86 @@ sorting (eg Revenues to appear above Expenses).
They help with account name completion in the add command,
hledger\-iadd, hledger\-web, ledger\-mode etc.
.PP
Here is the full syntax:
.IP
.nf
\f[C]
account\ ACCTNAME\ \ [ACCTTYPE]
\ \ [COMMENTS]
\f[]
.fi
.PP
The simplest form just declares a hledger\-style account name, eg:
The simplest form is just the word \f[C]account\f[] followed by a
hledger\-style account name, eg:
.IP
.nf
\f[C]
account\ assets:bank:checking
\f[]
.fi
.SS Account comments
.PP
Comments, beginning with a semicolon, optionally including tags, can be
written after the account name, and/or on following lines.
Eg:
.IP
.nf
\f[C]
account\ assets:bank:checking\ \ ;\ a\ comment
\ \ ;\ another\ comment
\ \ ;\ acctno:12345,\ a\ tag
\f[]
.fi
.PP
Tip: comments on the same line require hledger 1.12+.
If you need your journal to be compatible with older hledger versions,
write comments on the next line instead.
.SS Account subdirectives
.PP
We also allow (and ignore) Ledger\-style indented subdirectives, just
for compatibility.:
.IP
.nf
\f[C]
account\ assets:bank:checking
\ \ format\ blah\ blah\ \ ;\ <\-\ subdirective,\ ignored
\f[]
.fi
.PP
Here is the full syntax of account directives:
.IP
.nf
\f[C]
account\ ACCTNAME\ \ [ACCTTYPE]\ [;COMMENT]
\ \ [;COMMENTS]
\ \ [LEDGER\-STYLE\ SUBDIRECTIVES,\ IGNORED]
\f[]
.fi
.SS Account types
.PP
hledger recognises five types of account: asset, liability, equity,
revenue, expense.
This is useful for certain accounting\-aware reports, in particular
balancesheet, incomestatement and cashflow.
hledger recognises five types (or classes) of account: Asset, Liability,
Equity, Revenue, Expense.
This is used by a few accounting\-aware reports such as balancesheet,
incomestatement and cashflow.
.SS Auto\-detected account types
.PP
If you name your top\-level accounts with some variation of
\f[C]assets\f[], \f[C]liabilities\f[]/\f[C]debts\f[], \f[C]equity\f[],
\f[C]revenues\f[]/\f[C]income\f[], or \f[C]expenses\f[], their types are
detected automatically.
.SS Account types declared with tags
.PP
More generally, you can declare an account's type by adding one of the
letters \f[C]ALERX\f[] to its account directive, separated from the
account name by two or more spaces.
Eg:
More generally, you can declare an account's type with an account
directive, by writing a \f[C]type:\f[] tag in a comment, followed by one
of the words \f[C]Asset\f[], \f[C]Liability\f[], \f[C]Equity\f[],
\f[C]Revenue\f[], \f[C]Expense\f[], or one of the letters \f[C]ALERX\f[]
(case insensitive):
.IP
.nf
\f[C]
account\ assets\ \ \ \ \ \ \ ;\ type:Asset
account\ liabilities\ \ ;\ type:Liability
account\ equity\ \ \ \ \ \ \ ;\ type:Equity
account\ revenues\ \ \ \ \ ;\ type:Revenue
account\ expenses\ \ \ \ \ ;\ type:Expenses
\f[]
.fi
.SS Account types declared with account type codes
.PP
Or, you can write one of those letters separated from the account name
by two or more spaces, but this should probably be considered deprecated
as of hledger 1.13:
.IP
.nf
\f[C]
@ -1251,46 +1298,29 @@ account\ revenues\ \ \ \ \ R
account\ expenses\ \ \ \ \ X
\f[]
.fi
.SS Overriding auto\-detected types
.PP
Note: if you ever override the types of those auto\-detected english
account names mentioned above, you might need to help the reports a bit:
If you ever override the types of those auto\-detected english account
names mentioned above, you might need to help the reports a bit.
Eg:
.IP
.nf
\f[C]
;\ make\ "liabilities"\ not\ have\ the\ liability\ type,\ who\ knows\ why
account\ liabilities\ \ \ E
;\ make\ "liabilities"\ not\ have\ the\ liability\ type\ \-\ who\ knows\ why
account\ liabilities\ \ \ ;\ type:E
;\ better\ ensure\ some\ other\ account\ has\ the\ liability\ type,\
;\ we\ need\ to\ ensure\ some\ other\ account\ has\ the\ liability\ type,\
;\ otherwise\ balancesheet\ would\ still\ show\ "liabilities"\ under\ Liabilities\
account\ \-\ \ \ \ \ \ \ \ \ \ \ \ \ L
account\ \-\ \ \ \ \ \ \ \ \ \ \ \ \ ;\ type:L
\f[]
.fi
.PP
)
.SS Account comments
.PP
An account directive can also have indented comments on following lines,
eg:
.IP
.nf
\f[C]
account\ assets:bank:checking
\ \ ;\ acctno:12345
\ \ ;\ a\ comment
\f[]
.fi
.PP
We also allow (and ignore) Ledger\-style subdirectives, with no leading
semicolon, for compatibility.
.PP
Tags in account comments, like \f[C]acctno\f[] above, currently have no
effect.
.SS Account display order
.PP
Account directives also set the order in which accounts are displayed in
reports, the hledger\-ui accounts screen, the hledger\-web sidebar, etc.
Normally accounts are listed in alphabetical order, but if you have eg
these account directives in the journal:
Account directives also set the order in which accounts are displayed,
eg in reports, the hledger\-ui accounts screen, and the hledger\-web
sidebar.
By default accounts are listed in alphabetical order.
But if you have these account directives in the journal:
.IP
.nf
\f[C]
@ -1302,7 +1332,7 @@ account\ expenses
\f[]
.fi
.PP
you'll see those accounts listed in declaration order, not
you'll see those accounts displayed in declaration order, not
alphabetically:
.IP
.nf

View File

@ -1055,8 +1055,8 @@ File: hledger_journal.info, Node: Declaring accounts, Next: Rewriting accounts
1.14.7 Declaring accounts
-------------------------
'account' directives can be used to pre-declare some or all accounts.
Though not required, they can provide several benefits:
'account' directives can be used to pre-declare accounts. Though not
required, they can provide several benefits:
* They can document your intended chart of accounts, providing a
reference.
@ -1070,38 +1070,80 @@ Though not required, they can provide several benefits:
* They help with account name completion in the add command,
hledger-iadd, hledger-web, ledger-mode etc.
Here is the full syntax:
account ACCTNAME [ACCTTYPE]
[COMMENTS]
The simplest form just declares a hledger-style account name, eg:
The simplest form is just the word 'account' followed by a
hledger-style account name, eg:
account assets:bank:checking
* Menu:
* Account types::
* Account comments::
* Account subdirectives::
* Account types::
* Account display order::

File: hledger_journal.info, Node: Account types, Next: Account comments, Up: Declaring accounts
File: hledger_journal.info, Node: Account comments, Next: Account subdirectives, Up: Declaring accounts
1.14.7.1 Account types
1.14.7.1 Account comments
.........................
Comments, beginning with a semicolon, optionally including tags, can be
written after the account name, and/or on following lines. Eg:
account assets:bank:checking ; a comment
; another comment
; acctno:12345, a tag
Tip: comments on the same line require hledger 1.12+. If you need
your journal to be compatible with older hledger versions, write
comments on the next line instead.

File: hledger_journal.info, Node: Account subdirectives, Next: Account types, Prev: Account comments, Up: Declaring accounts
1.14.7.2 Account subdirectives
..............................
We also allow (and ignore) Ledger-style indented subdirectives, just for
compatibility.:
account assets:bank:checking
format blah blah ; <- subdirective, ignored
Here is the full syntax of account directives:
account ACCTNAME [ACCTTYPE] [;COMMENT]
[;COMMENTS]
[LEDGER-STYLE SUBDIRECTIVES, IGNORED]

File: hledger_journal.info, Node: Account types, Next: Account display order, Prev: Account subdirectives, Up: Declaring accounts
1.14.7.3 Account types
......................
hledger recognises five types of account: asset, liability, equity,
revenue, expense. This is useful for certain accounting-aware reports,
in particular balancesheet, incomestatement and cashflow.
hledger recognises five types (or classes) of account: Asset, Liability,
Equity, Revenue, Expense. This is used by a few accounting-aware
reports such as balancesheet, incomestatement and cashflow.
Auto-detected account types If you name your top-level accounts with
some variation of 'assets', 'liabilities'/'debts', 'equity',
'revenues'/'income', or 'expenses', their types are detected
automatically. Account types declared with tags More generally, you can
declare an account's type with an account directive, by writing a
'type:' tag in a comment, followed by one of the words 'Asset',
'Liability', 'Equity', 'Revenue', 'Expense', or one of the letters
'ALERX' (case insensitive):
If you name your top-level accounts with some variation of 'assets',
'liabilities'/'debts', 'equity', 'revenues'/'income', or 'expenses',
their types are detected automatically.
account assets ; type:Asset
account liabilities ; type:Liability
account equity ; type:Equity
account revenues ; type:Revenue
account expenses ; type:Expenses
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 by two or more spaces. Eg:
Account types declared with account type codes Or, you can write one
of those letters separated from the account name by two or more spaces,
but this should probably be considered deprecated as of hledger 1.13:
account assets A
account liabilities L
@ -1109,47 +1151,27 @@ account equity E
account revenues R
account expenses X
Note: if you ever override the types of those auto-detected english
account names mentioned above, you might need to help the reports a bit:
Overriding auto-detected types If you ever override the types of
those auto-detected english account names mentioned above, you might
need to help the reports a bit. Eg:
; make "liabilities" not have the liability type, who knows why
account liabilities E
; make "liabilities" not have the liability type - who knows why
account liabilities ; type:E
; better ensure some other account has the liability type,
; we need to ensure some other account has the liability type,
; otherwise balancesheet would still show "liabilities" under Liabilities
account - L
)
account - ; type:L

File: hledger_journal.info, Node: Account comments, Next: Account display order, Prev: Account types, Up: Declaring accounts
File: hledger_journal.info, Node: Account display order, Prev: Account types, Up: Declaring accounts
1.14.7.2 Account comments
.........................
An account directive can also have indented comments on following lines,
eg:
account assets:bank:checking
; acctno:12345
; a comment
We also allow (and ignore) Ledger-style subdirectives, with no
leading semicolon, for compatibility.
Tags in account comments, like 'acctno' above, currently have no
effect.

File: hledger_journal.info, Node: Account display order, Prev: Account comments, Up: Declaring accounts
1.14.7.3 Account display order
1.14.7.4 Account display order
..............................
Account directives also set the order in which accounts are displayed in
reports, the hledger-ui accounts screen, the hledger-web sidebar, etc.
Normally accounts are listed in alphabetical order, but if you have eg
these account directives in the journal:
Account directives also set the order in which accounts are displayed,
eg in reports, the hledger-ui accounts screen, and the hledger-web
sidebar. By default accounts are listed in alphabetical order. But if
you have these account directives in the journal:
account assets
account liabilities
@ -1157,7 +1179,7 @@ account equity
account revenues
account expenses
you'll see those accounts listed in declaration order, not
you'll see those accounts displayed in declaration order, not
alphabetically:
$ hledger accounts -1
@ -1605,35 +1627,37 @@ Node: Market prices38745
Ref: #market-prices38910
Node: Declaring accounts39751
Ref: #declaring-accounts39927
Node: Account types40884
Ref: #account-types41033
Node: Account comments42107
Ref: #account-comments42292
Node: Account display order42613
Ref: #account-display-order42786
Node: Rewriting accounts43908
Ref: #rewriting-accounts44093
Node: Basic aliases44827
Ref: #basic-aliases44973
Node: Regex aliases45677
Ref: #regex-aliases45848
Node: Multiple aliases46566
Ref: #multiple-aliases46741
Node: end aliases47239
Ref: #end-aliases47386
Node: Default parent account47487
Ref: #default-parent-account47653
Node: Periodic transactions48537
Ref: #periodic-transactions48719
Node: Two spaces after the period expression49844
Ref: #two-spaces-after-the-period-expression50089
Node: Forecasting with periodic transactions50574
Ref: #forecasting-with-periodic-transactions50864
Node: Budgeting with periodic transactions52551
Ref: #budgeting-with-periodic-transactions52790
Node: Transaction Modifiers53249
Ref: #transaction-modifiers53412
Node: EDITOR SUPPORT55393
Ref: #editor-support55511
Node: Account comments40852
Ref: #account-comments41015
Node: Account subdirectives41410
Ref: #account-subdirectives41605
Node: Account types41918
Ref: #account-types42102
Node: Account display order43746
Ref: #account-display-order43916
Node: Rewriting accounts45045
Ref: #rewriting-accounts45230
Node: Basic aliases45964
Ref: #basic-aliases46110
Node: Regex aliases46814
Ref: #regex-aliases46985
Node: Multiple aliases47703
Ref: #multiple-aliases47878
Node: end aliases48376
Ref: #end-aliases48523
Node: Default parent account48624
Ref: #default-parent-account48790
Node: Periodic transactions49674
Ref: #periodic-transactions49856
Node: Two spaces after the period expression50981
Ref: #two-spaces-after-the-period-expression51226
Node: Forecasting with periodic transactions51711
Ref: #forecasting-with-periodic-transactions52001
Node: Budgeting with periodic transactions53688
Ref: #budgeting-with-periodic-transactions53927
Node: Transaction Modifiers54386
Ref: #transaction-modifiers54549
Node: EDITOR SUPPORT56530
Ref: #editor-support56648

End Tag Table

View File

@ -846,8 +846,8 @@ FILE FORMAT
commodity using these prices.
Declaring accounts
account directives can be used to pre-declare some or all accounts.
Though not required, they can provide several benefits:
account directives can be used to pre-declare accounts. Though not
required, they can provide several benefits:
o They can document your intended chart of accounts, providing a refer-
ence.
@ -865,27 +865,62 @@ FILE FORMAT
o They help with account name completion in the add command,
hledger-iadd, hledger-web, ledger-mode etc.
Here is the full syntax:
account ACCTNAME [ACCTTYPE]
[COMMENTS]
The simplest form just declares a hledger-style account name, eg:
The simplest form is just the word account followed by a hledger-style
account name, eg:
account assets:bank:checking
Account types
hledger recognises five types of account: asset, liability, equity,
revenue, expense. This is useful for certain accounting-aware reports,
in particular balancesheet, incomestatement and cashflow.
Account comments
Comments, beginning with a semicolon, optionally including tags, can be
written after the account name, and/or on following lines. Eg:
account assets:bank:checking ; a comment
; another comment
; acctno:12345, a tag
Tip: comments on the same line require hledger 1.12+. If you need your
journal to be compatible with older hledger versions, write comments on
the next line instead.
Account subdirectives
We also allow (and ignore) Ledger-style indented subdirectives, just
for compatibility.:
account assets:bank:checking
format blah blah ; <- subdirective, ignored
Here is the full syntax of account directives:
account ACCTNAME [ACCTTYPE] [;COMMENT]
[;COMMENTS]
[LEDGER-STYLE SUBDIRECTIVES, IGNORED]
Account types
hledger recognises five types (or classes) of account: Asset, Liabil-
ity, Equity, Revenue, Expense. This is used by a few accounting-aware
reports such as balancesheet, incomestatement and cashflow.
Auto-detected account types
If you name your top-level accounts with some variation of assets, lia-
bilities/debts, equity, revenues/income, or expenses, their types are
detected automatically.
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
by two or more spaces. Eg:
Account types declared with tags
More generally, you can declare an account's type with an account
directive, by writing a type: tag in a comment, followed by one of the
words Asset, Liability, Equity, Revenue, Expense, or one of the letters
ALERX (case insensitive):
account assets ; type:Asset
account liabilities ; type:Liability
account equity ; type:Equity
account revenues ; type:Revenue
account expenses ; type:Expenses
Account types declared with account type codes
Or, you can write one of those letters separated from the account name
by two or more spaces, but this should probably be considered depre-
cated as of hledger 1.13:
account assets A
account liabilities L
@ -893,37 +928,22 @@ FILE FORMAT
account revenues R
account expenses X
Note: if you ever override the types of those auto-detected english
account names mentioned above, you might need to help the reports a
bit:
Overriding auto-detected types
If you ever override the types of those auto-detected english account
names mentioned above, you might need to help the reports a bit. Eg:
; make "liabilities" not have the liability type, who knows why
account liabilities E
; make "liabilities" not have the liability type - who knows why
account liabilities ; type:E
; better ensure some other account has the liability type,
; we need to ensure some other account has the liability type,
; otherwise balancesheet would still show "liabilities" under Liabilities
account - L
)
Account comments
An account directive can also have indented comments on following
lines, eg:
account assets:bank:checking
; acctno:12345
; a comment
We also allow (and ignore) Ledger-style subdirectives, with no leading
semicolon, for compatibility.
Tags in account comments, like acctno above, currently have no effect.
account - ; type:L
Account display order
Account directives also set the order in which accounts are displayed
in reports, the hledger-ui accounts screen, the hledger-web sidebar,
etc. Normally accounts are listed in alphabetical order, but if you
have eg these account directives in the journal:
Account directives also set the order in which accounts are displayed,
eg in reports, the hledger-ui accounts screen, and the hledger-web
sidebar. By default accounts are listed in alphabetical order. But if
you have these account directives in the journal:
account assets
account liabilities
@ -931,8 +951,8 @@ FILE FORMAT
account revenues
account expenses
you'll see those accounts listed in declaration order, not alphabeti-
cally:
you'll see those accounts displayed in declaration order, not alphabet-
ically:
$ hledger accounts -1
assets

View File

@ -2318,13 +2318,112 @@ Report account names having the same leaf but different prefixes.
An example: http://stefanorodighiero.net/software/hledger\-dupes.html
.SS close
.PP
Print closing/opening transactions that bring some or all account
balances to zero and back.
Can be useful for bringing asset/liability balances across file
boundaries, or for closing out income/expenses for a period.
This was formerly called \[lq]equity\[rq], as in Ledger, and that alias
is also accepted.
See close \[en]help for more.
close, equity
.PP
Prints a \[lq]closing balances\[rq] transaction and an \[lq]opening
balances\[rq] transaction, that bring account balances to and from zero,
respectively.
Useful for, eg:
.IP \[bu] 2
bringing asset/liability balances forward into a new journal file
.IP \[bu] 2
closing out revenues/expenses to retained earnings at the end of a
period
.PP
The closing transaction transfers balances to \[lq]equity:closing
balances\[rq].
The opening transaction transfers balances from \[lq]equity:opening
balances\[rq].
You can chose to print just one of the transactions by using the
\f[C]\-\-opening\f[] or \f[C]\-\-closing\f[] flag.
.PP
If you split your journal files by time (eg yearly), you will typically
run this command at the end of the year, and save the closing
transaction as last entry of the old file, and the opening transaction
as the first entry of the new file.
This makes the files self contained, so that correct balances are
reported no matter which of them are loaded.
Ie, if you load just one file, the balances are initialised correctly;
or if you load several files, the redundant closing/opening transactions
cancel each other out.
(They will show up in print or register reports; you can exclude them
with a query like
\f[C]not:desc:\[aq](opening|closing)\ balances\[aq]\f[].)
.PP
If you're running a business, you might also use this command to
\[lq]close the books\[rq] at the end of an accounting period,
transferring income statement account balances to retained earnings.
(You may want to change the equity account name to something like
\[lq]equity:retained earnings\[rq] for clarity.)
.PP
By default, the closing transaction is dated yesterday, the balances are
calculated as of end of yesterday, and the opening transaction is dated
today.
To close on some other date, use:
\f[C]hledger\ close\ \-e\ OPENINGDATE\f[].
Eg, to close/open on the 2018/2019 boundary, use \f[C]\-e\ 2019\f[].
You can also use \-p or \f[C]date:PERIOD\f[] (any starting date is
ignored).
.PP
Both transactions will include balance assertions for the
closed/reopened accounts.
You probably shouldn't use status or realness filters (like \-C or \-R
or \f[C]status:\f[]) with this command, or the generated balance
assertions will depend on these flags.
Likewise, if you run this command with \[en]auto, the balance assertions
will probably always require \[en]auto.
.PP
Examples:
.PP
Carrying asset/liability balances into a new file for 2019, all from
command line.
.PP
\f[I]Warning: we use \f[CI]>>\f[I] here to append; be careful not to
type a single \f[CI]>\f[I] which would wipe your journal!\f[]
.IP
.nf
\f[C]
$\ hledger\ close\ \-f\ 2018.journal\ \-e\ 2019\ assets\ liabilities\ \-\-opening\ >>2019.journal
$\ hledger\ close\ \-f\ 2018.journal\ \-e\ 2019\ assets\ liabilities\ \-\-closing\ >>2018.journal
\f[]
.fi
.PP
Now:
.IP
.nf
\f[C]
$\ hledger\ bs\ \-f\ 2019.journal\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ one\ file\ \-\ balances\ are\ correct
$\ hledger\ bs\ \-f\ 2018.journal\ \-f\ 2019.journal\ \ \ #\ two\ files\ \-\ balances\ still\ correct
$\ hledger\ bs\ \-f\ 2018.journal\ not:desc:closing\ \ #\ to\ see\ year\-end\ balances,\ must\ exclude\ closing\ txn
\f[]
.fi
.PP
Transactions spanning the closing date can complicate matters, breaking
balance assertions:
.IP
.nf
\f[C]
2018/12/30\ a\ purchase\ made\ in\ 2018,\ clearing\ the\ following\ year
\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ 5
\ \ \ \ assets:bank:checking\ \ \-5\ \ ;\ [2019/1/2]
\f[]
.fi
.PP
Here's one way to resolve that:
.IP
.nf
\f[C]
;\ in\ 2018.journal:
2018/12/30\ a\ purchase\ made\ in\ 2018,\ clearing\ the\ following\ year
\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ 5
\ \ \ \ liabilities:pending
;\ in\ 2019.journal:
2019/1/2\ clearance\ of\ last\ year\[aq]s\ pending\ transactions
\ \ \ \ liabilities:pending\ \ \ \ 5\ =\ 0
\ \ \ \ assets:checking
\f[]
.fi
.SS files
.PP
List all files included in the journal.

View File

@ -1851,11 +1851,87 @@ File: hledger.info, Node: close, Next: files, Prev: check-dupes, Up: COMMAND
4.10 close
==========
Print closing/opening transactions that bring some or all account
balances to zero and back. Can be useful for bringing asset/liability
balances across file boundaries, or for closing out income/expenses for
a period. This was formerly called "equity", as in Ledger, and that
alias is also accepted. See close -help for more.
close, equity
Prints a "closing balances" transaction and an "opening balances"
transaction, that bring account balances to and from zero, respectively.
Useful for, eg:
* bringing asset/liability balances forward into a new journal file
* closing out revenues/expenses to retained earnings at the end of a
period
The closing transaction transfers balances to "equity:closing
balances". The opening transaction transfers balances from
"equity:opening balances". You can chose to print just one of the
transactions by using the '--opening' or '--closing' flag.
If you split your journal files by time (eg yearly), you will
typically run this command at the end of the year, and save the closing
transaction as last entry of the old file, and the opening transaction
as the first entry of the new file. This makes the files self
contained, so that correct balances are reported no matter which of them
are loaded. Ie, if you load just one file, the balances are initialised
correctly; or if you load several files, the redundant closing/opening
transactions cancel each other out. (They will show up in print or
register reports; you can exclude them with a query like
'not:desc:'(opening|closing) balances''.)
If you're running a business, you might also use this command to
"close the books" at the end of an accounting period, transferring
income statement account balances to retained earnings. (You may want
to change the equity account name to something like "equity:retained
earnings" for clarity.)
By default, the closing transaction is dated yesterday, the balances
are calculated as of end of yesterday, and the opening transaction is
dated today. To close on some other date, use: 'hledger close -e
OPENINGDATE'. Eg, to close/open on the 2018/2019 boundary, use '-e
2019'. You can also use -p or 'date:PERIOD' (any starting date is
ignored).
Both transactions will include balance assertions for the
closed/reopened accounts. You probably shouldn't use status or realness
filters (like -C or -R or 'status:') with this command, or the generated
balance assertions will depend on these flags. Likewise, if you run
this command with -auto, the balance assertions will probably always
require -auto.
Examples:
Carrying asset/liability balances into a new file for 2019, all from
command line.
_Warning: we use '>>' here to append; be careful not to type a single
'>' which would wipe your journal!_
$ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal
$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal
Now:
$ hledger bs -f 2019.journal # one file - balances are correct
$ hledger bs -f 2018.journal -f 2019.journal # two files - balances still correct
$ hledger bs -f 2018.journal not:desc:closing # to see year-end balances, must exclude closing txn
Transactions spanning the closing date can complicate matters,
breaking balance assertions:
2018/12/30 a purchase made in 2018, clearing the following year
expenses:food 5
assets:bank:checking -5 ; [2019/1/2]
Here's one way to resolve that:
; in 2018.journal:
2018/12/30 a purchase made in 2018, clearing the following year
expenses:food 5
liabilities:pending
; in 2019.journal:
2019/1/2 clearance of last year's pending transactions
liabilities:pending 5 = 0
assets:checking

File: hledger.info, Node: files, Next: help, Prev: close, Up: COMMANDS
@ -2643,63 +2719,63 @@ Node: check-dupes61080
Ref: #check-dupes61204
Node: close61341
Ref: #close61449
Node: files61779
Ref: #files61880
Node: help62021
Ref: #help62121
Node: import63195
Ref: #import63309
Node: incomestatement64039
Ref: #incomestatement64173
Node: prices66577
Ref: #prices66692
Node: print66964
Ref: #print67074
Node: print-unique71968
Ref: #print-unique72094
Node: register72162
Ref: #register72289
Node: Custom register output76790
Ref: #custom-register-output76919
Node: register-match78149
Ref: #register-match78283
Node: rewrite78466
Ref: #rewrite78581
Node: roi78650
Ref: #roi78748
Node: stats78864
Ref: #stats78963
Node: tags79833
Ref: #tags79931
Node: test80167
Ref: #test80251
Node: ADD-ON COMMANDS80959
Ref: #add-on-commands81069
Node: Official add-ons82356
Ref: #official-add-ons82496
Node: api82583
Ref: #api82672
Node: ui82724
Ref: #ui82823
Node: web82881
Ref: #web82970
Node: Third party add-ons83016
Ref: #third-party-add-ons83191
Node: diff83326
Ref: #diff83423
Node: iadd83522
Ref: #iadd83636
Node: interest83719
Ref: #interest83840
Node: irr83935
Ref: #irr84033
Node: Experimental add-ons84164
Ref: #experimental-add-ons84316
Node: autosync84596
Ref: #autosync84707
Node: chart84946
Ref: #chart85065
Node: check85136
Ref: #check85238
Node: files64891
Ref: #files64992
Node: help65133
Ref: #help65233
Node: import66307
Ref: #import66421
Node: incomestatement67151
Ref: #incomestatement67285
Node: prices69689
Ref: #prices69804
Node: print70076
Ref: #print70186
Node: print-unique75080
Ref: #print-unique75206
Node: register75274
Ref: #register75401
Node: Custom register output79902
Ref: #custom-register-output80031
Node: register-match81261
Ref: #register-match81395
Node: rewrite81578
Ref: #rewrite81693
Node: roi81762
Ref: #roi81860
Node: stats81976
Ref: #stats82075
Node: tags82945
Ref: #tags83043
Node: test83279
Ref: #test83363
Node: ADD-ON COMMANDS84071
Ref: #add-on-commands84181
Node: Official add-ons85468
Ref: #official-add-ons85608
Node: api85695
Ref: #api85784
Node: ui85836
Ref: #ui85935
Node: web85993
Ref: #web86082
Node: Third party add-ons86128
Ref: #third-party-add-ons86303
Node: diff86438
Ref: #diff86535
Node: iadd86634
Ref: #iadd86748
Node: interest86831
Ref: #interest86952
Node: irr87047
Ref: #irr87145
Node: Experimental add-ons87276
Ref: #experimental-add-ons87428
Node: autosync87708
Ref: #autosync87819
Node: chart88058
Ref: #chart88177
Node: check88248
Ref: #check88350

End Tag Table

View File

@ -1646,11 +1646,87 @@ COMMANDS
example: http://stefanorodighiero.net/software/hledger-dupes.html
close
Print closing/opening transactions that bring some or all account bal-
ances to zero and back. Can be useful for bringing asset/liability
balances across file boundaries, or for closing out income/expenses for
a period. This was formerly called "equity", as in Ledger, and that
alias is also accepted. See close -help for more.
close, equity
Prints a "closing balances" transaction and an "opening balances"
transaction, that bring account balances to and from zero, respec-
tively. Useful for, eg:
o bringing asset/liability balances forward into a new journal file
o closing out revenues/expenses to retained earnings at the end of a
period
The closing transaction transfers balances to "equity:closing bal-
ances". The opening transaction transfers balances from "equity:open-
ing balances". You can chose to print just one of the transactions by
using the --opening or --closing flag.
If you split your journal files by time (eg yearly), you will typically
run this command at the end of the year, and save the closing transac-
tion as last entry of the old file, and the opening transaction as the
first entry of the new file. This makes the files self contained, so
that correct balances are reported no matter which of them are loaded.
Ie, if you load just one file, the balances are initialised correctly;
or if you load several files, the redundant closing/opening transac-
tions cancel each other out. (They will show up in print or register
reports; you can exclude them with a query like not:desc:'(open-
ing|closing) balances'.)
If you're running a business, you might also use this command to "close
the books" at the end of an accounting period, transferring income
statement account balances to retained earnings. (You may want to
change the equity account name to something like "equity:retained earn-
ings" for clarity.)
By default, the closing transaction is dated yesterday, the balances
are calculated as of end of yesterday, and the opening transaction is
dated today. To close on some other date, use: hledger close -e OPEN-
INGDATE. Eg, to close/open on the 2018/2019 boundary, use -e 2019.
You can also use -p or date:PERIOD (any starting date is ignored).
Both transactions will include balance assertions for the
closed/reopened accounts. You probably shouldn't use status or real-
ness filters (like -C or -R or status:) with this command, or the gen-
erated balance assertions will depend on these flags. Likewise, if you
run this command with -auto, the balance assertions will probably
always require -auto.
Examples:
Carrying asset/liability balances into a new file for 2019, all from
command line.
Warning: we use >> here to append; be careful not to type a single >
which would wipe your journal!
$ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal
$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal
Now:
$ hledger bs -f 2019.journal # one file - balances are correct
$ hledger bs -f 2018.journal -f 2019.journal # two files - balances still correct
$ hledger bs -f 2018.journal not:desc:closing # to see year-end balances, must exclude closing txn
Transactions spanning the closing date can complicate matters, breaking
balance assertions:
2018/12/30 a purchase made in 2018, clearing the following year
expenses:food 5
assets:bank:checking -5 ; [2019/1/2]
Here's one way to resolve that:
; in 2018.journal:
2018/12/30 a purchase made in 2018, clearing the following year
expenses:food 5
liabilities:pending
; in 2019.journal:
2019/1/2 clearance of last year's pending transactions
liabilities:pending 5 = 0
assets:checking
files
List all files included in the journal. With a REGEX argument, only