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. to another commodity using these prices.
.SS Declaring accounts .SS Declaring accounts
.PP .PP
\f[C]account\f[] directives can be used to pre\-declare some or all \f[C]account\f[] directives can be used to pre\-declare accounts.
accounts.
Though not required, they can provide several benefits: Though not required, they can provide several benefits:
.IP \[bu] 2 .IP \[bu] 2
They can document your intended chart of accounts, providing a 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, They help with account name completion in the add command,
hledger\-iadd, hledger\-web, ledger\-mode etc. hledger\-iadd, hledger\-web, ledger\-mode etc.
.PP .PP
Here is the full syntax: The simplest form is just the word \f[C]account\f[] followed by a
.IP hledger\-style account name, eg:
.nf
\f[C]
account\ ACCTNAME\ \ [ACCTTYPE]
\ \ [COMMENTS]
\f[]
.fi
.PP
The simplest form just declares a hledger\-style account name, eg:
.IP .IP
.nf .nf
\f[C] \f[C]
account\ assets:bank:checking account\ assets:bank:checking
\f[] \f[]
.fi .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 .SS Account types
.PP .PP
hledger recognises five types of account: asset, liability, equity, hledger recognises five types (or classes) of account: Asset, Liability,
revenue, expense. Equity, Revenue, Expense.
This is useful for certain accounting\-aware reports, in particular This is used by a few accounting\-aware reports such as balancesheet,
balancesheet, incomestatement and cashflow. incomestatement and cashflow.
.SS Auto\-detected account types
.PP .PP
If you name your top\-level accounts with some variation of 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]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 \f[C]revenues\f[]/\f[C]income\f[], or \f[C]expenses\f[], their types are
detected automatically. detected automatically.
.SS Account types declared with tags
.PP .PP
More generally, you can declare an account's type by adding one of the More generally, you can declare an account's type with an account
letters \f[C]ALERX\f[] to its account directive, separated from the directive, by writing a \f[C]type:\f[] tag in a comment, followed by one
account name by two or more spaces. of the words \f[C]Asset\f[], \f[C]Liability\f[], \f[C]Equity\f[],
Eg: \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 .IP
.nf .nf
\f[C] \f[C]
@ -1251,46 +1298,29 @@ account\ revenues\ \ \ \ \ R
account\ expenses\ \ \ \ \ X account\ expenses\ \ \ \ \ X
\f[] \f[]
.fi .fi
.SS Overriding auto\-detected types
.PP .PP
Note: if you ever override the types of those auto\-detected english If you ever override the types of those auto\-detected english account
account names mentioned above, you might need to help the reports a bit: names mentioned above, you might need to help the reports a bit.
Eg:
.IP .IP
.nf .nf
\f[C] \f[C]
;\ make\ "liabilities"\ not\ have\ the\ liability\ type,\ who\ knows\ why ;\ make\ "liabilities"\ not\ have\ the\ liability\ type\ \-\ who\ knows\ why
account\ liabilities\ \ \ E 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\ ;\ otherwise\ balancesheet\ would\ still\ show\ "liabilities"\ under\ Liabilities\
account\ \-\ \ \ \ \ \ \ \ \ \ \ \ \ L account\ \-\ \ \ \ \ \ \ \ \ \ \ \ \ ;\ type:L
\f[] \f[]
.fi .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 .SS Account display order
.PP .PP
Account directives also set the order in which accounts are displayed in Account directives also set the order in which accounts are displayed,
reports, the hledger\-ui accounts screen, the hledger\-web sidebar, etc. eg in reports, the hledger\-ui accounts screen, and the hledger\-web
Normally accounts are listed in alphabetical order, but if you have eg sidebar.
these account directives in the journal: By default accounts are listed in alphabetical order.
But if you have these account directives in the journal:
.IP .IP
.nf .nf
\f[C] \f[C]
@ -1302,7 +1332,7 @@ account\ expenses
\f[] \f[]
.fi .fi
.PP .PP
you'll see those accounts listed in declaration order, not you'll see those accounts displayed in declaration order, not
alphabetically: alphabetically:
.IP .IP
.nf .nf

View File

@ -1055,8 +1055,8 @@ File: hledger_journal.info, Node: Declaring accounts, Next: Rewriting accounts
1.14.7 Declaring accounts 1.14.7 Declaring accounts
------------------------- -------------------------
'account' directives can be used to pre-declare some or all accounts. 'account' directives can be used to pre-declare accounts. Though not
Though not required, they can provide several benefits: required, they can provide several benefits:
* They can document your intended chart of accounts, providing a * They can document your intended chart of accounts, providing a
reference. reference.
@ -1070,38 +1070,80 @@ Though not required, they can provide several benefits:
* They help with account name completion in the add command, * 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: The simplest form is just the word 'account' followed by a
hledger-style account name, eg:
account ACCTNAME [ACCTTYPE]
[COMMENTS]
The simplest form just declares a hledger-style account name, eg:
account assets:bank:checking account assets:bank:checking
* Menu: * Menu:
* Account types::
* Account comments:: * Account comments::
* Account subdirectives::
* Account types::
* Account display order:: * 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, hledger recognises five types (or classes) of account: Asset, Liability,
revenue, expense. This is useful for certain accounting-aware reports, Equity, Revenue, Expense. This is used by a few accounting-aware
in particular balancesheet, incomestatement and cashflow. 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', account assets ; type:Asset
'liabilities'/'debts', 'equity', 'revenues'/'income', or 'expenses', account liabilities ; type:Liability
their types are detected automatically. 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 Account types declared with account type codes Or, you can write one
the letters 'ALERX' to its account directive, separated from the account of those letters separated from the account name by two or more spaces,
name by two or more spaces. Eg: but this should probably be considered deprecated as of hledger 1.13:
account assets A account assets A
account liabilities L account liabilities L
@ -1109,47 +1151,27 @@ account equity E
account revenues R account revenues R
account expenses X account expenses X
Note: if you ever override the types of those auto-detected english Overriding auto-detected types If you ever override the types of
account names mentioned above, you might need to help the reports a bit: 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 ; make "liabilities" not have the liability type - who knows why
account liabilities E 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 ; 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 1.14.7.4 Account display order
.........................
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
.............................. ..............................
Account directives also set the order in which accounts are displayed in Account directives also set the order in which accounts are displayed,
reports, the hledger-ui accounts screen, the hledger-web sidebar, etc. eg in reports, the hledger-ui accounts screen, and the hledger-web
Normally accounts are listed in alphabetical order, but if you have eg sidebar. By default accounts are listed in alphabetical order. But if
these account directives in the journal: you have these account directives in the journal:
account assets account assets
account liabilities account liabilities
@ -1157,7 +1179,7 @@ account equity
account revenues account revenues
account expenses account expenses
you'll see those accounts listed in declaration order, not you'll see those accounts displayed in declaration order, not
alphabetically: alphabetically:
$ hledger accounts -1 $ hledger accounts -1
@ -1605,35 +1627,37 @@ Node: Market prices38745
Ref: #market-prices38910 Ref: #market-prices38910
Node: Declaring accounts39751 Node: Declaring accounts39751
Ref: #declaring-accounts39927 Ref: #declaring-accounts39927
Node: Account types40884 Node: Account comments40852
Ref: #account-types41033 Ref: #account-comments41015
Node: Account comments42107 Node: Account subdirectives41410
Ref: #account-comments42292 Ref: #account-subdirectives41605
Node: Account display order42613 Node: Account types41918
Ref: #account-display-order42786 Ref: #account-types42102
Node: Rewriting accounts43908 Node: Account display order43746
Ref: #rewriting-accounts44093 Ref: #account-display-order43916
Node: Basic aliases44827 Node: Rewriting accounts45045
Ref: #basic-aliases44973 Ref: #rewriting-accounts45230
Node: Regex aliases45677 Node: Basic aliases45964
Ref: #regex-aliases45848 Ref: #basic-aliases46110
Node: Multiple aliases46566 Node: Regex aliases46814
Ref: #multiple-aliases46741 Ref: #regex-aliases46985
Node: end aliases47239 Node: Multiple aliases47703
Ref: #end-aliases47386 Ref: #multiple-aliases47878
Node: Default parent account47487 Node: end aliases48376
Ref: #default-parent-account47653 Ref: #end-aliases48523
Node: Periodic transactions48537 Node: Default parent account48624
Ref: #periodic-transactions48719 Ref: #default-parent-account48790
Node: Two spaces after the period expression49844 Node: Periodic transactions49674
Ref: #two-spaces-after-the-period-expression50089 Ref: #periodic-transactions49856
Node: Forecasting with periodic transactions50574 Node: Two spaces after the period expression50981
Ref: #forecasting-with-periodic-transactions50864 Ref: #two-spaces-after-the-period-expression51226
Node: Budgeting with periodic transactions52551 Node: Forecasting with periodic transactions51711
Ref: #budgeting-with-periodic-transactions52790 Ref: #forecasting-with-periodic-transactions52001
Node: Transaction Modifiers53249 Node: Budgeting with periodic transactions53688
Ref: #transaction-modifiers53412 Ref: #budgeting-with-periodic-transactions53927
Node: EDITOR SUPPORT55393 Node: Transaction Modifiers54386
Ref: #editor-support55511 Ref: #transaction-modifiers54549
Node: EDITOR SUPPORT56530
Ref: #editor-support56648
 
End Tag Table End Tag Table

View File

@ -846,8 +846,8 @@ FILE FORMAT
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 accounts. Though not
Though not required, they can provide several benefits: 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.
@ -865,27 +865,62 @@ FILE FORMAT
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: The simplest form is just the word account followed by a hledger-style
account name, eg:
account ACCTNAME [ACCTTYPE]
[COMMENTS]
The simplest form just declares a hledger-style account name, eg:
account assets:bank:checking account assets:bank:checking
Account types Account comments
hledger recognises five types of account: asset, liability, equity, Comments, beginning with a semicolon, optionally including tags, can be
revenue, expense. This is useful for certain accounting-aware reports, written after the account name, and/or on following lines. Eg:
in particular balancesheet, incomestatement and cashflow.
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- 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 Account types declared with tags
letters ALERX to its account directive, separated from the account name More generally, you can declare an account's type with an account
by two or more spaces. Eg: 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 assets A
account liabilities L account liabilities L
@ -893,37 +928,22 @@ 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 Overriding auto-detected types
account names mentioned above, you might need to help the reports a If you ever override the types of those auto-detected english account
bit: names mentioned above, you might need to help the reports a bit. Eg:
; make "liabilities" not have the liability type, who knows why ; make "liabilities" not have the liability type - who knows why
account liabilities E 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 ; otherwise balancesheet would still show "liabilities" under Liabilities
account - L account - ; type: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 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, eg in reports, the hledger-ui accounts screen, and the hledger-web
etc. Normally accounts are listed in alphabetical order, but if you sidebar. By default accounts are listed in alphabetical order. But if
have eg these account directives in the journal: you have these account directives in the journal:
account assets account assets
account liabilities account liabilities
@ -931,8 +951,8 @@ 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 displayed in declaration order, not alphabet-
cally: ically:
$ hledger accounts -1 $ hledger accounts -1
assets 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 An example: http://stefanorodighiero.net/software/hledger\-dupes.html
.SS close .SS close
.PP .PP
Print closing/opening transactions that bring some or all account close, equity
balances to zero and back. .PP
Can be useful for bringing asset/liability balances across file Prints a \[lq]closing balances\[rq] transaction and an \[lq]opening
boundaries, or for closing out income/expenses for a period. balances\[rq] transaction, that bring account balances to and from zero,
This was formerly called \[lq]equity\[rq], as in Ledger, and that alias respectively.
is also accepted. Useful for, eg:
See close \[en]help for more. .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 .SS files
.PP .PP
List all files included in the journal. 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 4.10 close
========== ==========
Print closing/opening transactions that bring some or all account close, equity
balances to zero and back. Can be useful for bringing asset/liability
balances across file boundaries, or for closing out income/expenses for Prints a "closing balances" transaction and an "opening balances"
a period. This was formerly called "equity", as in Ledger, and that transaction, that bring account balances to and from zero, respectively.
alias is also accepted. See close -help for more. 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 File: hledger.info, Node: files, Next: help, Prev: close, Up: COMMANDS
@ -2643,63 +2719,63 @@ Node: check-dupes61080
Ref: #check-dupes61204 Ref: #check-dupes61204
Node: close61341 Node: close61341
Ref: #close61449 Ref: #close61449
Node: files61779 Node: files64891
Ref: #files61880 Ref: #files64992
Node: help62021 Node: help65133
Ref: #help62121 Ref: #help65233
Node: import63195 Node: import66307
Ref: #import63309 Ref: #import66421
Node: incomestatement64039 Node: incomestatement67151
Ref: #incomestatement64173 Ref: #incomestatement67285
Node: prices66577 Node: prices69689
Ref: #prices66692 Ref: #prices69804
Node: print66964 Node: print70076
Ref: #print67074 Ref: #print70186
Node: print-unique71968 Node: print-unique75080
Ref: #print-unique72094 Ref: #print-unique75206
Node: register72162 Node: register75274
Ref: #register72289 Ref: #register75401
Node: Custom register output76790 Node: Custom register output79902
Ref: #custom-register-output76919 Ref: #custom-register-output80031
Node: register-match78149 Node: register-match81261
Ref: #register-match78283 Ref: #register-match81395
Node: rewrite78466 Node: rewrite81578
Ref: #rewrite78581 Ref: #rewrite81693
Node: roi78650 Node: roi81762
Ref: #roi78748 Ref: #roi81860
Node: stats78864 Node: stats81976
Ref: #stats78963 Ref: #stats82075
Node: tags79833 Node: tags82945
Ref: #tags79931 Ref: #tags83043
Node: test80167 Node: test83279
Ref: #test80251 Ref: #test83363
Node: ADD-ON COMMANDS80959 Node: ADD-ON COMMANDS84071
Ref: #add-on-commands81069 Ref: #add-on-commands84181
Node: Official add-ons82356 Node: Official add-ons85468
Ref: #official-add-ons82496 Ref: #official-add-ons85608
Node: api82583 Node: api85695
Ref: #api82672 Ref: #api85784
Node: ui82724 Node: ui85836
Ref: #ui82823 Ref: #ui85935
Node: web82881 Node: web85993
Ref: #web82970 Ref: #web86082
Node: Third party add-ons83016 Node: Third party add-ons86128
Ref: #third-party-add-ons83191 Ref: #third-party-add-ons86303
Node: diff83326 Node: diff86438
Ref: #diff83423 Ref: #diff86535
Node: iadd83522 Node: iadd86634
Ref: #iadd83636 Ref: #iadd86748
Node: interest83719 Node: interest86831
Ref: #interest83840 Ref: #interest86952
Node: irr83935 Node: irr87047
Ref: #irr84033 Ref: #irr87145
Node: Experimental add-ons84164 Node: Experimental add-ons87276
Ref: #experimental-add-ons84316 Ref: #experimental-add-ons87428
Node: autosync84596 Node: autosync87708
Ref: #autosync84707 Ref: #autosync87819
Node: chart84946 Node: chart88058
Ref: #chart85065 Ref: #chart88177
Node: check85136 Node: check88248
Ref: #check85238 Ref: #check88350
 
End Tag Table End Tag Table

View File

@ -1646,11 +1646,87 @@ COMMANDS
example: http://stefanorodighiero.net/software/hledger-dupes.html example: http://stefanorodighiero.net/software/hledger-dupes.html
close close
Print closing/opening transactions that bring some or all account bal- close, equity
ances to zero and back. Can be useful for bringing asset/liability
balances across file boundaries, or for closing out income/expenses for Prints a "closing balances" transaction and an "opening balances"
a period. This was formerly called "equity", as in Ledger, and that transaction, that bring account balances to and from zero, respec-
alias is also accepted. See close -help for more. 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 files
List all files included in the journal. With a REGEX argument, only List all files included in the journal. With a REGEX argument, only