journal, bal: document account codes

This commit is contained in:
Simon Michael 2018-01-23 16:41:19 -08:00
parent e491f513a1
commit 37555617b7
11 changed files with 464 additions and 362 deletions

View File

@ -943,23 +943,55 @@ end\ aliases
.fi
.SS account directive
.PP
The \f[C]account\f[] directive predefines account names, as in Ledger
and Beancount.
This may be useful for your own documentation; hledger doesn't make use
of it yet.
The \f[C]account\f[] directive predeclares account names.
The simplest form is \f[C]account\ ACCTNAME\f[], eg:
.IP
.nf
\f[C]
;\ account\ ACCT
;\ \ \ OPTIONAL\ COMMENTS/TAGS...
account\ assets:bank:checking
\ a\ comment
\ acct\-no:12345
\f[]
.fi
.PP
Currently this mainly helps with account name autocompletion in eg
hledger add, hledger\-iadd, hledger\-web, and ledger\-mode.
.PD 0
.P
.PD
In future it will also help detect misspelled accounts.
.PP
Account names can be followed by a numeric account code:
.IP
.nf
\f[C]
account\ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 1000
account\ assets:bank:checking\ \ \ \ 1110
account\ liabilities\ \ \ \ \ \ \ \ \ \ \ \ \ 2000
account\ revenues\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 4000
account\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 6000
\f[]
.fi
.PP
This affects account display order in reports: accounts with codes are
listed before accounts without codes, in increasing code order.
(Otherwise, accounts are listed alphabetically.) Account codes should be
all numeric digits, unique, and separated from the account name by at
least two spaces (since account names may contain single spaces).
By convention, often the first digit indicates the type of account, as
in this numbering scheme and the example above.
In future, we might use this to recognize account types.
.PP
An account directive can also have indented subdirectives following it,
which are currently ignored.
Here is the full syntax:
.IP
.nf
\f[C]
;\ account\ ACCTNAME\ \ [OPTIONALCODE]
;\ \ \ [OPTIONALSUBDIRECTIVES]
account\ expenses:food
;\ etc.
account\ assets:bank:checking\ \ \ 1110
\ \ a\ comment
\ \ some\-tag:12345
\f[]
.fi
.SS apply account directive

View File

@ -903,20 +903,41 @@ File: hledger_journal.info, Node: account directive, Next: apply account direc
1.14.2 account directive
------------------------
The 'account' directive predefines account names, as in Ledger and
Beancount. This may be useful for your own documentation; hledger
doesn't make use of it yet.
; account ACCT
; OPTIONAL COMMENTS/TAGS...
The 'account' directive predeclares account names. The simplest form is
'account ACCTNAME', eg:
account assets:bank:checking
Currently this mainly helps with account name autocompletion in eg
hledger add, hledger-iadd, hledger-web, and ledger-mode.
In future it will also help detect misspelled accounts.
Account names can be followed by a numeric account code:
account assets 1000
account assets:bank:checking 1110
account liabilities 2000
account revenues 4000
account expenses 6000
This affects account display order in reports: accounts with codes
are listed before accounts without codes, in increasing code order.
(Otherwise, accounts are listed alphabetically.) Account codes should
be all numeric digits, unique, and separated from the account name by at
least two spaces (since account names may contain single spaces). By
convention, often the first digit indicates the type of account, as in
this numbering scheme and the example above. In future, we might use
this to recognize account types.
An account directive can also have indented subdirectives following
it, which are currently ignored. Here is the full syntax:
; account ACCTNAME [OPTIONALCODE]
; [OPTIONALSUBDIRECTIVES]
account assets:bank:checking 1110
a comment
acct-no:12345
account expenses:food
; etc.
some-tag:12345

File: hledger_journal.info, Node: apply account directive, Next: Multi-line comments, Prev: account directive, Up: Directives
@ -1218,23 +1239,23 @@ Node: end aliases32215
Ref: #end-aliases32355
Node: account directive32456
Ref: #account-directive32636
Node: apply account directive32932
Ref: #apply-account-directive33128
Node: Multi-line comments33787
Ref: #multi-line-comments33977
Node: commodity directive34105
Ref: #commodity-directive34289
Node: Default commodity35161
Ref: #default-commodity35334
Node: Default year35871
Ref: #default-year36036
Node: Including other files36459
Ref: #including-other-files36616
Node: Periodic transactions37013
Ref: #periodic-transactions37184
Node: Automated posting rules37927
Ref: #automated-posting-rules38105
Node: EDITOR SUPPORT39214
Ref: #editor-support39344
Node: apply account directive33983
Ref: #apply-account-directive34179
Node: Multi-line comments34838
Ref: #multi-line-comments35028
Node: commodity directive35156
Ref: #commodity-directive35340
Node: Default commodity36212
Ref: #default-commodity36385
Node: Default year36922
Ref: #default-year37087
Node: Including other files37510
Ref: #including-other-files37667
Node: Periodic transactions38064
Ref: #periodic-transactions38235
Node: Automated posting rules38978
Ref: #automated-posting-rules39156
Node: EDITOR SUPPORT40265
Ref: #editor-support40395

End Tag Table

View File

@ -716,20 +716,39 @@ end aliases
### account directive
The `account` directive predefines account names, as in Ledger and Beancount.
This may be useful for your own documentation; hledger doesn't make use of it yet.
The `account` directive predeclares account names. The simplest form is `account ACCTNAME`, eg:
```journal
; account ACCT
; OPTIONAL COMMENTS/TAGS...
account assets:bank:checking
```
Currently this mainly helps with account name autocompletion in eg
hledger add, hledger-iadd, hledger-web, and ledger-mode.
In future it will also help detect misspelled accounts.
Account names can be followed by a numeric account code:
```journal
account assets 1000
account assets:bank:checking 1110
account liabilities 2000
account revenues 4000
account expenses 6000
```
This affects account display order in reports: accounts with codes are listed before accounts without codes, in increasing code order.
(Otherwise, accounts are listed alphabetically.)
Account codes should be all numeric digits, unique, and separated from the account name by at least two spaces (since account names may contain single spaces).
By convention, often the first digit indicates the type of account,
as in
[this numbering scheme](http://www.dwmbeancounter.com/BCTutorSite/Courses/ChartAccounts/lesson02-6.html)
and the example above.
In future, we might use this to recognize account types.
An account directive can also have indented subdirectives following it, which are currently ignored. Here is the full syntax:
```journal
; account ACCTNAME [OPTIONALCODE]
; [OPTIONALSUBDIRECTIVES]
account assets:bank:checking 1110
a comment
acct-no:12345
account expenses:food
; etc.
some-tag:12345
```
### apply account directive

View File

@ -690,20 +690,41 @@ FILE FORMAT
end aliases
account directive
The account directive predefines account names, as in Ledger and Bean-
count. This may be useful for your own documentation; hledger doesn't
make use of it yet.
; account ACCT
; OPTIONAL COMMENTS/TAGS...
The account directive predeclares account names. The simplest form is
account ACCTNAME, eg:
account assets:bank:checking
Currently this mainly helps with account name autocompletion in eg
hledger add, hledger-iadd, hledger-web, and ledger-mode.
In future it will also help detect misspelled accounts.
Account names can be followed by a numeric account code:
account assets 1000
account assets:bank:checking 1110
account liabilities 2000
account revenues 4000
account expenses 6000
This affects account display order in reports: accounts with codes are
listed before accounts without codes, in increasing code order. (Oth-
erwise, accounts are listed alphabetically.) Account codes should be
all numeric digits, unique, and separated from the account name by at
least two spaces (since account names may contain single spaces). By
convention, often the first digit indicates the type of account, as in
this numbering scheme and the example above. In future, we might use
this to recognize account types.
An account directive can also have indented subdirectives following it,
which are currently ignored. Here is the full syntax:
; account ACCTNAME [OPTIONALCODE]
; [OPTIONALSUBDIRECTIVES]
account assets:bank:checking 1110
a comment
acct-no:12345
account expenses:food
; etc.
some-tag:12345
apply account directive
You can specify a parent account which will be prepended to all
@ -880,7 +901,6 @@ EDITOR SUPPORT
Editor
--------------------------------------------------------------------------
Emacs http://www.ledger-cli.org/3.0/doc/ledger-mode.html
Vim https://github.com/ledger/ledger/wiki/Getting-started
Sublime Text https://github.com/ledger/ledger/wiki/Edit-
ing-Ledger-files-with-Sublime-Text-or-RubyMine

View File

@ -289,7 +289,7 @@ balancemode = (defCommandMode $ ["balance"] ++ aliases) { -- also accept but don
,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't squash boring parent accounts (in tree mode)"
,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"
,flagNone ["pretty-tables"] (\opts -> setboolopt "pretty-tables" opts) "use unicode to display prettier tables"
,flagNone ["sort-amount","S"] (\opts -> setboolopt "sort-amount" opts) "sort by amount instead of account name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed."
,flagNone ["sort-amount","S"] (\opts -> setboolopt "sort-amount" opts) "sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed."
,flagNone ["budget"] (setboolopt "budget") "show performance compared to budget goals defined by periodic transactions"
,flagNone ["show-unbudgeted"] (setboolopt "show-unbudgeted") "with --budget, show unbudgeted accounts also"
]

View File

@ -106,7 +106,7 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = (defCommandMode $ cb
,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't squash boring parent accounts (in tree mode)"
,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"
,flagNone ["pretty-tables"] (\opts -> setboolopt "pretty-tables" opts) "use unicode when displaying tables"
,flagNone ["sort-amount","S"] (\opts -> setboolopt "sort-amount" opts) "sort by amount instead of account name"
,flagNone ["sort-amount","S"] (\opts -> setboolopt "sort-amount" opts) "sort by amount instead of account code/name"
,outputFormatFlag
,outputFileFlag
]

View File

@ -1464,7 +1464,7 @@ use unicode to display prettier tables.
.RE
.TP
.B \f[C]\-\-sort\-amount\f[]
sort by amount instead of account name (in flat mode).
sort by amount instead of account code/name (in flat mode).
With multiple columns, sorts by the row total, or by row average if that
is displayed.
.RS
@ -1510,14 +1510,18 @@ balance.
.PP
By default, accounts are displayed hierarchically, with subaccounts
indented below their parent.
At each level of the tree, accounts are sorted by account code if any,
then by account name.
Or with \f[C]\-S/\-\-sort\-amount\f[], by their balance amount.
.PP
\[lq]Boring\[rq] accounts, which contain a single interesting subaccount
and no balance of their own, are elided into the following line for more
compact output.
(Use \f[C]\-\-no\-elide\f[] to prevent this.
Eliding of boring accounts is not yet supported in multicolumn reports.)
(Not yet supported in tabular reports.) Use \f[C]\-\-no\-elide\f[] to
prevent this.
.PP
Each account's balance is the \[lq]inclusive\[rq] balance \- it includes
the balances of any subaccounts.
Account balances are \[lq]inclusive\[rq] \- they include the balances of
any subaccounts.
.PP
Accounts which have zero balance (and no non\-zero subaccounts) are
omitted.
@ -1971,7 +1975,7 @@ in single\-column balance reports: use this custom line format
.RE
.TP
.B \f[C]\-\-sort\-amount\f[]
sort by amount instead of account name
sort by amount instead of account code/name
.RS
.RE
.PP
@ -2113,7 +2117,7 @@ in single\-column balance reports: use this custom line format
.RE
.TP
.B \f[C]\-\-sort\-amount\f[]
sort by amount instead of account name
sort by amount instead of account code/name
.RS
.RE
.PP
@ -2300,7 +2304,7 @@ in single\-column balance reports: use this custom line format
.RE
.TP
.B \f[C]\-\-sort\-amount\f[]
sort by amount instead of account name
sort by amount instead of account code/name
.RS
.RE
.PP

View File

@ -1094,7 +1094,7 @@ Show accounts and their balances. Aliases: b, bal.
use unicode to display prettier tables.
'--sort-amount'
sort by amount instead of account name (in flat mode). With
sort by amount instead of account code/name (in flat mode). With
multiple columns, sorts by the row total, or by row average if that
is displayed.
'--budget'
@ -1128,14 +1128,17 @@ where you do not filter by date and your journal sets the correct
opening balances, this is the same as the account's ending balance.
By default, accounts are displayed hierarchically, with subaccounts
indented below their parent. "Boring" accounts, which contain a single
interesting subaccount and no balance of their own, are elided into the
following line for more compact output. (Use '--no-elide' to prevent
this. Eliding of boring accounts is not yet supported in multicolumn
reports.)
indented below their parent. At each level of the tree, accounts are
sorted by account code if any, then by account name. Or with
'-S/--sort-amount', by their balance amount.
Each account's balance is the "inclusive" balance - it includes the
balances of any subaccounts.
"Boring" accounts, which contain a single interesting subaccount and
no balance of their own, are elided into the following line for more
compact output. (Not yet supported in tabular reports.) Use
'--no-elide' to prevent this.
Account balances are "inclusive" - they include the balances of any
subaccounts.
Accounts which have zero balance (and no non-zero subaccounts) are
omitted. Use '-E/--empty' to show them.
@ -1537,7 +1540,7 @@ conventional financial statements, unlike balance/print/register)
in single-column balance reports: use this custom line format
'--sort-amount'
sort by amount instead of account name
sort by amount instead of account code/name
Example:
@ -1653,7 +1656,7 @@ statements, unlike balance/print/register) (experimental). (cf)
in single-column balance reports: use this custom line format
'--sort-amount'
sort by amount instead of account name
sort by amount instead of account code/name
Example:
@ -1821,7 +1824,7 @@ unlike balance/print/register) (experimental). (is)
in single-column balance reports: use this custom line format
'--sort-amount'
sort by amount instead of account name
sort by amount instead of account code/name
This command displays a simple income statement. It currently
assumes that you have top-level accounts named 'income' (or 'revenue')
@ -2429,89 +2432,89 @@ Node: add31307
Ref: #add31406
Node: balance34067
Ref: #balance34178
Node: Flat mode37552
Ref: #flat-mode37677
Node: Depth limited balance reports38097
Ref: #depth-limited-balance-reports38298
Node: Multicolumn balance reports38718
Ref: #multicolumn-balance-reports38913
Node: Budgets43602
Ref: #budgets43749
Node: Custom balance output47580
Ref: #custom-balance-output47742
Node: Colour support49835
Ref: #colour-support49994
Node: Output destination50167
Ref: #output-destination50323
Node: CSV output50593
Ref: #csv-output50710
Node: balancesheet51107
Ref: #balancesheet51243
Node: balancesheetequity53470
Ref: #balancesheetequity53619
Node: cashflow54156
Ref: #cashflow54284
Node: check-dates56323
Ref: #check-dates56450
Node: check-dupes56567
Ref: #check-dupes56691
Node: close56828
Ref: #close56935
Node: help57265
Ref: #help57365
Node: import58439
Ref: #import58553
Node: incomestatement59283
Ref: #incomestatement59417
Node: prices61737
Ref: #prices61852
Node: print61895
Ref: #print62005
Node: print-unique66890
Ref: #print-unique67016
Node: register67084
Ref: #register67211
Node: Custom register output71712
Ref: #custom-register-output71841
Node: register-match73138
Ref: #register-match73272
Node: rewrite73455
Ref: #rewrite73572
Node: stats73641
Ref: #stats73744
Node: tags74626
Ref: #tags74724
Node: test74960
Ref: #test75044
Node: ADD-ON COMMANDS75412
Ref: #add-on-commands75522
Node: Official add-ons76809
Ref: #official-add-ons76949
Node: api77036
Ref: #api77125
Node: ui77177
Ref: #ui77276
Node: web77334
Ref: #web77423
Node: Third party add-ons77469
Ref: #third-party-add-ons77644
Node: diff77779
Ref: #diff77876
Node: iadd77975
Ref: #iadd78089
Node: interest78172
Ref: #interest78293
Node: irr78388
Ref: #irr78486
Node: Experimental add-ons78564
Ref: #experimental-add-ons78716
Node: autosync79007
Ref: #autosync79119
Node: budget79358
Ref: #budget79480
Node: chart79546
Ref: #chart79663
Node: check79734
Ref: #check79836
Node: Flat mode37658
Ref: #flat-mode37783
Node: Depth limited balance reports38203
Ref: #depth-limited-balance-reports38404
Node: Multicolumn balance reports38824
Ref: #multicolumn-balance-reports39019
Node: Budgets43708
Ref: #budgets43855
Node: Custom balance output47686
Ref: #custom-balance-output47848
Node: Colour support49941
Ref: #colour-support50100
Node: Output destination50273
Ref: #output-destination50429
Node: CSV output50699
Ref: #csv-output50816
Node: balancesheet51213
Ref: #balancesheet51349
Node: balancesheetequity53581
Ref: #balancesheetequity53730
Node: cashflow54267
Ref: #cashflow54395
Node: check-dates56439
Ref: #check-dates56566
Node: check-dupes56683
Ref: #check-dupes56807
Node: close56944
Ref: #close57051
Node: help57381
Ref: #help57481
Node: import58555
Ref: #import58669
Node: incomestatement59399
Ref: #incomestatement59533
Node: prices61858
Ref: #prices61973
Node: print62016
Ref: #print62126
Node: print-unique67011
Ref: #print-unique67137
Node: register67205
Ref: #register67332
Node: Custom register output71833
Ref: #custom-register-output71962
Node: register-match73259
Ref: #register-match73393
Node: rewrite73576
Ref: #rewrite73693
Node: stats73762
Ref: #stats73865
Node: tags74747
Ref: #tags74845
Node: test75081
Ref: #test75165
Node: ADD-ON COMMANDS75533
Ref: #add-on-commands75643
Node: Official add-ons76930
Ref: #official-add-ons77070
Node: api77157
Ref: #api77246
Node: ui77298
Ref: #ui77397
Node: web77455
Ref: #web77544
Node: Third party add-ons77590
Ref: #third-party-add-ons77765
Node: diff77900
Ref: #diff77997
Node: iadd78096
Ref: #iadd78210
Node: interest78293
Ref: #interest78414
Node: irr78509
Ref: #irr78607
Node: Experimental add-ons78685
Ref: #experimental-add-ons78837
Node: autosync79128
Ref: #autosync79240
Node: budget79479
Ref: #budget79601
Node: chart79667
Ref: #chart79784
Node: check79855
Ref: #check79957

End Tag Table

View File

@ -997,9 +997,9 @@ COMMANDS
use unicode to display prettier tables.
--sort-amount
sort by amount instead of account name (in flat mode). With
multiple columns, sorts by the row total, or by row average if
that is displayed.
sort by amount instead of account code/name (in flat mode).
With multiple columns, sorts by the row total, or by row average
if that is displayed.
--budget
show performance compared to budget goals defined by periodic
@ -1031,14 +1031,17 @@ COMMANDS
ances, this is the same as the account's ending balance.
By default, accounts are displayed hierarchically, with subaccounts
indented below their parent. "Boring" accounts, which contain a single
interesting subaccount and no balance of their own, are elided into the
following line for more compact output. (Use --no-elide to prevent
this. Eliding of boring accounts is not yet supported in multicolumn
reports.)
indented below their parent. At each level of the tree, accounts are
sorted by account code if any, then by account name. Or with
-S/--sort-amount, by their balance amount.
Each account's balance is the "inclusive" balance - it includes the
balances of any subaccounts.
"Boring" accounts, which contain a single interesting subaccount and no
balance of their own, are elided into the following line for more com-
pact output. (Not yet supported in tabular reports.) Use --no-elide to
prevent this.
Account balances are "inclusive" - they include the balances of any
subaccounts.
Accounts which have zero balance (and no non-zero subaccounts) are
omitted. Use -E/--empty to show them.
@ -1390,7 +1393,7 @@ COMMANDS
in single-column balance reports: use this custom line format
--sort-amount
sort by amount instead of account name
sort by amount instead of account code/name
Example:
@ -1493,7 +1496,7 @@ COMMANDS
in single-column balance reports: use this custom line format
--sort-amount
sort by amount instead of account name
sort by amount instead of account code/name
Example:
@ -1627,7 +1630,7 @@ COMMANDS
in single-column balance reports: use this custom line format
--sort-amount
sort by amount instead of account name
sort by amount instead of account code/name
This command displays a simple income statement. It currently assumes
that you have top-level accounts named income (or revenue) and expense

View File

@ -45,7 +45,7 @@ txt, csv.
: use unicode to display prettier tables.
`--sort-amount`
: sort by amount instead of account name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed.
: sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed.
`--budget`
: show performance compared to budget goals defined by [periodic transactions](journal.html#periodic-transactions)
@ -75,15 +75,15 @@ $ hledger balance
More precisely, the balance command shows the *change* to each account's balance caused by all (matched) postings.
In the common case where you do not filter by date and your journal sets the correct opening balances, this is the same as the account's ending balance.
By default, accounts are displayed hierarchically, with subaccounts
indented below their parent.
"Boring" accounts, which contain a single interesting
subaccount and no balance of their own, are elided into the following
line for more compact output. (Use `--no-elide` to prevent this.
Eliding of boring accounts is not yet supported in multicolumn reports.)
By default, accounts are displayed hierarchically, with subaccounts indented below their parent.
At each level of the tree, accounts are sorted by [account code](/manual.html#account-directive) if any, then by account name.
Or with `-S/--sort-amount`, by their balance amount.
Each account's balance is the "inclusive" balance - it includes the
balances of any subaccounts.
"Boring" accounts, which contain a single interesting subaccount and
no balance of their own, are elided into the following line for more compact output.
(Not yet supported in tabular reports.) Use `--no-elide` to prevent this.
Account balances are "inclusive" - they include the balances of any subaccounts.
Accounts which have zero balance (and no non-zero subaccounts) are
omitted. Use `-E/--empty` to show them.

View File

@ -218,7 +218,7 @@ _include_({{hledger_balance.m4.md}})
: in single-column balance reports: use this custom line format
`--sort-amount`
: sort by amount instead of account name
: sort by amount instead of account code/name
Example:
```shell
@ -324,7 +324,7 @@ Total:
: in single-column balance reports: use this custom line format
`--sort-amount`
: sort by amount instead of account name
: sort by amount instead of account code/name
Example:
```shell
@ -463,7 +463,7 @@ $ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
: in single-column balance reports: use this custom line format
`--sort-amount`
: sort by amount instead of account name
: sort by amount instead of account code/name
This command displays a simple
[income statement](http://en.wikipedia.org/wiki/Income_statement). It